<?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 changes entities property when it should change sketch property as a whole. in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10130644#M121711</link>
    <description>&lt;P&gt;Without using VBA there are two ways to modify a drawing sketch's lineweight property.&lt;/P&gt;&lt;P&gt;1) Individually, per entity, from inside the sketch.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EntityProperty.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/888796i80F96354DA6A93D2/image-size/large?v=v2&amp;amp;px=999" role="button" title="EntityProperty.jpg" alt="EntityProperty.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2) As a whole, per sketch, from outside the sketch.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SketchProperty.jpg" style="width: 886px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/888797i386C40E62C47D3D4/image-size/large?v=v2&amp;amp;px=999" role="button" title="SketchProperty.jpg" alt="SketchProperty.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VBA should allow a macro to be written to use either method.&lt;/P&gt;&lt;P&gt;You might tell me I'm the one making a mistake here, but I think when VBA modifies a sketch as a whole from outside the sketch it is actually overriding the all entities within the sketch. Which isn't how it works without VBA (ref: screen cap above)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code that should modify the sketch as a whole looks something like this,,,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oDoc As DrawingDocument&lt;BR /&gt;Dim oSketch As DrawingSketch&lt;BR /&gt;Set oDoc = ThisApplication.ActiveDocument&lt;BR /&gt;Set oSketch = oDoc.ActiveSheet.Sketches(oDoc.ActiveSheet.Sketches.Count)&lt;BR /&gt;oSketch.LineWeight = 0.0508&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;,,,,after the code has run &amp;amp; ended,,, if you edit the sketch to inspect the entities within; it changed them individually.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Mar 2021 16:48:35 GMT</pubDate>
    <dc:creator>tom.prichard</dc:creator>
    <dc:date>2021-03-04T16:48:35Z</dc:date>
    <item>
      <title>VBA changes entities property when it should change sketch property as a whole.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10130644#M121711</link>
      <description>&lt;P&gt;Without using VBA there are two ways to modify a drawing sketch's lineweight property.&lt;/P&gt;&lt;P&gt;1) Individually, per entity, from inside the sketch.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EntityProperty.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/888796i80F96354DA6A93D2/image-size/large?v=v2&amp;amp;px=999" role="button" title="EntityProperty.jpg" alt="EntityProperty.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;2) As a whole, per sketch, from outside the sketch.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SketchProperty.jpg" style="width: 886px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/888797i386C40E62C47D3D4/image-size/large?v=v2&amp;amp;px=999" role="button" title="SketchProperty.jpg" alt="SketchProperty.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VBA should allow a macro to be written to use either method.&lt;/P&gt;&lt;P&gt;You might tell me I'm the one making a mistake here, but I think when VBA modifies a sketch as a whole from outside the sketch it is actually overriding the all entities within the sketch. Which isn't how it works without VBA (ref: screen cap above)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code that should modify the sketch as a whole looks something like this,,,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oDoc As DrawingDocument&lt;BR /&gt;Dim oSketch As DrawingSketch&lt;BR /&gt;Set oDoc = ThisApplication.ActiveDocument&lt;BR /&gt;Set oSketch = oDoc.ActiveSheet.Sketches(oDoc.ActiveSheet.Sketches.Count)&lt;BR /&gt;oSketch.LineWeight = 0.0508&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;,,,,after the code has run &amp;amp; ended,,, if you edit the sketch to inspect the entities within; it changed them individually.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 16:48:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10130644#M121711</guid>
      <dc:creator>tom.prichard</dc:creator>
      <dc:date>2021-03-04T16:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: VBA changes entities property when it should change sketch property as a whole.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10131125#M121720</link>
      <description>&lt;P&gt;It looks like I got a few views but no replies. ,,,so perhaps the initial post was not clear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I have &lt;STRONG&gt;discovered a bug&lt;/STRONG&gt; where VBA should work with a drawing sketch's property, not just the entities in the sketch itself. Using AIP through its GUI you can see how the software is intended to work, and &lt;STRONG&gt;does&lt;/STRONG&gt; work.&lt;/P&gt;&lt;P&gt;Using VBA to get AIP to perform the same task, in the correct method, however does &lt;STRONG&gt;not work&lt;/STRONG&gt; correctly. The plotted/printed graphics may look the same, but the properties are not set to what should have been done.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 19:20:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10131125#M121720</guid>
      <dc:creator>tom.prichard</dc:creator>
      <dc:date>2021-03-04T19:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: VBA changes entities property when it should change sketch property as a whole.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10131174#M121724</link>
      <description>&lt;P&gt;For me this works fine:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim a As Inventor.DrawingDocument = ThisDrawing.Document

Dim sk As Inventor.DrawingSketch = a.ActiveSheet.Sketches.Item(1)
sk.LineWeight= 1&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 04 Mar 2021 19:41:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10131174#M121724</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-03-04T19:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: VBA changes entities property when it should change sketch property as a whole.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10131228#M121726</link>
      <description>&lt;P&gt;and this for the entities based on lines only for my example:&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;a&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDrawing&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;sk&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;DrawingSketch&lt;/SPAN&gt; = &lt;SPAN&gt;a&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveSheet&lt;/SPAN&gt;.&lt;SPAN&gt;Sketches&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(1)
&lt;SPAN&gt;sk&lt;/SPAN&gt;.&lt;SPAN&gt;Edit&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;l&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;SketchLine&lt;/SPAN&gt;
&lt;SPAN&gt;l&lt;/SPAN&gt; = &lt;SPAN&gt;sk&lt;/SPAN&gt;.&lt;SPAN&gt;SketchLines&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(1)
&lt;SPAN&gt;l&lt;/SPAN&gt;.&lt;SPAN&gt;LineWeight&lt;/SPAN&gt; = 6
&lt;SPAN&gt;sk&lt;/SPAN&gt;.&lt;SPAN&gt;ExitEdit&lt;/SPAN&gt;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bradeneuropeArthur_0-1614887970280.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/888922i962A1A6E64AB9696/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bradeneuropeArthur_0-1614887970280.png" alt="bradeneuropeArthur_0-1614887970280.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 19:59:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10131228#M121726</guid>
      <dc:creator>bradeneuropeArthur</dc:creator>
      <dc:date>2021-03-04T19:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: VBA changes entities property when it should change sketch property as a whole.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10131404#M121733</link>
      <description>&lt;P&gt;What you have done is illustrate an &lt;STRONG&gt;issue with what is understood to be 'fine'&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;The screen capture below illustrates how AIP does work through the GUI,,,&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="non-VBA_Output.jpg" style="width: 774px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/888941i348F172C07D8B7F2/image-size/large?v=v2&amp;amp;px=999" role="button" title="non-VBA_Output.jpg" alt="non-VBA_Output.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This, below, is what your code outputs,,, incorrectly.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="VBA_Output.jpg" style="width: 733px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/888943i38AD60437D0E2CB3/image-size/large?v=v2&amp;amp;px=999" role="button" title="VBA_Output.jpg" alt="VBA_Output.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Mar 2021 21:15:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10131404#M121733</guid>
      <dc:creator>tom.prichard</dc:creator>
      <dc:date>2021-03-04T21:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: VBA changes entities property when it should change sketch property as a whole.</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10142771#M121939</link>
      <description>&lt;P&gt;It looks like Autodesk is ignoring this.&lt;/P&gt;&lt;P&gt;I do not consider this post solved.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far we have illustrated a misunderstanding about how it is supposed to work.&lt;/P&gt;&lt;P&gt;Has anyone else verified the behavior of the software comparing it to the non-VBA(GUI mehod), and then with the VBA method?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2021 17:44:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/vba-changes-entities-property-when-it-should-change-sketch/m-p/10142771#M121939</guid>
      <dc:creator>tom.prichard</dc:creator>
      <dc:date>2021-03-09T17:44:11Z</dc:date>
    </item>
  </channel>
</rss>

