<?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 VBA macro in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-macro/m-p/9184272#M103710</link>
    <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;I'm quite inexperienced with VBA so if any of you can help me get this macro to work will be very much appreciated. I am trying to extract X Y Z of work points in the 3D model and create a General table into a drawing with the info, 1st column to be with the name of the work point, 2nd column empty, the rest are X Y Z. It's highlighting the last row but I don't know how to fix it&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Set oCustomTable = oSheet.CustomTables.Add("", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), 5, oSheet.Centermarks.Count, oTitles, oContents, oColumnWidths)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The whole code is this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Sub CreateGLOBALtest()&lt;BR /&gt;' Set a reference to the drawing document.&lt;BR /&gt;' This assumes a drawing document is active.&lt;BR /&gt;Dim oDrawDoc As DrawingDocument&lt;BR /&gt;Set oDrawDoc = ThisApplication.ActiveDocument&lt;BR /&gt;&lt;BR /&gt;' Set a reference to the active sheet.&lt;BR /&gt;Dim oSheet As Sheet&lt;BR /&gt;Set oSheet = oDrawDoc.ActiveSheet&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;' Set the column titles&lt;BR /&gt;Dim oTitles(1 To 5) As String&lt;BR /&gt;oTitles(1) = "RPS"&lt;BR /&gt;oTitles(2) = "Note"&lt;BR /&gt;oTitles(3) = "X (mm)"&lt;BR /&gt;oTitles(4) = "Y (mm)"&lt;BR /&gt;oTitles(5) = "Z (mm)"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;' Set the contents of the custom table (contents are set row-wise)&lt;BR /&gt;Dim oCenterMark As Centermark&lt;BR /&gt;Dim oPoint As Point&lt;BR /&gt;Dim i As Integer&lt;BR /&gt;i = oSheet.Centermarks.Count * 5&lt;BR /&gt;ReDim oContents(1 To i) As String&lt;BR /&gt;i = 1&lt;BR /&gt;&lt;BR /&gt;For Each oCenterMark In oDrawDoc.ActiveSheet.Centermarks&lt;BR /&gt;Set oPoint = oCenterMark.ModelWorkFeature.Point&lt;BR /&gt;oContents(i) = oCenterMark.ModelWorkFeature.Name&lt;BR /&gt;i = i + 2&lt;BR /&gt;oContents(i) = Round((oPoint.X * 10), 10)&lt;BR /&gt;i = i + 1&lt;BR /&gt;oContents(i) = Round((oPoint.Y * 10), 10)&lt;BR /&gt;i = i + 1&lt;BR /&gt;oContents(i) = Round((oPoint.Z * 10), 10)&lt;BR /&gt;i = i + 1&lt;BR /&gt;'Debug.Print oPoint.X &amp;amp; ", " &amp;amp; oPoint.Y &amp;amp; ", " &amp;amp; oPoint.Z&lt;BR /&gt;Next&lt;BR /&gt;&lt;BR /&gt;' Set the column widths (defaults to the column title width if not specified)&lt;BR /&gt;Dim oColumnWidths(1 To 5) As Double&lt;BR /&gt;oColumnWidths(1) = 3&lt;BR /&gt;oColumnWidths(2) = 6&lt;BR /&gt;oColumnWidths(3) = 2.3&lt;BR /&gt;oColumnWidths(4) = 2.3&lt;BR /&gt;oColumnWidths(5) = 2.3&lt;BR /&gt;&lt;BR /&gt;' Create the custom table&lt;BR /&gt;Dim oCustomTable As CustomTable&lt;BR /&gt;Set oCustomTable = oSheet.CustomTables.Add("", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), 5, oSheet.Centermarks.Count, oTitles, oContents, oColumnWidths)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Thu, 05 Dec 2019 10:31:21 GMT</pubDate>
    <dc:creator>sandreev</dc:creator>
    <dc:date>2019-12-05T10:31:21Z</dc:date>
    <item>
      <title>VBA macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-macro/m-p/9184272#M103710</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;I'm quite inexperienced with VBA so if any of you can help me get this macro to work will be very much appreciated. I am trying to extract X Y Z of work points in the 3D model and create a General table into a drawing with the info, 1st column to be with the name of the work point, 2nd column empty, the rest are X Y Z. It's highlighting the last row but I don't know how to fix it&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Set oCustomTable = oSheet.CustomTables.Add("", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), 5, oSheet.Centermarks.Count, oTitles, oContents, oColumnWidths)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The whole code is this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Sub CreateGLOBALtest()&lt;BR /&gt;' Set a reference to the drawing document.&lt;BR /&gt;' This assumes a drawing document is active.&lt;BR /&gt;Dim oDrawDoc As DrawingDocument&lt;BR /&gt;Set oDrawDoc = ThisApplication.ActiveDocument&lt;BR /&gt;&lt;BR /&gt;' Set a reference to the active sheet.&lt;BR /&gt;Dim oSheet As Sheet&lt;BR /&gt;Set oSheet = oDrawDoc.ActiveSheet&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;' Set the column titles&lt;BR /&gt;Dim oTitles(1 To 5) As String&lt;BR /&gt;oTitles(1) = "RPS"&lt;BR /&gt;oTitles(2) = "Note"&lt;BR /&gt;oTitles(3) = "X (mm)"&lt;BR /&gt;oTitles(4) = "Y (mm)"&lt;BR /&gt;oTitles(5) = "Z (mm)"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;' Set the contents of the custom table (contents are set row-wise)&lt;BR /&gt;Dim oCenterMark As Centermark&lt;BR /&gt;Dim oPoint As Point&lt;BR /&gt;Dim i As Integer&lt;BR /&gt;i = oSheet.Centermarks.Count * 5&lt;BR /&gt;ReDim oContents(1 To i) As String&lt;BR /&gt;i = 1&lt;BR /&gt;&lt;BR /&gt;For Each oCenterMark In oDrawDoc.ActiveSheet.Centermarks&lt;BR /&gt;Set oPoint = oCenterMark.ModelWorkFeature.Point&lt;BR /&gt;oContents(i) = oCenterMark.ModelWorkFeature.Name&lt;BR /&gt;i = i + 2&lt;BR /&gt;oContents(i) = Round((oPoint.X * 10), 10)&lt;BR /&gt;i = i + 1&lt;BR /&gt;oContents(i) = Round((oPoint.Y * 10), 10)&lt;BR /&gt;i = i + 1&lt;BR /&gt;oContents(i) = Round((oPoint.Z * 10), 10)&lt;BR /&gt;i = i + 1&lt;BR /&gt;'Debug.Print oPoint.X &amp;amp; ", " &amp;amp; oPoint.Y &amp;amp; ", " &amp;amp; oPoint.Z&lt;BR /&gt;Next&lt;BR /&gt;&lt;BR /&gt;' Set the column widths (defaults to the column title width if not specified)&lt;BR /&gt;Dim oColumnWidths(1 To 5) As Double&lt;BR /&gt;oColumnWidths(1) = 3&lt;BR /&gt;oColumnWidths(2) = 6&lt;BR /&gt;oColumnWidths(3) = 2.3&lt;BR /&gt;oColumnWidths(4) = 2.3&lt;BR /&gt;oColumnWidths(5) = 2.3&lt;BR /&gt;&lt;BR /&gt;' Create the custom table&lt;BR /&gt;Dim oCustomTable As CustomTable&lt;BR /&gt;Set oCustomTable = oSheet.CustomTables.Add("", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), 5, oSheet.Centermarks.Count, oTitles, oContents, oColumnWidths)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 10:31:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-macro/m-p/9184272#M103710</guid>
      <dc:creator>sandreev</dc:creator>
      <dc:date>2019-12-05T10:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: VBA macro</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-macro/m-p/9184509#M103711</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/8016737"&gt;@sandreev&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When it comes to programming needs for Inventor use the Inventor Customization forum for that &lt;A href="https://forums.autodesk.com/t5/inventor-customization/bd-p/120" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-customization/bd-p/120&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will request your posting to be relocated there to best suit your needs.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Dec 2019 12:19:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-macro/m-p/9184509#M103711</guid>
      <dc:creator>Mark.Lancaster</dc:creator>
      <dc:date>2019-12-05T12:19:19Z</dc:date>
    </item>
  </channel>
</rss>

