Edit Derived Assembly Part with Code

Edit Derived Assembly Part with Code

cencinaNB2ET
Advocate Advocate
613 Views
5 Replies
Message 1 of 6

Edit Derived Assembly Part with Code

cencinaNB2ET
Advocate
Advocate

I'm trying to include or exclude occurrences from the base assembly on call from the derived assembly part.

It seems i can show the Derived Component Option Enum from each solid/part but I cant change it.

 

Here is a sample code and a screen-cast also.:

 

 

 

Dim Doc_P As PartDocument = ThisDoc.Document
Dim oDoc_Def As ComponentDefinition = Doc_P.ComponentDefinition
Dim oAsmDef As AssemblyComponentDefinition
Dim oDerAssemblyComp As DerivedAssemblyComponent
Dim oDerAssemblyCompDef As DerivedAssemblyDefinition
Dim oDerEntity As DerivedAssemblyOccurrence
Dim Inclusion As DerivedComponentOptionEnum 
Dim New_Inclusion As DerivedComponentOptionEnum


New_Inclusion = kDerivedIncludeAll
oDerAssemblyComp = Doc_P.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents(1)
oDerAssemblyComp.SuppressLinkToFile = False
oDerAssemblyCompDef = oDerAssemblyComp.Definition


For i = 1 To  oDerAssemblyCompDef.Occurrences.Count
oDerEntity = oDerAssemblyCompDef.Occurrences.Item(i)'.InclusionOption
Inclusion =  oDerAssemblyCompDef.Occurrences.Item(i).InclusionOption
MessageBox.Show(oDerEntity.Name & vbCr & Inclusion)
oDerAssemblyCompDef.Occurrences.Item(i).InclusionOption = kDerivedIncludeAll
oDerAssemblyCompDef.Occurrences.Item(i).InclusionOption = 27137
oDerAssemblyCompDef.Occurrences.Item(i).InclusionOption = New_Inclusion
MessageBox.Show(oDerEntity.Name & vbCr & Inclusion & vbCr & New_Inclusion)
Next i


oDerAssemblyComp.SuppressLinkToFile = True



InventorVb.DocumentUpdate()






 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0 Likes
614 Views
5 Replies
Replies (5)
Message 2 of 6

bradeneuropeArthur
Mentor
Mentor

Hi @cencinaNB2ET 

 

Is this the same as this one?

https://forums.autodesk.com/t5/inventor-customization/how-to-control-include-exclude-state-of-compon... 

 

Regards,

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

cencinaNB2ET
Advocate
Advocate

Yes, I posted that right before trying your code.

Ill leave it here for Autodesk to see if there is a bug?

 

By the way, how does your code work and not mine?

I still don't understand what it does, and how it goes from bounding box to the actual occurrences.

 

0 Likes
Message 4 of 6

cencinaNB2ET
Advocate
Advocate

You seem to know more about these issues than anybody else?

How can I recover not only solid bodies of a part in the assembly but the surface bodies?

 

0 Likes
Message 5 of 6

cencinaNB2ET
Advocate
Advocate

Well, Im trying to fix this issue once again. It completely changed its behavior once Model States was introduced it seems.

 

Im just trying to access the work geometry on the edit derived assembly button.

Leave the view as default to match the parent assembly but not loose work geometry ( mainly planes) that were also derived initially. 

For some reason when you switch between default and master view you loose the work geometry inclusion now. This didn't happen when model states was not present..

 

 

 

0 Likes
Message 6 of 6

bradeneuropeArthur
Mentor
Mentor

With level of details the master lod was not editable. With Model States you are able to edit. That may be the reason.

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