乐筑天下

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

[编程交流] LISP从块中抓取层

[复制链接]

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:23:25 | 显示全部楼层
 
 
好极了伙计
干杯
回复

使用道具 举报

12

主题

40

帖子

28

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
60
发表于 2022-7-6 07:26:17 | 显示全部楼层
好了,现在我们已经把这一切都做好了,公司已经改变了主意,关于MLEADER应该在哪一层。现在他们希望它们位于任何一个导线层上。我修改了您编写的代码来实现这一点,但是这又产生了另一个问题。两个导线层不是“连续”线型。如何在代码中添加线型替代以强制使用连续线型绘制所有引线?
 
再次感谢您的帮助!
  1. (defun c:wtags ( / *error* la pt ss vl vr wl )
  2.    (defun *error* ( msg )
  3.        (mapcar 'setvar vr vl)
  4.        (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
  5.            (princ (strcat "\nError: " msg))
  6.        )
  7.        (princ)
  8.    )
  9.    (setq vr '(clayer osmode cmdecho)
  10.          vl  (mapcar 'getvar vr)
  11.    )
  12.    (setvar 'osmode 531)
  13.    (setvar 'cmdecho 0)
  14.    (if (setq pt (getpoint "\nSelect Wire to Tag: "))
  15.        (if (setq ss (ssget pt))
  16.            (if (wcmatch (setq wl (strcase (cdr (assoc 8 (entget (ssname ss 0)))))) "F-ALRM-WIRE*")
  17.                (progn
  18.                    (setq wl (substr wl 12)
  19.                          la (strcat "F-ALRM-WIRE" wl)
  20.                    )
  21.                    (if (tblsearch "LAYER" la)
  22.                        (command "_.-layer" "_U" la "_T" la "_ON" la "_S" la "")
  23.                        (command "_.-layer" "_M" la "")
  24.                    )
  25.                    (command "_.mleader" "_non" pt "\")
  26.                    (cond
  27.                        (   (= wl "-SPKR") (command "S"))
  28.                        (   (= wl "-INDC") (command "V"))
  29.                        (   (= wl "-DTCT") (command "M"))
  30.                        (   (= wl "-POWR")  (command "P"))
  31.                 (   (= wl "-CTRL")  (command "R"))
  32.                        (   (command "" "_.ddedit" (entlast) ""))
  33.                    )
  34.                )
  35.                (princ "\nObject not on "F-ALRM-WIRE*" layer.")                     
  36.            )
  37.            (princ "\nNo Object found at selected point.")
  38.        )
  39.    )
  40.    (*error* nil)
  41.    (princ)
  42. )
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:31:45 | 显示全部楼层
试试这个:
  1. (defun c:wtags ( / *error* la pt ss vl vr wl )
  2.    (defun *error* ( msg )
  3.        (mapcar 'setvar vr vl)
  4.        (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*")))
  5.            (princ (strcat "\nError: " msg))
  6.        )
  7.        (princ)
  8.    )
  9.    (setq vr '(clayer osmode cmdecho)
  10.          vl  (mapcar 'getvar vr)
  11.    )
  12.    (setvar 'osmode 531)
  13.    (setvar 'cmdecho 0)
  14.    (if (setq pt (getpoint "\nSelect Wire to Tag: "))
  15.        (if (setq ss (ssget pt))
  16.            (if (wcmatch (setq wl (strcase (cdr (assoc 8 (entget (ssname ss 0)))))) "F-ALRM-WIRE*")
  17.                (progn
  18.                    (setq wl (substr wl 12)
  19.                          la (strcat "F-ALRM-WIRE" wl)
  20.                    )
  21.                    (if (tblsearch "LAYER" la)
  22.                        (command "_.-layer" "_U" la "_T" la "_ON" la [color=red]"_L" "Continuous" la[/color] "_S" la "")
  23.                        (command "_.-layer" "_M" la [color=red]"_L" "Continuous" la[/color] "")
  24.                    )
  25.                    (command "_.mleader" "_non" pt "\")
  26.                    (cond
  27.                        (   (= wl "-SPKR") (command "S"))
  28.                        (   (= wl "-INDC") (command "V"))
  29.                        (   (= wl "-DTCT") (command "M"))
  30.                        (   (= wl "-POWR") (command "P"))
  31.                        (   (= wl "-CTRL") (command "R"))
  32.                        (   (command "" "_.ddedit" (entlast) ""))
  33.                    )
  34.                )
  35.                (princ "\nObject not on "F-ALRM-WIRE*" layer.")                     
  36.            )
  37.            (princ "\nNo Object found at selected point.")
  38.        )
  39.    )
  40.    (*error* nil)
  41.    (princ)
  42. )
回复

使用道具 举报

12

主题

40

帖子

28

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
60
发表于 2022-7-6 07:37:36 | 显示全部楼层
知道我刚刚意识到什么吗?我所需要做的就是修改多重引线样式,使线型连续。。哼!
 
再次感谢!
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 07:40:51 | 显示全部楼层
别担心!
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 15:58 , Processed in 0.340403 second(s), 60 queries .

© 2020-2025 乐筑天下

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