Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Export flat pattern dxf for all ipart members

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
aurel_e
732 Views, 2 Replies

Export flat pattern dxf for all ipart members

Hi all

is there any way to export all dxfs from Ipart?

The way I have done it so far is: generate files, insert all them in an assembly, export from assembly using ilogic rule.

I wonder if there is a better way. Another reason to look for it is that Ipart often has got a custom Iproperty called Qty. I fill it from the excel table and would like to have that number in the file name.

Thanks.

2 REPLIES 2
Message 2 of 3
bhavik4244
in reply to: aurel_e

@aurel_e 

 

Here below rule will save all the dxf of the iPart member in the folder where iPart is being saved. Technically if there is a sheet metal component then only a flat pattern or dxf can be developed. So you may iterate this rule as per your need in any occurrences of sheet metal in an assembly.

 

In order to assign custom properties, you may visit this link: https://forums.autodesk.com/t5/inventor-customization/ilogic-rule-to-update-custom-iproperties-with-...

 

Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oDef As SheetMetalComponentDefinition = oDoc.ComponentDefinition

Dim oPartMember As iPartMember

For Each oTab As iPartTableRow In oDef.iPartFactory.TableRows

MessageBox.Show(oTab.MemberName, "Name of the Memeber")

iPart.ChangeRow("", oTab.MemberName)

Dim oFeat As PartFeature
For Each oFeat In oDef.Features

	If oDoc.SubType = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then

	If oDef.HasFlatPattern = False Then
		oDef.Unfold
	Else
		oDef.FlatPattern.Edit
	End If

	Dim odxf As String
	Dim oPath As String

	oPath = ThisDoc.Path & "\DXF" 

	If Not System.IO.Directory.Exists(oPath) Then
		System.IO.Directory.CreateDirectory(oPath)
	End If

	Dim odxfname As String

	odxf = "FLAT PATTERN DXF?OuterProfileLayer=0&OuterProfileLayerColor=0;0;0&InteriorProfilesLayer=0&InteriorProfilesLayerColor=0;0;0&BendDownLayerLineType=37633&BendDownLayerColor=0;0;255&BendUpLayerLineType=37633&BendUpLayerColor=0;0;255IV_BEND;IV_BEND_DOWN;IV_OUTER_PROFILE;IV_INTERIOR_PROFILES;IV_FEATURE_PROFILES;IV_FEATURE_PROFILES_DOWN;IV_ALTREP_FRONT;IV_ALTREP_BACK;IV_ROLL_TANGENT;IV_ROLL&InvisibleLayers=IV_TANGENT;IV_TOOL_CENTER;IV_TOOL_CENTER_DOWN;IV_ARC_CENTERS;IV_UNCONSUMED_SKETCHES" _
		+ "&RebaseGeometry=True" _
		+ "&SimplifySplines=True" _
		+ "&SplineTolerance=0.01" _
		
	odxfname = oPath & "\"& oTab.MemberName & ".dxf"
	oDef.DataIO.WriteDataToFile(odxf, odxfname)
	oDef.FlatPattern.ExitEdit
	
	MessageBox.Show("DXF has been saved in this location: " + odxfname)
	Else
	MessageBox.Show("There must be a sheetmetal component to get the dxf file!")
	End If

Next

Next

 


Bhavik Suthar
Message 3 of 3
dbanksUHFZ7
in reply to: bhavik4244

@bhavik4244 

 

Thanks so much for this post! It was very useful. I am curious, is it possible to run this rule without needing to click ok after each I-part instance has been saved?

 

dbanksUHFZ7_0-1721048638686.png

 

Thanks,

Dylan

INV PRO 23

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report