<?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 Conversion of a simple Inventor VBA macro to Python in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/conversion-of-a-simple-inventor-vba-macro-to-python/m-p/11966655#M3630</link>
    <description>&lt;P&gt;Can anybody help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following Inventor VBA macro:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Quantity = "12"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;PartDescription = "TEST PART DESCRIPTION"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;OutputString = OutputString &amp;amp; Space(22 - Len(OutputString)) &amp;amp; Space(4 - Len(Quantity)) &amp;amp; Quantity&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;OutputString = OutputString &amp;amp; Space(28 - Len(OutputString)) &amp;amp; PartDescription&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;OutputString = OutputString &amp;amp; Space(188 - Len(OutputString)) &amp;amp; "P" &amp;amp; " " &amp;amp; "T"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody convert the script to Python?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Darren&lt;/P&gt;</description>
    <pubDate>Tue, 16 May 2023 08:19:47 GMT</pubDate>
    <dc:creator>isocam</dc:creator>
    <dc:date>2023-05-16T08:19:47Z</dc:date>
    <item>
      <title>Conversion of a simple Inventor VBA macro to Python</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/conversion-of-a-simple-inventor-vba-macro-to-python/m-p/11966655#M3630</link>
      <description>&lt;P&gt;Can anybody help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following Inventor VBA macro:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;Quantity = "12"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;PartDescription = "TEST PART DESCRIPTION"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;OutputString = OutputString &amp;amp; Space(22 - Len(OutputString)) &amp;amp; Space(4 - Len(Quantity)) &amp;amp; Quantity&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;OutputString = OutputString &amp;amp; Space(28 - Len(OutputString)) &amp;amp; PartDescription&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;OutputString = OutputString &amp;amp; Space(188 - Len(OutputString)) &amp;amp; "P" &amp;amp; " " &amp;amp; "T"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anybody convert the script to Python?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Darren&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 08:19:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/conversion-of-a-simple-inventor-vba-macro-to-python/m-p/11966655#M3630</guid>
      <dc:creator>isocam</dc:creator>
      <dc:date>2023-05-16T08:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: Conversion of a simple Inventor VBA macro to Python</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/conversion-of-a-simple-inventor-vba-macro-to-python/m-p/11967288#M3631</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/84538"&gt;@isocam&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the python code for it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;OutputString = "..."  #set initial value
Quantity = "12"
PartDescription = "TEST PART DESCRIPTION"
# OutputString = OutputString &amp;amp; Space(22 - Len(OutputString)) &amp;amp; Space(4 - Len(Quantity)) &amp;amp; Quantity
OutputString = f'{OutputString:22.22}{Quantity:4.4}'
# OutputString = OutputString &amp;amp; Space(28 - Len(OutputString)) &amp;amp; PartDescription
OutputString = f'{OutputString:28.28}{PartDescription}'
# OutputString = OutputString &amp;amp; Space(188 - Len(OutputString)) &amp;amp; "P" &amp;amp; " " &amp;amp; "T"
OutputString = f'{OutputString:188.188}P T'

print('         1         2         3         4         5         6         7         8         9        10'
      '        11        12        13        14        15        16        17        18        19        20')
print('....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0'
      '....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0....5....0')
print(OutputString)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jorge Jaramillo&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 04:09:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/conversion-of-a-simple-inventor-vba-macro-to-python/m-p/11967288#M3631</guid>
      <dc:creator>Jorge_Jaramillo</dc:creator>
      <dc:date>2023-08-17T04:09:30Z</dc:date>
    </item>
  </channel>
</rss>

