Exporting FACE as DXF and keep bend lines

Exporting FACE as DXF and keep bend lines

llorden4
Collaborator Collaborator
437 Views
3 Replies
Message 1 of 4

Exporting FACE as DXF and keep bend lines

llorden4
Collaborator
Collaborator

Taking inspiration from this post...

https://forums.autodesk.com/t5/inventor-programming-ilogic/export-to-dxf-without-tangent-and-bending...

 

I've got a working routine to create my desired face but I'd also like to keep the bend lines with the DXF.  I've not been able to dig-up any options to include them, does anyone have any suggestions on a way to accomplish this?

 

Below is my current code adaption after various manipulations have been made to the flat pattern for CNC prep...

oFace = oCompDef.FlatPattern.TopFace
Dim oSS As SelectSet = oDoc.SelectSet
oSS.Clear
oSS.Select(oFace)
Dim Cm As CommandManager
Cm = ThisApplication.CommandManager
Cm.PostPrivateEvent(PrivateEventTypeEnum.kFileNameEvent, oDXFDir & iProperties.Value("Project", "Part Number") & ".dxf")
Dim oCtrlDef As ButtonDefinition
oCtrlDef = ThisApplication.CommandManager.ControlDefinitions.Item("GeomToDXFCommand")
Call oCtrlDef.Execute
Autodesk Inventor Certified Professional
0 Likes
438 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor

Hi @llorden4.  The process of selecting a face, then sending the file name, then executing the command, is certainly convenient, and relatively simple, but it does not let you specify any options either.  I am not sure if it is possible to use the PostPrivateEvent to post any other more specific options in this situation, but I rather doubt it, because it appears to somehow be using the standard TranslatorAddIn behind the scenes, which only has one option...specifying the full file name of the INI file, which contains all other options/settings, including a pointer to an XML file, where the layers edits are specified.

You may either have to:

  • Go the drawing view route, where you have control over showing the bend lines.
  • Or, Use the DataIO.WriteDataToFile method on the FlatPattern object itself (which can be pretty complicated to get the 'Format' String just right for)
    • I have used this one many times before, but generally do not need it for production purposes where I work.
  • Or, possibly create a sketch on that face, project all edges (or cut edges), 'include' the bend lines, then use its DataIO.WriteDataToFile method, where we can only specify "DXF" or "DWG" in the Format string, then undo the transaction in which the sketch was created.
    • I have used this last option many times, for added control, but I never include bend lines, because we do not need them.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 4

llorden4
Collaborator
Collaborator

Thanks for the feedback.

 

I just departed from using a sketch to export, and am keeping a return to that option as a Plan B.  I was really just hoping for some luck with this simpler path.

Autodesk Inventor Certified Professional
0 Likes
Message 4 of 4

WCrihfield
Mentor
Mentor

On the bright side, I do believe that Inventor holds onto the previous settings, somewhere, but I do not know for how long.  So, if you export one face to DXF manually, using the right-click menu, and the dialog, that should ensure the options are set the way you want them.  Then your rule/code can use the simpler method, like you are doing in that example, and those options should be applied to every export...at least in theory.  However, if we are talking about doing a single manual export, followed by a bunch of code based exports, then going into FlatPattern edit mode, then right-clicking on the "Flat Pattern" top node, then choosing 'Save Copy As' (which shows a plain Save As dialog, with no options button enabled), then after you click the 'Save' button, the really nice, multi-tab dialog shows, giving you the most detailed manual control of any route.  Then you can save a copy of that 'configuration' (INI file) out for use later, when using the traditional TranslatorAddIn export process.

 

On that last note...I'm still using 2024.3.1, but if you are using 2025 version, there is a great new option available.  See the following 'Sample' (in VBA, of course 🙄) (PublishFlatPatternToDXF.Sample )in the online help documentation.  It is showing that we can use the FlatPattern object itself, instead of the Document object, as the 'SourceObject' input when using the TranslatorAddIn.SaveCopyAs method.  The documentation for that method also mentions this ability, which is nice.  Neither of those are shown in 2024 online help.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes