Vb.Net - Get Part Material Name & Export as a Dwg or Dxf file Using A Add-In

Vb.Net - Get Part Material Name & Export as a Dwg or Dxf file Using A Add-In

isocam
Collaborator Collaborator
204 Views
1 Reply
Message 1 of 2

Vb.Net - Get Part Material Name & Export as a Dwg or Dxf file Using A Add-In

isocam
Collaborator
Collaborator

Can anybody help?

 

Please see the attached Add-In file (I have changed the file name extension to txt from vb)

 

The attached Add-In works great when I have an "idw" (drawing) document open.

 

Now for the part that I need help with...

 

If I open an "ipt" (part) document and press "SAVE" I need to get the parts material iProperty and display it in a message box for testing purposes.

 

Also,

 

The opened "ipt" file will always only contain one extrusion only using "Sketch1". Is it possible to also export the sketch to a "DXF" or "DWG" file???

 

Can anybody update the attached code to allow me to do this?

 

Many thanks in advance!

 

Darren

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

JelteDeJong
Mentor
Mentor

Have a look at this iLogic code. I expect that it's what you are looking for.

Dim DocumentObject As _Document = ThisDoc.Document

Dim def As PartComponentDefinition = DocumentObject.ComponentDefinition

' Get material name
MsgBox(def.Material.Name)

' Export to dxf
Dim extrusion = def.Features.ExtrudeFeatures.Item(1)
Dim sketch = extrusion.Definition.Profile.Parent
sketch.DataIO.WriteDataToFile("DXF", "C:\Temp\dxfout.dxf")

 

Jelte de Jong
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.

EESignature


Blog: hjalte.nl - github.com

0 Likes