mitre962 Posted February 15, 2017 Posted February 15, 2017 Please help! New to writing LISP's, never used cond before. I'm trying to create a LISP which inserts a block whom's insertion point is determined using a cond statement which evaulates the dwgname variable and returns a value for the insertion coordinates depending on what the dwgname is. If neither are true, it asks for the insertion point to be picked. Please note that stamp.dwg is in my support path so should be able to be located by AutoCAD. Here is what I have... (defun c:insertstamp (x y filename) (setq filename (getvar dwgname)) (stamp:getcoord) (defun stamp:getcoord () (cond ( (= filename A1L.dwg) ((setq x (778.5)) (setq y (204.6716)) (stamp:insert) ) ( (= filename A1P.dwg) ((setq x (531.5)) (setq y (204.6716)) (stamp:insert) ) (t (setq ins (getpoint "Pick Point to Label: ")) (stamp:insert1) ) ) ) (defun stamp:insert () (command _insert stamp.dwg (x,y)) ) (defun stamp:insert1 () (command _insert stamp.dwg ins) ) ) THANKYOU! Quote
mitre962 Posted February 15, 2017 Author Posted February 15, 2017 EDIT: Oops, just noticed the text "Pick point to label: " should read "Pick Insertion Point" Quote
David Bethel Posted February 15, 2017 Posted February 15, 2017 Try using quotes on drawing name "A1L.DWG" Also I would suggest testing both names in upper case (eq (strcase filename) (strcase "A1L.dwg")) (defun stamp:insert () (command "_.insert" "stamp" (list x y)) (while (> (getvar "CMDACTIVE") 0) (command "")) ) -David Quote
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.