Koalbee Posted February 7, 2011 Share Posted February 7, 2011 Hi I'm new to writing lisp. How can I get the lisp to ascertain the current dimscale and insert the block I am inserting as a multiple of the dimscale ? Here is the current lisp as it stands: (defun c:2011-insert-sm () (setq clay (getvar "clayer")) (setq *ERROR* MyError) (command "-layer" "m" "025txt" "") (command "insert" "Dynamic_Section_Mark-2009" pause "1" 1 0) (setvar "clayer" clay) (princ) ) Thanks in advance Koal Bee Quote Link to comment Share on other sites More sharing options...
ReMark Posted February 7, 2011 Share Posted February 7, 2011 Would the multiple be static or variable? Quote Link to comment Share on other sites More sharing options...
Koalbee Posted February 7, 2011 Author Share Posted February 7, 2011 Hi The multiple would just be the current dimscale at the time .... so would need to be picked up by looking at the dimscale each time the command is run. thanks Quote Link to comment Share on other sites More sharing options...
ReMark Posted February 7, 2011 Share Posted February 7, 2011 (getvar "dimscale")? Quote Link to comment Share on other sites More sharing options...
Koalbee Posted February 7, 2011 Author Share Posted February 7, 2011 Sorry Remark .. do I add this in the lisp ? If so how do I put in the instruction to multiply by the dimscale. As I said, it's all new to me and the current lisp has been copied from another file Thanks again Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 7, 2011 Share Posted February 7, 2011 (edited) Check this out Buddy . (defun c:2011-insert-sm (/ clay *error* DScale) (setq clay (getvar "clayer")) (setq *ERROR* MyError) (command "_.-layer" "m" "025txt" "") (while (setq DScale (getint "\n Enter scale factor for Block Insertion :")) (command "_.-insert" "Dynamic_Section_Mark-2009" pause DScale DScale 0) ) (setvar "clayer" clay) (princ) ) Tharwat Edited February 7, 2011 by Tharwat Y stretch for block modified Quote Link to comment Share on other sites More sharing options...
Smirnoff Posted February 7, 2011 Share Posted February 7, 2011 Is this you need? I just add some lines, some remove and write relevant error handler. (defun c:2011-insert-sm (/ clay cScl *error*) (defun *error*(msg) (setvar "clayer" clay) (setvar "CMDECHO" 1) (princ) ); end of *error* (setq clay (getvar "clayer") cScl(getvar "DIMSCALE") ); end setq (princ(strcat "\nCurrent DIMSCALE = " (rtos cScl 2 2))) (setvar "CMDECHO" 0) (command "-layer" "m" "025txt" "") (command "-insert" "Dynamic_Section_Mark-2009" "_s" cScl pause 0) (setvar "CMDECHO" 1) (setvar "clayer" clay) (princ) ) Quote Link to comment Share on other sites More sharing options...
Koalbee Posted February 7, 2011 Author Share Posted February 7, 2011 Hi Tharwat - your lisp brings in the block but seems to stretch it one directiom only, does it need to add something added to scale it in all directions ? Smirnoff - your lisp returns the following message : Error: malformed list on input Command: Unknown command "2011-INSERT-SM". Press F1 for help. Thanks for helping guys ... any further ideas ? Koal Bee Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 7, 2011 Share Posted February 7, 2011 Hi Tharwat - your lisp brings in the block but seems to stretch it one directiom only, does it need to add something added to scale it in all directions ? Thanks for helping guys ... any further ideas ? Koal Bee Codes updated Koal Bee Tharwat Quote Link to comment Share on other sites More sharing options...
Smirnoff Posted February 7, 2011 Share Posted February 7, 2011 Smirnoff - your lisp returns the following message :Error: malformed list on input Command: Unknown command "2011-INSERT-SM". Press F1 for help. Thanks for helping guys ... any further ideas ? I think you missed the first or the last bracket in copying. Please try again. Either you have the file there is another code with missed bracket. This code is working. Quote Link to comment Share on other sites More sharing options...
Koalbee Posted February 7, 2011 Author Share Posted February 7, 2011 Smirnoff / Tharwat ...both routines work a treat ..... it was my error ...missing bracket Thank you very much for your help Hopefully I can help you guys out one day ... but I doubt it !! thanks again Koal Bee Quote Link to comment Share on other sites More sharing options...
Tharwat Posted February 7, 2011 Share Posted February 7, 2011 You're welcome anytime Koal. Tharwat Quote Link to comment Share on other sites More sharing options...
Koalbee Posted February 8, 2011 Author Share Posted February 8, 2011 Thanks again ... may have some more stuff requiring your guidance soon 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.