Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Toolbar Button Command pause?

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
178 Views, 3 Replies

Toolbar Button Command pause?

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.
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

You might browse the Customer Files for Eric's AutoLay2.lsp. Does all that
and more.

-Jason


"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.
>
>
Message 3 of 4
Anonymous
in reply to: Anonymous

I think your problem is with the ^C^C in front of the dimlinear command and
the (cmdwait). If you issue a command in autolisp, it will either pause on
its own ( I think) or you can enter a series of \ 's or pause to allow user
input. The help can explain it better than I can.
We use a similar system to change layers for graphic block inserts and text
and then change back to the previous layer.

Dave Alexander

"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.
>
>
Message 4 of 4
Anonymous
in reply to: Anonymous

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.
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost