TunzaGibbo Posted December 15, 2017 Share Posted December 15, 2017 (defun c:FilletWeldBottL () (InsertBlockExplode) [color="lime"]; I added this line to call the below function [/color] (setvar "cmleaderstyle" "Fillet Weld Bott L") (command "_mleader") ) The first defun works perfect without the second line. I have added 15 mleader styles (One called "Fillet Weld B-S") to my template drawing with, So now each time I open a new drawing I have all the leader styles available. Unfortunately when I open an older drawing that wasn't created with my current template I don't have those mleader styles. So I thought I would try to get Lisp to help me and came up with the this defun below. I'm trying to get lisp to recognize that if "Fillet Weld B-S" is not present in this drawing the it should load "MW Leader Styles.dwg" It's not happening. Can somebody help with this?? Thanks (defun InsertBlockExplode () (if (= ("mleaderstyle" "Fillet Weld B-S") nil) (command "_.insert" "MW Leader Styles" "0,0,0" 1 0)) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 15, 2017 Share Posted December 15, 2017 Consider the following function to test whether a given MLeader Style is defined within the active drawing: (defun mleaderstyle-p ( mls / dic ) (and (setq dic (dictsearch (namedobjdict) "acad_mleaderstyle")) (dictsearch (cdr (assoc -1 dic)) mls) ) ) In your code: (defun InsertBlockExplode ( ) (if (not (mleaderstyle-p "Fillet Weld B-S")) (command "_.-insert" "MW Leader Styles" nil) ) ) (defun mleaderstyle-p ( mls / dic ) (and (setq dic (dictsearch (namedobjdict) "acad_mleaderstyle")) (dictsearch (cdr (assoc -1 dic)) mls) ) ) Quote Link to comment Share on other sites More sharing options...
TunzaGibbo Posted December 16, 2017 Author Share Posted December 16, 2017 Thank you Lee Very interesting & helpful Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 16, 2017 Share Posted December 16, 2017 You're welcome! 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.