John2020
Guest
hi sir,
recently i have copy a ilogic from autodesk forum, and actulally i wish to export the unfold pattern to dxf with part number instead of file name in ipt files. appreciate if you could help me to edit the code as below.
my sample expected: https://mega.nz/file/xf0qxloa#v5iqzzbitihin-cimbiurdeexakihiyea3b3q1hdt08
dim odoc as document = thisapplication.activedocument 'get active document
if odoc.documenttype <> documenttypeenum.kdrawingdocumentobject then exit sub 'drawings only
for each omodel as document in odoc.referenceddocuments' loop through all referenced documents
'sheet metal parts only
if omodel.documentsubtype.documentsubtypeid <> "{9c464203-9bae-11d3-8bad-0060b0ce6bb4}" then continue for
dim osmcd as sheetmetalcomponentdefinition = omodel.componentdefinition
if not osmcd.hasflatpattern then 'if it doesn't have a flat patter, create one (unfold the model)
osmcd.unfold ()
osmcd.flatpattern.exitedit ()
end if
dim fname as string = omodel.fullfilename 'get the document's path and name
fname = microsoft.visualbasic.left (fname, len (fname) - 4) & ".dxf"
dim sout as string = "flat pattern dxf? acadversion = r12 & rebasegeometry = true & outerprofilelayer = 0 & outerprofilelayercolor = 0; 0; 0 & interiorprofileslayer = 0 & interiorprofileslayercolor = 0; 0; 0 & invisiblelayers = iv_arc_centers; iv_tangent; iv_roll; iv_roll_tangent; iv_altrep_back; iv_altrep_front; iv_feature_profiles_down; iv_feature_profiles; iv_tool_center_down; digi_marker_tool_1; digi_marker_tool_2; iv_bend; iv_bend_down "'export settings
try
osmcd.dataio.writedatatofile (sout, fname) 'export
catch
end try
next
recently i have copy a ilogic from autodesk forum, and actulally i wish to export the unfold pattern to dxf with part number instead of file name in ipt files. appreciate if you could help me to edit the code as below.
my sample expected: https://mega.nz/file/xf0qxloa#v5iqzzbitihin-cimbiurdeexakihiyea3b3q1hdt08
dim odoc as document = thisapplication.activedocument 'get active document
if odoc.documenttype <> documenttypeenum.kdrawingdocumentobject then exit sub 'drawings only
for each omodel as document in odoc.referenceddocuments' loop through all referenced documents
'sheet metal parts only
if omodel.documentsubtype.documentsubtypeid <> "{9c464203-9bae-11d3-8bad-0060b0ce6bb4}" then continue for
dim osmcd as sheetmetalcomponentdefinition = omodel.componentdefinition
if not osmcd.hasflatpattern then 'if it doesn't have a flat patter, create one (unfold the model)
osmcd.unfold ()
osmcd.flatpattern.exitedit ()
end if
dim fname as string = omodel.fullfilename 'get the document's path and name
fname = microsoft.visualbasic.left (fname, len (fname) - 4) & ".dxf"
dim sout as string = "flat pattern dxf? acadversion = r12 & rebasegeometry = true & outerprofilelayer = 0 & outerprofilelayercolor = 0; 0; 0 & interiorprofileslayer = 0 & interiorprofileslayercolor = 0; 0; 0 & invisiblelayers = iv_arc_centers; iv_tangent; iv_roll; iv_roll_tangent; iv_altrep_back; iv_altrep_front; iv_feature_profiles_down; iv_feature_profiles; iv_tool_center_down; digi_marker_tool_1; digi_marker_tool_2; iv_bend; iv_bend_down "'export settings
try
osmcd.dataio.writedatatofile (sout, fname) 'export
catch
end try
next