material of a part from a drawing

material of a part from a drawing

thomasdietschy
Community Visitor Community Visitor
176 Views
1 Reply
Message 1 of 2

material of a part from a drawing

thomasdietschy
Community Visitor
Community Visitor

Hello to all,

I'm looking for a way to store the material of a part from a drawing in a variable?

Thanks in advance!

0 Likes
177 Views
1 Reply
Reply (1)
Message 2 of 2

A.Acheson
Mentor
Mentor

Hi @thomasdietschy 

You will need the drawing views referenced document then get the Active material. 

 

API full method

Dim drawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim drwView As DrawingView = drawDoc.ActiveSheet.DrawingViews(1)
Dim partDoc As PartDocument = drwView.ReferencedDocumentDescriptor.ReferencedDocument
Dim material As String = partDoc.ActiveMaterial.DisplayName

MessageBox.Show(material, "Title")

 

Using ilogic and API method. 

Dim modDoc As PartDocument = ThisDoc.ModelDocument
Dim material1 As String = modDoc.ActiveMaterial.DisplayName

MessageBox.Show(material1, "Title")

 

 

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