entmake创建图元必要条件
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
entmake创建图元较command速度快,且不受捕捉等CAD环境因素影响,因此优先选用entmake。
entmake创建图元必要条件,即创建图元的最少组码项,再少就无法正确创建图元,实际使用中需要颜色、图层等组码项自己添加。水平有限,欢迎拍砖。
本帖隐藏的内容
1、直线
(entmake (list '(0 . "LINE") (cons 10 pt1) (cons 11 pt2)))
2、两顶点多段线(多顶点类似)
(entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 2) (cons 10 pt1) (cons 10 pt2)))
3、点表生成多段线
(entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length lst))) (mapcar '(lambda (pt)(cons 10 pt)) lst ))
)
4、圆
(entmake (list '(0 . "CIRCLE") (cons 10 pt) (cons 40 r)))
5、圆弧
(entmake (list '(0 . "ARC") (cons 10 pt) (cons 40 r) (cons 50 ang1) (cons 51 ang2)))
6、单行文本
(entmake (list '(0 . "TEXT") (cons 1 str) (cons 10 pt) (cons 40 5)))
7、多行文本
(entmake (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText") '(7 . "Standard") (cons 1 str) (cons 10 pt)))
8、半径标注
(entmake (list '(0 . "DIMENSION") '(100 . "AcDbEntity") '(100 . "AcDbDimension")(cons 10 pt) '(70 . 36) '(100 . "AcDbRadialDimension") (cons 15 pt1) ) )
9、直径标注
(entmake (list '(0 . "DIMENSION") '(100 . "AcDbEntity") '(100 . "AcDbDimension") (cons 10 pt1) (cons 11 pt2) '(70 . 163) ' (100 . "AcDbDiametricDimension") (cons 15 pt3)
)
)
10、水平标注
(entmake (list '(0 . "DIMENSION") '(100 . "AcDbEntity") '(100 . "AcDbDimension") (cons 10 pt) '(70 . 32) '(1 . "") '(100 . "AcDbAlignedDimension")
(cons 13 pt1) (cons 14 pt2) '(100 . "AcDbRotatedDimension")
)
)
11、垂直标注
(entmake (list '(0 . "DIMENSION") '(100 . "AcDbEntity") '(100 . "AcDbDimension") (cons 10 pt) '(70 . 32) '(1 . "") '(100 . "AcDbAlignedDimension")
(cons 13 pt1) (cons 14 pt2) '(50 . 1.5708) '(100 . "AcDbRotatedDimension")
)
)
12、倾斜标注
(entmake (list '(0 . "DIMENSION") '(100 . "AcDbEntity") '(100 . "AcDbDimension") (cons 10 pt1) '(70 . 33) '(1 . "") '(100 . "AcDbAlignedDimension")
(cons 13 pt2) (cons 14 pt3)
)
)
13、entmake生成普通块
(defun emkblk (ss pt name / i)
(entmake (list '(0 . "block") (cons 2 name) '(70 . 0) (cons 10 pt)))
(repeat (setq i (sslength ss)) (entmake (cdr (entget (ssname ss (setq i (1- i)))))) )
(entmake '((0 . "ENDBLK")))
(command "_.erase" ss "")
(entmake (list '(0 . "INSERT") (cons 2 name) (cons 10 pt)))
)
14、entmake插入普通块
(entmake (list '(0 . "INSERT") (cons 2 name) (cons 10 pt)))
15 、entmake生成无名块
(defun emkunameblk (ss pt / i name)
(entmake (list '(0 . "block") '(2 . "*U") '(70 . 1) (cons 10 pt)))
(repeat (setq i (sslength ss)) (entmake (cdr (entget (ssname ss (setq i (1- i)))))) )
(setq name (entmake '((0 . "ENDBLK"))))
(command "_.erase" ss "")
(entmake (list '(0 . "INSERT") (cons 2 name) (cons 10 pt)))
name
)
16、将选择集做成属性块(选择集中单行文本作为属性)
(defun emkattblk (ss pt name / ent i)
(entmake (list '(0 . "block") (cons 2 name) '(70 . 2) (cons 10 pt)))
(repeat (setq i (sslength ss))
(setq ent (entget (ssname ss (setq i (1- i)))))
(if (= (cdr (assoc 0 ent)) "TEXT")