Jump to content

Combining two LISP Routines - Leader to Mleader and Mleader Rotate


Cylis0509

Recommended Posts

Hi everyone,

 

I have a drawing with a ton of leaders and text received from an outside source. I need to change the drawing orientation to a different rotation. By doing this all the text is obviously rotated to a different orientation.

 

I am trying to take all the leaders and text and combine them into mleaders, I can do this using LeaderToMleader.lsp and it works great. What I am trying to add to it is a another LISP that then rotates the mtext based on the snap angle. This LISP also works, but what I really want to do is combine the two.

 

As of now I have to run one then the other. Ideally I would like to combine them into one LISP. I have tried many different things but not matter what I do I always end up with an error stating too many arguments.

 

Can anyone help? The LISPs are below...

 

;;; CADALYST 08/08  www.cadalyst.com/code 
;;; Tip 2305: LeaderToMleader.lsp	Leader to Multileader	(c) 2008 Lyle Hardin 
;;; Pick an old style leader and text to create a new mleader entity and erase the old leader and text.
;;; March/2008

(defun c:leadertomleader ()
 (setq	leader	(entsel "\nPick Leader")	; pick leader
leader2	(entget (car leader))
pt1	(dxf 10 leader2)		; get first point of leader
layer 	(dxf 8 leader2)			; get layer of leader

mtext	(entsel "\nPick Text")	; pick text
mtext2	(entget (car mtext))
pt2	(dxf 10 mtext2)		; get point of text
text	(dxf 1 mtext2)		; get 
 )					; setq
 
 (command "-layer" "s" layer "")	; set layer of leader picked to current
 (command "mleader" pt1 pt2 text)	; start mleader command
 (COMMAND "ERASE" mtext "")		; erase text picked
 (command "erase" leader "")		; erase leader picked

)					; defun

(defun dxf(code elist)		; define dxf function
 (cdr (assoc code elist))     ;Finds the association pair, strips 1st element
);defun

 

(defun c:MLRO (/ ss ang i sset)

(vl-load-com)

(defun *error*()  (setvar "nomutt" 0) )

 (if
   (and
(progn
	(setvar "nomutt" 1)
	(setq ss (ssget '((0 . "MULTILEADER"))))
	(setvar "nomutt" 0)
	(princ)
)
(setq ang (getvar "snapang"))
   )
    (repeat
      (setq i (sslength ss))
       (setq sset (ssname ss (setq i (1- i))))
       (vla-put-TextRotation (vlax-ename->vla-object sset) ang)
    )
    (princ)
 )
 (princ)
)

Link to comment
Share on other sites

No one huh? :) I am really stumped on this one, any help would be greatly appreciated.

 

Thanks in advance...

I would just add the L filter with ssget and then put the code after your create the multileader. Ie:
 (setq ss (ssget "_L"))

instead of

(setq ss (ssget '((0 . "MULTILEADER))))

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...