<?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: I-Logic delete iproperties if they contain a text string in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/i-logic-delete-iproperties-if-they-contain-a-text-string/m-p/9332262#M106137</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6396632"&gt;@william&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This should work for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also recall that there is the Inventor Customization forum , where programming questions of this type are better suited:&lt;BR /&gt;&lt;A href="http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120" target="_blank"&gt;http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll ask the moderators to move this to that forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")

Dim searchTerm As String 
searchTerm = "Item"

For Each oProp In oCustomPropertySet
	If oProp.name.Contains(searchTerm) Then 
		MessageBox.Show("We found: " &amp;amp; oProp.name  _
		&amp;amp; vbLf &amp;amp; "Now we're going to delete it!", "iLogic")
		oProp.delete
		
	End If	
Next&lt;/PRE&gt;</description>
    <pubDate>Thu, 20 Feb 2020 23:05:18 GMT</pubDate>
    <dc:creator>Curtis_Waguespack</dc:creator>
    <dc:date>2020-02-20T23:05:18Z</dc:date>
    <item>
      <title>I-Logic delete iproperties if they contain a text string</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/i-logic-delete-iproperties-if-they-contain-a-text-string/m-p/9330099#M106134</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to write some code to look through the custom i-properties and if the name of the i-property contains the search term, then delete it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So far I have got to here...&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;oCustomPropertySet&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;PropertySets&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Inventor User Defined Properties"&lt;/SPAN&gt;)
&lt;SPAN&gt;oCustomPropertyName&lt;/SPAN&gt; = (&lt;SPAN&gt;oCustomPropertySet&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt;)

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;searchTerm&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; 
&lt;SPAN&gt;searchTerm&lt;/SPAN&gt; = &lt;SPAN&gt;"Item"&lt;/SPAN&gt;

&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oCustomPropertyName&lt;/SPAN&gt; &lt;SPAN&gt;in&lt;/SPAN&gt; &lt;SPAN&gt;oCustomPropertySet&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;InStr&lt;/SPAN&gt;(1, &lt;SPAN&gt;oCustomPropertyName&lt;/SPAN&gt;, &lt;SPAN&gt;searchTerm&lt;/SPAN&gt;, &lt;SPAN&gt;CompareMethod&lt;/SPAN&gt;.&lt;SPAN&gt;Text&lt;/SPAN&gt;) &amp;gt;0 &lt;SPAN&gt;Then&lt;/SPAN&gt; 
		&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"We found it"&lt;/SPAN&gt;, &lt;SPAN&gt;"Debug"&lt;/SPAN&gt;)

	&lt;SPAN&gt;Else&lt;/SPAN&gt;
		&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"We didnt find it"&lt;/SPAN&gt;, &lt;SPAN&gt;"Debug"&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error i am getting is "Conversion from type 'Property' to type 'String' is not valid."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What am I doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 07:42:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/i-logic-delete-iproperties-if-they-contain-a-text-string/m-p/9330099#M106134</guid>
      <dc:creator>william</dc:creator>
      <dc:date>2020-02-20T07:42:17Z</dc:date>
    </item>
    <item>
      <title>Re: I-Logic delete iproperties if they contain a text string</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/i-logic-delete-iproperties-if-they-contain-a-text-string/m-p/9332137#M106135</link>
      <description>&lt;P&gt;Hi William,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to take a guess. Probably, you need to declare a String variable to capture "CustomPropertyName" value. It is because "CustomPropertyName" itself isn't a String variable.&lt;/P&gt;
&lt;P&gt;Many thanks!&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 21:58:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/i-logic-delete-iproperties-if-they-contain-a-text-string/m-p/9332137#M106135</guid>
      <dc:creator>johnsonshiue</dc:creator>
      <dc:date>2020-02-20T21:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: I-Logic delete iproperties if they contain a text string</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/i-logic-delete-iproperties-if-they-contain-a-text-string/m-p/9332188#M106136</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/486618"&gt;@johnsonshiue&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have just tried that, I get the same error.&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;oCustomPropertySet&lt;/SPAN&gt; = &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;PropertySets&lt;/SPAN&gt;.&lt;SPAN&gt;Item&lt;/SPAN&gt;(&lt;SPAN&gt;"Inventor User Defined Properties"&lt;/SPAN&gt;)

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCustomPropertyName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; 
&lt;SPAN&gt;oCustomPropertyName&lt;/SPAN&gt; = &lt;SPAN&gt;CStr&lt;/SPAN&gt;(&lt;SPAN&gt;oCustomPropertySet&lt;/SPAN&gt;.&lt;SPAN&gt;Name&lt;/SPAN&gt;)

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;searchTerm&lt;/SPAN&gt; &lt;SPAN&gt;as&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt; 
&lt;SPAN&gt;searchTerm&lt;/SPAN&gt; = &lt;SPAN&gt;"Item"&lt;/SPAN&gt;

&lt;SPAN&gt;For&lt;/SPAN&gt; &lt;SPAN&gt;Each&lt;/SPAN&gt; &lt;SPAN&gt;oCustomPropertyName&lt;/SPAN&gt; &lt;SPAN&gt;In&lt;/SPAN&gt; &lt;SPAN&gt;oCustomPropertySet&lt;/SPAN&gt;
	&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;InStr&lt;/SPAN&gt;(1, &lt;SPAN&gt;oCustomPropertyName&lt;/SPAN&gt;, &lt;SPAN&gt;searchTerm&lt;/SPAN&gt;, &lt;SPAN&gt;CompareMethod&lt;/SPAN&gt;.&lt;SPAN&gt;Text&lt;/SPAN&gt;) &amp;gt;0 &lt;SPAN&gt;Then&lt;/SPAN&gt; 
		&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"We found it"&lt;/SPAN&gt;, &lt;SPAN&gt;"Debug"&lt;/SPAN&gt;)

	&lt;SPAN&gt;Else&lt;/SPAN&gt;
		&lt;SPAN&gt;MessageBox&lt;/SPAN&gt;.&lt;SPAN&gt;Show&lt;/SPAN&gt;(&lt;SPAN&gt;"We didnt find it"&lt;/SPAN&gt;, &lt;SPAN&gt;"Debug"&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;&lt;P&gt;Is the InStr command the best way of going about this? I originally took&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt;&amp;nbsp;code from an earlier post (&lt;A href="https://forums.autodesk.com/t5/inventor-forum/how-to-remove-custom-iproperty-with-ilogic/td-p/4364060" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-forum/how-to-remove-custom-iproperty-with-ilogic/td-p/4364060&lt;/A&gt;)&amp;nbsp;&lt;/P&gt;&lt;P&gt;but the ".contains" method doesnt seem to work if the search term is inside the string, eg. it will not pick up that "Item" is contained inside "Item8_Code"&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so I found another post that I though would be applicable (&lt;A href="https://forums.autodesk.com/t5/inventor-customization/code-vb-for-if-quot-value-quot-contains-quot-texta-quot-then/td-p/5662423" target="_blank"&gt;https://forums.autodesk.com/t5/inventor-customization/code-vb-for-if-quot-value-quot-contains-quot-texta-quot-then/td-p/5662423&lt;/A&gt;)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 22:26:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/i-logic-delete-iproperties-if-they-contain-a-text-string/m-p/9332188#M106136</guid>
      <dc:creator>william</dc:creator>
      <dc:date>2020-02-20T22:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: I-Logic delete iproperties if they contain a text string</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/i-logic-delete-iproperties-if-they-contain-a-text-string/m-p/9332262#M106137</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6396632"&gt;@william&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This should work for you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also recall that there is the Inventor Customization forum , where programming questions of this type are better suited:&lt;BR /&gt;&lt;A href="http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120" target="_blank"&gt;http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll ask the moderators to move this to that forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;BR /&gt;Best of luck to you in all of your Inventor pursuits,&lt;BR /&gt;Curtis&lt;BR /&gt;&lt;A href="http://inventortrenches.blogspot.com" target="_blank"&gt;http://inventortrenches.blogspot.com&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")

Dim searchTerm As String 
searchTerm = "Item"

For Each oProp In oCustomPropertySet
	If oProp.name.Contains(searchTerm) Then 
		MessageBox.Show("We found: " &amp;amp; oProp.name  _
		&amp;amp; vbLf &amp;amp; "Now we're going to delete it!", "iLogic")
		oProp.delete
		
	End If	
Next&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Feb 2020 23:05:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/i-logic-delete-iproperties-if-they-contain-a-text-string/m-p/9332262#M106137</guid>
      <dc:creator>Curtis_Waguespack</dc:creator>
      <dc:date>2020-02-20T23:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: I-Logic delete iproperties if they contain a text string</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/i-logic-delete-iproperties-if-they-contain-a-text-string/m-p/9332283#M106138</link>
      <description>&lt;P&gt;many thanks. That works great&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2020 23:16:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/i-logic-delete-iproperties-if-they-contain-a-text-string/m-p/9332283#M106138</guid>
      <dc:creator>william</dc:creator>
      <dc:date>2020-02-20T23:16:12Z</dc:date>
    </item>
  </channel>
</rss>

