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: 

Ilogic: export flat pattern as .dwg API

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
1793 Views, 4 Replies

Ilogic: export flat pattern as .dwg API

Hi,

 

I'm looking for a way to get flat pattern .dwg from my 3D model. Problem is my model is a configurator and it has parts that are invisible and referenced.

I tried a tool but this exports all the sheetmetal parts, and this is more then i need.

 

I can select by rule which parts i want to export and which i don't want. All i need to know is how to perform this operation via API (see image). And then select the .ini file with the right settings.

 

Does anybody have a idea?

 

Save copy as.png

 

 

4 REPLIES 4
Message 2 of 5
rikard.nilsson
in reply to: Anonymous

Hi,

 

If you do a search for "Translate - Sheet Metal to DXF API Sample " in Programming Help. You will find how to create DXF through API..

It will not create a dwg, but dxf is the same in this simple drawings..

 

/Rikard

Message 3 of 5
Anonymous
in reply to: rikard.nilsson

I tried this sample and i get error:

 

Rule:

'*****************************************************
'******************** Export: DXF ********************
'*****************************************************

' Get the active document.  This assumes it is a part document.
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

' Get the DataIO object.
Dim oDataIO As DataIO
oDataIO = oDoc.ComponentDefinition.DataIO

' Build the string that defines the format of the DXF file.
Dim sOut As String
sOut = "FLAT PATTERN DXF?AcadVersion=R12&OuterProfileLayer=Outer"

' Create the DXF file.
oDataIO.WriteDataToFile sOut, "C:\temp\flat-test.dxf"

 

 Error:

Rule Compile Errors in Export: DXF, in PNR_Cilinder_01a.ipt

Error on Line 19 : Method arguments must be enclosed in parentheses.

 What to do?

Message 4 of 5
Anonymous
in reply to: Anonymous

 

Code:

'*****************************************************
'******************** Export: DXF ********************
'*****************************************************


' Get the active document.  This assumes it is a part document.
Dim oDoc As PartDocument
oDoc = ThisApplication.ActiveDocument

' Get the DataIO object.
Dim oDataIO As DataIO
oDataIO = oDoc.ComponentDefinition.DataIO

' Build the string that defines the format of the DXF file.
Dim sOut As String
sOut = "FLAT PATTERN DXF?AcadVersion=R12&OuterProfileLayer=Outer"

' Create the DXF file.
oDataIO.WriteDataToFile(sOut, "C:\temp\flat-test.dxf")

 

But now i want to modify the result, we have a (when doing manually) a .ini file that workers can select to get the right layers & settings for export.

 

 

Spoiler
configuuration file.png

 

Can i still use this file, or do i have to write out the settings like this (see spoiler)?

  

Spoiler

The sample code below writes a sheet metal file out as DXF. DWG is also supported. Use either the FLAT PATTERN DWG or FLAT PATTERN DXF formats.There are several optional arguments that can be specified as part of the format string. E.g. 'FLAT PATTERN DXF?TangentLayer=Tangents&SimplifySplines=True'). Below are the names of these arguments and relevant default values. The output will use these values unless you override them as part of the input string.

ArgumentTypeDefault ValueNote
TangentLayerStringIV_TANGENT 
OuterProfileLayerStringIV_OUTER_PROFILE 
ArcCentersLayerStringIV_ARC_CENTERS 
InteriorProfilesLayerStringIV_INTERIOR_PROFILES 
BendLayerStringIV_BENDBendUpLayer + BendDownLayer (legacy support)
BendUpLayerStringIV_BEND 
BendDownLayerStringIV_BEND_DOWN 
ToolCenterLayerStringIV_TOOL_CENTERToolCenterUpLayer + ToolCenterDownLayer (legacy support)
ToolCenterUpLayerStringIV_TOOL_CENTER 
ToolCenterDownLayerStringIV_TOOL_CENTER_DOWN 
FeatureProfilesLayerStringIV_FEATURE_PROFILESFeatureProfilesUpLayer + FeatureProfilesDownLayer (legacy support)
FeatureProfilesUpLayerStringIV_FEATURE_PROFILES 
FeatureProfilesDownLayerStringIV_FEATURE_PROFILES_DOWN 
AltRepFrontLayerStringIV_ALTREP_FRONT 
AltRepBackLayerStringIV_ALTREP_BACK 
UnconsumedSketchesLayerStringIV_UNCONSUMED_SKETCHES 
TangentRollLinesLayerStringIV_ROLL_TANGENT 
RollLinesLayerStringIV_ROLL 
***ColorString *** indicates name of layer from the argument column. RGB values separated by ;. Example: TangentLayerColor=255;0;0
***LineTypeLong *** indicates name of layer from the argument column. Long value from LineTypeEnum. Example: TangentLayerLineType=37644
***LineWeightDouble *** indicates name of layer from the argument column. Value in centimeters. Example: TangentLayerLineWeight=.1016
ExportUnconsumedSketchPropertiesBooleanTrueSpecifies whether individual sketch entity properties should be exported. If set to False, the properties specified by the UnconsumedSketchesLayer are used.
CustomizeFilenameString  
AcadVersionString 2010, 2007, 2004, 2000, or R12 (for DXF only)
SimplifySplinesBooleanTrueEnable spline replacement by linear segments
SplineToleranceDouble0.01Chord tolerance for spline replacement
AdvancedLegacyExportBooleanTrue 
MergeProfilesIntoPolylineBooleanFalseBuild a polyline of the exterior profiles
RebaseGeometryBooleanFalseMove geometry to 1st quadrant
InvisibleLayersString List of layer names to make invisible, separated by ;

 

Or should i just use the content like this is found in actual .ini for putting in my rule? (see spoiler)

Spoiler
[FP EXPORT SELECT OPTIONS] AUTOCAD VERSION=AutoCAD 2004 USE CUSTOMIZE=No CUSTOMIZE FILE=c:\program files\autodesk\inventor 2013\Design Data\DWG-DXF\FlatPattern.xml [FLATPATTERN LAYER OPTIONS] Tangent Lines=IV_TANGENT:Visibility=ON;LinePattern=28110;LineWeight=0,0500;Color=0,128,0; Bend Lines (Front)=IV_BEND:Visibility=ON;LinePattern=28110;LineWeight=0,0500;Color=0,128,0; Bend Lines (Back)=IV_BEND_DOWN:Visibility=ON;LinePattern=28110;LineWeight=0,0500;Color=0,128,0; Tool Centers (Front)=IV_TOOL_CENTER:Visibility=OFF;LinePattern=28100;LineWeight=0,0500;Color=0,0,0; Tool Centers (Back)=IV_TOOL_CENTER_DOWN:Visibility=OFF;LinePattern=28100;LineWeight=0,0500;Color=0,0,0; Arc Centers=IV_ARC_CENTERS:Visibility=ON;LinePattern=28110;LineWeight=0,0500;Color=0,128,0; Outer Profile=IV_OUTER_PROFILE:Visibility=ON;LinePattern=28100;LineWeight=0,0500;Color=0,0,0; Inner Profile=IV_INTERIOR_PROFILES:Visibility=ON;LinePattern=28101;LineWeight=0,0500;Color=0,255,255; Feature Profile (Front)=IV_FEATURE_PROFILES:Visibility=ON;LinePattern=28100;LineWeight=0,0500;Color=0,0,0; Feature Profile (Back)=IV_FEATURE_PROFILES_DOWN:Visibility=ON;LinePattern=28101;LineWeight=0,0500;Color=0,255,255; Alternate Rep (Front)=IV_ALTREP_FRONT:Visibility=OFF;LinePattern=28100;LineWeight=0,0500;Color=0,0,0; Alternate Rep (Back)=IV_ALTREP_BACK:Visibility=OFF;LinePattern=28100;LineWeight=0,0500;Color=0,0,0; Unconsumed Sketches=IV_UNCONSUMED_SKETCHES:Visibility=OFF;LinePattern=0;LineWeight=-1,0000;Color=-255,-255,-255; Tangent Roll Lines=IV_ROLL_TANGENT:Visibility=OFF;LinePattern=28100;LineWeight=0,0500;Color=0,0,0; Roll Lines=IV_ROLL:Visibility=OFF;LinePattern=28100;LineWeight=0,0500;Color=0,0,0; [FLATPATTERN GEOMETRY OPTIONS] REBASE GEOMETRY=No GROUP GEOMETRY=No REPLACE SPLINE=Yes SPLINE SIMPLIFICATION METHOD=Linear CHORD_TOLERANCE=0.5

 

Thanks

 
Message 5 of 5
mario.lung
in reply to: Anonymous

Hey,

the First Proplem ist the Value "LinePattern" you must convert it to LineTypeEnum.

the Secound is the RGB Value you must replace "." to ";"

cu
Mario

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

Post to forums  

Autodesk Design & Make Report