autocad-plugin - 在 AutoLISP 的特定索引中更改 DXF 实体
问题描述
我正在努力改变正确的 DXF,有 9 个 300 的 DXF。
我使用命令 (entget (car (entsel))) 得到以下列表:
((-1 . <Entity name: 223791faf20>)
(0 . "HSB_BEAMENT")
(330 . <Entity name: 21b6fa889f0>)
(5 . "5A612")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "E-01")
(62 . 92)
(100 . "Hsb_BeamEnt")
(70 . 3)
(10 -86756.4 43492.7 3022.5)
(15 -86756.4 43492.7 530.094)
(142 . 5469.91)
(143 . -485.094)
(11 0.0 0.0 1.0)
(12 -1.83697e-16 -1.0 0.0)
(13 1.0 -1.83697e-16 0.0)
(14 0.0 0.0 0.0)
(140 . 45.0)
(141 . 295.0)
(300 . "")
(70 . 10)
(79 . 0)
(332 . <Entity name: 0>)
(144 . 0.0)
(300 . "STUTZ")
(300 . "Bearbejdet")
(300 . "490")
(300 . "E-01")
(300 . "")
(300 . "")
(300 . "Ribbe C24 295x45")
(300 . "C24")
(301 . "")
(302 . "")
(71 . -1)
(72 . 0)
(73 . 0)
(74 . 6))
在这里,我想在索引 4 (300 . "E-01") 处更改 DXF 300
我创建了以下代码:但是如何选择索引?并获得我想要的 DXF。
(defun c:changeattr()
(setq a (car (entsel "\nSelect a object: ")))
(setq b (entget a))
(setq c (subst (cons 300 "F200") (assoc 300 b) b)) ; Trying to update and change the Label Property
(entmod c)
(entupd a)
(prompt "\nAttribute entity updated.")
(princ)
)
感谢您的帮助。我很感激 :)
解决方案
尝试这个:
(setq def (entget (car(entsel ))) )
(defun DXF:Put ( def code index val / subs cp
*error* ) (defun *error* ( msg / )
(if (not (null msg ) ) (progn (princ "\nDXF:Pu:*error*: " ) (princ msg ) (princ "\n") ) )
)
(setq cp def )
( while (setq item (assoc code cp ))
(setq subs (append subs (list item ) ) )
(setq cp (cdr (member item cp ) ))
)
(subst (cons code val) (nth index subs ) def )
)
(setq code 300
index 4
val "test"
)
(DXF:Put def code index val )
那么当然endmod
,entupd
推荐阅读
- azure-devops - 是否可以基于 System.PullRequest.TargetBranch 为管道模板中的阶段设置条件?
- c++ - range-v3 是否适合将函数应用于向量中的某些索引?
- javascript - 如何将多个音频文件添加到一个视频并添加控件以便用户只能听到选定的曲目
- c# - 具有依赖注入的 .NET 5 Windows 窗体 - 为什么 InitializeComponent 将窗体的 TextBox 和 FormTab Enabled 属性设置为 False?
- algorithm - DEFLATE 算法的内存使用情况
- csv - AWK:过滤多列数据
- angular - Angular 测试:依赖于模板和文档对象的 ngOnInit 方法
- wordpress - 如何在 Wordpress 中发送按顺序创建用户编号(并保存在数据库中)的时事通讯?
- javascript - 通俗地说,NodeSource 是什么以及为什么?
- python - 根据所选总和显示所有数字组合