<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Express DXF macro in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5780682#M58153</link>
    <description>&lt;P&gt;I can change the layer and color. But I do not know how to change the bending symbel as Ellipse. Can we change the bending symbel?&lt;/P&gt;</description>
    <pubDate>Thu, 20 Aug 2015 19:12:01 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-08-20T19:12:01Z</dc:date>
    <item>
      <title>Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5776683#M58070</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im fairly skilled with Inventor but a complete noobie to macros/VBA's. I have some programming knowledge and would like some guidance in making a macro to do the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. "Save Copy As" of a flat pattern that will be open&lt;/P&gt;&lt;P&gt;2. Request the user to input BOM quantity and assembly quantity&lt;/P&gt;&lt;P&gt;3. Multiply the BOM quantity by the assembly quantity to get an integer "Z"&lt;/P&gt;&lt;P&gt;4. Save the flat pattern as XXXXX-XX-XX-Z&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before I start coding I'd just like to know if this is possible and any advice I can get.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Brendan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2015 20:46:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5776683#M58070</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-18T20:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5777807#M58097</link>
      <description>&lt;P&gt;This is definitely possible and not that difficult. Here is some code I put together from something similar I had. It will prompt for the two quantities and multipy them, if the flat pattern doesn't exist yet it will create it, and then it will save the dxf in the same folder as the part with "-(totalquantity) added to the file name. Let me know how it works for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Public Sub Export_DXF()
    Dim oDoc As PartDocument
    Set oDoc = ThisApplication.ActiveEditDocument
    If (oDoc.FullDocumentName &amp;lt;&amp;gt; oDoc.FullDocumentName) Then
        MsgBox "Can't export while editing a part in an assembly"
        Exit Sub
    ElseIf (oDoc.ComponentDefinition.Type &amp;lt;&amp;gt; kSheetMetalComponentDefinitionObject) Then
        MsgBox "Not a sheet metal part Sorry."
        Exit Sub
    End If
    
    Dim BomQty As Integer
    BomQty = InputBox(Prompt:="Enter Bom Quantity", Title:="Bom Quantity")
    
    Dim AsmQty As Integer
    AsmQty = InputBox(Prompt:="Enter Assembly Quantity", Title:="Assembly Quantity")
    
    Dim TotQty As Integer
    TotQty = BomQty * AsmQty
    
    'If flat pattern doesn't exist, create it and return to folded view
    If (oDoc.ComponentDefinition.FlatPattern Is Nothing) Then
        Dim oDef As ControlDefinition
        oDoc.ComponentDefinition.Unfold
        Set oDef = ThisApplication.CommandManager.ControlDefinitions.Item("PartSwitchRepresentationCmd")
        oDef.Execute
    End If

    ' Get the DataIO object.
    Dim oDataIO As DataIO
    Set oDataIO = oDoc.ComponentDefinition.DataIO

    ' Build the string that defines the format of the DXF file.
    Dim sOut As String
    sOut = "FLAT PATTERN DXF?AcadVersion=2004&amp;amp;OuterProfileLayer=Outer&amp;amp;InvisibleLayers=IV_Tangent;IV_Bend;IV_Bend_Down;IV_Bend_Up;IV_Arc_Centers"

    ' Create the DXF file.
    oDataIO.WriteDataToFile sOut, full_path(oDoc.FullFileName) &amp;amp; filename_noext(oDoc.FullFileName) &amp;amp; "-" &amp;amp; TotQty &amp;amp; ".dxf"
End Sub

Function filename_noext(spth As String)
    'Returns filename without extension from full path
    If (spth &amp;lt;&amp;gt; "") And (InStr(spth, ".")) And (InStrRev(spth, "\") &amp;lt; InStrRev(spth, ".")) Then
        filename_noext = Mid(spth, InStrRev(spth, "\") + 1, InStrRev(spth, ".") - InStrRev(spth, "\") - 1)
    ElseIf (spth &amp;lt;&amp;gt; "") And Not (InStr(spth, ".")) Then
        filename_noext = Mid(spth, InStrRev(spth, "\", Len(spth)) + 1, Len(spth))
    Else:
        filename_noext = ""
    End If
End Function

Function full_path(spth As String)
    'Returns full path minus filename, trailing slash is included
    If spth &amp;lt;&amp;gt; "" Then
        full_path = Left(spth, Len(spth) - (Len(spth) - InStrRev(spth, "\")))
    Else:
        full_path = ""
    End If
End Function&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2015 14:55:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5777807#M58097</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2015-08-19T14:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5778029#M58108</link>
      <description>&lt;P&gt;THANK YOU SO MUCH!&lt;/P&gt;&lt;P&gt;That works beautifully.&lt;/P&gt;&lt;P&gt;One more question, where does the code describe where to save the dxf to?&lt;/P&gt;&lt;P&gt;I would like it to go into a sub-folder named "DXF" that is&amp;nbsp;in the same folder as the part I am exporting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again,&lt;/P&gt;&lt;P&gt;Brendan&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2015 16:34:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5778029#M58108</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-19T16:34:17Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5778132#M58115</link>
      <description>&lt;P&gt;The code for setting the file path is the second to last line in the main sub. I modified the line below to save the file in a subfolder named "DXF".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example of how the code for the file name works.&lt;/P&gt;&lt;P&gt;original ipt file: c:\inventor\part1.ipt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;full_path(oDoc.FullFileName) returns c:\inventor\&lt;/P&gt;&lt;P&gt;filename_noext(oDoc.FullFileName) returns part1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So adding those with other parts yields&lt;/P&gt;&lt;P&gt;dxf file: c:\inventor\DXF\part1-6.dxf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    'This line saves the dxf.
    oDataIO.WriteDataToFile sOut, full_path(oDoc.FullFileName) &amp;amp; "DXF\" &amp;amp; filename_noext(oDoc.FullFileName) &amp;amp; "-" &amp;amp; TotQty &amp;amp; ".dxf"

&lt;/PRE&gt;&lt;P&gt;Hope that explains it well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2015 17:28:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5778132#M58115</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2015-08-19T17:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5778313#M58120</link>
      <description>&lt;P&gt;Yup that worked again.&lt;/P&gt;&lt;P&gt;Any idea how to get material thickness from the sheet metal defaults?&lt;/P&gt;&lt;P&gt;For example here I would want 0.1875 to appear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking on other forums as well but no luck so far.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Brendan&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2015 18:39:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5778313#M58120</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-19T18:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5778365#M58121</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have same requirement. But i have other problem. I created DXf file with Inventor, but my supplier said their machine does not reconigze my file.&amp;nbsp;We use different symbel to mark bend space.&lt;/P&gt;&lt;P&gt;AEAHHMZ001-1-001 is a smple from supplier.&amp;nbsp; 1-004-004-1 is from Inventor. I am not sure if i can change the configuration to make my DXf same as supplier's. Now i can see that the layer and bending symbel are different.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please kindly&amp;nbsp;take a look attached files, and give suggetion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jason&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pball wrote:&lt;/P&gt;&lt;P&gt;The code for setting the file path is the second to last line in the main sub. I modified the line below to save the file in a subfolder named "DXF".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An example of how the code for the file name works.&lt;/P&gt;&lt;P&gt;original ipt file: c:\inventor\part1.ipt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;full_path(oDoc.FullFileName) returns c:\inventor\&lt;/P&gt;&lt;P&gt;filename_noext(oDoc.FullFileName) returns part1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So adding those with other parts yields&lt;/P&gt;&lt;P&gt;dxf file: c:\inventor\DXF\part1-6.dxf&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    'This line saves the dxf.
    oDataIO.WriteDataToFile sOut, full_path(oDoc.FullFileName) &amp;amp; "DXF\" &amp;amp; filename_noext(oDoc.FullFileName) &amp;amp; "-" &amp;amp; TotQty &amp;amp; ".dxf"

&lt;/PRE&gt;&lt;P&gt;Hope that explains it well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2015 18:57:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5778365#M58121</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-19T18:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5778597#M58126</link>
      <description>brendansullivan:&lt;BR /&gt;You can use the following code to get the sheet metal thickness. The first two lines are not needed if you it with the code above as it already has those lines.&lt;BR /&gt;&lt;BR /&gt;Dim oDoc As PartDocument&lt;BR /&gt;Set oDoc = ThisApplication.ActiveEditDocument&lt;BR /&gt;&lt;BR /&gt;Dim oSheetMetalCompDef As SheetMetalComponentDefinition&lt;BR /&gt;Set oSheetMetalCompDef = oDoc.ComponentDefinition&lt;BR /&gt;&lt;BR /&gt;Dim thick As Double&lt;BR /&gt;'Inventor returns the thickness in metric so it needs converted&lt;BR /&gt;thick = oSheetMetalCompDef.Thickness.Value / 2.54</description>
      <pubDate>Wed, 19 Aug 2015 20:44:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5778597#M58126</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2015-08-19T20:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5779616#M58137</link>
      <description>&lt;P&gt;Thank you. I had that same code except I didnt know the value was returned as metric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally the code is all done and it works perfectly. Thanks so much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Brendan&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2015 11:42:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5779616#M58137</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-20T11:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5779623#M58138</link>
      <description>&lt;P&gt;Weird, my ACAD doesnt recognize your supplier's drawing but it can open your drawing fine. Could it be that they have a different version of autocad? I'm using 2010 to open both files.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2015 11:47:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5779623#M58138</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-20T11:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5779846#M58143</link>
      <description>&lt;P&gt;I use&amp;nbsp;AutoCAD2014. I saved the file as 2010dxf and attaced it again. Can you please try it again?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2015 13:29:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5779846#M58143</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-20T13:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5779879#M58145</link>
      <description>&lt;P&gt;Jason,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;sOut = "FLAT PATTERN DXF?AcadVersion=2004&amp;amp;OuterProfileLayer=Outer&amp;amp;InvisibleLayers=IV_Tangent;IV_Bend;IV_Bend_Down;IV_Bend_Up;IV_Arc_Centers"&lt;/PRE&gt;&lt;P&gt;This is the line that determines the naming of the layers, colour of the layers and version of the dxf. It seems like you want to name OuterProfileLayer and Interior Profile Layer to be = to "Part" and change their colours to cyan. I'm not sure what the AM_5 layer is as it does not&amp;nbsp;contain any objects in my autoCAD. There is also the code for IV_BEND and IV_BEND_DOWN in the code above. Perhaps you want to rename those?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2015 13:42:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5779879#M58145</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-20T13:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5780682#M58153</link>
      <description>&lt;P&gt;I can change the layer and color. But I do not know how to change the bending symbel as Ellipse. Can we change the bending symbel?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2015 19:12:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5780682#M58153</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-08-20T19:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5916443#M60007</link>
      <description>&lt;P&gt;Can someone show me how to change the color with this code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 19:26:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5916443#M60007</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-19T19:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5916565#M60009</link>
      <description>&lt;P&gt;sOut = "FLAT PATTERN DXF?AcadVersion=2013&amp;amp;OuterProfileLayerColor=0;255;255&amp;amp;OuterProfileLayer=Part&amp;amp;InteriorProfilesLayer=Part" '&amp;amp;TangentLayer=Part&amp;amp;TangentLayer=Part"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can change the color by chaning the 0;255;255 to something else.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 20:10:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5916565#M60009</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-19T20:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: Express DXF macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5916714#M60012</link>
      <description>&lt;P&gt;Perfect, thanks. &amp;nbsp;How about changing the save path to lets say f:\DFX?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 21:29:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/express-dxf-macro/m-p/5916714#M60012</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-11-19T21:29:13Z</dc:date>
    </item>
  </channel>
</rss>

