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?
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
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?
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.
Can i still use this file, or do i have to write out the settings like this (see 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.
Argument | Type | Default Value | Note |
TangentLayer | String | IV_TANGENT | |
OuterProfileLayer | String | IV_OUTER_PROFILE | |
ArcCentersLayer | String | IV_ARC_CENTERS | |
InteriorProfilesLayer | String | IV_INTERIOR_PROFILES | |
BendLayer | String | IV_BEND | BendUpLayer + BendDownLayer (legacy support) |
BendUpLayer | String | IV_BEND | |
BendDownLayer | String | IV_BEND_DOWN | |
ToolCenterLayer | String | IV_TOOL_CENTER | ToolCenterUpLayer + ToolCenterDownLayer (legacy support) |
ToolCenterUpLayer | String | IV_TOOL_CENTER | |
ToolCenterDownLayer | String | IV_TOOL_CENTER_DOWN | |
FeatureProfilesLayer | String | IV_FEATURE_PROFILES | FeatureProfilesUpLayer + FeatureProfilesDownLayer (legacy support) |
FeatureProfilesUpLayer | String | IV_FEATURE_PROFILES | |
FeatureProfilesDownLayer | String | IV_FEATURE_PROFILES_DOWN | |
AltRepFrontLayer | String | IV_ALTREP_FRONT | |
AltRepBackLayer | String | IV_ALTREP_BACK | |
UnconsumedSketchesLayer | String | IV_UNCONSUMED_SKETCHES | |
TangentRollLinesLayer | String | IV_ROLL_TANGENT | |
RollLinesLayer | String | IV_ROLL | |
***Color | String | *** indicates name of layer from the argument column. RGB values separated by ;. Example: TangentLayerColor=255;0;0 | |
***LineType | Long | *** indicates name of layer from the argument column. Long value from LineTypeEnum. Example: TangentLayerLineType=37644 | |
***LineWeight | Double | *** indicates name of layer from the argument column. Value in centimeters. Example: TangentLayerLineWeight=.1016 | |
ExportUnconsumedSketchProperties | Boolean | True | Specifies whether individual sketch entity properties should be exported. If set to False, the properties specified by the UnconsumedSketchesLayer are used. |
CustomizeFilename | String | ||
AcadVersion | String | 2010, 2007, 2004, 2000, or R12 (for DXF only) | |
SimplifySplines | Boolean | True | Enable spline replacement by linear segments |
SplineTolerance | Double | 0.01 | Chord tolerance for spline replacement |
AdvancedLegacyExport | Boolean | True | |
MergeProfilesIntoPolyline | Boolean | False | Build a polyline of the exterior profiles |
RebaseGeometry | Boolean | False | Move geometry to 1st quadrant |
InvisibleLayers | String | 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)
Thanks