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

Modify insertion point of text

11 REPLIES 11
Reply
Message 1 of 12
Anonymous
958 Views, 11 Replies

Modify insertion point of text

How do I change the insertion point of a text using "vla-put" ? I've tried
using :

(vla-put-InsertionPoint en a)) with a = (4455.94 428.576 0.0)

and I get the following error:

lisp value has no coercion to VARIANT with this type: (4455.94 428.576 0.0)

Tom
11 REPLIES 11
Message 2 of 12
Anonymous
in reply to: Anonymous

One way would be:

(vla-put-insertionpoint mtextObject (vlax-3d-point '(0 0 0)))

Substitute '(0 0 0) with your desired insertion point

--
Autodesk Discussion Group Facilitator


"Tom Quok" wrote in message
news:5817484@discussion.autodesk.com...
How do I change the insertion point of a text using "vla-put" ? I've tried
using :

(vla-put-InsertionPoint en a)) with a = (4455.94 428.576 0.0)

and I get the following error:

lisp value has no coercion to VARIANT with this type: (4455.94 428.576 0.0)

Tom
Message 3 of 12
t.willey
in reply to: Anonymous

Or

(vlax-put en 'InsertionPoint a)
Message 4 of 12
Anonymous
in reply to: Anonymous

That did it ... Thanks

Tom

wrote in message news:5817545@discussion.autodesk.com...
Or

(vlax-put en 'InsertionPoint a)
Message 5 of 12
iwafb
in reply to: Anonymous

Hi All,

 

I've been trying to modify the insertion point using both of these methods and nothing happens. Do I need to do something else after using vlax-put to update the object?

 

At the moment, I'm just passing

 

(vlax-put obj 'InsertionPoint '(0 0 0))

 

Where obj is a VLA-Object. And expecting the text to move, but nothing...

 

Thanks in advance

John

Message 6 of 12
iwafb
in reply to: iwafb

Should've mentioned I've also tried:

 

(vla-put-insertionpoint obj (vlax-3d-point '(0 0 0)))

 

Thanks...

Message 7 of 12
iwafb
in reply to: iwafb

Ok,

 

I've found that I can change the insertion point of some of the text, but not all. The only difference that I can see is that if dxf group 11 is shown as (11 0.0 0.0 0.0), then I can modify the text (either by using vlisp or modifying group code 10). However, when 11 is anyhing but (11 0.0 0.0 0.0), the only way I can modify the inserction is by modifying group code 11??

 

Can anyone shed light on the difference between code 10 and 11? Is there a way of modifying the text entity so that it works in all cases (modifying 11 does not change the text when its (11 0.0 0.0 0.0))?

 

Thanks in advance and I hope i've explained the issue properly...

 

John.

Message 8 of 12
alanjt_
in reply to: iwafb

That means the text has had the justification changed to something other than top left (default).

Message 9 of 12
Kent1Cooper
in reply to: iwafb


@iwafb wrote:

... I can change the insertion point of some of the text, but not all. ... if dxf group 11 is shown as (11 0.0 0.0 0.0), then I can modify the text (either by using vlisp or modifying group code 10). However, when 11 is anyhing but (11 0.0 0.0 0.0), the only way I can modify the inserction is by modifying group code 11??

 

Can anyone shed light on the difference between code 10 and 11? Is there a way of modifying the text entity so that it works in all cases (modifying 11 does not change the text when its (11 0.0 0.0 0.0))?

....


For Text entities, the 10 code location in the entity data is always the left end of the baseline, and it's also always stored in the InsertionPoint VLA property.  It is also the insertion point that object snap goes to for left-justified Text only [left-justified is the default for regular Text, rather than, as alanjt said, top left, which is the default only for Mtext].  The 11 code location is also stored in the TextAlignmentPoint VLA property.  For left-justified Text, that is always (11 0.0 0.0 0.0) [when in the drawing plane -- if it's got a non-zero Z coordinate, that will show up in the 11 code.]  For any justification other than left, the 11 code is the object-snap insertion point and the InsertionPoint VLA property, and the 10 code is only a result of the size/shape of the overall entity in relation to that.

 

Because of those quirks, you need to do it differently for left-justified Text than for any other justification.  I don't think there is any justification-independent way to do it, whether by entity data substitution or through VLA properties.  You need to find the justification [which you can do in several ways], and depending on what you find, change the appropriate entry or property.

 

EDIT:  The 10 code is also the object-snap insertion point if the justification is the more rarely-used Fit or Aligned, not only for Left.

Kent Cooper, AIA
Message 10 of 12
Kent1Cooper
in reply to: Kent1Cooper


@Kent1Cooper wrote:
....you need to do it differently for left-justified Text than for any other justification.  I don't think there is any justification-independent way to do it, whether by entity data substitution or through VLA properties.  You need to find the justification [which you can do in several ways], and depending on what you find, change the appropriate entry or property. ....

For instance, if 'obj' is the Text entity as a VLA-object:

 

(vlax-put
  obj
  (if (= (vla-get-Alignment obj) 0); left-justified
    'InsertionPoint ; then
    'TextAlignmentPoint ; else
  ); if
  YourNewLocation
); vlax-put

 

[That ignores the Fit and Aligned possibilities, since it would depend on what you would be wanting to do in those cases, if you would ever have them -- leave one point where it is and move the other, and if so, which? move the whole thing but leave it the same size and angle and so on? etc.  Some possibilities would require changing both those properties.]

Kent Cooper, AIA
Message 11 of 12
Kent1Cooper
in reply to: Kent1Cooper


@Kent1Cooper wrote:
.... For any justification other than left, the 11 code is the object-snap insertion point and the InsertionPoint VLA property, and the 10 code is only a result of the size/shape of the overall entity in relation to that.

....


[The red part above is not true -- my mistake.  As stated farther up in that same message, the 10 code location is in the InsertionPoint VLA property, and the 11 code is in the TextAlignmentPoint property.]

Kent Cooper, AIA
Message 12 of 12
iwafb
in reply to: Kent1Cooper

Thanks Kent,

 

As usual, your answers are etremely informative. I'm surprised Autodesk haven't included a link to your email in their help menu...Smiley Very Happy

 

John

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

Post to forums  

Autodesk Design & Make Report

”Boost