<?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: Rule doesn't work for removing extra dimensions in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12284136#M158708</link>
    <description>&lt;P&gt;At first I got these to work and now they are not working.&amp;nbsp; I have the rule placed in the "After Open Document" in the event triggers.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jsternamanLULAE_0-1696423675518.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1275029iFA895F6F6703BF4D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jsternamanLULAE_0-1696423675518.png" alt="jsternamanLULAE_0-1696423675518.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Oct 2023 12:49:00 GMT</pubDate>
    <dc:creator>jsternamanLULAE</dc:creator>
    <dc:date>2023-10-04T12:49:00Z</dc:date>
    <item>
      <title>Rule doesn't work for removing extra dimensions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12274984#M158563</link>
      <description>&lt;P&gt;How do I remove the unwanted dimensions after I shorten my piece on the drawing?&amp;nbsp; When I shorten the part and holes go aways but the dimensions stay and turn magenta.&amp;nbsp; How do I remove the dimensions.&amp;nbsp; The code I have does not work.&amp;nbsp; It works from my local files but not from vault.&lt;/P&gt;&lt;P&gt;This is the error I get when I open drawing from vault...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jsternamanLULAE_0-1695989656138.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1273451i07506F7E76948E0E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jsternamanLULAE_0-1695989656138.png" alt="jsternamanLULAE_0-1695989656138.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is the code that I found that should but does not work...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jsternamanLULAE_1-1695989725126.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1273453i90E488F0882453E8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jsternamanLULAE_1-1695989725126.png" alt="jsternamanLULAE_1-1695989725126.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This the view before....&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jsternamanLULAE_2-1695989879722.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1273455i6CA9958C254501A2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jsternamanLULAE_2-1695989879722.png" alt="jsternamanLULAE_2-1695989879722.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is after and want the dimensions removed before drawing is saved.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jsternamanLULAE_3-1695989928731.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1273456i6217AAA2B091CEC0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jsternamanLULAE_3-1695989928731.png" alt="jsternamanLULAE_3-1695989928731.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 12:19:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12274984#M158563</guid>
      <dc:creator>jsternamanLULAE</dc:creator>
      <dc:date>2023-09-29T12:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Rule doesn't work for removing extra dimensions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12275049#M158564</link>
      <description>&lt;P&gt;What does the second tab of that error message say.&amp;nbsp; The second tab of the error message sometimes contains more useful, and more detailed information about the error, and sometimes that will give us a clue as to where the error happened also.&amp;nbsp; Did running that shown rule on that drawing cause the dimensions to turn magenta, or were the dimensions already magenta before trying to run that rule on that drawing?&amp;nbsp; There is a way to find only the dimensions that are sick like that, and get rid of them.&amp;nbsp; We can check the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DrawingDimension_Attached" target="_blank" rel="noopener"&gt;DrawingDimension.Attached&lt;/A&gt; property, which is a ReadOnly Boolean type value.&amp;nbsp; They provide an &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DrawingDimension_Attached_Sample" target="_blank" rel="noopener"&gt;example VBA macro code&lt;/A&gt; for removing dimensions that are not attached to anything also.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 12:56:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12275049#M158564</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-09-29T12:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Rule doesn't work for removing extra dimensions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12275079#M158565</link>
      <description>&lt;P&gt;This is the second tab...&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jsternamanLULAE_1-1695992244196.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1273469i0E07523B0FA1C118/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jsternamanLULAE_1-1695992244196.png" alt="jsternamanLULAE_1-1695992244196.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Running the rule did not make dimensions magenta.&amp;nbsp; I shortened the part which is remove couple holes.&amp;nbsp; This is what makes the dimensions turn magenta.&amp;nbsp; I need the magenta dimensions to go away.&amp;nbsp; How do I remove the magenta dimensions?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Jeff S.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 13:00:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12275079#M158565</guid>
      <dc:creator>jsternamanLULAE</dc:creator>
      <dc:date>2023-09-29T13:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: Rule doesn't work for removing extra dimensions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12275109#M158566</link>
      <description>&lt;P&gt;OK.&amp;nbsp; That additional error data indicates that the error is happening when it tries to execute the DrawingDimension.Delete method.&amp;nbsp; So, there must be at least one dimension that is giving this routine that problem.&amp;nbsp; My guess is that it might be the first OrdinateDimension shown in the image.&amp;nbsp; I just created a quick drawing view and added an OrdinateDimensionSet to the view, with multiple members.&amp;nbsp; Then I created a quick, simple iLogic rule to loop through all generic DrawingDimensions on the sheet, and delete them.&amp;nbsp; It threw the exact same error.&lt;/P&gt;
&lt;P&gt;You could try this very similar iLogic rule, which includes a Try...Catch block to avoid the potential error, and let the rule continue.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;If ThisDoc.Document.DocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oDDims As DrawingDimensions = oDDoc.ActiveSheet.DrawingDimensions
For Each oDDim As DrawingDimension In oDDims
	If oDDim.Attached = False Then
		Try
			oDDim.Delete
		Catch
		End Try
	End If
Next 'oDDim&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt; ACCEPT SOLUTION &lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 13:12:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12275109#M158566</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-09-29T13:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: Rule doesn't work for removing extra dimensions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12275967#M158588</link>
      <description>&lt;P&gt;Here is one more for pink dimensions&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;'This code deletes unattached dimensions&lt;/SPAN&gt;

    &lt;SPAN&gt;' Set a reference to the active drawing document&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;DrawingDocument&lt;/SPAN&gt;
    &lt;SPAN&gt;oDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt; &lt;SPAN&gt;'ThisServer.ActiveDocument&lt;/SPAN&gt;
    
    &lt;SPAN&gt;' Set a reference to the active sheet&lt;/SPAN&gt;
&lt;SPAN&gt;'    Dim oSheet As Sheet&lt;/SPAN&gt;
    &lt;SPAN&gt;oSheet&lt;/SPAN&gt; = &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveSheet&lt;/SPAN&gt;
    
  
    &lt;SPAN&gt;' Iterate over all dimensions in the drawing&lt;/SPAN&gt;
    &lt;SPAN&gt;' and delete unattached (sick) dimensions.&lt;/SPAN&gt;
    
    &lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oDrawingDim&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oSheet&lt;/SPAN&gt;.&lt;SPAN&gt;DrawingDimensions&lt;/SPAN&gt;
        &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDrawingDim&lt;/SPAN&gt;.&lt;SPAN&gt;Attached&lt;/SPAN&gt; = &lt;SPAN&gt;False&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
            &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;oDrawingDim&lt;/SPAN&gt;.&lt;SPAN&gt;Delete&lt;/SPAN&gt;
        &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
		&lt;SPAN&gt;Next&lt;/SPAN&gt;
&lt;/PRE&gt;</description>
      <pubDate>Fri, 29 Sep 2023 19:20:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12275967#M158588</guid>
      <dc:creator>GosponZ</dc:creator>
      <dc:date>2023-09-29T19:20:59Z</dc:date>
    </item>
    <item>
      <title>Re: Rule doesn't work for removing extra dimensions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12284136#M158708</link>
      <description>&lt;P&gt;At first I got these to work and now they are not working.&amp;nbsp; I have the rule placed in the "After Open Document" in the event triggers.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jsternamanLULAE_0-1696423675518.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1275029iFA895F6F6703BF4D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jsternamanLULAE_0-1696423675518.png" alt="jsternamanLULAE_0-1696423675518.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2023 12:49:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12284136#M158708</guid>
      <dc:creator>jsternamanLULAE</dc:creator>
      <dc:date>2023-10-04T12:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Rule doesn't work for removing extra dimensions</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12289578#M158815</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/14526764"&gt;@jsternamanLULAE&lt;/a&gt;.&amp;nbsp; Is it throwing an error when it does not work?&amp;nbsp; If so, please include what the 'More Info' tab of the error message says.&amp;nbsp; Do you believe it is possible that it is deleting some, but not all of the unattached dimensions?&amp;nbsp; If that is the case, then we may need to either create a more detailed routine that checks what more specific derived type each dimension is, then react appropriately.&amp;nbsp; Or we may need to put that whole loop and delete routine out into a separate Function type routine, so that it can be called multiple times in a loop, until it no longer makes any changes.&amp;nbsp; One of the potential problems is that you are not allowed to delete the first dimension in a set.&amp;nbsp; So if you have any &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-OrdinateDimensionSets" target="_blank" rel="noopener"&gt;OrdinateDimensionSets&lt;/A&gt;, then you can not delete just the first &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-OrdinateDimension" target="_blank" rel="noopener"&gt;OrdinateDimension&lt;/A&gt; from each&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-OrdinateDimensionSet" target="_blank" rel="noopener"&gt;OrdinateDimensionSet&lt;/A&gt;.&amp;nbsp; If you have any &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-BaselineDimensionSets" target="_blank" rel="noopener"&gt;BaseLineDimensionSets&lt;/A&gt;, you can not delete the first dimension from each &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-BaselineDimensionSet" target="_blank" rel="noopener"&gt;BaseLineDimensionSet&lt;/A&gt;, and so on.&amp;nbsp; So, in those cases, if that first dimension in a set is not attached you may have to delete the whole set, instead of just the one dimension.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; Another thing that comes to mind is that the views may have not had time to update before that code ran.&amp;nbsp; What I mean is that views can be forced to update due to changes that happened in the model, and when those changes happen, that may cause some dimensions to no longer be attached.&amp;nbsp; Well, if that updating of the views happens after the rule already ran, the rule would not have known about the dimensions not being attached.&amp;nbsp; I am not sure if the 'after open' event is triggered, running that rule, before the views get updated or not.&amp;nbsp; Just a thought.&amp;nbsp; If you run that rule manually after that point in time, does it work on that drawing then?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2023 14:36:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/rule-doesn-t-work-for-removing-extra-dimensions/m-p/12289578#M158815</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-10-06T14:36:05Z</dc:date>
    </item>
  </channel>
</rss>

