I found this lisp here in this forum and I tried to modify it by adding an option to set the offset distance of the text from the alignment.
And it works. But what I want is to change the justification of the text from left to middle left. When I change the dxf code 73 from 0 to 2, all the texts created were place at 0,0.
How can I change the justification of the text to middle left?
I've attached the modified lisp and the screen shot of what I want with the lisp.
Thank you in advance
Solved! Go to Solution.
Solved by pbejse. Go to Solution.
@rulep21 wrote:
I found this lisp here in this forum and I tried to modify it by adding an option to set the offset distance of the text from the alignment.
And it works. But what I want is to change the justification of the text from left to middle left. When I change the dxf code 73 from 0 to 2, all the texts created were place at 0,0.
How can I change the justification of the text to middle left?
Thank you in advance
(defun _text (p b o h c)
;;; pBe -<-- dont forget to mention the original author dude (entmake (append '((0 . "MTEXT") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (7 . "Standard Arial") (8 . "C-CTRL_TXT") (100 . "AcDbMText") ) (list (cons 10 (polar p (+ b PI) o)) ) (list (cons 40 h)) (list (cons 1 (strcat "CH " (if (setq ld (nth (strlen (rtos c 2 0)) '(x ""))) ld "") (rtos c 2 2)))) (list (cons 50 (+ b PI))) '((41 . 1.0) (71 . 4) (72 . 5) (210 0.0 0.0 1.0) (73 . 1) ) ) ) )
MTEXT and Middle Left among other things
It does not work pbjse.
I tried it just while ago.
Text are missing or not created.
But anyway thanks very much for your quick response.
Can you modify the lisp and and attach it here?
Add the below highlighted code and try
(defun _text (p b o h c) (entmake (append '((0 . "TEXT") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (7 . "Arial") (8 . "C-CTRL_TXT") (100 . "AcDbText") ) (list (cons 10 (polar p (+ b PI) (* o 1.0))) ) (list (cons 40 h)) (list (cons 1 (strcat "CH " (if (setq ld (nth (strlen (rtos c 2 0)) '(x ""))) ld "") (rtos c 2 2)))) (list (cons 50 (+ b PI))) '((41 . 1.0) (51 . 180) (71 . 0) (72 . 0) (11 0.0 0.0 0.0) (210 0.0 0.0 1.0) (100 . "AcDbText") (73 . 2) ) ) ) ;change the Alignemnt (setq txt (entget(entlast))) (setq Align (polar p (+ b PI) (* o 1.0))) (setq txt (subst (cons 11 Align) (assoc 11 txt) txt)) (entmod txt) )
@rulep21 wrote:
.... I want is to change the justification of the text from left to middle left. When I change the dxf code 73 from 0 to 2, all the texts created were place at 0,0.
How can I change the justification of the text to middle left?
....
The 10 code is the left end of the baseline of the text for all justifications, but that's only the insertion point for ordinary Left justification. For other justifications, the 10 code is a resultant that you wouldn't be able to calculate, and the 11 code is the insertion point. [For Left justification, the 11 code is always 0,0,0, regardless of the insertion point.] I think you can just omit the 10 code from the (entmake) list. Middle left justification is a combination of (72 . 0) and (73 . 2).
....
(list (cons 11 (polar p (+ b PI) (* o 1.0))); insertion point [11 instead of 10, or put it below and omit 10 altogether]
)
(list (cons 40 h))
(list (cons 1 (strcat "CH "
(if (setq ld (nth (strlen (rtos c 2 0)) '(x "")))
ld "")
(rtos c 2 2))))
(list (cons 50 (+ b PI)))
'((41 . 1.0)
(51 . 180)
(71 . 0)
(72 . 0)
;; (11 0.0 0.0 0.0) ; leave this out or put the (polar function above here instead of above
(210 0.0 0.0 1.0)
(100 . "AcDbText")
(73 . 2)
....
@rulep21 wrote:
It does not work pbjse.
I tried it just while ago.
Text are missing or not created.
But anyway thanks very much for your quick response.
Can you modify the lisp and and attach it here?
Works find here rulep21, At first i thought its the TEXT STYLE issue but apparently not, is there any error message?
See attached file
Hi pbe!
thank you for your help.
How can I change the textstyle? and is it possible to make the text annotative and put a background mask?
thanks Ajilal.Vijayan
It works!!!
Can you please help me again?
I want to change text to mtext and make it annotative with a background mask.
Is it possible?
@rulep21 wrote:
Hi pbe!
thank you for your help.
How can I change the textstyle? and is it possible to make the text annotative and put a background mask?
Are you using a specific Textstyle? YES and YES. Did the modification even work for you rulep21 ?
I havent had a situtation where the program did not work.
yes i used specific textstyle.
Your lisp work for me.
I attach the sample generated by your lisp and what i want to achieve.
much appreciate your help pbe
thanks a lot
@rulep21 wrote:
yes i used specific textstyle.
Your lisp work for me.
I attach the sample generated by your lisp and what i want to achieve.
much appreciate your help pbe
thanks a lot
The background Mask is easy. I'll just leave the Annotative thingy and Text Style creation to you. As you may already know, you can set Annotative on the TEXTSTYLE you create. Then modify the code to remove the prompt for height. but you need to replace that part of code to account for the value referencing height variable
(defun _text (p b o h c) ;;; pBe -<-- dont forget to mention the original author dude (entmake (append '((0 . "MTEXT") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (7 . "Standard Arial") (8 . "C-CTRL_TXT") (100 . "AcDbMText") ) (list (cons 10 (polar p (+ b PI) o)) ) (list (cons 40 h)) (list (cons 1 (strcat "CH " (if (setq ld (nth (strlen (rtos c 2 0)) '(x ""))) ld "") (rtos c 2 2)))) (list (cons 50 (+ b PI))) '((41 . 0);<-- width issue (90 . 3);<-- Mask (63 . 256)<--Mask (441 . 3935927);<-- Mask (71 . 4) (72 . 5) (210 0.0 0.0 1.0) (73 . 1) ) ) ) )
HTH
rulep21 wrote:How can I change the default textstyle to a current textstyle which is already exist in the drawing?
@pbejse I hope you don't mind...
Cheers
@marlance at pBe's _text function, remove this code line
(7 . "Standard Arial")
and replace these code lines
'((41 . 0);<-- width issue (90 . 3);<-- Mask (63 . 256)<--Mask (441 . 3935927);<-- Mask (71 . 4) (72 . 5) (210 0.0 0.0 1.0) (73 . 1) )
by these code lines
(list '(41 . 0) '(90 . 3);<-- Mask '(63 . 256);<--Mask '(441 . 3935927);<-- Mask '(71 . 4) '(72 . 5) (cons 7 (getvar "textstyle")) '(210 0.0 0.0 1.0) '(73 . 1) )
HTH
Henrique
Your Lisp file working Fine There is a issue with Starting Chainage
your LISP start from 0.000 but
i want to start Chainage from middle
Example:25.000,25.020....etc.