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

DIESEL MACRO - Select

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
Ertqwa
1266 Views, 8 Replies

DIESEL MACRO - Select

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

8 REPLIES 8
Message 2 of 9
aliensinearth
in reply to: Ertqwa

(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

Message 3 of 9
Lee_Mac
in reply to: aliensinearth


@aliensinearth wrote:
(setq	ss (if (= nil (cadr (ssgetfirst)))
	     (ssget)
	     (cadr (ssgetfirst))
	   )
)

The above could be written as:

 

(setq ss (cond ((cadr (ssgetfirst))) ((ssget))))

 

Message 4 of 9
aliensinearth
in reply to: Ertqwa

You are brilliant Lee_Mac.

 

Message 5 of 9
Lee_Mac
in reply to: aliensinearth


@aliensinearth wrote:

You are brilliant Lee_Mac.


That is very kind of you aliensinearth, thanks Smiley Happy

Message 6 of 9
Ertqwa
in reply to: aliensinearth

Hello,

 

That is a nice solution. However, I was curious if it could be done in a macro with DIESEL.

 

Ty for your reply.

 

 

Message 7 of 9
Lee_Mac
in reply to: Ertqwa


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

Message 8 of 9

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.

Message 9 of 9

Ty, that was helpfull.

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

Post to forums  

Autodesk Design & Make Report

”Boost