Jump to content

Create Last Select & Previous by LISP. Can be done ???


Recommended Posts

Posted

How to make a simply code and functional with well of the "Select Last and Previous" onto LISP ?

 

I'd tried with two ways advance. That are; I have try with "ActionRecord" to create it but the result it wasn't prefectly or effectively and I was try this methode by a few time repeatly just to looking for a good result but I didn't or get a nothing. The second way what I've tried is I put my code maded by someone I don't remember where I got this from and gave me get a nothing too. Here it is of the code I got from that a somewhere:

 

 


(defun C:Q1 (); create a Selection Set in the SS/PP "system"
 (setq _ssinc_ (if _ssinc_ (1+ _ssinc_) 1))
 (set (read (strcat "_ss" (itoa _ssinc_) "_")) (ssget))
 (prompt (strcat "\nSelection set " (itoa _ssinc_) "."))
 (princ)
); defun

(defun C:Q2 (); select/highlight/grip the latest SS-made set
 (if _ssinc_
   (progn ; then
     (setq _ppinc_ _ssinc_)
     (sssetfirst nil (eval (read (strcat "_ss" (itoa _ppinc_) "_"))))
     (prompt (strcat "\nSelection set " (itoa _ppinc_) "."))
   ); progn
   (alert "Requires selection sets made with SS."); else
 ); if
 (princ)
); defun

(defun C:Q3 ()
 ; select/highlight/grip the SS-made set Prior to the one most
 ; recently called for [= PP if used without using PP first]
 (if _ssinc_
   (progn ; then
     (setq _ppinc_ (if _ppinc_ (1- _ppinc_) _ssinc_))
     (if (eval (read (strcat "_ss" (itoa _ppinc_) "_")))
       (sssetfirst nil (eval (read (strcat "_ss" (itoa _ppinc_) "_")))); then
       (progn ; else
         (alert "No prior selection set available.")
         (setq _ppinc_ (1+ _ppinc_))
         (sssetfirst nil (eval (read (strcat "_ss" (itoa _ppinc_) "_"))))
       ); progn
     ); if
     (prompt (strcat "\nSelection set " (itoa _ppinc_) "."))
   ); progn
   (alert "Requires selection sets made with SS."); else
 ); if
 (princ)
); defun

(defun C:Q4 ()
 ; select/highlight/grip the Next SS-made set after the one most
 ; recently called for [= PP if used without using PP first]
 (if _ssinc_
   (progn ; then
     (setq _ppinc_ (if _ppinc_ (1+ _ppinc_) _ssinc_))
     (if (eval (read (strcat "_ss" (itoa _ppinc_) "_")))
       (sssetfirst nil (eval (read (strcat "_ss" (itoa _ppinc_) "_")))); then
       (progn ; else
         (alert "No further selection set available.")
         (setq _ppinc_ (1- _ppinc_))
         (sssetfirst nil (eval (read (strcat "_ss" (itoa _ppinc_) "_"))))
       ); progn
     ); if
     (prompt (strcat "\nSelection set " (itoa _ppinc_) "."))
   ); progn
   (alert "Requires selection sets made with SS."); else
 ); if
 (princ)
); defun 

 

 

That code gave a function of a "last or forward or backward" of the history of my selection I've compromise before with "Q1" before I can get use them or those feature "last, next and previous my selection".

  • Replies 21
  • Created
  • Last Reply

Top Posters In This Topic

  • Deby Ferdian

    8

  • tombu

    5

  • Ahmed_Hisham

    4

  • David Bethel

    2

Posted (edited)

It seems doesn't work for me. why ? where from my fault is ?

 

I try with type "Result" at the command line but seems nothing happen. anything! and I was add new command too into my "CUI" as a suggested by @irneb but it still doesn't work for me. I loaded the "SelResult" from "APPLOAD". Where does this problem come from?

 

I don't understand. if you mind whould you explain this to me @tombu everything of the steps of them step by step. Hopeless! pleasssssse.. ^_^"

 

 

 

 

~.Thanks again and sorry about my words. I am still beginner and I am still also process of learning in english.~

CUI for my SelResult.lsp.jpg

Edited by Deby Ferdian
too many appears of a pict!
Posted

Somebody help.. !

Posted

UnTested

 

(defun c:test (/ s1 s2 s3 i e)
 (setq s1 (ssget "P"))
 (setq s2 (ssget "L"))
 (setq s3 (ssadd))
 (and s1
      (setq i 0)
      (while (setq e (ssname s1 i))
             (ssadd e s3)
             (setq i (1+ i))))
 (and s2
      (setq i 0)
      (while (setq e (ssname s2 i))
             (ssadd e s3)
             (setq i (1+ i))))
(prin1))

Posted

Yes David, I see what you're getting on, but I think OP wanted to select not last entity and previous selection set, but previous selection and new one and make single s3 from them...

 

(defun c:test (/ s1 s2 s3 i e)
 (setq s1 (ssget "_P"))
 (setq s2 (ssget "_:L")) ;;; user is prompted to select objects on unlocked layer(s)...
 (setq s3 (ssadd))
 (and s1
      (setq i 0)
      (while (setq e (ssname s1 i))
             (ssadd e s3)
             (setq i (1+ i))))
 (and s2
      (setq i 0)
      (while (setq e (ssname s2 i))
             (ssadd e s3)
             (setq i (1+ i))))
 (sssetfirst nil s3)
(prin1))

Posted

Could be. Maybe we'll find out 8)

Posted
It seems doesn't work for me. why ? where from my fault is ?

 

I try with type "Result" at the command line but seems nothing happen. anything! and I was add new command too into my "CUI" as a suggested by @irneb but it still doesn't work for me. I loaded the "SelResult" from "APPLOAD". Where does this problem come from?

 

I don't understand. if you mind whould you explain this to me @tombu everything of the steps of them step by step. Hopeless! pleasssssse.. ^_^"

 

 

 

 

~.Thanks again and sorry about my words. I am still beginner and I am still also process of learning in english.~

First it's meant to be called transparently so you need to type "'Result" at the command line when prompted for a selection as shown in the link.

 

Second to keep track of command results it must be loaded before those commands are run. I load the routine in acaddoc.lsp as I don't have much faith in "APPLOAD".

 

Marko Ribar's lisp does combine previous and last selections as you asked. Keep in mind last is the last single object added to the drawing. If you select three objects and copy them the last selection will only include the last of the three objects selected while 'Result would select all three. If none of these solutions is exactly what you're looking for can you explain a situation when you would use this?

Posted (edited)

Sorry still not solve I was load the "selresult.lsp" in acaddoc.lsp as "S::STARTUP" but it still doesn't want work. The cad system in command line said "no result set available" my effort in vain, to no avail. Please help need enlightenment soon! Thx, my appreciate and I was very fortunate if would anyone want to help me be finish!

 

 

 

~.Thanks again and sorry about my words. I am still beginner and I am still also process of learning in english.~

Edited by Deby Ferdian
add the descriptions more!
Posted
Sorry still not solve the cad system in command line said "no result set available" my effort in vain, to no avail. Please help need enlightenment soon!
I assume "no result set available" means you had not previously added any objects in the current drawing session.

 

As an example I used the line command to draw 4 line segments then selected them and copied them. Afterwards I started the move command and used 'Result which offered me the option to enter 0 for the output of the Copy command or 1 for the output of the Line command. I entered 0 and entered again to finish selecting objects then picked the from and to points.

 

Copy from text screen of commands:

Command: _line

Specify first point:

Specify next point or [undo]:

Specify next point or [undo]:

Specify next point or [Close/Undo]:

Specify next point or [Close/Undo]:

Specify next point or [Close/Undo]:

 

Command: Specify opposite corner or [Fence/WPolygon/CPolygon]:

Command:

Command:

Command: _copy 4 found

 

Current settings: Copy mode = Multiple

Specify base point or [Displacement/mOde] :

Specify second point or [Array] :

Specify second point or [Array/Exit/Undo] :

 

Command: M

MOVE

Select objects: 'Result

Which one of these do you want to select? 0-COPY 1-LINE : 0

4 found

 

Select objects:

 

Select objects:

 

Specify base point or [Displacement] :

Specify second point or :

 

If you're still having trouble paste from your text screen where you've drawn something then were unable to select it with 'Result after starting a command that prompts for a selection like Move or Copy.

Posted

YES.. It just happen because of you.. Thank you so much @tombu! it turns out all this time I just do not know how it works! You are my hero! and friends the other...

 

But how to insert or given an aliases command as what I've try on the attach file that I give an above to looking for the solution before these.. I was try assigned "EW & WQ" as a "'result & 'result;0". What do you say ?

Posted

I'm not sure getting any transparent command to work using an aliases the way you want is possible. You can add it to the CUI though.

 

One of 13 Macros in Select menu from my CUIX file:

Name = Added by Previous Commands

Macro = 'Result

 

You've got me thinking about the routine though. When I get time I'm going to try replacing the prompt with a getkword to give me the option to use my mouse. I'll reply here if I do.

Posted (edited)

Yeah..! and I am sorry it's my mistake. I think so mean same as you are though too.. Yes, the onto CUIX I mean exactly right! and I assigned the combine keys too likes; "CTRL+SHIFT+F as a 'Result" and "CTRL+R as a 'Result;0"

 

Oke, @tombu! thank you for your appreciation and have give hard attention to me. Hehe..! ^_^" Thx again and I'll be wait..

Edited by Deby Ferdian
Answer for waitting!
Posted

Now.. I got it. I did! because I have been sucessfully to create it into CUI but there is a one problem I have now. Could it these do with "SELECT" directly than it after a link of history selections are seen in an one action to process together by CUI and/or "'result" of command line ???

Posted

It was very remarkable @tombu! that's what since I mean from the yesterday's. Just that a little bit I have too hard to say that. Because of my language knowledge is what makes me stops there in nowhere in sometimes.. It was very unexpected buildup @tombu! you're one step ahead of my mind..

  • 7 years later...
Posted

Hi @tombu

 

Do you why I receive the below msg while trying to use the lisp with dynamic blocks ?

 

"Which one of these do you want to select? [0-MOVE/1-COPY/2-COPY/3-MOVE/4-COPY/]<0>: 4
; error: bad argument type: lselsetp nil"

 

I am trying to use it but selection doesnt occur 

 

Check my attached video for more clarification

 

Any help will be appreciated 

 

Thanks

Media1.rar

Posted

Which Lisp ?

 

Have a look at my Multi radio Buttons.lsp as a replacement for INITGET method.

Posted

Hi @BIGAL

 

Can you attach your lisp file here to give it a try ?

 

Thanks for your reply

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...