How to modify base components in derived part

How to modify base components in derived part

Damian_Apex
Enthusiast Enthusiast
488 Views
3 Replies
Message 1 of 4

How to modify base components in derived part

Damian_Apex
Enthusiast
Enthusiast

Hello,

I have a derived part that has 1 assembly and some parts inside it. From the level of the derived part I would like to get to this assembly and to be able to modify it. For example, to be able to use the command "component.replace".

 

I think I need to transfer somehow "DerivedAssemblyComponent" to "AssemblyDocument".

 

Sub main
Dim oPart  As PartDocument = ThisDoc.Document 
Dim oRef As Document = oPart.ReferencedDocuments.Item(1)
Dim oDerAssembly As DerivedAssemblyComponent
oDerAssembly = oPart.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents.Item(1) Trace.Write(oDerAssembly.Name) For Each oPart In oRef.AllReferencedDocuments Trace.Write("ALL: " & oPart.FullFileName) Next End Sub

 

0 Likes
Accepted solutions (1)
489 Views
3 Replies
Replies (3)
Message 2 of 4

SometimesInventorMakesMeAngry
Advocate
Advocate

@Damian_Apex wrote:

Hello,

I have a derived part that has 1 assembly and some parts inside it. From the level of the derived part I would like to get to this assembly and to be able to modify it. For example, to be able to use the command "component.replace".

 

I think I need to transfer somehow "DerivedAssemblyComponent" to "AssemblyDocument".

 

Sub main
Dim oPart  As PartDocument = ThisDoc.Document 
Dim oRef As Document = oPart.ReferencedDocuments.Item(1)
Dim oDerAssembly As DerivedAssemblyComponent
oDerAssembly = oPart.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents.Item(1) Trace.Write(oDerAssembly.Name) For Each oPart In oRef.AllReferencedDocuments Trace.Write("ALL: " & oPart.FullFileName) Next End Sub

 


dim refAssembly as AssemblyDocument = oPart.ReferencedDocuments.Item(1)
0 Likes
Message 3 of 4

Damian_Apex
Enthusiast
Enthusiast

I am getting such an error

Damian_Apex_0-1637821250294.png

 

0 Likes
Message 4 of 4

SometimesInventorMakesMeAngry
Advocate
Advocate
Accepted solution
Sub main
Dim oPart  As PartDocument = ThisDoc.Document 
dim refAssembly as AssemblyDocument = oPart.ReferencedDocuments.Item(1)
'Do what you need to do with refAssembly here
End Sub
0 Likes