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: 

get embossed text lengt

6 REPLIES 6
Reply
Message 1 of 7
GeorgK
313 Views, 6 Replies

get embossed text lengt

Hello together,

 

I try to automatically place and emboss text. How could I calculate the embossed text lengt and the angle?

 

Embossed Text.png

 

Thank you very much

 

Georg

6 REPLIES 6
Message 2 of 7
YuhanZhang
in reply to: GeorgK

I think it depends, the Face the text wrap to and the text orientation both should be considered for calculate the length and angle.  For the sample in your picture, the emboss is on a cylinder face, and the text is a normal text(not the geometry text) I think you can just create a sketch on the end face of the cylinder, and project the emboss edges onto the sketch, and then you can easily create a circular arc which use the center of the cylinder end face and the projected farmost points and then create a arc length dimension, like below picture shows:

Emboxx.png

But for other situation I think you need to calculate it case by case. Hope this helps.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 3 of 7
GeorgK
in reply to: YuhanZhang

@YuhanZhangThank you. That doesn't sound quite easy.

Message 4 of 7
YuhanZhang
in reply to: GeorgK

Not easy I think, multiple cases should be considered, like the Face type(planar, cylindrical, conical), and also the text orientation all should be considered, also I think you should just consider the general Text but not the Geometry Text.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 5 of 7
GeorgK
in reply to: YuhanZhang

@YuhanZhang  Is there a possibility to calculate only the text length?

 

This does not work:

Dim text1 As String = "Measure this text"
        Dim arialBold As New Font("Arial", 12.0F)

        Dim s As Size = TextRenderer.MeasureText(text1, arialBold)

        Dim bmp As New Bitmap(s.Width, s.Height)
        Dim WidthMM As Decimal = ((s.Width * 25.4) / bmp.HorizontalResolution)
        Dim WidthCM As Decimal = WidthMM / 10
        Dim WidthInch As Decimal = WidthMM / 25.4

        MsgBox("Text Width: " & s.Width & " Pixels" & vbCrLf &
                    "Text Width: " & WidthMM & " mm" & vbCrLf &
                    "Text Width: " & WidthCM & " cm" & vbCrLf &
                    "Text Width: " & WidthInch & " Inches")
Message 6 of 7
YuhanZhang
in reply to: GeorgK

The TextBox itself has the properties(Height/Width and RangeBox) to return the size of the text, but this only works when the TextBox.Fitted returns True. I have not investigated TextRenderer, but if you currently can make the TextBox as fitted I think you can get its size as expected, otherwise you can log to IdeaStation about to expose new API to make a TextBox fitted.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 7 of 7
YuhanZhang
in reply to: YuhanZhang

Just recalled that we already have the TextBox.FittedTextHeight and FittedTextWidth exposed, so you can get the text size using these two properties. Hope this helps.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report