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

Can someone merge these two "align object" routines

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
mjs9199
393 Views, 2 Replies

Can someone merge these two "align object" routines

I've gotten these two routines from different threads on here.

 

One works with *text and blocks.  The second works with multileaders.

 

I'd like to merge the two so one command can work with a selection set of any of the above objects (assume selection set of mixed objects - some multileaders, some text, some blocks)

 

	(defun c:at ( / ss ang *error*)
		(vl-load-com)
		(ErrorHandler '("cmdecho" "osmode"))
			(setvar "cmdecho" 0)
			(setvar "osmode" 576)
		(setq
			ss (ssget '((0 . "*TEXT,INSERT")))
			ang (getangle "\nSelect two points along desired alignment:"))
		(mapcar
			'(lambda (x)
				(vla-put-rotation
					(vlax-ename->vla-object x)
					ang))
			(mapcar 'cadr (ssnamex ss)))
		(*error* nil))



	(defun c:test (/ ss ang i sset)
		(vl-load-com)
		; Tharwat 17. 05. 2011
	  (if
	    (and
	      (setq ss (ssget ":L" '((0 . "MULTILEADER"))))
	      (setq ang (getangle "\n Specify Rotation Angle :")))
	    (repeat
				(setq i (sslength ss))
	      (setq sset (ssname ss (setq i (1- i))))
	      (vla-put-TextRotation (vlax-ename->vla-object sset) ang))
	    (princ))
	  (princ))

 

Or see C:AT and C:TEST in the attached file

 

2 REPLIES 2
Message 2 of 3
stevor
in reply to: mjs9199

1. To use different object snaps for two selections of the angle points

you can select the points first, then use ;angle to the the angle:

 

    (setvar "osmode" 576) ; NEA+INS 110712  

    (setq p1 (getoint "\n Angle Pt 1: ")) ;

    (setvar "osmode" 704 )   ; NEA+PER+INS 110708

    (setq p2 (getoint p1 "\n Angle Pt 1: ")) ; relative indicated

    (setq ang (angle p1 p2)) ;a 'REAL number

    (setq angstr (angtos ang)) ; a 'STRING

 

2. The 'merge' idea, is not clear to me.

S
Message 3 of 3
pbejse
in reply to: mjs9199


@mjs9199 wrote:

I've gotten these two routines from different threads on here.

 

One works with *text and blocks.  The second works with multileaders.

 

I'd like to merge the two so one command can work with a selection set of any of the above objects (assume selection set of mixed objects - some multileaders, some text, some blocks)

  

Or see C:AT and C:TEST in the attached file

 


(defun c:test (/ ss ang i sset)
  (vl-load-com)
  ; Tharwat 17. 05. 2011
   (if
     (and
  (setq ss (ssget ":l" '((0 . "*TEXT,INSERT,MULTILEADER"))))
       (setq ang (getangle "\n Specify Rotation Angle :")))
    
     (repeat
  (setq i (sslength ss))
         (setq sset (ssname ss (setq i (1- i))))
       ((if (eq (cdr (assoc 0 (entget sset))) "MULTILEADER")
        vla-put-TextRotation vla-put-rotation) (vlax-ename->vla-object sset) ang)
         )
    )
   (princ))

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

Post to forums  

Autodesk Design & Make Report

”Boost