Changing the View Label font size with I logic

Changing the View Label font size with I logic

Jorrit086
Observer Observer
438 Views
6 Replies
Message 1 of 7

Changing the View Label font size with I logic

Jorrit086
Observer
Observer

We are using drawings with multiple views as cut sheets. After scaling the components to fith in the sheet size with I logic we would like to change the font height of the label text for all views from 3,5 to 2,5 without loosing the linked parameters in the view label. Is there an easy I logic solution?

 

thanks in advance.

0 Likes
439 Views
6 Replies
Replies (6)
Message 2 of 7

Sergio.D.Suárez
Mentor
Mentor

Yes it is possible, but to do this you have to know the structure of the text box
This is in DrawingView.Label.FormattedText

 

If possible, share a sample file where I could help you, you only need the text box and see its structure


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

Message 3 of 7

WCrihfield
Mentor
Mentor

Hi @Jorrit086.  Have you tried setting a different value to the DrawingViewLabel.TextStyle property yet?  If not, then to try that, first get a reference to the DrawingView object, then to its DrawingViewLabel through the DrawingView.Label property.  But before you can set a new value to its TextStyle property, you will need to get a reference to the TextStyle object that you want to set as its new value.  If one does not already exist the way you want it, then you will have to make one (either manually, or by code) first.  If it already exists, you can get it through the DrawingDocument.StylesManager.TextStyles collection.  If one does not exist the way you want it, and you want to create one by code, then you can copy an existing TextStyle object to create a new one, then change its properties the way you want, then use that one.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 7

Jorrit086
Observer
Observer

Please find the text box below

 

Jorrit086_1-1711022802073.png

 

 

0 Likes
Message 5 of 7

Sergio.D.Suárez
Mentor
Mentor

Try the following code. At the beginning of the code you can place the font you need, the height and whether it is bolt or not.
Generally the content of the text tends to seem confusing, I have tried to adjust it to make it understandable. The properties are from the view model, I hope they are correct.
I hope this helps in your work

 

Dim oFSize As Double = 0.6
'"Times New Roman" "Technic" "Tahoma" "TechnicBolt"
Dim oFont As String = "Times New Roman" 
Dim oBolt As String = "False" '"True"


Dim oDraw As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDraw.ActiveSheet
Dim oView As DrawingView = oSheet.DrawingViews(1)

Dim oFontText As String = "<StyleOverride Font='" & oFont & "' FontSize='" & oFSize & "' Bold='" & oBolt & "'>"
Dim oText As String = "Pos: <Property Document='model' PropertySet='Inventor Summary Information' Property='Comments' FormatID='{F29F85E0-4FF9-1068-AB91-08002B27B3D9}' PropertyID='6'>COMMENTS</Property><Br/>Material: <Property Document='model' PropertySet='Design Tracking Properties' Property='Material' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='20'>MATERIAL</Property> <Property Document='model' PropertySet='Design Tracking Properties' Property='Catalog Web Link' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='23'>WEBLINK</Property><Br/>Thickness: <Property Document='model' PropertySet='Design Tracking Properties' Property='Vendor' FormatID='{32853F0F-3444-11D1-9E93-0060B03C1CA6}' PropertyID='30'>VENDOR</Property><Br/>Qty: <Property Document='model' PropertySet='Inventor Document Summary Information' Property='Company' FormatID='{D5CDD502-2E9C-101B-9397-08002B2CF9AE}' PropertyID='15'>COMPANY</Property>"
oView.Label.FormattedText = oFontText & oText & "</StyleOverride>"

 


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes
Message 6 of 7

Jorrit086
Observer
Observer

Unfortunately nothing happened to the size of the label text when i use your rule. Still i would like to thank you for your cooperation!

 

A collegue from another location had rewrote a rule to solve the issue (the height can be filled in the second last rule before ..../10)

 

Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document
Dim oSheets As Sheets
Dim oViews As DrawingViews
oSheets = oDoc.Sheets
For Each oSheet As Sheet In oSheets
oViews = oSheet.DrawingViews
For Each oView As DrawingView In oViews
oView.ShowLabel = True


Dim sThickness As String = ActiveSheet.View(oView.Name).ModelDocument.PropertySets("Design Tracking Properties")("Vendor").Value
Dim sMaterial As String = ActiveSheet.View(oView.Name).ModelDocument.PropertySets("Design Tracking Properties")("Material").Value
Dim sQTY As String = ActiveSheet.View(oView.Name).ModelDocument.PropertySets("Inventor Document Summary Information")("Company").Value
Dim sDescript As String = ActiveSheet.View(oView.Name).ModelDocument.PropertySets("Inventor Summary Information")("Comments").Value


oView.Label.TextStyle.FontSize = 2.5/10


oView.Label.FormattedText = "Pos: " & sDescript & vbCrLf & "Material: " & sMaterial & vbCrLf & "Thickness: " & sThickness & vbCrLf & "QTY: " & sQTY



Next
Next

 

 

0 Likes
Message 7 of 7

Sergio.D.Suárez
Mentor
Mentor

Don't worry, at some point you will find the solution, here I share the files I tried to try to solve the problem in Inv 2024


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes