Benjo Posted February 4, 2011 Posted February 4, 2011 Hi, I have created a macro command for my "dimaligned" so that every time i click on macro button and create a dimaligned it turns onto the good layers and i wanted to know if it is possible to remplace or create another dimaligned shortcut command (dal) by that macro command that i created. So everytime i would type Dimaligned or dal on the command prompts it would be my macro and not the standart dimaligned command. Is it possible? Heres my macro, ^C^C_-layer;_make;A-ANNO-DIMS;;_dimaligned; Thanks! Quote
Glen1980 Posted February 4, 2011 Posted February 4, 2011 Personally I have put my macro onto the toolpalette. Maybe if you amend the acad(lt)pgp file (doc settings/user/application data/Autoesk/R15/enu/support to put DAL in the user defined areas and put somehting else in its place in the default commands. Back up your original pgp file though Quote
Benjo Posted February 4, 2011 Author Posted February 4, 2011 I put my macro on a toolpalette too but i would prefer to type something on the command prompt to use that macro. i think i need a list routine but i dont know how to use or creat lisp Quote
BIGAL Posted February 6, 2011 Posted February 6, 2011 Put this in acaddoc.lsp it will load on start up its the same as the macro is typed (defun c:dal () (command "layer" "M" "A-ANNO-DIMS" "" "" "dimaligned") ) Quote
Benjo Posted February 8, 2011 Author Posted February 8, 2011 Awesome! it work perfect Thx BIGAL! Quote
alanjt Posted February 8, 2011 Posted February 8, 2011 If you create one dimension and drag it into Tool Palettes, when you click on that palette button, it will temporary set the correct layer and dimstyle and execute the dimension command. Quote
Benjo Posted February 9, 2011 Author Posted February 9, 2011 How can i modify this lisp so that at the end of the command it return to the layer 0? (defun c:dal () (command "layer" "M" "A-ANNO-DIMS" "" "" "dimaligned") ) Quote
alanjt Posted February 9, 2011 Posted February 9, 2011 Here's an example I use for labeling the distance from a building corner to a perpendicular point on the boundary (when doing boundary surveys). (defun c:BB (/ *error* el ov vl p1 p2 e) ;; building offset dimension (picks endpoint then perpendicular on property line ;; Alan J. Thompson (defun *error* (msg) (and ov (mapcar 'setvar vl ov)) (if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,"))) (princ (strcat "\nError: " msg)) ) ) (setq el (entlast)) (setq ov (mapcar 'getvar (setq vl '("CMDECHO" "OSMODE")))) (mapcar 'setvar vl '(0 1)) (if (and (setq p1 (getpoint "\nSpecify building corner: ")) (setvar 'osmode 128) (setq p2 (getpoint p1 "\nSpecify boundary line: ")) (vl-cmdf "_.dimaligned" "_non" p1 "_non" p2 "_non" PAUSE) (not (eq el (setq e (entlast)))) ) (progn (vla-put-color (vla-add (vla-get-layers (cond (*AcadDoc*) ((setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object) ) ) ) ) ) "V-DIMS" ) 10 ) (vla-put-layer (vlax-ename->vla-object e) "V-DIMS") ) ) (*error* nil) (princ) ) Quote
alanjt Posted February 9, 2011 Posted February 9, 2011 However, this would also work... (defun c:dal (/) (command "layer" "M" "A-ANNO-DIMS" "" "" "dimaligned") (while (eq 1 (logand 1 (getvar 'cmdactive))) (command PAUSE)) (setvar 'clayer "0") ) Quote
Benjo Posted February 9, 2011 Author Posted February 9, 2011 Nice! exactly what i wanted! Thx alanjt! where you learn all that lisp thing? I got another question if you can help, it would be very appreciated! i have a lisp that create hatch on the layer i always use for hatch but i would like to see the dialog box not question on the command prompt and i would like that at the end of the command its return to the layer 0 automaticaly here the lisp (defun c:H () (command "layer" "M" "A-HATC" "" "" "hatch") ) Thx again! Quote
alanjt Posted February 9, 2011 Posted February 9, 2011 (initdia) will give you the dialog, but since you have several of these it really seems like you need a command reactor. Quote
BIGAL Posted February 10, 2011 Posted February 10, 2011 A quick lisp lesson first of all its better to have a drawing template with all your layers that you may want to use already existing. the line (setvar "clayer" "0") means set the current layer to layer 0 or (setvar "clayer" "myhatch lay") for existing layer called myhatch lay one used all the time in nearly every program (setq oldlay (getvar "clayer")) at end of code (setvar "clayer" "oldlay") re one type of hatch same thing write down the commands but using "-hatch" "P" for pattern name, then scale then angle etc if you want an internal point then add (setq pt1 (getpoint "\nPick hatch internal pt")) create a shortand maybe h1 h2 h3 etc for hatch type 1 2 3 get stuck post here for help. I would drag out the help section and have a look at "down the garden path" the example that comes with Autocad. Quote
mdbdesign Posted February 10, 2011 Posted February 10, 2011 Thx alanjt! where you learn all that lisp thing? C'mon Alan, I want to know too... Quote
alanjt Posted February 10, 2011 Posted February 10, 2011 C'mon Alan, I want to know too... Hanging out in the forums, asking questions and practice. 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.