Code to delete <SCALE> from Edit View Label

Code to delete <SCALE> from Edit View Label

Anonymous
Not applicable
809 Views
4 Replies
Message 1 of 5

Code to delete <SCALE> from Edit View Label

Anonymous
Not applicable

Hi all,

 

I would like to delete Scale from all views on my sheet. Now I have to erase it manually and it takes a lot of time as I have to do this on hundreds of drawings. 

 

Any way to do this in iLogic? I found a thread with something similar, however I'm new to iLogic and could not find a way to edit the code to make it work for deleting Scale. 

 

https://forums.autodesk.com/t5/inventor-customization/custom-user-properties-in-view-label-of-drawin...

 

 

Thanks. 

0 Likes
Accepted solutions (2)
810 Views
4 Replies
Replies (4)
Message 2 of 5

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @Anonymous 

Try running this rule in your drawing 🙂

For Each oSheet As Sheet In ThisDrawing.Document.Sheets
	For Each oView As DrawingView In oSheet.DrawingViews
		oView.Label.FormattedText = oView.Label.FormattedText.Replace("<DrawingViewScale/>", "")
	Next
Next
Message 3 of 5

Anonymous
Not applicable

Works perfectly!

 

However I forgot to mention that I also want to delete the parentheses before and after SCLAE. Format text now look like this: <VIEW>-<VIEW> ( <SCALE> )

 

I guess this is a simple fix but I'm not familiar with this coding language. 

0 Likes
Message 4 of 5

JhoelForshav
Mentor
Mentor
Accepted solution

Anyone of these options should work then 🙂

For Each oSheet As Sheet In ThisDrawing.Document.Sheets
	For Each oView As DrawingView In oSheet.DrawingViews
		oView.Label.FormattedText = oView.Label.FormattedText.Replace("<DrawingViewScale/>", "").Replace("(", "").Replace(")", "")
	Next
Next

Or

For Each oSheet As Sheet In ThisDrawing.Document.Sheets
	For Each oView As DrawingView In oSheet.DrawingViews
		oView.Label.FormattedText = "<DrawingViewName/>-<DrawingViewName/>"
	Next
Next
Message 5 of 5

Anonymous
Not applicable

Thanks!!

0 Likes