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

dxf 10 and 11 help needed

1 REPLY 1
SOLVED
Reply
Message 1 of 2
aqdam1978
665 Views, 1 Reply

dxf 10 and 11 help needed

Hi,

 

As you knows, insertion point for text objects defines by DXF code 10 or 11

if text justify is LEFT so dxf 10 is valid for text insertion point.

but for the other text justifications, valid code for text insertion point is 11.

 

I tried to change justification of a text by lisp. It works for texts with Non-LEFT justification.

Can anybody help me to improve this code? (in LEFT justification texts)

 

(defun c:test ( / e1 en P1 P2)
(setq e1 (entsel "Choose a text: "))
(setq en (entget(car e1)))
(entmod 
	(subst (cons 72 1) (assoc 72 en) 
	(subst (cons 73 2) (assoc 73 en) en)
	)
);entmod
(setq P1 (cdr (assoc 10 en)))
(setq P2 (cdr (assoc 11 en)))
(princ "\nP1: ") (princ P1)
(princ "\nP2: ") (princ P2)
(princ)
)

 Thanks,

Abbas

1 REPLY 1
Message 2 of 2
Kent1Cooper
in reply to: aqdam1978


@aqdam1978 wrote:

.... 

As you knows, insertion point for text objects defines by DXF code 10 or 11

if text justify is LEFT so dxf 10 is valid for text insertion point.

but for the other text justifications, valid code for text insertion point is 11.

 

I tried to change justification of a text by lisp. It works for texts with Non-LEFT justification.

Can anybody help me to improve this code? (in LEFT justification texts)

....


It actually does "work," but since DXF code 11 becomes the insertion point, and since in Left-justified Text that is always 0,0,0, the Text gets moved there, rather than just moved a little around the current insertion point for other justifications.

 

Here's one adjustment that seems to work in minimal testing:

 

(defun c:test ( / e1 en P1 P2)
  (setq e1 (entsel "Choose a text: "))
  (setq en (entget (car e1)))
  (if (= (cdr (assoc 72 en)) (cdr (assoc 73 en)) 0); Left justified
    (setq en (subst (cons 11 (cdr (assoc 10 en))) (assoc 11 en) en))
      ; put insertion point into 11 entry
  ); if
  (entmod
    (subst (cons 72 1) (assoc 72 en)
      (subst (cons 73 2) (assoc 73 en)
        en
      ); subst [inner]
    ); subst [outer]
  );entmod
  (setq en (entget (car e1)))
    ; again, so 10 entry will be updated [otherwise if originally Left-justified, P1 = P2]
  (setq P1 (cdr (assoc 10 en)))
  (setq P2 (cdr (assoc 11 en)))
  (princ "\nP1: ") (princ P1)
  (princ "\nP2: ") (princ P2)
  (princ)
); defun

 

There are also, no doubt, other ways to do it.

Kent Cooper, AIA

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

Post to forums  

Autodesk Design & Make Report

”Boost