Community
Hi,
I just got some time to write a dirty iLogic to pull the Material from a part to the assembly.
I wrote this, because most of the time when designing sheet metal assemblys with pressed bolts etc. the assembly and the main sheet metal part get the same name.
Solved! Go to Solution.
Solved by frederik_vollbrecht. Go to Solution.
' Pull Material from sheet metal part to sheet metal assembly
' Copyright Frederik Vollbrecht 2020
' V 1.0
' Get the active assembly.
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
' Get the definition of the assembly.
Dim oAsmDef As AssemblyComponentDefinition
oAsmDef = oAsmDoc.ComponentDefinition
' Some kind of error handling
Try
' Get the document to find occurrences for. It will be asumed that both, part
' and assembly, have the same filename
Dim oDoc As Document
oDoc = ThisApplication.Documents.ItemByName( ThisDoc.PathAndFileName(False) & ".ipt")
' Get the occurrences that represent this document.
Dim oOccs As ComponentOccurrencesEnumerator
oOccs = oAsmDef.Occurrences.AllReferencedOccurrences(oDoc)
' Set definition of the Material var
oMat = oDoc.ComponentDefinition.Material.Name
' Create iProperty in the assembly containing the part material
iProperties.Value("Custom", "Material") = oMat
Catch
MessageBox.Show("Baugruppe enthält keine Blechkonstruktion", "Fehler")
End Try
Can't find what you're looking for? Ask the community or share your knowledge.