<?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: Replace MASS\P1; with MASS\P2; in title block field text - DWG Physical Properties in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-mass-p1-with-mass-p2-in-title-block-field-text-dwg/m-p/10630397#M129066</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7024076"&gt;@dg8MW9N&lt;/a&gt;.&amp;nbsp; This is some pretty tricky/complicated business, but I think I may have something here that might work for you.&amp;nbsp; It gets the 'active' drawing document, the 'active' sheet, then the title block definition of the current title block on that sheet, then gets its sketch.&amp;nbsp; Then it starts looping through each TextBox within that sketch, looking for one that contains the necessary 'FormattedText' contents for the Mass physical property.&amp;nbsp; Here is the &lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-915B75BA-4696-4fc7-A2C6-54B2BACDE7E1" target="_blank" rel="noopener"&gt;online help page for dealing with FormattedText&lt;/A&gt;.&amp;nbsp; If it finds one, it then tries to replace the current 'Precision' part with the other 'toggled' value.&amp;nbsp; When done, it saves the modified sketch back over the definition, updating the current title block.&lt;/P&gt;
&lt;P&gt;Give this iLogic rule a try.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("A Drawing Document must be active for this rule to work. Exiting.",vbCritical, "WRONG DOCUMENT TYPE")
	Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDDoc.ActiveSheet
If oSheet.TitleBlock Is Nothing Then Exit Sub
Dim oTBDef As TitleBlockDefinition = oSheet.TitleBlock.Definition
Dim oSketch As DrawingSketch
oTBDef.Edit(oSketch)
If oSketch.TextBoxes.Count = 0 Then Exit Sub
For Each oTBox As Inventor.TextBox In oSketch.TextBoxes
	Dim oFT As String = oTBox.FormattedText
	Dim oParts
	'if 1 decimal place, then toggle to 2
	If oFT.Contains("&amp;lt;PhysicalProperty PhysicalPropertyID='72449' Precision='1'&amp;gt;") Then
		oTBox.FormattedText = Replace(oFT, "Precision='1'&amp;gt;", "Precision='2'&amp;gt;")
	ElseIf oFT.Contains("&amp;lt;PhysicalProperty PhysicalPropertyID='kPhysicalModelMass' Precision='1'&amp;gt;") Then
		oTBox.FormattedText = Replace(oFT, "Precision='1'&amp;gt;", "Precision='2'&amp;gt;")
	'If 2 decimal places, then toggle to 1
	ElseIf oFT.Contains("&amp;lt;PhysicalProperty PhysicalPropertyID='72449' Precision='2'&amp;gt;") Then
		oTBox.FormattedText = Replace(oFT, "Precision='2'&amp;gt;", "Precision='1'&amp;gt;")
	ElseIf oFT.Contains("&amp;lt;PhysicalProperty PhysicalPropertyID='kPhysicalModelMass' Precision='2'&amp;gt;") Then
		oTBox.FormattedText = Replace(oFT, "Precision='2'&amp;gt;", "Precision='1'&amp;gt;")
	End If
Next
oTBDef.ExitEdit(True)&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&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;SPAN&gt;&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;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;If you want and have time, I would appreciate your Vote(s) for &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank"&gt;My IDEAS &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B166FEBB95D67CFA84899D32D8E17FC1/emoticons/1f4a1.png" alt=":light_bulb:" title=":light_bulb:" /&gt;&lt;/SPAN&gt;&lt;/A&gt;or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 17 Sep 2021 18:56:00 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2021-09-17T18:56:00Z</dc:date>
    <item>
      <title>Replace MASS\P1; with MASS\P2; in title block field text - DWG Physical Properties</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-mass-p1-with-mass-p2-in-title-block-field-text-dwg/m-p/10629531#M129036</link>
      <description>&lt;P&gt;Is there a way to replace the physical properties precision in the title block of a drawing using iLogic?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dg8MW9N_0-1631882487333.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/966483iFE826FA0161D96BE/image-size/large?v=v2&amp;amp;px=999" role="button" title="dg8MW9N_0-1631882487333.png" alt="dg8MW9N_0-1631882487333.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I know I can create a custom property to adjust the accuracy, but I only want to change the precision in the title block.&lt;/P&gt;&lt;P&gt;Simply, replace MASS\P1; with MASS\P2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have searched the forums and haven't found the solution to the mass precision.&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/ilogic-insert-text-parameter-into-a-text-field/m-p/9730434" target="_blank"&gt;Solved: iLogic Insert Text Parameter into a Text Field - Autodesk Community - Inventor&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/change-titleblock-textfields-with-ilogic/td-p/9676622" target="_blank"&gt;Fixed: Change Titleblock Textfields with iLogic - Autodesk Community - Inventor&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks to anyone who can help.&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5330176"&gt;@JhoelForshav&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_Waguespack&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2021 12:53:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-mass-p1-with-mass-p2-in-title-block-field-text-dwg/m-p/10629531#M129036</guid>
      <dc:creator>dg8MW9N</dc:creator>
      <dc:date>2021-09-17T12:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: Replace MASS\P1; with MASS\P2; in title block field text - DWG Physical Properties</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-mass-p1-with-mass-p2-in-title-block-field-text-dwg/m-p/10630397#M129066</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7024076"&gt;@dg8MW9N&lt;/a&gt;.&amp;nbsp; This is some pretty tricky/complicated business, but I think I may have something here that might work for you.&amp;nbsp; It gets the 'active' drawing document, the 'active' sheet, then the title block definition of the current title block on that sheet, then gets its sketch.&amp;nbsp; Then it starts looping through each TextBox within that sketch, looking for one that contains the necessary 'FormattedText' contents for the Mass physical property.&amp;nbsp; Here is the &lt;A href="https://help.autodesk.com/view/INVNTOR/2021/ENU/?guid=GUID-915B75BA-4696-4fc7-A2C6-54B2BACDE7E1" target="_blank" rel="noopener"&gt;online help page for dealing with FormattedText&lt;/A&gt;.&amp;nbsp; If it finds one, it then tries to replace the current 'Precision' part with the other 'toggled' value.&amp;nbsp; When done, it saves the modified sketch back over the definition, updating the current title block.&lt;/P&gt;
&lt;P&gt;Give this iLogic rule a try.&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;If ThisApplication.ActiveDocumentType &amp;lt;&amp;gt; DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("A Drawing Document must be active for this rule to work. Exiting.",vbCritical, "WRONG DOCUMENT TYPE")
	Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDDoc.ActiveSheet
If oSheet.TitleBlock Is Nothing Then Exit Sub
Dim oTBDef As TitleBlockDefinition = oSheet.TitleBlock.Definition
Dim oSketch As DrawingSketch
oTBDef.Edit(oSketch)
If oSketch.TextBoxes.Count = 0 Then Exit Sub
For Each oTBox As Inventor.TextBox In oSketch.TextBoxes
	Dim oFT As String = oTBox.FormattedText
	Dim oParts
	'if 1 decimal place, then toggle to 2
	If oFT.Contains("&amp;lt;PhysicalProperty PhysicalPropertyID='72449' Precision='1'&amp;gt;") Then
		oTBox.FormattedText = Replace(oFT, "Precision='1'&amp;gt;", "Precision='2'&amp;gt;")
	ElseIf oFT.Contains("&amp;lt;PhysicalProperty PhysicalPropertyID='kPhysicalModelMass' Precision='1'&amp;gt;") Then
		oTBox.FormattedText = Replace(oFT, "Precision='1'&amp;gt;", "Precision='2'&amp;gt;")
	'If 2 decimal places, then toggle to 1
	ElseIf oFT.Contains("&amp;lt;PhysicalProperty PhysicalPropertyID='72449' Precision='2'&amp;gt;") Then
		oTBox.FormattedText = Replace(oFT, "Precision='2'&amp;gt;", "Precision='1'&amp;gt;")
	ElseIf oFT.Contains("&amp;lt;PhysicalProperty PhysicalPropertyID='kPhysicalModelMass' Precision='2'&amp;gt;") Then
		oTBox.FormattedText = Replace(oFT, "Precision='2'&amp;gt;", "Precision='1'&amp;gt;")
	End If
Next
oTBDef.ExitEdit(True)&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN style="background-color: green; color: white;"&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;SPAN&gt;&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;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;If you want and have time, I would appreciate your Vote(s) for &lt;A href="https://forums.autodesk.com/t5/forums/recentpostspage/post-type/message/interaction-style/idea/user-id/7812054/" target="_blank"&gt;My IDEAS &lt;SPAN&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@B166FEBB95D67CFA84899D32D8E17FC1/emoticons/1f4a1.png" alt=":light_bulb:" title=":light_bulb:" /&gt;&lt;/SPAN&gt;&lt;/A&gt;or you can Explore &lt;A href="https://knowledge.autodesk.com/profile/LTSUSR7HXMSAE/articles" target="_blank"&gt;My CONTRIBUTIONS &lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2021 18:56:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-mass-p1-with-mass-p2-in-title-block-field-text-dwg/m-p/10630397#M129066</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2021-09-17T18:56:00Z</dc:date>
    </item>
    <item>
      <title>Re: Replace MASS\P1; with MASS\P2; in title block field text - DWG Physical Properties</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-mass-p1-with-mass-p2-in-title-block-field-text-dwg/m-p/10630408#M129067</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Oh wow! This works perfectly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate the effort, especially since it was so complicated.&lt;/P&gt;&lt;P&gt;Have a great weekend!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Sep 2021 19:04:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/replace-mass-p1-with-mass-p2-in-title-block-field-text-dwg/m-p/10630408#M129067</guid>
      <dc:creator>dg8MW9N</dc:creator>
      <dc:date>2021-09-17T19:04:18Z</dc:date>
    </item>
  </channel>
</rss>

