Issue:
You've found a great 3D
model on the web that you want to use in Inventor. It was originally created in some
other 3D design software, but you were able to import
it into Inventor. The problem is that the parts come in unconstrained and can move all over the place. Is
there an option to import models from other software and keep the assembly
constraints?
Solution:
There is no option to import the assembly constraints, but
most likely you won't need to apply constraints to all of the parts because they
have been imported in the correct orientation and location. Instead you can
just ground
all of the parts in place so that they will not move, and then un-ground and apply assembly constraints to just the parts that need to move or that you
need to edit.
If the assembly has a lot of moving parts that need assembly constraints, you can un-ground and constrain one part at a time to keep everything from moving on you.
If the assembly has a lot of moving parts that need assembly constraints, you can un-ground and constrain one part at a time to keep everything from moving on you.
Here is a quick iLogic rule that will ground all components
in place also.
' get the active assembly
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
'set the Master LOD active
Dim oLODRep As LevelofDetailRepresentation
oLODRep = oAsmCompDef.RepresentationsManager.LevelOfDetailRepresentations.Item("Master")
oLODRep.Activate
'Iterate through all of the occurrences and ground them.
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
'check for and skip virtual components
If Not TypeOf oOccurrence.Definition Is VirtualComponentDefinition Then
oOccurrence.Grounded = True
Else
End If
Next
Update :
Here is an updated version of this rule that grounds everything in all assembly levels.
Sub Main
Call TraverseAssembly(ThisDoc.Document.ComponentDefinition.Occurrences)
End Sub
Function TraverseAssembly(oOccs As ComponentOccurrences)
Dim oOcc As ComponentOccurrence
For Each oOcc In oOccs
Try : oOcc.Grounded = True: Catch : End Try
If oOcc.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Call TraverseAssembly(oOcc.SubOccurrences)
End If
Next
End Function
Another version that offers the user a choice to ground or unground:
Sub Main
oOccs = ThisDoc.Document.ComponentDefinition.Occurrences
oInput = InputRadioBox("Select one", "Ground All", "Unground All", True,"iLogic")
Call TraverseAssembly(ThisDoc.Document.ComponentDefinition.Occurrences, oInput)
End Sub
Function TraverseAssembly(oOccs As ComponentOccurrences, oInput As Boolean)
Dim oOcc As ComponentOccurrence
For Each oOcc In oOccs
Try : oOcc.Grounded = oInput : Catch : End Try
If oOcc.DefinitionDocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Call TraverseAssembly(oOcc.SubOccurrences, oInput)
End If
Next
End Function