oldsoftboss Posted October 9, 2010 Share Posted October 9, 2010 Hi all, I have a macro ^C^C^P(if (= C:FLXDCT nil)(load (strcat dct_drltr "/dct10/flxdct")))(princ) ^PFLXDCT that runs from a click on on an icon in the toolbar. I would like to call this from a keyboard shortcut - say N - (doesn't seem to be used for any thing else). Ideally I would like to tag this macro to the end of an AutoLisp, but that may be a task for another day. Have played around with customising keyboard shortcuts in the CUI but they all seem to require the shift or ctrl key combinations. Any feedback would be greatly appriciated. Dave Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 9, 2010 Share Posted October 9, 2010 Easiest way I can see: (defun c:n nil (or c:flxdct (load (strcat dct_drltr "/dct10/flxdct") nil)) (if c:flxdct (c:flxdct)) ) Quote Link to comment Share on other sites More sharing options...
oldsoftboss Posted October 10, 2010 Author Share Posted October 10, 2010 Once again Lee Mac - works a treat. Thankyou How would I go tagging to the end of this lisp? (defun c:FF (/ *error* LastEntity OldLayoer pt eLast ent) ;; (defun *error* ( msg ) (and OldLayer (setvar "CLAYER" OldLayer)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (setq LastEntity (entlast) OldLayer (getvar "CLAYER")) (or (tblsearch "LAYER" "flex-cr") (command "_.-layer" "_M" "flex-cr" "")) ;; (setvar 'filletrad (cond ((getdist (strcat "\nSpecify radius of flex bends <" (rtos (getvar 'filletrad)) ">: "))) ((getvar 'filletrad)) ) ) (if (setq pt (getpoint "\nSpecify start point: ")) (progn ; (setq eLast (entlast)) (setvar "CLAYER" "flex-cr") (command "_.pline" "_non" pt) (while (= 1 (logand (getvar 'cmdactive) 1)) (princ "\nSpecify next point: ") (command PAUSE) ) (or (equal eLast (setq ent (entlast))) (command "_.fillet" "_P" ent) ) ) ) (setvar "CLAYER" OldLayer) (princ) ) . This lisp creates the flex line. The n lisp puts a zig-zaggy line along it. It would be great to have this all in one hit. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 10, 2010 Share Posted October 10, 2010 I thought I recognised it http://www.cadtutor.net/forum/showthread.php?44009-Macros&p=327191&viewfull=1#post327191 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 10, 2010 Share Posted October 10, 2010 I suppose the easiest way would be something like this: (defun c:FF ( / *error* LastEntity OldLayoer pt ent ) (defun *error* ( msg ) (and OldLayer (setvar "CLAYER" OldLayer)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ) ) (setq LastEntity (entlast) OldLayer (getvar "CLAYER")) (or (tblsearch "LAYER" "flex-cr") (entmake (list (cons 0 "LAYER") (cons 100 "AcDbSymbolTableRecord") (cons 100 "AcDbLayerTableRecord") (cons 2 "flex-cr") (cons 70 0) ) ) ) (setvar 'filletrad (cond ( (getdist (strcat "\nSpecify radius of flex bends <" (rtos (getvar 'filletrad)) ">: ")) ) ( (getvar 'filletrad) ) ) ) (if (setq pt (getpoint "\nSpecify start point: ")) (progn (setvar "CLAYER" "flex-cr") (command "_.pline" "_non" pt) (while (= 1 (logand (getvar 'cmdactive) 1)) (princ "\nSpecify next point: ") (command pause) ) (or (equal LastEntity (setq ent (entlast))) (command "_.fillet" "_P" ent) ) ) ) (setvar "CLAYER" OldLayer) (princ) (or c:flxdct (load (strcat dct_drltr "/dct10/flxdct") nil)) (if c:flxdct (c:flxdct)) ) Quote Link to comment Share on other sites More sharing options...
oldsoftboss Posted October 11, 2010 Author Share Posted October 11, 2010 Yet again you have come to the rescue. Thankyou I was trying to add the function at the bottom of the code, then call the n function after the other lisp finished, but just kept getting an error no matter which way I tried it. Who would of thought of simply adding the code to the bottom. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 11, 2010 Share Posted October 11, 2010 Well, its not the ideal way to approach it, but I don't have the other code to incorporate it. As long as it works I suppose 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.