pixel8er Posted August 31, 2013 Share Posted August 31, 2013 Hi all I'm trying to work out how to do this - but the kicker is it's for AutoCAd Mac - so no visual lisp. I want to use the dimscale to set the mleader scale. This is what I have so far: (defun c:MLP () (setvar "cmdecho" 0) (setvar "dimscale" (/ 1.0 (getvar "CANNOSCALEVALUE"))) (cond (= (getvar 'dimscale) 1) (= (getvar 'dimscale) 2) (= (getvar 'dimscale) 5) (= (getvar 'dimscale) 10) (= (getvar 'dimscale) 20) (= (getvar 'dimscale) 25) (= (getvar 'dimscale) 50) (= (getvar 'dimscale) 100) (= (getvar 'dimscale) 200) (= (getvar 'dimscale) 250) (= (getvar 'dimscale) 500) (= (getvar 'dimscale) 1000) (= (getvar 'dimscale) 2000) (= (getvar 'dimscale) 2500) (= (getvar 'dimscale) 5000) (= (getvar 'dimscale) 10000) ) (command "cmleaderstyle" "standard") (command "-layer" "Make" "PL-TEXT-LEAD" "") (prompt "\n Please pick your start point for MultiLeaderPlus ") (setvar "mleaderscale" (* 1.0(getvar "dimscale" "")) (initdia) (command "mleader" "" pause) (setvar "cmdecho" 1) (princ) ) I've worked out by process of elimination that there is a problem with this line of code - though there may be more... (setvar "mleaderscale" (* 1.0(getvar "dimscale" "")) Does anyone know if this is even possible? I've read a lot of posts from people saying it's not possible without visual lisp. Regards Paul Quote Link to comment Share on other sites More sharing options...
jdiala Posted August 31, 2013 Share Posted August 31, 2013 (defun c:MLP (/ oldcmd oldcmls oldlay oldmls *error*) (defun *error* (msg) (setvar 'cmleaderstyle oldcmls) (setvar 'clayer oldlay) (setvar 'mleaderscale oldmls) (setvar "cmdecho" oldcmd) (princ msg)(princ) ) (setq oldcmd (getvar 'cmdecho) oldcmls (getvar 'cmleaderstyle) oldlay (getvar 'clayer) oldmls (getvar 'mleaderscale) ) (setvar "cmdecho" 0) (setvar "cmleaderstyle" "standard") (if (not (tblsearch "LAYER" "PL-TEXT-LEAD")) (command "-layer" "Make" "PL-TEXT-LEAD" "") ) (setvar 'clayer "PL-TEXT-LEAD") (setvar "mleaderscale" (/ 1.0 (getvar "CANNOSCALEVALUE"))) (initcommandversion 2) (princ "\n Please pick your start point for MultiLeaderPlus : ") (command "mleader") (while (> (logand (getvar "CMDACTIVE") 0) 1) (command pause ) ) (setvar 'cmleaderstyle oldcmls) (setvar 'clayer oldlay) (setvar 'mleaderscale oldmls) (setvar "cmdecho" oldcmd) (princ)) Quote Link to comment Share on other sites More sharing options...
pixel8er Posted September 1, 2013 Author Share Posted September 1, 2013 Hi jdiala Thanks so much for your response. Sorry for the late reply but I missed your posting - was fathers day here today. Your code works beautifully - and is more concise than mine too. That's not to say I understand what all your code does. Thanks again! Paul Quote Link to comment Share on other sites More sharing options...
jpcadconsulting Posted May 30, 2018 Share Posted May 30, 2018 Hey Jdiala, This is great! I've been looking for a way to insert mleaders based on the scale of INSUNITS (so I don't need to maintain multiple mleader styles for inches, feet, Meters, MM etc.). I've modified the code you posted to do that, except when an annotative multileader style is current (as it needs to be for this office) you cannot set MLEADERSCALE to anything but 1. Any thoughts? Thanks for any guidance!!! My edits to the code in red: (defun c:MLP (/ oldcmd oldcmls oldlay oldmls SCL *error*) (defun *error* (msg) (setvar 'cmleaderstyle oldcmls) (setvar 'clayer oldlay) (setvar 'mleaderscale oldmls) (setvar "cmdecho" oldcmd) (princ msg)(princ) ) (setq oldcmd (getvar 'cmdecho) oldcmls (getvar 'cmleaderstyle) oldlay (getvar 'clayer) oldmls (getvar 'mleaderscale) ) [color="red"](cond ((= (getvar "INSUNITS") 1) (setq SCL 1)) ((= (getvar "INSUNITS") 2) (setq SCL 0.08333)) ((= (getvar "INSUNITS") 4) (setq SCL 25.4)) ((= (getvar "INSUNITS") 5) (setq SCL 2.54)) ((= (getvar "INSUNITS") 6) (setq SCL 0.0254)) (t (alert "Current DWG set to non-standard units. Check UNITS settings")) )[/color] (setvar "cmdecho" 0) (setvar "cmleaderstyle" "standard") (if (not (tblsearch "LAYER" "PL-TEXT-LEAD")) (command "-layer" "Make" "PL-TEXT-LEAD" "") ) (setvar 'clayer "PL-TEXT-LEAD") [color="red"](command "mleaderscale" SCL)[/color] (initcommandversion 2) (princ "\n Please pick your start point for MultiLeaderPlus : ") (command "mleader") (while (> (logand (getvar "CMDACTIVE") 0) 1) (command pause ) ) (setvar 'cmleaderstyle oldcmls) (setvar 'clayer oldlay) (setvar 'mleaderscale oldmls) (setvar "cmdecho" oldcmd) (princ)) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.