Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

formatting code to not go to next line.

4 REPLIES 4
Reply
Message 1 of 5
eric.smyth
251 Views, 4 Replies

formatting code to not go to next line.

I have found a code to automatically enter information to my detail view label. It works great. I am just having trouble finding the right code format so the values do not go to the next line. the detail on the left is what is desired. the detail on the right is what the code currently does.  What do I need to keep those values on the same line?

Labels (1)
4 REPLIES 4
Message 2 of 5
WCrihfield
in reply to: eric.smyth

Hi @eric.smyth.  This looks to me like a simple TextBox boundary not updating its size to fit its contents, and therefore is causing the text to wrap to the next line.  To test this theory, if you double click on the view label on the right, to bring up the Format Text dialog, then enter a single space in there somewhere, then delete that space, then click the OK button to accept the change, and close the dialog box, does that cause the contents to show up correctly?  If so, you may be able to simulate that same type of action to get it to update by code.  The DrawingView.Label (a DrawingViewLabel type object), does not have any built-in method for causing it to resize itself.  So, you may just need to adjust something about its contents after the fact, to get it to update its bounding box, to fit its new contents.  You could try changing its DrawingViewLabel.HorizontalJustification to a different variation of the HorizontalTextAlignmentEnum, then back again, and see if that works.  If not, you could try adjusting some other propery value momentarily, then setting it back.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 5

Hi @eric.smyth,

 

in the formatted text this creates a break:

<Br/>

 I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

Message 4 of 5
WCrihfield
in reply to: eric.smyth

Now that I look at it again and think about how it is laid out on the right, I believe those "[" & "]" type characters may have special meaning in XML.  You may have to either use double quotation marks ("""") around both of those characters, or use a different means of conveying those special characters within that text. 

https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references 

https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents 

https://www.w3schools.com/XML/xml_syntax.asp 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 5
eric.smyth
in reply to: eric.smyth

probably should have added a piece of the code.

 

 

 

oLargediastring = "<Br/><StyleOverride FontSize='0.317'>LARGE DIA. INISDE = Ø</StyleOverride> " & oLargedia & "[" & oLargediamm & "]"
oSmalldiastring = "<Br/><StyleOverride FontSize='0.317'>SMALL DIA. INISDE = Ø</StyleOverride> " & oSmalldia & "[" & oSmalldiamm & "]"
oInsideheightstring = "<Br/><StyleOverride FontSize='0.317'>INISDE HEIGHT = </StyleOverride> " & oInsideheight & "[" & oInsideheightmm & "]"
oCompletecone = "<Br/><StyleOverride FontSize='0.317'>(2) REQ'D FOR COMPLETE CONE</StyleOverride> "

'add to the view label
oView.Label.FormattedText = "<StyleOverride Underline='True'>DETAIL ITEM#</StyleOverride> " & oDescription & oStringScale & oCompletecone & oLargediastring & oSmalldiastring & oInsideheightstring

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report