View Label Text Height update

View Label Text Height update

anandaraj.ganesanGP4H9
Participant Participant
1,010 Views
8 Replies
Message 1 of 9

View Label Text Height update

anandaraj.ganesanGP4H9
Participant
Participant

Hello Everyone,

 

I'm doing a repetitive task that is to change the view label text height from value x.xxxin to 0.188 in. Tentatively I have to edit 4 or 5 view labels per sheet to modify the text height (one .idw may contain multiple sheets). I'm doing this task by editing the view label and changing the height one by one in a text editor. Can anyone suggest to me a ilogic code that can help me? I would appreciate 

0 Likes
1,011 Views
8 Replies
Replies (8)
Message 3 of 9

anandaraj.ganesanGP4H9
Participant
Participant

Thank you for your reply @Gabriel_Watson,

 

It is hard for me to formulate a workable code since I'm new to programming and macro.

 

I would need a code that can modify the available text height alone in the selected view label. All your reference links are for new properties added to the view labels and other related things. 

 

(E.g. The existing available text in the view label is "FRONT VIEW" with a text height of 0.197. I need to change the text height from 0.197 to 0.188).

 

 

 

0 Likes
Message 4 of 9

mcgyvr
Consultant
Consultant

@anandaraj.ganesanGP4H9  Try this..

This will set the view label of each view on each sheet to "Front View" and make the font height .187"

 

oFSize = 0.47498 'font size in cm
oNewLabel = "<StyleOverride FontSize='" & oFSize & "'>FRONT VIEW </StyleOverride>"

Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView

oSheets = ThisDoc.Document.Sheets

For Each oSheet In oSheets
	oViews = oSheet.DrawingViews
    	For Each oView In oViews
    		oView.Label.FormattedText = oNewLabel
    	Next
Next


-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 5 of 9

mcgyvr
Consultant
Consultant

And this is more generic.. It just changes the font and can be used with any label text.

 

oFSize = 0.47498 'font size in cm

Dim oSheets As Sheets
Dim oSheet As Sheet
Dim oViews As DrawingViews
Dim oView As DrawingView

oSheets = ThisDoc.Document.Sheets

For Each oSheet In oSheets
	oViews = oSheet.DrawingViews
    	For Each oView In oViews
			oOldLabel = oView.Label.Text
			oView.Label.FormattedText = "<StyleOverride FontSize='" & oFSize & "'>" & oOldLabel & "</StyleOverride>"
    	Next
Next

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 6 of 9

anandaraj.ganesanGP4H9
Participant
Participant

Thanks a lot, @mcgyvr for your support,

 

This macro works great but all the view label values are getting changed and overwritten to nonassociated values (E.g. View label stacked by a Part Number from the model, view scale, view name) These values are overwritten with the same value.

 

It is really helpful if the height alone gets changed.

 

 

 

0 Likes
Message 7 of 9

mcgyvr
Consultant
Consultant

@anandaraj.ganesanGP4H9  Are your view labels always consistent (aka have the same data in them)?

Can you show pictures of how each one is formatted specifically?

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 8 of 9

anandaraj.ganesanGP4H9
Participant
Participant

Each sheet has a Front view, top view, and side.

 

Top view label has only have top view text.

 

Front view has below text view label. Part number value will be called from the model. After the Part number value, some additional text also gets added that is different in sheet by sheet to indicate the variable.

anandarajganesanGP4H9_0-1638804092998.png

 

Side view label has only had Side view text.

 

Section and detail view may get added.

 

Hope this will give more clarity on my need.

 

Thank you.,

0 Likes
Message 9 of 9

A.Acheson
Mentor
Mentor

 

Is this a permanent change in all drawings? If so ideally you would change the view label font style in the style editor and apply this as a global change. How this will update in your existing drawings will depend on which style was being used. You could use some ilogic to update the style also but just hitting the update from style should work. The method being used in the post previously is deleting the view rep and adding a new label. Only items contained in the ilogic code will be added in. Ilogic will work but you really are only changing the local copy and as so the issue will persist in all future drawings should you wish to do a new change. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan