assigning material with appearance to part from assembly

assigning material with appearance to part from assembly

NachoShaw
Advisor Advisor
435 Views
1 Reply
Message 1 of 2

assigning material with appearance to part from assembly

NachoShaw
Advisor
Advisor

Hey

 

from assembly level, i am trying to assign a material with its associated appearance. I am first clearing the part level appearance override as its been set in a file conversion. 

Dim asmDoc As AssemblyDocument = FrmModelLoader._invApp.ActiveDocument
   Dim doc As Document
      For Each doc In asmDoc.AllReferencedDocuments
         If doc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
            Dim Part As PartDocument = doc
            Dim p As PartComponentDefinition = Part.ComponentDefinition
            p.ClearAppearanceOverrides()

            asmDoc.Rebuild2()
         End If
     Next
    End Sub

While i doing this, i need to assign a material from a library (it should already be accessible from the part). I can assign the material but it doesnt assign the associated appearance. When i do it manually, it does.

 

Do i need to assign the appearance separately if assigning by code? If so, what is the best way to do that? All of the posts i found were either too old (predating Assets) or showing me how to get the materials into a text file...

 

Summary

From assembly level, i need to

loop assembly

for each part, clear appearance

assign a material

assign an appearance

 

Thanks

 

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Accepted solutions (1)
436 Views
1 Reply
Reply (1)
Message 2 of 2

NachoShaw
Advisor
Advisor
Accepted solution

I managed to resolve this

Nacho
Automation & Design Engineer

Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes