<?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: Why this rule does not to run? in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12168203#M20160</link>
    <description>&lt;P&gt;Here it is to delete custom iprop per document, run as an external rule&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As Document = ThisApplication.ActiveDocument

Dim opropset As Inventor.PropertySet = oDoc.PropertySets.Item(4)
For Each prop As Inventor.Property In opropset
   prop.Delete
Next&lt;/LI-CODE&gt;</description>
    <pubDate>Sun, 13 Aug 2023 19:33:59 GMT</pubDate>
    <dc:creator>A.Acheson</dc:creator>
    <dc:date>2023-08-13T19:33:59Z</dc:date>
    <item>
      <title>Why this rule does not to run?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12166828#M20153</link>
      <description>&lt;P&gt;HI,I don't know how to make this rule work below the code, who can tell me what to do?&lt;/P&gt;&lt;P&gt;Thanks!&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;P&gt;Dim oDoc As Document&lt;BR /&gt;oDoc = ThisApplication.ActiveDocument&lt;BR /&gt;Dim osubdoc As Document&lt;BR /&gt;Dim opropset As Inventor.PropertySet&lt;BR /&gt;Dim icount As Long&lt;BR /&gt;For Each osubdoc In oDoc.AllReferencedDocuments&lt;BR /&gt;opropset = osubdoc.PropertySets.Item(4).Item 'User DefinedProperties&lt;BR /&gt;icount = opropset.Count&lt;BR /&gt;If icount&amp;gt;0 Then&lt;BR /&gt;For i = icount To 1 Step -1&lt;BR /&gt;On Error Resume Next&lt;BR /&gt;opropset.Item(i). Delete&lt;BR /&gt;Err.Clear&lt;BR /&gt;Next&lt;BR /&gt;End If&lt;BR /&gt;Next&lt;/P&gt;</description>
      <pubDate>Sat, 12 Aug 2023 15:37:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12166828#M20153</guid>
      <dc:creator>38620079</dc:creator>
      <dc:date>2023-08-12T15:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Why this rule does not to run?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12167096#M20154</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/13345335"&gt;@38620079&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have incorrectly set the Property Set.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AAcheson_0-1691865700583.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1252580iA6D8C58C9182E295/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AAcheson_0-1691865700583.png" alt="AAcheson_0-1691865700583.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Working code&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument

Dim osubdoc As Document
Dim opropset As Inventor.PropertySet
Dim icount As Long

For Each osubdoc In oDoc.AllReferencedDocuments

	opropset = osubdoc.PropertySets.Item(4) 'User DefinedProperties
	icount = opropset.Count

	If icount&amp;gt;0 Then
	
		For i = icount To 1 Step -1
			On Error Resume Next
			opropset.Item(i).Delete
			Err.Clear
		Next
	End If
Next&lt;/LI-CODE&gt;&lt;P&gt;and here is a shorter version of the same without indexing and with a check for modifiable files ( skip Read only files such as Content center and Library files)&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim oDoc As Document = ThisApplication.ActiveDocument

For Each osubdoc As Document In oDoc.AllReferencedDocuments
	If osubdoc.IsModifiable Then
		Dim opropset As Inventor.PropertySet = osubdoc.PropertySets.Item(4)

		For Each prop As Inventor.Property In opropset
			prop.Delete
		Next
	End If
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Aug 2023 19:22:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12167096#M20154</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-08-12T19:22:14Z</dc:date>
    </item>
    <item>
      <title>Re: Why this rule does not to run?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12167845#M20155</link>
      <description>&lt;P&gt;thank you! but i want to do that&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mmexport1691928662756.png" style="width: 470px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1252688i643AD59DC53F5D85/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mmexport1691928662756.png" alt="mmexport1691928662756.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2023 12:14:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12167845#M20155</guid>
      <dc:creator>38620079</dc:creator>
      <dc:date>2023-08-13T12:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why this rule does not to run?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12167979#M20156</link>
      <description>&lt;P&gt;This screenshot is from VBA object model editor.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AAcheson_0-1691939057566.png" style="width: 317px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1252700i74C228775BE2E2F4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AAcheson_0-1691939057566.png" alt="AAcheson_0-1691939057566.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you using VBA or ilogic\VB.Net launguage?&lt;/P&gt;&lt;P&gt;The code you provide originally is for&amp;nbsp;ilogic\VB.Net launguage and the revised code is written for their also.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2023 15:07:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12167979#M20156</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-08-13T15:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Why this rule does not to run?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12167987#M20157</link>
      <description>&lt;P&gt;is Ok thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mmexport1691939044106.png" style="width: 447px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1252703iC5755FD92D34860B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mmexport1691939044106.png" alt="mmexport1691939044106.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2023 15:11:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12167987#M20157</guid>
      <dc:creator>38620079</dc:creator>
      <dc:date>2023-08-13T15:11:11Z</dc:date>
    </item>
    <item>
      <title>Re: Why this rule does not to run?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12168002#M20158</link>
      <description>&lt;P&gt;Yes this code here will do exactly that, loop over all custom iproperties and delete. If it does not work please provide a screenshot of errorbmessages.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual"&gt;Dim oDoc As Document = ThisApplication.ActiveDocument

For Each osubdoc As Document In oDoc.AllReferencedDocuments
	If osubdoc.IsModifiable Then
		Dim opropset As Inventor.PropertySet = osubdoc.PropertySets.Item(4)

		For Each prop As Inventor.Property In opropset
			prop.Delete
		Next
	End If
Next&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2023 15:27:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12168002#M20158</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-08-13T15:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why this rule does not to run?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12168088#M20159</link>
      <description>&lt;P&gt;I am wrong，I use rules to run in part, not in assembly.&lt;/P&gt;</description>
      <pubDate>Sun, 13 Aug 2023 16:57:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12168088#M20159</guid>
      <dc:creator>38620079</dc:creator>
      <dc:date>2023-08-13T16:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: Why this rule does not to run?</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12168203#M20160</link>
      <description>&lt;P&gt;Here it is to delete custom iprop per document, run as an external rule&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Dim oDoc As Document = ThisApplication.ActiveDocument

Dim opropset As Inventor.PropertySet = oDoc.PropertySets.Item(4)
For Each prop As Inventor.Property In opropset
   prop.Delete
Next&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 13 Aug 2023 19:33:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/why-this-rule-does-not-to-run/m-p/12168203#M20160</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2023-08-13T19:33:59Z</dc:date>
    </item>
  </channel>
</rss>

