乐筑天下

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

[编程交流] Noob - Selection set problems

[复制链接]

2

主题

12

帖子

10

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 11:59:28 | 显示全部楼层 |阅读模式
I just wanted to start off saying that I'm new to lisp and this forum and would appreciate any info.
 
I use a dated architectural add-in called ArchT.  It uses enhanced commands to move, copy, etc architectural objects.  The application redefines stock autocad commands with their own enhanced versions to provide functionality with their own objects.  Unfortunately Autocad crashes when any of these commands involve blocks with attributes.  As a bandaid, I've written a lisp routine that will get a selection set and separate out all blocks with attributes and place them into a separate selection set.  I was then hoping to move the blocks separately (and transparently) using ._copy or ._move.  All of this would not require any more clicks or user input.  This is when the problems begin....
 
I can not access ArchT's enhanced commands through autolisp because I believe they are lisp functions themselves.  In other words, when I type (command "_move") it gives me an unknown command error.  I can call the function (kti_archt_move) but it accepts no parameters and only allow user input (ie screen input).
 
Is there any other way I can call this command? Could I create a macro that would pause for my selection set routine and then call the command I need?
 
Sorry for being wordy, but I have seemed to hit a wall in every direction I turn.  I am unsure about all the ins and outs of the i/o system for lisp.  Any help would be greatly appreciated.  Thanks
 
Christian
回复

使用道具 举报

2

主题

12

帖子

10

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 12:04:58 | 显示全部楼层
Figured I would try to bump.  Anyone have any ideas?
回复

使用道具 举报

5

主题

194

帖子

193

银币

初来乍到

Rank: 1

铜币
24
发表于 2022-7-6 12:06:41 | 显示全部楼层
Hi
 
Could you post a sample code of what you have written so far?
 
 
You are probably correct with this
 
 
For simple routines a work around can be achieved via a script file
 
 
See
 
http://www.cadtutor.net/forum/showthread.php?t=32685&page=2
http://www.cadtutor.net/forum/showthread.php?t=38450
 
 
Could you post a sample of the command line prompts for the (kti_archt_move)
 
Regards
 
Jammie
回复

使用道具 举报

1

主题

316

帖子

311

银币

初来乍到

Rank: 1

铜币
29
发表于 2022-7-6 12:12:14 | 显示全部楼层
when you first select an object manually then initiate your custom ArchT command, does it process your pre-selected entities  or does it ask you again for your selection set?
回复

使用道具 举报

4

主题

327

帖子

324

银币

初来乍到

Rank: 1

铜币
19
发表于 2022-7-6 12:15:22 | 显示全部楼层
try vla-move and vla-copy to bypass using the command call
回复

使用道具 举报

2

主题

12

帖子

10

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 12:15:25 | 显示全部楼层
Hi Jammie,  here is the code to get the selection set and separate the objects:
 
  1. (setq SelMain(ssget))(setq SelMainSize(sslength SelMain))(setq SelBlock(ssadd))(setq SelNoblock(ssadd))(setq ctr 0)(while (< ctr (sslength SelMain))   (setq Ent(ssname SelMain ctr))   (setq EntData(entget Ent))   (if (assoc 66 EntData)       (setq SelBlock(ssadd Ent SelBlock))       (setq SelNoblock(ssadd Ent SelNoblock))   )   (setq ctr(+ ctr 1)))(sssetfirst nil SelNoblock)
Regarding the Archt commands, they mimic the stock autocad commands exactly.  Here is what the archt move command does at the command line:
 
  1. Command: kti_archt_moveSelect objects: Specify opposite corner: 1 foundSelect objects:Base point or displacement: Second point of displacement:
I'm not sure how to use scripts but I will look into this.  Thanks!
 
 
Hi wizman, I tried what you said, and the command does work with the pre-selected object.
 
 
Hi John,  I'm not sure how to use these (or vlisp for that matter), but I will read up on them.  Thanks.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:20:17 | 显示全部楼层
These will help you with the Visual LISP:
 
  1. (defun v-move (ss p1 p2 / i ent) (vl-load-com) (setq i -1) (while (setq ent (ssname ss (setq i (1+ i))))   (vla-move (vlax-ename->vla-object ent)             (vlax-3D-point p1)             (vlax-3D-point p2))) ss)(defun v-copy (ss p1 p2 / i ent) (vl-load-com) (setq i -1) (while (setq ent (ssname ss (setq i (1+ i))))   (vla-move (vla-copy (vlax-ename->vla-object ent))             (vlax-3D-point p1)             (vlax-3D-point p2))) ss)(defun c:test (/ ss pt1 pt2) (if (and (setq ss (ssget "_:L"))          (setq pt1 (getpoint "\nFrom: "))          (setq pt2 (getpoint pt1 "\nTo: ")))   (v-move ss pt1 pt2)) (princ))
 
 
"ss" is a SelectionSet, p1, p2 are points.
回复

使用道具 举报

2

主题

12

帖子

10

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 12:23:41 | 显示全部楼层
Hi Lee,
 
Thanks for the vlisp code.  Any help is greatly appreciated.  I don't see how this can help me though.  I need to be able to move certain objects through the ArchT routine so that I can retain ArchT object functionality.
 
For example, I have walls with centerlines, windows, doors, etc.  If I select a wall centerline through the ArchT command, the whole object moves along with the doors and windows in that wall.  If I just use the standard move command, only the selected object moves and the assembly breaks.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 12:25:47 | 显示全部楼层
I was under the impression that you needed a workaround to move your separate selection set - the above code is your workaround.
回复

使用道具 举报

2

主题

12

帖子

10

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 12:28:16 | 显示全部楼层
 
 
Ah I see
 
That part I was fairly comfortable with in lisp.  Sorry if I am not explaining this properly.  The problem I'm having is not being able to pass my modified selection set to the ArchT command.  This is the step I need to prevent autocad from crashing.  Once I accomplish this, then I think I can integrate your code to move the other selection set........or the obvious could just be flying over my head .
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-5 10:14 , Processed in 0.329944 second(s), 72 queries .

© 2020-2025 乐筑天下

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