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 to DXF from assembly

5 REPLIES 5
Reply
Message 1 of 6
engineeringSEZWD
314 Views, 5 Replies

Export Flat Pattern to DXF from assembly

Hello everyone,

I've searched through this forum for a few options to export flat patterns to DXF, but those macros or iLogic rules didn't fit into my workflow. I tried to adapt them, but I lack the necessary knowledge.

Here's my workflow, and I hope someone could assist me:

  • Scan all parts in the assembly and sub-assembly and export all flat patterns to DXF files.
  • The files can be saved in the same path as the IPT file.
  • Only boundaries and hole lines need to be exported; bending lines are not necessary.

If possible, I'd like the name of the DXF file to include:

  • The name of the IPT file
  • The total quantity placed (in both assembly and sub-assembly)
  • The material
  • The thickness

Thank you!


example of dxf file name
        <name of the file IPT>             - qnty -       Material               -  Ticknees
24018-P-007 _ Side Reinforcement - 3x - Steel AS3678 GR 250 - 2mm

5 REPLIES 5
Message 2 of 6

This should help get you started
https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=WriteFlatPatternAsDXF_Sample

Dim oADoc As AssemblyDocument = ThisDoc.Document
Dim oBOM As BOM = oADoc.ComponentDefinition.BOM
oBOM.PartsOnlyViewEnabled = True
Dim oBOMView As BOMView = oBOM.BOMViews.Item("Parts Only")

For Each oBOMRow As BOMRow In oBOMView.BOMRows
	'sheet metal document sub type
	If Not oBOMRow.ComponentDefinitions(1).Document.SubType.ToString = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Continue For
		
	Dim qty As Double = oBOMRow.ItemQuantity
	
	'this takes the first document file for the row (should only be 1 unless duplicate part numbers)
	Dim oDoc As PartDocument = oBOMRow.ComponentDefinitions(1).Document
	
	'export dxf
Next
Message 3 of 6

Thank you for your assistance.

However, I lack expertise in macros and coding, so I find myself somewhat stuck here. Additionally, I am more accustomed to SolidWorks rather than Inventor.

Could you possibly provide further elaboration on this macro or perhaps direct me to other users who may be able to assist?

Thank you for everything.

 

Message 4 of 6

This is one of the most common requests on the forums. Some people like to like to try and create a rule themselves, some people just want a copy/paste that will work. Try this:

It might need bug fixing and can be improved on but its what your asking.

'get the document this rule is ran from
Dim oADoc As AssemblyDocument = ThisDoc.Document
Dim oBOM As BOM = oADoc.ComponentDefinition.BOM
'disable row merge for dupiclate part numbers
oBOM.SetPartNumberMergeSettings(False)
'ignore suppressed components so you dont have to open the files in the background
oBOM.HideSuppressedComponentsInBOM = True
oBOM.PartsOnlyViewEnabled = True
'use parts only BOM to get sheet metal parts
Dim oBOMView As BOMView = oBOM.BOMViews.Item("Parts Only")

'dxf format
sOut = "FLAT PATTERN DXF?AcadVersion=R12&OuterProfileLayer=0&InteriorProfilesLayer=0&InvisibleLayers=IV_ARC_CENTERS;IV_BEND_DOWN;IV_BEND;IV_FEATURE_PROFILES&TrimCenterlinesAtContour=True"

For Each oBOMRow As BOMRow In oBOMView.BOMRows
	'sheet metal document sub type
	If Not oBOMRow.ComponentDefinitions(1).Document.SubType.ToString = "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then Continue For

	Dim qnty As Integer = oBOMRow.ItemQuantity

	'this takes the first document file for the row (should only be 1 unless duplicate part numbers)
	Dim oDoc As PartDocument = oBOMRow.ComponentDefinitions(1).Document

	'try to create flat pattern
	Dim oSMCD As SheetMetalComponentDefinition
	oSMCD = oDoc.ComponentDefinition
	
	If oSMCD.HasFlatPattern = False
		Try
			oSMCD.Unfold
			oSMCD.FlatPattern.ExitEdit
		Catch : Continue For : End Try
	End If
	
	Dim thickness As String = oSMCD.Thickness.Expression
	Dim material As String = oDoc.PropertySets.Item(3).Item("Material").Value
	
	'create file name
	Dim dxfname As String = Left(oDoc.FullFileName, oDoc.FullFileName.Length - 4) & " - " & qnty & " - " & material & " - " & thickness
	'create dxf
	oSMCD.DataIO.WriteDataToFile(sOut, dxfname)
Next
Message 5 of 6

thank you @daltonNYAW9 @daltonNYAW

To be honest I don't know much about macros.

but I was wondering if there anyone willing to develop this macro for me as a service?

the company that I work is willing to pay for this macro. 

Let me know if someone provides this service.

thanks

 

Message 6 of 6

@engineeringSEZWD These people do this I believe:
you could try to message other people on the "top soultions hiscores"
Curtis_Waguespack
Ralf_Krieg

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report