I used this lisp routine to help keep my button programming on the smaller
size. Just make sure you have this lisp loaded (I would put in the mnl file
of the menu you use that will use the toolbar buttons. The code on the
button needs to look like this.
(laysave "layer you want" "command to run")
so to do what you show in your post the button would look like
[_Button("Linear Dimension",
"ICON_16_DIMLIN","ICON_16_DIMLIN")]^C^C^P(laysave "g-dim" "_dimlinear")
I don't remember what the ^P does so I'm not sure if you want it or not 🙂
the known (and wanted) limitation to this routine is it won't create the
layer. If the layer is not there it uses the current layer. the reason for
this is sometimes I want to issue the button command using a clients layers
rather than our layers. This requires the user to be sure the layers they
want are loaded. this routine should work with most autocad commands, i.e.
hatch, dim..., line, pline, mtext, etc.
Stephen Damon wrote in message
news:25AF264D26FBE962B4F354B3847636C8@in.WebX.maYIadrTaRb...
> We are trying to get a toolbar button to look at the existing layer then
> temporarily set to a standard layer for dimensioning then let you do the
> dimension and then reset to the original layer. We already have the way
we
> think to do it laid out but I am running into problems. Here is the way I
> have it laid out right now: [_Button("Linear Dimension", "ICON_16_DIMLIN",
> "ICON_16_DIMLIN")]^C^C^P(setq #exlyr (getvar "clayer")) (if (null
(tblsearch
> "layer" "g-dim")) (command "-layer" "m" "g-dim" "c" "7" "" "") (command
> "-layer" "s" "g-dim" "" "")) ^C^C_dimlinear (cmdWait)(setvar "clayer"
> #exlyr). I think there is something wrong with the (CMDWAIT) statement if
> one even exists? All of the code in the beginning works ok up until I get
> to the dimlinear command. What I need if for the button to pause at the
> dimlinear command and let me put the dimension in on the G-DIM layer then
> set it back to the original current layer. Can anyone help me I have been
> pulling out what is left of my hair over this. Thanks in advance for any
> help. We are using LDDr2i.
>
>