Add or Remove Solid Bodies from Derived Part.

Add or Remove Solid Bodies from Derived Part.

C_Haines_ENG
Collaborator Collaborator
528 Views
5 Replies
Message 1 of 6

Add or Remove Solid Bodies from Derived Part.

C_Haines_ENG
Collaborator
Collaborator

Good afternoon,

 

I need some help figuring out how to add or remove solidparts from an extracted "Derived Part".

 

I can use the "make components" tool to extract my solid bodies but I need to be able to add / remove parts from the derived part and I need to be able to switch model states of the derived part aswell.

 

Could anyone help with this?

0 Likes
Accepted solutions (1)
529 Views
5 Replies
Replies (5)
Message 2 of 6

bradeneuropeArthur
Mentor
Mentor

Could you explain a bit more in detail?

Maybe you can make some screenshots to explain what you try to do.

Your question is based on i-logic or via VBA or via an add-in?

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 6

C_Haines_ENG
Collaborator
Collaborator

My question is a iLogic questions, here is what I mean by derived part:

chainesL5H3G_0-1696511243615.png

 

Its a single solid body extracted from a larger part file containing all the solid bodies, and im trying to select whatever solid body I want within this menu:

 

chainesL5H3G_1-1696511314759.png

In iLogic, however I cant seem to figure out how exactly this works, and on top of that id like to be able to select what model state it wants as shown below:

chainesL5H3G_2-1696511383584.png

 

0 Likes
Message 4 of 6

A.Acheson
Mentor
Mentor

Hi @C_Haines_ENG 

 

There is a post on this forum for adjusting the solidy body shown here There is also a DerivedPartDefinition help page here where you can start adjusting the outcome of the derive. Attach your attempted sample if you get stuck implementing. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 5 of 6

C_Haines_ENG
Collaborator
Collaborator

Is there anyway to simplify this? Seems like I have a couple things here that do not need to be there.

 

Edit: This code can only be run on an already extracted derived part.

 

Dim ODDoc As Document = ThisDoc.Document
Dim oDPComp As DerivedPartComponent
Dim oDPComps As DerivedPartComponents
oDPComps = ODDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents

	For x = 1 To oDPComps.Count
		oDPComp = oDPComps.Item(x)
		Dim oDPDef As DerivedPartUniformScaleDef = oDPComp.Definition
		Dim oDPEnts As DerivedPartEntities = oDPDef.Solids
		Dim oDPEnt As DerivedPartEntity
		
			For Each oDPEnt In oDPEnts
				
				'CHANGE MODEL STATE
				oDPDef.ActiveModelState = "MODEL STATE NAME"
			
'ADD PART YOU WANT BY SOLID NAME If oDPEnt.ReferencedEntity.Name = "YOUR SOLID BODY NAME" Then oDPEnt.IncludeEntity = True Exit For End If Next oDPComp.Definition = oDPDef Next

 

 

0 Likes
Message 6 of 6

C_Haines_ENG
Collaborator
Collaborator
Accepted solution

For anyone who comes by this in the future, this code will extract all solid bodies from your part file, allowing you to select the model state.

 

 

Dim doc As PartDocument = ThisApplication.ActiveDocument

For Each sb In doc.ComponentDefinition.SurfaceBodies
				
    'Create Part With A Derived Part Component
    Dim prt As PartDocument
    prt = ThisApplication.Documents.Add(kPartDocumentObject, "PART TEMPLATE DIRECTORY")
    
    Dim oDPComps As DerivedPartComponents = prt.ComponentDefinition.ReferenceComponents.DerivedPartComponents
    Dim oDPDef As DerivedPartUniformScaleDef = oDPComps.CreateUniformScaleDef(doc.FullDocumentName)
	
	'Select Model States
	oDPDef.ActiveModelState = "MODEL STATE NAME"	
	
    'Hide All Other Solid Bodies
    Dim oDPEnt As DerivedPartEntity
   	For Each oDPEnt In oDPDef.Solids
	
        oDPEnt.IncludeEntity = oDPEnt.ReferencedEntity Is sb
		
    Next
	
	oDPComps.Add(oDPDef)
	
	        prt.SaveAs("DRIVE PATH" & sb.Name & ".ipt", False)
		
		prt.Close
		
Next