Author Topic: text points and justification  (Read 6079 times)

0 Members and 1 Guest are viewing this topic.

Oak3s

  • Bull Frog
  • Posts: 321
text points and justification
« on: March 14, 2005, 06:03:39 PM »
i have a pretty general question about text. i could be wrong but in the text that i edit or create there is always one grip for the text itself and one insurtion point. for instance, if i want to move text i can pick it and then move it from its insurtion point or another point. its that other point im interested in. what is it called. the pick point that is always in the bottom left. the reason i want to know is i would like to create a lisp routine to change the justification of text but have it stay in its current location.
i hope that makes sense.

"Freedom is not defined by safety. Freedom is Defined by the ability of citizens to live without government interference"
-- Ron Paul

Jeff_M

  • King Gator
  • Posts: 4042
  • C3D user & customizer
text points and justification
« Reply #1 on: March 14, 2005, 06:22:37 PM »
Texy objects have 2 properties that affect this. One, that always stays at the lower left corner, is the InsertionPoint....the other, that only comes in to play with text that is NOT Left Justified, is the TextAlignmentPoint.

See the Alignment Property section in the ActiveX and VBA Reference for a more specific description.

Oak3s

  • Bull Frog
  • Posts: 321
text points and justification
« Reply #2 on: March 14, 2005, 06:23:56 PM »
so ive found that there are geometry properties 'position X,Y,Z'. that seems to be the default grip. how would i extract these coordinantes in a lisp routine?

"Freedom is not defined by safety. Freedom is Defined by the ability of citizens to live without government interference"
-- Ron Paul

Oak3s

  • Bull Frog
  • Posts: 321
text points and justification
« Reply #3 on: March 14, 2005, 06:25:02 PM »
thanks Jeff. i guess i was a little slow to reply to my first post. i will look into that.

"Freedom is not defined by safety. Freedom is Defined by the ability of citizens to live without government interference"
-- Ron Paul

Jeff_M

  • King Gator
  • Posts: 4042
  • C3D user & customizer
text points and justification
« Reply #4 on: March 14, 2005, 06:30:44 PM »
Sure thing Jeremy,
If you aren't sure about using the ActiveX approach, the Text entity's assoc codes for Insertionpoint, Alignmentpoint and Justification type are 10, 11 & 72/73.

If you need additional guidance, just ask.

Oak3s

  • Bull Frog
  • Posts: 321
text points and justification
« Reply #5 on: March 14, 2005, 06:44:54 PM »
yeah, your starting to talk about things i dont have a clue about. lisp is something that i can manipulate to get what i want but starting from scratch is something i struggle very hard with. same thing with the manipulation. what takes some a few min. to to from nothing takes me hours to do from examples. but i thought i could just pull properties like 'basepoint' and such to move the text around. but like i said, i dont know much or anything reall about the ActiveX stuff. i look breifly at the reference stuff in the help but thats about as far as i could go ;)

"Freedom is not defined by safety. Freedom is Defined by the ability of citizens to live without government interference"
-- Ron Paul

Oak3s

  • Bull Frog
  • Posts: 321
text points and justification
« Reply #6 on: March 14, 2005, 07:05:13 PM »
nevermind this whole thing. its in express tools already..... :oops:

"Freedom is not defined by safety. Freedom is Defined by the ability of citizens to live without government interference"
-- Ron Paul

Jeff_M

  • King Gator
  • Posts: 4042
  • C3D user & customizer
text points and justification
« Reply #7 on: March 14, 2005, 07:29:55 PM »
Quote from: Oak3s
yeah, your starting to talk about things i dont have a clue about. lisp is something that i can manipulate to get what i want but starting from scratch is something i struggle very hard with.

Sounds like a good project to start learning ;-)

Here's some code to get you started. Rememeber, the help files and these forums are your friends  :D Don't hesitate to ask for guidance when the waters get a little muddied. But you really should give a try, and in a few months you will happy you did.

Code: [Select]

;;first select a text object
(setq obj (car (entsel "\nSelect text object to chnage alignment for: ")))
;;next get the entity list
(setq ent (entget obj))
;;also get the VLA-Object
(setq obj (vlax-ename->vla-object obj))
;;now we'll find the properties we need to use
;;first using the assoc codes that we know from the DXF reference
(setq insPt-DXF (cdr (assoc 10 ent));;insertion point
      alignPt-DXF (cdr (assoc 11 ent));;alignment point
      justH-DXF (cdr (assoc 72 ent));;horizontal justificatio
      justV-DXF (cdr (assoc 73 ent));;vertical justification
      )
;;now well do the same thing ActiveX style
(setq inspt-VLA (vlax-get obj 'insertionpoint);;insertion point
      alignPt-VLA (vlax-get obj 'textalignmentpoint);;alignment point
      just-VLA (vlax-get obj 'alignment);;unlike DXF, the H & V are combined
      )
;;now, ignoring my comments, which way is easier to read what it is you are retreiving?

;|and now let's assume that the text object is Left justified so we won't need to worry
  about the alignment property or textalignmentpoint.....and we'll move the text 5 units
  up and 10 units to the right, first via standard lisp and then by ActiveX|;

(setq newinspt-DXF (list (+ 10.0 (car insPt-DXF))(+ 5.0 (cadr insPt-DXF)) (caddr inspt-DXF)))
(setq newEnt (subst (cons 10 newinspt-DXF) (assoc 10 ent) ent))
(entmod newent)

;;now with Activex, the first step is pretty much identical
(setq newinspt-VLA (list (+ 10.0 (car insPt-VLA))(+ 5.0 (cadr insPt-VLA))(caddr inspt-VLA)))
(vlax-put obj 'insertionpoint newinspt-VLA)

And remember, too, that most of here would rather you learned how to do this yourself with help from us, than to code the whole thing for you.

MikePerry

  • Guest
Re: text points and justification
« Reply #8 on: March 15, 2005, 03:16:28 AM »
Quote from: Oak3s
the reason i want to know is i would like to create a lisp routine to change the justification of text but have it stay in its current location.
Hi

How about AutoCAD's built-in command ._JustifyText

Have a good one, Mike

ronjonp

  • Needs a day job
  • Posts: 7462
text points and justification
« Reply #9 on: March 15, 2005, 11:48:52 AM »
Quote
Hi

How about AutoCAD's built-in command ._JustifyText

Have a good one, Mike


Thats a good one :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

CAB

  • Global Moderator
  • Seagull
  • Posts: 10400
Re: text points and justification
« Reply #10 on: March 15, 2005, 01:27:46 PM »
Quote from: MikePerry
Quote from: Oak3s
the reason i want to know is i would like to create a lisp routine to change the justification of text but have it stay in its current location.
Hi

How about AutoCAD's built-in command ._JustifyText

Have a good one, Mike

And what version of acad did that become available?
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

CADaver

  • Guest
Re: text points and justification
« Reply #11 on: March 15, 2005, 01:35:57 PM »
Quote from: CAB
And what version of acad did that become available?
It's in my R2002.
There's also the expresstools TJUST.

Jeff_M

  • King Gator
  • Posts: 4042
  • C3D user & customizer
Re: text points and justification
« Reply #12 on: March 15, 2005, 01:37:07 PM »
Quote from: CAB

And what version of acad did that become available?

According to THIS it was 2002

Oak3s

  • Bull Frog
  • Posts: 321
text points and justification
« Reply #13 on: March 15, 2005, 02:00:43 PM »
:oops:  im using 2002 and had no idea

"Freedom is not defined by safety. Freedom is Defined by the ability of citizens to live without government interference"
-- Ron Paul

Jeff_M

  • King Gator
  • Posts: 4042
  • C3D user & customizer
text points and justification
« Reply #14 on: March 15, 2005, 02:22:49 PM »
Quote from: Oak3s
:oops:  im using 2002 and had no idea
Heh, nor did.  But then again, I don't recall ever needing to rejustify text........Just shows to go ya that no one needs everything in Acad, but it's nice to know that it's there in case you do.......  :)