Hello,
I want to create a simple macro (user button in user toolbar in CUI):
If nothing is selected, ask user to select and perform action (scale x2).
If something is selected, perform action (scale x2).
In otherwords, check Pickfirst selection set. But I can't get it to work.
$(if,$(=,1,0),T,F) would return F, so I tried
...$(if,$(=,$(ssget,"_I"),nil...
But that's not correct.
How would I use DIESEL in a macro to use the pickfirst selection set, or if that is nil/empty, ask the user to select objects?
Thank you.
(I hope this is the correct forum for this question.)
Solved! Go to Solution.
Solved by christopher.l.evans. Go to Solution.
(setq ss (if (= nil (cadr (ssgetfirst))) (ssget) (cadr (ssgetfirst)) ) )
selection set now stored in variable "ss"
write your balance code in lisp file and then load the lisp file in the button's macro using
(load "c:\\your_lisp_file.lsp")
This is what I am using. I don't to write directly in DIESEL
@aliensinearth wrote:(setq ss (if (= nil (cadr (ssgetfirst))) (ssget) (cadr (ssgetfirst)) ) )
The above could be written as:
(setq ss (cond ((cadr (ssgetfirst))) ((ssget))))
@aliensinearth wrote:You are brilliant Lee_Mac.
That is very kind of you aliensinearth, thanks
Hello,
That is a nice solution. However, I was curious if it could be done in a macro with DIESEL.
Ty for your reply.
@Ertqwa wrote:That is a nice solution. However, I was curious if it could be done in a macro with DIESEL.
I very much doubt that it would be possible using DIESEL, as DIESEL has a very limited set of functions.
Is there a specific reason it must be in diesel? If you look at the scale command while you're in cui it shows
$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_scale,^C^C_scale)
maybe that will give you a starting point.
Alternatively you could just create a new toolbar, make a button for it and add a new command with the following macro and it will do what I believe you're asking with something selected or not. It pauses for user input for base point.
^C^Cscale \ \2;
Only thing is that it's not in diesel.