Cylis0509 发表于 2022-7-5 18:11:54

Combining two LISP Routines -

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/08www.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 leaderleader2        (entget (car leader))pt1        (dxf 10 leader2)                ; get first point of leaderlayer         (dxf 8 leader2)                        ; get layer of leadermtext        (entsel "\nPick Text")        ; pick textmtext2        (entget (car mtext))pt2        (dxf 10 mtext2)                ; get point of texttext        (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))

Cylis0509 发表于 2022-7-5 18:39:39

No one huh?I am really stumped on this one, any help would be greatly appreciated.
 
Thanks in advance...

broncos15 发表于 2022-7-5 18:42:15

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))))

Cylis0509 发表于 2022-7-5 19:11:21

So I did your suggestion and it seems to be working. I swear I tried that already, very strange. But thank you very much!!

broncos15 发表于 2022-7-5 19:15:30

No worries, I'm glad I could help.
页: [1]
查看完整版本: Combining two LISP Routines -