<?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: Replacing text in rules in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/8968581#M105915</link>
    <description>&lt;P&gt;Provide an example of the iLogic code you are trying to replace and what it is being replaced with. Then someone might be able to help.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Aug 2019 18:52:09 GMT</pubDate>
    <dc:creator>pball</dc:creator>
    <dc:date>2019-08-15T18:52:09Z</dc:date>
    <item>
      <title>Replacing text in rules</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/6652925#M105911</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question on Inventor ilogic.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a assembly with about 2000 parts with all parts having ilogic rules. There is common text "H:\CADsupport\Inventor"" in all these part rules and I need to change this text to "ASVICM\Inventor" in all rules of all parts. I can open all parts individually and change the text but it will take huge time.&lt;/P&gt;&lt;P&gt;Is there any way to write a rule to change the text in all rules of all parts?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help will be greatly appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rudresh&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Oct 2016 11:11:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/6652925#M105911</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-10-28T11:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing text in rules</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/6653221#M105912</link>
      <description>&lt;P&gt;The code below loops through every component in the assembly and replaces any text inside of any local ilogic rules. I'm including both vba and ilogic code for this as I work in vba mostly and then port to ilogic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would suggest trying this on a small assembly first to verify it works for you. Also if you use the iLogic code do NOT add and run it as a local rule or it will update itself, so please run it as an external rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps out.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;'iLogic&lt;BR /&gt;Public Sub Main()
    original_text = "test\path"
    replacement_text = "path\real"

    Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument
    
    Call rilogic(oAsmDoc, original_text, replacement_text)
    
    Dim item As Document
    For Each item In oAsmDoc.AllReferencedDocuments
        Call rilogic(item, original_text, replacement_text)
    Next item
    
    MsgBox ("Done")
End Sub

Public Sub rilogic(docfile As Document, str1 as String, str2 as String)
	Try
    	Dim iLogicObject As Object = iLogicVb.Automation
        
    	Dim rules As Object
    	rules = iLogicObject.rules(docfile)

    	If (Not rules Is Nothing) Then
        	Dim rule As Object
        	For Each rule In rules
            	rule.Text = Replace(rule.Text, str1, str2)
        	Next rule
    	End If
	Catch
		'error getting ilogic addin
	End Try
End Sub&lt;/PRE&gt;&lt;PRE&gt;'VBA&lt;BR /&gt;Public Sub ReplaceiLogic()
    original_text = "test\path"
    replacement_text = "path\real"

    Dim oAsmDoc As AssemblyDocument
    Set oAsmDoc = ThisApplication.ActiveDocument
    
    Call rilogic(oAsmDoc, original_text, replacement_text)
    
    Dim item As Document
    For Each item In oAsmDoc.AllReferencedDocuments
        Call rilogic(item, original_text, replacement_text)
    Next item
    
    MsgBox ("Done")
End Sub

Public Sub rilogic(docfile As Document, str1 as string, str2 as string)
    Dim iLogicObject As Object
    On Error GoTo error
    Set iLogicObject = ThisApplication.ApplicationAddIns.ItemById("{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}").Automation
        
    Dim rules As Object
    Set rules = iLogicObject.rules(docfile)

    If (Not rules Is Nothing) Then
        Dim rule As Object
        For Each rule In rules
            rule.Text = Replace(rule.Text, str1, str2)
        Next rule
    End If
    Exit Sub
error:
    'error getting ilogic addin
End Sub&lt;/PRE&gt;</description>
      <pubDate>Fri, 28 Oct 2016 13:39:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/6653221#M105912</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2016-10-28T13:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing text in rules</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/6661828#M105913</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your solution. It worked great.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the ilogic code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for one more help for the same assembly&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to add a parameter to the all rules of all parts of a assembly (of thousand parts)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again thanks for your help&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Rudresh&lt;/P&gt;</description>
      <pubDate>Wed, 02 Nov 2016 09:35:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/6661828#M105913</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-02T09:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing text in rules</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/8968410#M105914</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;its a older post, at least i try to get an answer...&lt;/P&gt;&lt;P&gt;iam working on this and i cannot make it happen to replace existing text if there are more lines.&lt;/P&gt;&lt;P&gt;Iam able to have multiple lines in the Replacement-text by using&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;amp; Chr(10) &amp;amp;&lt;/PRE&gt;&lt;P&gt;at the end of the line.&lt;/P&gt;&lt;P&gt;But if I use that in the original_text field it is not working, any idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jonathan&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 17:22:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/8968410#M105914</guid>
      <dc:creator>Jonathanspies</dc:creator>
      <dc:date>2019-08-15T17:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing text in rules</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/8968581#M105915</link>
      <description>&lt;P&gt;Provide an example of the iLogic code you are trying to replace and what it is being replaced with. Then someone might be able to help.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 18:52:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/8968581#M105915</guid>
      <dc:creator>pball</dc:creator>
      <dc:date>2019-08-15T18:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing text in rules</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/8968646#M105916</link>
      <description>&lt;P&gt;Finally I found another solution, with this rule I can just replace the full content of the Rule, basiclly I overwrite the internal rule, using an external rule. Using&amp;nbsp;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; for the different " and&amp;nbsp;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; for next line.&lt;/P&gt;&lt;P&gt;It works perfect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Before that I wanted to use the rule from Above to replace for example this text:&lt;/P&gt;&lt;P&gt;'DisplayName&lt;BR /&gt;ThisDoc.Document.DisplayName= iProperties.Value("Custom", "Title-EN CAD")&lt;/P&gt;&lt;P&gt;with this text:&lt;/P&gt;&lt;P&gt;'Removed function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to replace on line with multiple lines but iam not able to find/locate a text with multiple lines and replace it with only one line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my rule to write or overwrite an internal rule, using an external rule.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;() 
&lt;SPAN&gt;'CreateRule(ByVal RuleName As String)	&lt;/SPAN&gt;
&lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; = &lt;SPAN&gt;kPartDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
	&lt;SPAN&gt;RuleName&lt;/SPAN&gt; = &lt;SPAN&gt;"Rule-Trigger"&lt;/SPAN&gt;
&lt;SPAN&gt;Else&lt;/SPAN&gt;
	&lt;SPAN&gt;RuleName&lt;/SPAN&gt; = &lt;SPAN&gt;"Rule-iTrigger0"&lt;/SPAN&gt;
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;i&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Object&lt;/SPAN&gt;
    &lt;SPAN&gt;i&lt;/SPAN&gt; = &lt;SPAN&gt;GetiLogicAddin&lt;/SPAN&gt;(&lt;SPAN&gt;ThisApplication&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;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;
     &lt;SPAN&gt;oDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
    
    &lt;SPAN&gt;'we will create a rule in the current document, that has a name, but doesn't have any text&lt;/SPAN&gt;
    &lt;SPAN&gt;'this way the rule will fire with nothing to do, meaning that it does nothing&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;exRule&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Object&lt;/SPAN&gt;
    
    &lt;SPAN&gt;'i will try and open that rule to see if it exists, if it does, then we will overwrite it&lt;/SPAN&gt;
    &lt;SPAN&gt;On&lt;/SPAN&gt; &lt;SPAN&gt;Error&lt;/SPAN&gt; &lt;SPAN&gt;Resume&lt;/SPAN&gt; &lt;SPAN&gt;Next&lt;/SPAN&gt;
   	&lt;SPAN&gt;exRule&lt;/SPAN&gt; = &lt;SPAN&gt;i&lt;/SPAN&gt;.&lt;SPAN&gt;GetRule&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;, &lt;SPAN&gt;RuleName&lt;/SPAN&gt;)
    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;exRule&lt;/SPAN&gt; &lt;SPAN&gt;Is&lt;/SPAN&gt; &lt;SPAN&gt;Nothing&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
        &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;i&lt;/SPAN&gt;.&lt;SPAN&gt;AddRule&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;, &lt;SPAN&gt;RuleName&lt;/SPAN&gt;, &lt;SPAN&gt;""&lt;/SPAN&gt;)
        &lt;SPAN&gt;exRule&lt;/SPAN&gt; = &lt;SPAN&gt;i&lt;/SPAN&gt;.&lt;SPAN&gt;GetRule&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;, &lt;SPAN&gt;RuleName&lt;/SPAN&gt;)
    &lt;SPAN&gt;Else&lt;/SPAN&gt;
        &lt;SPAN&gt;exRule&lt;/SPAN&gt;.&lt;SPAN&gt;Text&lt;/SPAN&gt; = &lt;SPAN&gt;""&lt;/SPAN&gt;
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

    &lt;SPAN&gt;'now create the rule text, be careful here with double quotes and line breaks that you use the correct chr()&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;ruleText&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;ThisDoc&lt;/SPAN&gt;.&lt;SPAN&gt;Document&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; = &lt;SPAN&gt;kDrawingDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
		&lt;SPAN&gt;ruleText&lt;/SPAN&gt; = 	&lt;SPAN&gt;"iTrigger = iTrigger0"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"FILEPATH_RULES = "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"C:\Vault_WORK\TC_VAULT\Templates\Rules\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;""&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"If System.IO.File.Exists(ThisDoc.PathAndFileName(True)) Then"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"iLogicForm.ShowGlobal("&lt;/SPAN&gt;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"ENG_Category Type-EN"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;", FormMode.Modal)"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"iProperties.Value("&lt;/SPAN&gt;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"Custom"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;","&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"Category Type-ENG-PRJ"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;") = Parameter("&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"Category_type_ENG_PRJ"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;")"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"If iProperties.Value("&lt;/SPAN&gt;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"Custom"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;","&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"Category Type-ENG-PRJ"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;") = "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"Customer drawing"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"Then"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"iLogicForm.ShowGlobal("&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp;&lt;SPAN&gt;"02_Customer drawing"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;",FormMode.Modal)"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"ElseIf iProperties.Value("&lt;/SPAN&gt;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp;&lt;SPAN&gt;"Custom"&lt;/SPAN&gt;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp;&lt;SPAN&gt;","&lt;/SPAN&gt;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"Category Type-ENG-PRJ"&lt;/SPAN&gt;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp;&lt;SPAN&gt;") = "&lt;/SPAN&gt;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp;&lt;SPAN&gt;"Internal drawing"&lt;/SPAN&gt;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp;&lt;SPAN&gt;"Then"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"iLogicForm.ShowGlobal("&lt;/SPAN&gt;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp;&lt;SPAN&gt;"01_Internal Drawing"&lt;/SPAN&gt;&amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp;&lt;SPAN&gt;", FormMode.Modal)"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"Else"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"End If"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"iLogicVb.RunExternalRule(FILEPATH_RULES + "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"02_BeforeSave_MustProperties"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;")"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"Else"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"MessageBox.Show("&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"Please save the File first!"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;","&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"Title"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;")"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"End If"&lt;/SPAN&gt;
	&lt;SPAN&gt;Else&lt;/SPAN&gt;
		&lt;SPAN&gt;ruleText&lt;/SPAN&gt; = 	&lt;SPAN&gt;"iTrigger = iTrigger0"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"FILEPATH_RULES = "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"C:\Vault_WORK\TC_VAULT\Templates\Rules\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;""&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
					&lt;SPAN&gt;"iLogicForm.ShowGlobal("&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"01_Internal Drawing"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;", FormMode.Modal)"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(10) &amp;amp; _
	                &lt;SPAN&gt;"iLogicVb.RunExternalRule(FILEPATH_RULES + "&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;"02_BeforeSave_MustProperties"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;Chr&lt;/SPAN&gt;(34) &amp;amp; &lt;SPAN&gt;")"&lt;/SPAN&gt;	
	&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;
    &lt;SPAN&gt;'now we can assign the users rule text to that rule, without it actually running&lt;/SPAN&gt;
    &lt;SPAN&gt;exRule&lt;/SPAN&gt;.&lt;SPAN&gt;Text&lt;/SPAN&gt; = &lt;SPAN&gt;ruleText&lt;/SPAN&gt;
    &lt;SPAN&gt;Debug&lt;/SPAN&gt;.&lt;SPAN&gt;Print&lt;/SPAN&gt; (&lt;SPAN&gt;exRule&lt;/SPAN&gt;.&lt;SPAN&gt;Text&lt;/SPAN&gt;) 
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;

&lt;SPAN&gt;Function&lt;/SPAN&gt; &lt;SPAN&gt;GetiLogicAddin&lt;/SPAN&gt;(&lt;SPAN&gt;oApplication&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Inventor&lt;/SPAN&gt;.&lt;SPAN&gt;Application&lt;/SPAN&gt;) &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Object&lt;/SPAN&gt;
	&lt;SPAN&gt;addIns&lt;/SPAN&gt; = &lt;SPAN&gt;oApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ApplicationAddIns&lt;/SPAN&gt;
	&lt;SPAN&gt;'Find the add-in you are looking for&lt;/SPAN&gt;
	&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;addIn&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;ApplicationAddIn&lt;/SPAN&gt;
	&lt;SPAN&gt;On&lt;/SPAN&gt; &lt;SPAN&gt;Error&lt;/SPAN&gt; &lt;SPAN&gt;GoTo&lt;/SPAN&gt; &lt;SPAN&gt;NotFound&lt;/SPAN&gt;
	&lt;SPAN&gt;addIn&lt;/SPAN&gt; = &lt;SPAN&gt;oApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ApplicationAddIns&lt;/SPAN&gt;.&lt;SPAN&gt;ItemById&lt;/SPAN&gt;(&lt;SPAN&gt;"{3bdd8d79-2179-4b11-8a5a-257b1c0263ac}"&lt;/SPAN&gt;)
	&lt;SPAN&gt;If&lt;/SPAN&gt; (&lt;SPAN&gt;addIn&lt;/SPAN&gt; &lt;SPAN&gt;Is&lt;/SPAN&gt; &lt;SPAN&gt;Nothing&lt;/SPAN&gt;) &lt;SPAN&gt;Then&lt;/SPAN&gt; &lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Function&lt;/SPAN&gt;
	&lt;SPAN&gt;addIn&lt;/SPAN&gt;.&lt;SPAN&gt;Activate&lt;/SPAN&gt;
	&lt;SPAN&gt;GetiLogicAddin&lt;/SPAN&gt; = &lt;SPAN&gt;addIn&lt;/SPAN&gt;.&lt;SPAN&gt;Automation&lt;/SPAN&gt;
	&lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Function&lt;/SPAN&gt;
	&lt;SPAN&gt;NotFound&lt;/SPAN&gt;:
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Function&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 19:23:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/8968646#M105916</guid>
      <dc:creator>Jonathanspies</dc:creator>
      <dc:date>2019-08-15T19:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Replacing text in rules</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/11775580#M105917</link>
      <description>&lt;P&gt;can you help me or give a code ilogic rule to repalce the particular text inside ilogic rule in part file indiviually&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ASTM A-36 OR EQUIVALENT to&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;SPAN&gt;ASTM A36 OR EQUIVALENT&lt;/SPAN&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Feb 2023 11:19:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/replacing-text-in-rules/m-p/11775580#M105917</guid>
      <dc:creator>lohithna</dc:creator>
      <dc:date>2023-02-23T11:19:49Z</dc:date>
    </item>
  </channel>
</rss>

