Deby Ferdian Posted March 11, 2016 Posted March 11, 2016 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". Quote
tombu Posted March 11, 2016 Posted March 11, 2016 Not sure what you're trying to do, take a look at: http://forums.augi.com/showthread.php?81175-select-result-lisp-modification#5 The selresult.lsp by Irné Barnard allows you to select objects created by previous commands. It comes in handy more often than you might think. Quote
Deby Ferdian Posted March 12, 2016 Author Posted March 12, 2016 (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.~ Edited March 12, 2016 by Deby Ferdian too many appears of a pict! Quote
David Bethel Posted March 13, 2016 Posted March 13, 2016 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)) Quote
marko_ribar Posted March 13, 2016 Posted March 13, 2016 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)) Quote
tombu Posted March 13, 2016 Posted March 13, 2016 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? Quote
Deby Ferdian Posted March 14, 2016 Author Posted March 14, 2016 (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 March 14, 2016 by Deby Ferdian add the descriptions more! Quote
tombu Posted March 14, 2016 Posted March 14, 2016 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. Quote
Deby Ferdian Posted March 14, 2016 Author Posted March 14, 2016 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 ? Quote
tombu Posted March 14, 2016 Posted March 14, 2016 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. Quote
Deby Ferdian Posted March 14, 2016 Author Posted March 14, 2016 (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 March 14, 2016 by Deby Ferdian Answer for waitting! Quote
Deby Ferdian Posted March 15, 2016 Author Posted March 15, 2016 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 ??? Quote
tombu Posted March 15, 2016 Posted March 15, 2016 For Deby or anyone interested I added a modified version of selresult.lsp by Irné Barnard to http://forums.augi.com/showthread.php?81175-select-result-lisp-modification&p=1310162&viewfull=1#post1310162 Quote
Deby Ferdian Posted March 15, 2016 Author Posted March 15, 2016 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.. Quote
Ahmed_Hisham Posted October 22, 2023 Posted October 22, 2023 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 Quote
BIGAL Posted October 22, 2023 Posted October 22, 2023 Which Lisp ? Have a look at my Multi radio Buttons.lsp as a replacement for INITGET method. Quote
Ahmed_Hisham Posted October 23, 2023 Posted October 23, 2023 Hi @BIGAL Can you attach your lisp file here to give it a try ? Thanks for your reply Quote
BIGAL Posted October 23, 2023 Posted October 23, 2023 This program has examples in top of code.Multi radio buttons.lsp Quote
Recommended Posts
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.