Jump to content
harrison-matt

Two questions that have not been asked often, maybe...

Recommended Posts

harrison-matt

All,

 

I am inquiring about how to add the ' apostrophe function to my programs.

And how to have your ssget recognize objects selected prior to command start.

 

Any thoughts?

 

Kind Regards,

 

Matt

Share this post


Link to post
Share on other sites
Ahankhah
how to have your ssget recognize objects selected prior to command start.

 

(setvar 'Pickfirst 1)(ssget "_I" )

Share this post


Link to post
Share on other sites
Ahankhah
I am inquiring about how to add the ' apostrophe function to my programs.

Can you explain more clearly about your aim?

Share this post


Link to post
Share on other sites
alanjt

By apostrophe, I'm assuming you mean running the command transparently.

If so, any LISP routine can be executed transparently IF and on IF it does NOT have any command calls.

 

eg.

(defun c:L0 (/ ss i)
 (if (setq ss (ssget "_:L"))
   (repeat (setq i (sslength ss))
     (entmod (list '(8 . "0") (cons -1 (ssname ss (setq i (1- i))))))
   )
 )
 (princ)
)

 

If you notice, this can be executed transparently by typing 'L0 at any time AND if objects are selected before the routine is executed, it will process said objects, thus suppressing the prompt to select objects.

Share this post


Link to post
Share on other sites
Lee Mac

ssget will detect an existing selection, regardless of whether the Implied "_I" mode string is used.

 

As for the apostrophe, I'm unsure as to whether you are referring to marking expressions as literals or running a function transparently within a command. If it is the former, read this:

http://www.cadtutor.net/forum/showpost.php?p=258390&postcount=20

 

Lee

Share this post


Link to post
Share on other sites
harrison-matt
ssget will detect an existing selection, regardless of whether the Implied "_I" mode string is used.

 

I use ssget in the majority of my commands and if i have a selection set prior to launching the command it does not recognize the set.

 

Matt

Share this post


Link to post
Share on other sites
alanjt

Do you have a command call before the ssget call? Also, check our pickfirst variable.

Edited by alanjt

Share this post


Link to post
Share on other sites
Ahankhah
ssget will detect an existing selection, regardless of whether the Implied "_I" mode string is used.]

 

Lee

 

You are right Lee, just to add some necessry explanations:

1- If Pickfirst system variable is set to 1, (ssget) detects existing selection.

2- If Pickfirst is set to 0, (ssget) prompts user to select desired objects.

 

So what is the task of "_I"? I think NOTHING.

Share this post


Link to post
Share on other sites
Lee Mac
So what is the task of "_I"? I think NOTHING.

 

Perhaps for when PICKFIRST is set to 0... I wouldn't know, I always have it set to 1.

Share this post


Link to post
Share on other sites
Ahankhah
Perhaps for when PICKFIRST is set to 0... I wouldn't know, I always have it set to 1.

 

I tested that. It returnes a value and doesn't wait for user input or selection. This is the differnce of (ssget "_I") with (ssget).

 

Pickfirst=0, a selection set exists: (ssget "_I") returns nil

Pickfirst=1, no selection set exists: (ssget "_I") returns nil

Pickfirst=1, a selection set exists: (ssget "_I") returns

Pickfirst=1, no selection set exists: (ssget "_I") returns nil

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×