Text stretch with ilogic

Text stretch with ilogic

aurel_e
Collaborator Collaborator
588 Views
8 Replies
Message 1 of 9

Text stretch with ilogic

aurel_e
Collaborator
Collaborator

Hi all,

 

I have a ilogic rule to turn on the view label in a drawing and change it using iproperties.

The rule use the line below to change font type and size:

 

oModelPN="<StyleOverride Font='" & Sfont1 & "' FontSize='0.7'>" & oPropSet(2).Value & "</StyleOverride>"

 

Is there any way to change the text stretch as well?

0 Likes
Accepted solutions (1)
589 Views
8 Replies
Replies (8)
Message 2 of 9

dalton98
Collaborator
Collaborator

Try something like this to change the view label

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView
oView = oSheet.DrawingViews.Item(1)

oView.ShowLabel = True
oView.Label.FormattedText = "<StyleOverride FontSize = '0.9525'>" & "HI" & "</StyleOverride>"
oView.Label.WidthScale = 2 

 

Message 3 of 9

WCrihfield
Mentor
Mentor

Hi @aurel_e.  It looks like you are attempting to manipulate the style of the text showing for a DrawingView.Label (Link1, Link2) by editing its FormattedText.  This is always pretty challenging, because it involves using XML tags, and the documentation for doing  so is pretty brief.  The online help page for editing FormattedText has a small area about the 'Style Override' settings, but it does not list a property for stretching text, just properties for Font, FontSize, Bold, Italic, & Underline.  You could always try formatting the text manually to the way you want it to be, then check that FormattedText content by code afterwards to see how it is done within that code.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 9

aurel_e
Collaborator
Collaborator

Thanks @dalton98 for trying this.

It's a bit more complex though:

In the same view label I would like to have the first line stretched 180% and all the rest normal 100%.

 

See the discussion: https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/qr-code-in-the-view-label/td-p/11191...

0 Likes
Message 5 of 9

WCrihfield
Mentor
Mentor

After posting that, then seeing @dalton98 's updated post content, I realized that in this case the actual DrawingViewLabel object itself as a lot of very useful properties that you could use for manipulating most of its visual aspects.  He already pointed out the most obvious one for WidthScale, which seems to match your inquiry.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 9

aurel_e
Collaborator
Collaborator
Yes but as I said above:
In the same view label I would like to have the first line stretched 180% and all the rest normal 100%.
Is it possible?
0 Likes
Message 7 of 9

WCrihfield
Mentor
Mentor
Accepted solution

I just tried doing what you are talking about manually, using the Format Text dialog,  and could not make that happen, so I'm pretty sure that you could not make it happen by code then.  It wants to apply the stretch value to the whole thing, not just a selected portion of the text.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 8 of 9

WCrihfield
Mentor
Mentor

If this is important, you may have to use the view's label for part of the text, then use a leader note for the rest of the text, then turn the leader visibility off.  I would use the leader text because it can be attached to the view and will move with the view and stay in place.  If done right, it would look like a single note.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 9 of 9

aurel_e
Collaborator
Collaborator

Thanks to both @WCrihfield and @dalton98 

 

At least I know it is not possible in that way.

As a workaround I'm thinking now to use a condensed font for the other lines.

0 Likes