Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Stringlengt of text?

17 REPLIES 17
Reply
Message 1 of 18
Anonymous
170 Views, 17 Replies

Stringlengt of text?

How can i determine (calculate) how much space a string is gonna take up as
text in a drawing?
So i mean before it is text.

Regards,

Paul
17 REPLIES 17
Message 2 of 18
Anonymous
in reply to: Anonymous

If you mean the length in drawing units ...
(caadr (textbox (list (cons 40 txth)(cons 1 txtv)(cons 41 txtw)(cons 7
txts))))
where txth=height, txtv=value, txtw=width factor, txts=style

Mark


"Paul" wrote in message
news:68EB715F22A2428FB35DBFBE9B11F8D5@in.WebX.maYIadrTaRb...
> How can i determine (calculate) how much space a string is gonna take up
as
> text in a drawing?
> So i mean before it is text.
>
> Regards,
>
> Paul
>
>
Message 3 of 18
Anonymous
in reply to: Anonymous

Paul,

If you use a monospaced font that you know the spacing, you can be fairly
accurate using the technique Mark suggested. However, in a proportional
spaced font, letters vary in width with each character. "W" is wider than
"H" which is wider than "I".

They do tend to average out. It all depends on how accurate you need to
e. -David


"Paul" wrote in message
news:68EB715F22A2428FB35DBFBE9B11F8D5@in.WebX.maYIadrTaRb...
> How can i determine (calculate) how much space a string is gonna take up
as
> text in a drawing?
> So i mean before it is text.
>
> Regards,
>
> Paul
>
>
Message 4 of 18
Anonymous
in reply to: Anonymous

In your sugestion i already have text. That isn't wat i meant. I nead to
calculate the space it's gonna take up before it is text


Mark schreef in berichtnieuws
4605482049A8B18474C77B2A65BB9B1A@in.WebX.maYIadrTaRb...
> If you mean the length in drawing units ...
> (caadr (textbox (list (cons 40 txth)(cons 1 txtv)(cons 41 txtw)(cons 7
> txts))))
> where txth=height, txtv=value, txtw=width factor, txts=style
>
> Mark
>
>
> "Paul" wrote in message
> news:68EB715F22A2428FB35DBFBE9B11F8D5@in.WebX.maYIadrTaRb...
> > How can i determine (calculate) how much space a string is gonna take up
> as
> > text in a drawing?
> > So i mean before it is text.
> >
> > Regards,
> >
> > Paul
> >
> >
>
>
Message 5 of 18
Anonymous
in reply to: Anonymous

I know that they all have different width, therfore i need a way to
calculate the total width.

David Bethel schreef in berichtnieuws
94A2E30B7B9949F78350E38448AB732E@in.WebX.maYIadrTaRb...
> Paul,
>
> If you use a monospaced font that you know the spacing, you can be fairly
> accurate using the technique Mark suggested. However, in a proportional
> spaced font, letters vary in width with each character. "W" is wider than
> "H" which is wider than "I".
>
> They do tend to average out. It all depends on how accurate you need to
> e. -David
>
>
> "Paul" wrote in message
> news:68EB715F22A2428FB35DBFBE9B11F8D5@in.WebX.maYIadrTaRb...
> > How can i determine (calculate) how much space a string is gonna take up
> as
> > text in a drawing?
> > So i mean before it is text.
> >
> > Regards,
> >
> > Paul
> >
> >
>
>
Message 6 of 18
Anonymous
in reply to: Anonymous

Sounds like you need to measure each and every letter, U/Lcase, and if you're
lucky, differences from font to font will be proportional. Then a routine could
be written that predicts overall length of a string of certain font, height,
rotation, etc. Could be fun.
-doug

"Paul" wrote in message
news:985A4A54C1956AED308A805829048D29@in.WebX.maYIadrTaRb...
> I know that they all have different width, therfore i need a way to
> calculate the total width.
>
> David Bethel schreef in berichtnieuws
> 94A2E30B7B9949F78350E38448AB732E@in.WebX.maYIadrTaRb...
> > Paul,
> >
> > If you use a monospaced font that you know the spacing, you can be fairly
> > accurate using the technique Mark suggested. However, in a proportional
> > spaced font, letters vary in width with each character. "W" is wider than
> > "H" which is wider than "I".
> >
> > They do tend to average out. It all depends on how accurate you need to
> > e. -David
> >
> >
> > "Paul" wrote in message
> > news:68EB715F22A2428FB35DBFBE9B11F8D5@in.WebX.maYIadrTaRb...
> > > How can i determine (calculate) how much space a string is gonna take up
> > as
> > > text in a drawing?
> > > So i mean before it is text.
> > >
> > > Regards,
> > >
> > > Paul
> > >
> > >
> >
> >
>
>
Message 7 of 18
Anonymous
in reply to: Anonymous

Something like that. But my idea of fun is different (other hobbies or
drink some beer)
any other ideas???

Doug Barr schreef in berichtnieuws
3B86ADDD723C4DB812122F4D1A8DBC24@in.WebX.maYIadrTaRb...
> Sounds like you need to measure each and every letter, U/Lcase, and if
you're
> lucky, differences from font to font will be proportional. Then a routine
could
> be written that predicts overall length of a string of certain font,
height,
> rotation, etc. Could be fun.
> -doug
>
> "Paul" wrote in message
> news:985A4A54C1956AED308A805829048D29@in.WebX.maYIadrTaRb...
> > I know that they all have different width, therfore i need a way to
> > calculate the total width.
> >
> > David Bethel schreef in berichtnieuws
> > 94A2E30B7B9949F78350E38448AB732E@in.WebX.maYIadrTaRb...
> > > Paul,
> > >
> > > If you use a monospaced font that you know the spacing, you can be
fairly
> > > accurate using the technique Mark suggested. However, in a
proportional
> > > spaced font, letters vary in width with each character. "W" is wider
than
> > > "H" which is wider than "I".
> > >
> > > They do tend to average out. It all depends on how accurate you need
to
> > > e. -David
> > >
> > >
> > > "Paul" wrote in message
> > > news:68EB715F22A2428FB35DBFBE9B11F8D5@in.WebX.maYIadrTaRb...
> > > > How can i determine (calculate) how much space a string is gonna
take up
> > > as
> > > > text in a drawing?
> > > > So i mean before it is text.
> > > >
> > > > Regards,
> > > >
> > > > Paul
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Message 8 of 18
Anonymous
in reply to: Anonymous

The way I've worked around it is to place the text, use textbox to measure
it, then erase the text. Clumsy, but it works. I'll be monitoring this
thread with interest to see if someone has another way.

Jim
Message 9 of 18
Anonymous
in reply to: Anonymous

I don't see why Mark's suggestion doesn't work for you. You seem to be
under the impression that the text must exist for it to work, not so. I
mean you know the text height, text style, width factor, text value and
width factor, right? Most of those things are stored in the text style.

-Jason



"Paul" wrote in message
news:F66D164ECD23A99B1FA8CDEE184B5E47@in.WebX.maYIadrTaRb...
> Something like that. But my idea of fun is different (other hobbies or
> drink some beer)
> any other ideas???
>
> Doug Barr schreef in berichtnieuws
> 3B86ADDD723C4DB812122F4D1A8DBC24@in.WebX.maYIadrTaRb...
> > Sounds like you need to measure each and every letter, U/Lcase, and if
> you're
> > lucky, differences from font to font will be proportional. Then a
routine
> could
> > be written that predicts overall length of a string of certain font,
> height,
> > rotation, etc. Could be fun.
> > -doug
> >
> > "Paul" wrote in message
> > news:985A4A54C1956AED308A805829048D29@in.WebX.maYIadrTaRb...
> > > I know that they all have different width, therfore i need a way to
> > > calculate the total width.
> > >
> > > David Bethel schreef in berichtnieuws
> > > 94A2E30B7B9949F78350E38448AB732E@in.WebX.maYIadrTaRb...
> > > > Paul,
> > > >
> > > > If you use a monospaced font that you know the spacing, you can be
> fairly
> > > > accurate using the technique Mark suggested. However, in a
> proportional
> > > > spaced font, letters vary in width with each character. "W" is
wider
> than
> > > > "H" which is wider than "I".
> > > >
> > > > They do tend to average out. It all depends on how accurate you
need
> to
> > > > e. -David
> > > >
> > > >
> > > > "Paul" wrote in message
> > > > news:68EB715F22A2428FB35DBFBE9B11F8D5@in.WebX.maYIadrTaRb...
> > > > > How can i determine (calculate) how much space a string is gonna
> take up
> > > > as
> > > > > text in a drawing?
> > > > > So i mean before it is text.
> > > > >
> > > > > Regards,
> > > > >
> > > > > Paul
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Message 10 of 18
Anonymous
in reply to: Anonymous

Paul,

> I know that they all have different width, therfore i need a way to
> calculate the total width.

For .shx fonts, the only way would be to have access to the .shp file, step
thru each characters definition, and calculate it's width based on the
original definition. No fun at all. Allow for oblique angles & text size
and you would be close. -David

"Paul" wrote in message
news:985A4A54C1956AED308A805829048D29@in.WebX.maYIadrTaRb...
Message 11 of 18
Anonymous
in reply to: Anonymous

You don't have to place the text to use the textbox function.

(textbox '((1 . "Jason")))

returns

((0.0 -6.93889e-018 0.0) (0.387931 0.09375 0.0))

-Jason



"Jim Nelson" wrote in message
news:9DDE613E10E39B67F8E897C81A43E3AF@in.WebX.maYIadrTaRb...
> The way I've worked around it is to place the text, use textbox to measure
> it, then erase the text. Clumsy, but it works. I'll be monitoring this
> thread with interest to see if someone has another way.
>
> Jim
>
>
>
Message 12 of 18
Anonymous
in reply to: Anonymous

>"Jason Piercey" wrote :
> You don't have to place the text to use the textbox function.
> (textbox '((1 . "Jason")))
> returns
> ((0.0 -6.93889e-018 0.0) (0.387931 0.09375 0.0))

Cool! That works great, and would seem to answer the original question of
this thread. I wish someone would have told me that when I posted a similar
question years ago. Thanks!
Message 13 of 18
Anonymous
in reply to: Anonymous

Your welcome. There is also this Express Tools function (acet-geom-textbox)
that takes two arguments.

(acet-geom-textbox )

The difference is the return value includes the rotation of the text and I
believe the returned coordinates are relative to the entity.


BTW: It is in the help file for the TextBox function.

-Jason


"Jim Nelson" wrote in message
news:7CD43F7535C34447E6D4E37F3B6E2526@in.WebX.maYIadrTaRb...
> >"Jason Piercey" wrote :
> > You don't have to place the text to use the textbox function.
> > (textbox '((1 . "Jason")))
> > returns
> > ((0.0 -6.93889e-018 0.0) (0.387931 0.09375 0.0))
>
> Cool! That works great, and would seem to answer the original question of
> this thread. I wish someone would have told me that when I posted a
similar
> question years ago. Thanks!
>
>
>
Message 14 of 18
Anonymous
in reply to: Anonymous

Thanks

My question is answerd

Paul schreef in berichtnieuws
68EB715F22A2428FB35DBFBE9B11F8D5@in.WebX.maYIadrTaRb...
> How can i determine (calculate) how much space a string is gonna take up
as
> text in a drawing?
> So i mean before it is text.
>
> Regards,
>
> Paul
>
>
Message 15 of 18
Anonymous
in reply to: Anonymous

I should mention that the is related to the textsize.
0 = no offset
1 = text height
2 = textheight x2

etc....

-Jason


"Jason Piercey" wrote in message
news:896088290673A0FDE54F18ACED6DFA98@in.WebX.maYIadrTaRb...
> Your welcome. There is also this Express Tools function
(acet-geom-textbox)
> that takes two arguments.
>
> (acet-geom-textbox )
>
> The difference is the return value includes the rotation of the text and I
> believe the returned coordinates are relative to the entity.
>
>
> BTW: It is in the help file for the TextBox function.
>
> -Jason
>
>
> "Jim Nelson" wrote in message
> news:7CD43F7535C34447E6D4E37F3B6E2526@in.WebX.maYIadrTaRb...
> > >"Jason Piercey" wrote :
> > > You don't have to place the text to use the textbox function.
> > > (textbox '((1 . "Jason")))
> > > returns
> > > ((0.0 -6.93889e-018 0.0) (0.387931 0.09375 0.0))
> >
> > Cool! That works great, and would seem to answer the original question
of
> > this thread. I wish someone would have told me that when I posted a
> similar
> > question years ago. Thanks!
> >
> >
> >
>
>
Message 16 of 18
Anonymous
in reply to: Anonymous

What I usually do in a case like this is to temporarily create the object
(in this case text) to be analyzed, and then (in this case) use the (in this
case) textbox function to get the required information; then, simply erase
or (entdel) the temporary object. Yes, it's a bit of a kludge, but much
simpler than creating a character width table for every font you're likely
to be using.
___

"Paul" wrote in message
news:985A4A54C1956AED308A805829048D29@in.WebX.maYIadrTaRb...
> I know that they all have different width, therfore i need a way to
> calculate the total width.
Message 17 of 18
Anonymous
in reply to: Anonymous

All these years ... and still learning. Thanks, Jason.
___

"Jason Piercey" wrote in message
news:58C7DB63FE5B6FB3BD1F237A0C69EAC3@in.WebX.maYIadrTaRb...
> You don't have to place the text to use the textbox function.
Message 18 of 18
Anonymous
in reply to: Anonymous

Glad I could learn ya a little sumthin' 🙂

-Jason

"Paul Turvill" wrote in message
news:33087637815EB8D0E08C9A64B87BC475@in.WebX.maYIadrTaRb...
> All these years ... and still learning. Thanks, Jason.
> ___
>
> "Jason Piercey" wrote in message
> news:58C7DB63FE5B6FB3BD1F237A0C69EAC3@in.WebX.maYIadrTaRb...
> > You don't have to place the text to use the textbox function.
>
>
>

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

Post to forums  

Autodesk Design & Make Report

”Boost