明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3309|回复: 5

[提问] 关于(ssadd)用法,请教前辈

[复制链接]
发表于 2017-12-21 19:51:23 | 显示全部楼层 |阅读模式
本帖最后由 千秋雪 于 2017-12-21 19:53 编辑

      (setq sdkq (ssadd))

      (command "pline" paw1 paw1 pan1 "")
      (command "change" (entlast) "" "p" "lt" "hidden" "lts" 1 "c" "" "")
      (command "pline" pbw1 pbw1 pbn1 "")
      (command "change" (entlast) "" "p" "lt" "hidden" "lts" 1 "c" "" "")
      (command "line" paw1 pbw1 "" "line" pan1 pbn1 "")
      (command "pline" pan1 pan3 pj pbn3 pbn1 "")
      (command "line" pan3 pbn3 "")

      (setq sdkq (ssadd sdkq))

      (command "chprop" sdkq "" "la" (cdr (assoc 8 (entget (car (entsel))))) "")

上面选择集,没能选中,请问,问题出哪里?

错误: 参数类型错误: lentityp <Selection set: 2>

发表于 2017-12-21 21:10:01 | 显示全部楼层
Adds an object (entity) to a selection set, or creates a new selection set

(ssadd [ename [ss]])
Arguments
ename
An entity name.
ss
A selection set.


您没给代码注解,原意不明

...没能选中...
原意想选中什么?
Try
(ssadd (entlast) sdkq)
 楼主| 发表于 2017-12-21 21:51:31 | 显示全部楼层
Andyhon 发表于 2017-12-21 21:10
Adds an object (entity) to a selection set, or creates a new selection set

(ssadd [ename [ss]])

选择自 (setq sdkq (ssadd))始,至(setq sdkq (ssadd sdkq))终,产生的实体

即这些玩意:
      (command "pline" paw1 paw1 pan1 "")
       (command "change" (entlast) "" "p" "lt" "hidden" "lts" 1 "c" "" "")
       (command "pline" pbw1 pbw1 pbn1 "")
       (command "change" (entlast) "" "p" "lt" "hidden" "lts" 1 "c" "" "")
       (command "line" paw1 pbw1 "" "line" pan1 pbn1 "")
       (command "pline" pan1 pan3 pj pbn3 pbn1 "")
       (command "line" pan3 pbn3 "")
全部代码好长,比较繁杂琐碎,这程序流程中的一段画线动作,想选中这段流程产生的东西
 楼主| 发表于 2017-12-21 22:02:26 | 显示全部楼层
      (setq sdkq (ssadd))

       (command "pline" paw1 paw1 pan1 "")
       (command "change" (entlast) "" "p" "lt" "hidden" "lts" 1 "c" "" "")
       (command "pline" pbw1 pbw1 pbn1 "")
       (command "change" (entlast) "" "p" "lt" "hidden" "lts" 1 "c" "" "")
       (command "line" paw1 pbw1 "" "line" pan1 pbn1 "")
       (command "pline" pan1 pan3 pj pbn3 pbn1 "")
       (command "line" pan3 pbn3 "")

       (setq sdkq (ssadd (entlast) sdkq))
这样只选中最后一个





      (setq sdkq (ssadd (entlast) sdkq))

       (command "pline" paw1 paw1 pan1 "")
       (command "change" (entlast) "" "p" "lt" "hidden" "lts" 1 "c" "" "")
       (command "pline" pbw1 pbw1 pbn1 "")
       (command "change" (entlast) "" "p" "lt" "hidden" "lts" 1 "c" "" "")
       (command "line" paw1 pbw1 "" "line" pan1 pbn1 "")
       (command "pline" pan1 pan3 pj pbn3 pbn1 "")
       (command "line" pan3 pbn3 "")

       (setq sdkq (ssadd sdkq))
这样 错误: 参数类型错误: lentityp <Selection set: 2>
发表于 2017-12-21 23:03:54 来自手机 | 显示全部楼层
每生成一个图元都要加到选择集
发表于 2017-12-21 23:10:12 | 显示全部楼层
您可以每段加

或借重EntNext函数
这个讨论个很多次,请自行搜寻...

Returns the name of the next object (entity) in the drawing

(entnext [ename])
Arguments

ename

The name of an existing entity.

Return Values

If entnext is called with no arguments, it returns the entity name of the first nondeleted entity in the database. If an ename argument is supplied to entnext, the function returns the entity name of the first nondeleted entity following ename in the database. If there is no next entity in the database, it returns nil. The entnext function returns both main entities and subentities.

Examples

(setq e1 (entnext))     ; Sets e1 to the name of the first entity in the  drawing
(setq e2 (entnext e1)) ; Sets e2 to the name of the entity following e1
Notes

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

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-6-7 01:51 , Processed in 0.168811 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表