乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 57|回复: 15

[编程交流] Create Last Select & Previous

[复制链接]

14

主题

75

帖子

61

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
70
发表于 2022-7-5 17:55:33 | 显示全部楼层 |阅读模式
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:
 
 
  1. (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".
回复

使用道具 举报

17

主题

1274

帖子

25

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
260
发表于 2022-7-5 18:00:02 | 显示全部楼层
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.
回复

使用道具 举报

14

主题

75

帖子

61

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
70
发表于 2022-7-5 18:04:32 | 显示全部楼层
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.~
185535saaa9b99nnagg85h.jpg
回复

使用道具 举报

14

主题

75

帖子

61

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
70
发表于 2022-7-5 18:08:48 | 显示全部楼层
Somebody help.. !
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-5 18:13:16 | 显示全部楼层
UnTested
 
  1. (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))
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 18:17:03 | 显示全部楼层
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...
 
  1. (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))
回复

使用道具 举报

26

主题

1495

帖子

20

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
118
发表于 2022-7-5 18:19:40 | 显示全部楼层
Could be.  Maybe we'll find out
回复

使用道具 举报

17

主题

1274

帖子

25

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
260
发表于 2022-7-5 18:27:26 | 显示全部楼层
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?
回复

使用道具 举报

14

主题

75

帖子

61

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
70
发表于 2022-7-5 18:29:51 | 显示全部楼层
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.~
回复

使用道具 举报

17

主题

1274

帖子

25

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
260
发表于 2022-7-5 18:34:31 | 显示全部楼层
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.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-12 23:45 , Processed in 0.744828 second(s), 74 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表