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: 

Drawing GeneralNote MeasureText

1 REPLY 1
Reply
Message 1 of 2
bLennitz
275 Views, 1 Reply

Drawing GeneralNote MeasureText

I need assistance with portion of drawing routine.  I need to determine size of GeneralNote before placing note to my sheet.  My notes are single or multi-line notes depending on length of note.  I need to determine length to know if note will break to multi-line.  I did not find function in Inventor API to get value.  I cannot place note and move it.  I must know position prior to placing to sheet.

 

I attempted use of .NET function `System.Windows.Forms.TextRenderer.MeasureText()`, but it seems Inventor calculates text size differently.

 

My trials are included;

 

?System.Windows.Forms.TextRenderer.MeasureText("XXXXXX", New System.Drawing.Font("ARIAL", 72))
{Width = 543 Height = 134}
    Empty: {Width = 0 Height = 0}
    Height: 134
    height: 134
    IsEmpty: False
    Width: 543
    width: 543

When I perform math to convert pixels to inches to centimeters I get following
--I divide 120 which is from this.CreateGraphics().DpiX to convert pixels to inches
--I multiply 2.54 to convert inches to centimeters
543 / 120 * 2.54
Width = 11.4935
134 / 120 * 2.54
Height = 2.836333

 

I use same values for my GeneralNote;

 

FormattedText=<StyleOverride Font='Arial' FontSize='2.54'>XXXXXX</StyleOverride>
LineSpacing=1
WidthScale=1
RESULTS...
Height=2.5399999618530273 Width=14.206189155578613

 

As you see there is significant difference in text size calculated via .NET and GeneralNote.  Does any one have an idea?

 

Thank you

1 REPLY 1
Message 2 of 2
bLennitz
in reply to: bLennitz

No input from community.  Can Autodesk employee offer assistance?

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

Post to forums  

Autodesk Design & Make Report