Hi,
I have a large step file that i wish to import into Inventor 2009 to create a Inventor assembly.
Now this is not something I commonly do,so i have some questions
I opened the step file in Inventor with no problems and was able to save it as an assembly. However i see that only the first component is grounded the others are free (un constrained)
Do i need to go through the model tree and ground each component individually(there are hundreds) or is there a setting in Inventor to do this automatically when opening the step file?
Any help/advice is appreciated
Inventor 2009,windows xp 32 bit, excel 2000
There may be an easier way but if you go to the Model tree and click on the part at the top of the list and hold shift and then select the last part you can select every part at once and then right click any of the highlighted parts and ground them that way.
Further, you can also window select everything in the model, RMB and hit Ground TWICE! The frst time you hit Ground it will UN-Ground everything. The second time will Ground everything. Just make sure all your parts have the thumb tack in the Browser Window once you are done.
Thanks,
Converting it to a Inventor assembly has created multiple subassemblies(with unconstrained parts) and individual parts. So i was a bit wary of grabbing the whole model tree and selecting ground.
I will give it a try though 🙂
Hi swordmaster,
There is not a setting to do this in Inventor out of the box, but you might be able to use the iLogic code at this link:
http://inventortrenches.blogspot.com/2012/05/working-with-unconstrained-imported.html
Since you're using Inventor 2009 you might need to convert the code to VBA, if you don't have iLogic avaliable.
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Hi Curtis,
Ilogic was one of my first thoughts to accomplish this. I have ilogic (use it every day)
Took a look at your code and it looks promising, I will try it as a external rule.
Not sure if it will iterate through the sub asemblies, we shall see 🙂
thanks
Curtis,
When i run the rule i get a "catastrophic error" got to love those!
I narrowed it down to this section
'Iterate through all of the occurrences and ground them.
Try this:
' Description: ' Ground all Components (both in the main assy & components in sub-assy) ' ' Event Trigger: ' External Rule run by user as need ' ' ----------------------------------------------------------------------- Sub Main() ' Set reference to active document. ' This assumes the active document is an assembly Dim oDoc As Inventor.AssemblyDocument oDoc = ThisApplication.ActiveDocument ' Get assembly component definition Dim oCompDef As Inventor.ComponentDefinition oCompDef = oDoc.ComponentDefinition Dim sMsg As String Dim iLeafNodes As Long Dim iSubAssemblies As Long ' Get all occurrences from component definition for Assembly document Dim oCompOcc As ComponentOccurrence For Each oCompOcc In oCompDef.Occurrences ' Check if it's child occurrence (leaf node) If oCompOcc.SubOccurrences.Count = 0 Then 'MessageBox.Show(oCompOcc.Name, "Components") oCompOcc.Grounded = True ' This performs the action on the component iLeafNodes = iLeafNodes + 1 Else 'MessageBox.Show(oCompOcc.Name, "Sub-Assemblies") oCompOcc.Grounded = True ' This performs the action on the component iSubAssemblies = iSubAssemblies + 1 Call processAllSubOcc(oCompOcc, _ sMsg, _ iLeafNodes, _ iSubAssemblies) ' subassembly End If Next 'MessageBox.Show("No of leaf nodes : " + CStr(iLeafNodes), "Title") ' DEBUG LINE 'MessageBox.Show("No of sub assemblies: " + CStr(iSubAssemblies), "Title") ' DEBUG LINE End Sub ' This function is called for processing sub assembly. It is called recursively ' to iterate through the entire assembly tree. Sub processAllSubOcc(ByVal oCompOcc As ComponentOccurrence, _ ByRef sMsg As String, _ ByRef iLeafNodes As Long, _ ByRef iSubAssemblies As Long) Dim oSubCompOcc As ComponentOccurrence For Each oSubCompOcc In oCompOcc.SubOccurrences ' Check if it's child occurrence (leaf node) If oSubCompOcc.SubOccurrences.Count = 0 Then oSubCompOcc.Grounded = True ' This performs the action on the component 'MessageBox.Show(oSubCompOcc.Name, "Components-B") iLeafNodes = iLeafNodes + 1 Else sMsg = sMsg + oSubCompOcc.Name + vbCr iSubAssemblies = iSubAssemblies + 1 oSubCompOcc.Grounded = True ' This performs the action on the component Call processAllSubOcc(oSubCompOcc, _ sMsg, _ iLeafNodes, _ iSubAssemblies) End If Next