eric_monceaux Posted November 13, 2009 Author Share Posted November 13, 2009 OK. I do believe it is good to go now. Thanks again alanjt and StykFacE...you guys are always helpful! Just for S&G's I have posted the final LSP. Considering what I have seen, this is nothing compaired to where I hope to eventually be, but it will do for now. ;;; ;;; ;;;North American Stone Drawing Set Up ;;;Assisted ;;;alanjt and StykFacE assisted in the code writing ;;;--------------------- ;;;ENVIRONMENT (setvar "CMDECHO" 0) (command "graphscr") (command "base" "0,0,0") (setvar "osmode" 6255) (command "-INSERT" "Z_STD_SETUP=" nil) (command "ERASE" "L" "") (command "-STYLE" "SHEET" "tahoma.TTF" "0" "1" "0" "N" "N") (if (tblsearch "layer" "0-STONE") (command "-LAYER" "_T" "0-STONE" "S" "0-STONE" "") (command "_.-layer" "_m" "0-STONE" "" "") ) (and (tblsearch "dimstyle" "24") (command "-DIMSTYLE" "R" "24") ) (command "LTSCALE" "6") (command "PDMODE" "3") (command "PDSIZE" "0") (command "-HATCH" "P" "AR-SAND" "0.25" "0" "") (command "INSUNITS" "1") (command "LUNITS" "4") (command "LUPREC" "4") (command "AUNITS" "0") (command "AUPREC" "0") (command "VIEWRES" "Y""20000") (command "SPLINESEGS" "20") (command "FACETRES" "10") (command "ISOLINES" "20") (command "grid" "off") (setvar "CMDECHO" 1);;;--------------------- Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 13, 2009 Share Posted November 13, 2009 Get rid of this: (command "ERASE" "L" "") Most of what you have in commands, you can set with (setvar "units" #) Quote Link to comment Share on other sites More sharing options...
eric_monceaux Posted November 13, 2009 Author Share Posted November 13, 2009 Oops...can't believe I missed that. What is the difference between using command vs. setvar? Speaking of that...one of the reasons I really want to learn LISP is because it has more capabilities that standard macros. Granted I can write some pretty complicated macros, its process is more limited. My plan is to learn how to change my macros into LISP, and then see what I can do to make them better. Example: *^C^Cmline;st;standard;s;.25;j;z;\\;xplode;l;;la;mortar; I know it's simple, but it helped get rid of a severly redundant task. What I dislike about macros (until I discovered custom Keybord Shortcuts) was that I only know how to make them buttons. I consider myself a bit old school, so typing comes more natural to me than icons. Anyway, back to my question...what would do to turn this one into a lisp? I am sure there is a better way....like having the lisp generate a line on a specified layer offset from the users center pick point. Or, you might say, "why not just use mline?" Our use for it turns it into more of a chorus task... Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 13, 2009 Share Posted November 13, 2009 Much faster, cleaner, less typing, no echo to commandline. Test to show difference. Command: (benchmark '( (command "clayer" "alan") (setvar "clayer" "alan") )) Elapsed milliseconds / relative speed for 2048 iteration(s): (SETVAR "clayer" "alan")......1266 / 4.43 <fastest> (COMMAND "clayer" "alan").....5609 / 1 <slowest> Quote Link to comment Share on other sites More sharing options...
tzframpton Posted November 13, 2009 Share Posted November 13, 2009 What is the difference between using command vs. setvar? command executes a native AutoCAD command. setvar just sets a drawing and/or registry variable. *EDIT* and once again I've been outdone by Alan. hehe I like his explanation better. Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 13, 2009 Share Posted November 13, 2009 command executes a native AutoCAD command. setvar just sets a drawing and/or registry variable. *EDIT* and once again I've been outdone by Alan. hehe I like his explanation better. Yours was a more educated response. With our responses combined, we formed Captain Autocad. Dork test achievement if you get that reference. LoL It depresses me that I made it. Quote Link to comment Share on other sites More sharing options...
eric_monceaux Posted November 13, 2009 Author Share Posted November 13, 2009 Better Captain AutoCAD than Captain Planet...I don't think AutoCAD has any....heart power...lol. So, what would be the best way to write that macro into a LISP? And I am all kinds of dork. Cool....but still dork. Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 13, 2009 Share Posted November 13, 2009 Better Captain AutoCAD than Captain Planet...I don't think AutoCAD has any....heart power...lol. So, what would be the best way to write that macro into a LISP? And I am all kinds of dork. Cool....but still dork. DORK!!! (defun c:TEst (/ #Entlast) (setq #Entlast (entlast)) (command "_.mline" "_st" "Standard" "_s" 0.25 "_j" "_z") (while (> (getvar 'cmdactive) 0) (princ "\nSpecify next point: ") (command PAUSE) ) ;_ while (and (not (eq #Entlast (entlast))) (or (tblsearch "layer" "Mortar") (alert "Mortar layer does not exist!")) (progn (command "_.change" (entlast) "" "_p" "_la" "Mortar" "") (command "_.explode" (entlast)) ) ;_ progn ) ;_ and (princ) ) ;_ defun Had to ditch the use of XPlode, since it's not a core command. Quote Link to comment Share on other sites More sharing options...
eric_monceaux Posted November 16, 2009 Author Share Posted November 16, 2009 Don't get me started on the dorkiness stuff I know! I'll give you points if you know about the fizz of Cuckoo Cola... Anywho, I am gonna pick this LISP apart....for learning purposes. (hope you aren't tired of me yet) Firstly, it doesn't need to be a continous command. It just requires the user to pick two points and done. So, attempting to find that in the code...entlast tells CAD to repeat the command? I get the flow of what you have written, however some of the symbol usage is confusing...i.e. # (> ) ;_ 'cmdactive is saying to perform the following script on the command line only? Other than that, I am a bit lost, but I think I have a window of opportunity today to run through some tutorials. Thanks again! 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.