找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 535|回复: 2

[每日一码] 将一组对象的图层同指定的对象匹配

[复制链接]

已领礼包: 19个

财富等级: 恭喜发财

发表于 2016-9-6 14:05:30 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
  1. (defun c:CL ( / ENTITY1 LN OLDCE OLDERR OLDTE)
  2.   ; Save the current value of cmdecho then redefine it.
  3.   (setq OLDCE (getvar "cmdecho"))
  4.   (setvar "cmdecho" 1)
  5.   ; Save the current value of texteval then set it to 1
  6.   (setq OLDTE (getvar "texteval"))
  7.   (setvar "texteval" 1)
  8.   ; Save the current value of the error handling subroutine then redefine it.
  9.   (setq OLDERR *error*)
  10.   (defun *error* (errmes)
  11.     (princ (strcat "\nExecution of CL halted by the following error: " ERRMES))
  12.     (setvar "cmdecho" OLDCE)
  13.     (setq *error* OLDERR)
  14.     (prin1)
  15.   )
  16.   ;(setq *error* nil)
  17.   ; NOTE: to turn error handling off, erase the semicolon in the line above.

  18.   ; GET a ENTITY from the user and store it in ENTITY1.
  19.   (setq ENTITY1 (car (entsel "\nSelect object from which to extract the layer: ")))

  20.   ; EXTRACT the Layer name from the entity ENTITY1 and store it in LN.
  21.   (setq LN (cdr (assoc 8 (entget ENTITY1))))

  22.   ; Input to AutoCAD's command line.
  23.   (command
  24.     "change"
  25.   )
  26.   (command
  27.     (ssget)
  28.     ""
  29.     "p"
  30.     "la"
  31.     LN
  32.     ""
  33.   )

  34.   ; Reset "cmdecho" to previous value.
  35.   (setvar "cmdecho" OLDCE)
  36.   ; Reset "texteval" to previous value.
  37.   (setvar "texteval" OLDTE)
  38.   ; Reset *error* to previous definition.
  39.   (setq *error* OLDERR)
  40.   ; Exit quietly (no return value.)
  41.   (prin1)
  42. )


论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!

已领礼包: 1094个

财富等级: 财源广进

发表于 2021-9-25 00:01:53 | 显示全部楼层
感谢分享将一组对象的图层同指定的对象匹配
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

发表于 2024-2-22 20:19:53 | 显示全部楼层
能说说用法吗?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-3-29 17:12 , Processed in 0.173215 second(s), 32 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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