Author Topic: Problem with entmake Mtext position  (Read 2243 times)

0 Members and 1 Guest are viewing this topic.

Lost_in_()

  • Guest
Problem with entmake Mtext position
« on: August 30, 2016, 09:05:15 PM »
More problems at the ranch!  I am using this entmake list for a MTEXT entity and it inserts at 0,0 not the coordinates in the 10 group  why?
Heads up  - we are still using Autocad 2008!

Code - Auto/Visual Lisp: [Select]
  1.   (setq p_elst nil)
  2.  
  3.  ; (princ "yy")
  4.   (setq p_elst (list
  5.                  (cons 0 "MTEXT")
  6.                  (cons 100 "AcDbEntity")
  7.                  (cons 8 "Text List")
  8.                  (cons 10 p_txtpt)
  9.                  (cons 100 "AcDbMText")
  10.                  (cons 67 0)
  11.                  (cons 71 1)
  12.                  (cons 72 5)
  13.                  (cons 40 p_tsize)
  14.                  (cons 41 (* 40.0 p_tsize))
  15.                  (cons 50 0)
  16.                  (list 11 1.0 0.0 0.0)
  17.                  (list 210 0.0 0.0 0.1)
  18.                  )
  19.         )
  20.  
  21.  

This returns -
((0 . MTEXT) (100 . AcDbEntity) (8 . Text List) (10 391619.0
6.46318e+006 0.0) (100 . AcDbMText) (67 . 0) (71 . 1) (72 . 5) (40 . 50.0) (41
. 2000.0) (50 . 0) (11 1.0 0.0 0.0) (210 0.0 0.0 0.1))
after the creation, indicating it is a valid MTEXT list.  As can be seen the coodinates are at  X=391619  Y=6463175.  However the MTEXT is created at 0,0?
I am not using any UCS coordinate shifting, but I hace tried various trans options on the coord.
Been chasing this for almost a day now  :x

kpblc

  • Bull Frog
  • Posts: 396
Re: Problem with entmake Mtext position
« Reply #1 on: August 31, 2016, 01:12:19 AM »
Try to change DXF group 11 to value p_txtpt.
Sorry for my English.

Lost_in_()

  • Guest
Re: Problem with entmake Mtext position
« Reply #2 on: August 31, 2016, 02:30:50 AM »
From LISP Reference fo MTEXT entity -

11
 X-axis direction vector (in WCS)

DXF: X value; APP: 3D vector

A group code 50 (rotation angle in radians) passed as DXF input is converted to the equivalent direction vector (if both a code 50 and codes 11, 21, 31 are passed, the last one wins). This is provided as a convenience for conversions from text objects
 
I did try it but just rotated the MTEXT and still at 0,0

Thanks for the suggestion though  :-)

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Problem with entmake Mtext position
« Reply #3 on: August 31, 2016, 02:55:54 AM »
I know in newer version of Acad it matters the order of the elist you are making.  By reordering your list it worked in my 2012 version.  I would just make sure you copy the correct order of an existing mtext entity.  Here is a reordered list, plus a default text string just to test.  I only switched two items in the list... the second 100 and 10.

Code - Auto/Visual Lisp: [Select]
  1. (setq p_elst (list
  2.                  (cons 0 "MTEXT")
  3.                  (cons 100 "AcDbEntity")
  4.                  (cons 8 "Text List")
  5.                  (cons 100 "AcDbMText")
  6.                  (cons 10 p_txtpt)
  7.                  (cons 67 0)
  8.                  (cons 71 1)
  9.                  (cons 72 5)
  10.                  (cons 1 "this is another test")
  11.                  (cons 40 p_tsize)
  12.                  (cons 41 (* 40.0 p_tsize))
  13.                  (cons 50 0)
  14.                  (list 11 1.0 0.0 0.0)
  15.                  (list 210 0.0 0.0 0.1)
  16.                  )
  17.         )
  18.  
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

kpblc

  • Bull Frog
  • Posts: 396
Re: Problem with entmake Mtext position
« Reply #4 on: August 31, 2016, 03:03:11 AM »
Ah, sorry. My mistake: i mixed up TEXT and MTEXT.
Maybe will be a reason to change DXF10 after creating an MTEXT object?
Sorry for my English.

Lost_in_()

  • Guest
Re: Problem with entmake Mtext position
« Reply #5 on: August 31, 2016, 05:01:51 AM »
Thanks Tim,  I'll try that tomorrow but annoying that if wrong order is accepted but not correctly ordered that the entity is wrong.  Will let you know how it goes.


« Last Edit: August 31, 2016, 08:59:33 PM by Lost_in_() »

Lost_in_()

  • Guest
Re: Problem with entmake Mtext position
« Reply #6 on: August 31, 2016, 08:58:58 PM »
 :-D  Thanks Tim - That worked!   :-D

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Problem with entmake Mtext position
« Reply #7 on: September 01, 2016, 01:58:35 AM »
Glad that simple fix worked.  When it first happened to me it took forever to figure out why my code was erroring, when it worked flawlessly on a previous version of Acad.  You're welcome.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.