04-17-2016
02:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
04-17-2016
02:01 PM
HI, I don't have acces to Inventor right now, as Im at home, so I can't test it.
But did you try something like this below? (made from memory, so you may need to play with the statements - highlighted)
The idea in this is to run it for every component (as you do now, I suppose) and every time remove all components but one.
The "FirstComponent" name will come from the body name.
Dim oCurrentComponent As String = "FirstComponent" 'Here you should write the name of the first component
oDerivedPrtDef = oFinalCompDef.ReferenceComponents.DerivedPartComponents.CreateDefinition(oPartDoc.FullDocumentName) oFinalCompDef.ReferenceComponents.DerivedPartComponents.Add(oDerivedPrtDef)
Dim oCom As PartComponent
For Each oCom In oFinalCompDef.ReferenceComponents.DerivedPartComponents
MsgBox(oCom.Name) ' For testing purposes
If Not oCom.Name = oCurrentComponent Than
oCom.Remove
End If
Next
Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
- - - - - - - - - - - - - - -
Regards,
Mike
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods