画管路图时,常画俯视图和相应的45°角视图。其实45°角视图中包含的信息只比俯视图中多了每根管路的水平高度。下面这个用LISP编写的程序可以自动将俯视图转化为同一水平高度的45°角视图,使用者只需在转化后的图上将每组管路在竖直方向上移动相应的高度,一幅45°角视图就轻松完成了。
由于每根管路用一直线表示,所以只需改变直线的起点和终点坐标为相应的45°角视图中的坐标。程序中变量p0记录45°角视图的坐标原点,由用户输入。p1记录直线的起点坐标,p2记录直线的终点坐标。
(defun c:V45( / cmdmode sset ssl ent p0,p1,p2,x1,x2,y0,y1,y2,z1,z2)
(setq cmdmode (getvar "cmdecho"))
(setvar "cmdecho" 0)
;select lines by user
(prompt "nSelect lines:")
(setq sset (ssget))
(if (not(null sset))
(progn
(setq ssl (sslength sset))
;input base point by user
(setq p0 (getpoint "nThe base point: "))
(setq y0 (cadr p0))
(while (> ssl 0)
(setq ent(entget (ssname sset (setq ssl (1- ssl)))))
;filter the lines
(if (= (cdr (assoc 0 ent)) "LINE")
;change the start point and end point of the line
(progn
(setq x1 (cadr(assoc 10 ent)))
(setq y1 (caddr(assoc 10 ent)))
(setq z1 (cadddr(assoc 10 ent)))
(setq x2 (cadr(assoc 11 ent)))
(setq y2 (caddr(assoc 11 ent)))
(setq z2 (cadddr(assoc 11 ent)))
(setq p1 (list (+ x1 (/ (* (sqrt 2) (- y1 y0)) 4)) (+ y0 (/ (* (sqrt 2) (- y1 y0))4)) z1))
(setq p2 (list (+ x2 (/ (* (sqrt 2) (- y2 y0)) 4)) (+ y0 (/ (* (sqrt 2) (- y2 y0))4)) z2))
(setq ent (entmod (subst (cons 10 p1)
(assoc 10 ent) ent)))
(entmod (subst (cons 11 p2)
(assoc 11 ent) ent))
(redraw (cdr(assoc -1 ent)) 1))
)
)
)
)
(setvar "CMDECHO" cmdmode)
)
(princ "ntc:V45 loaded. Start command with V45.")
由于每根管路用一直线表示,所以只需改变直线的起点和终点坐标为相应的45°角视图中的坐标。程序中变量p0记录45°角视图的坐标原点,由用户输入。p1记录直线的起点坐标,p2记录直线的终点坐标。
(defun c:V45( / cmdmode sset ssl ent p0,p1,p2,x1,x2,y0,y1,y2,z1,z2)
(setq cmdmode (getvar "cmdecho"))
(setvar "cmdecho" 0)
;select lines by user
(prompt "nSelect lines:")
(setq sset (ssget))
(if (not(null sset))
(progn
(setq ssl (sslength sset))
;input base point by user
(setq p0 (getpoint "nThe base point: "))
(setq y0 (cadr p0))
(while (> ssl 0)
(setq ent(entget (ssname sset (setq ssl (1- ssl)))))
;filter the lines
(if (= (cdr (assoc 0 ent)) "LINE")
;change the start point and end point of the line
(progn
(setq x1 (cadr(assoc 10 ent)))
(setq y1 (caddr(assoc 10 ent)))
(setq z1 (cadddr(assoc 10 ent)))
(setq x2 (cadr(assoc 11 ent)))
(setq y2 (caddr(assoc 11 ent)))
(setq z2 (cadddr(assoc 11 ent)))
(setq p1 (list (+ x1 (/ (* (sqrt 2) (- y1 y0)) 4)) (+ y0 (/ (* (sqrt 2) (- y1 y0))4)) z1))
(setq p2 (list (+ x2 (/ (* (sqrt 2) (- y2 y0)) 4)) (+ y0 (/ (* (sqrt 2) (- y2 y0))4)) z2))
(setq ent (entmod (subst (cons 10 p1)
(assoc 10 ent) ent)))
(entmod (subst (cons 11 p2)
(assoc 11 ent) ent))
(redraw (cdr(assoc -1 ent)) 1))
)
)
)
)
(setvar "CMDECHO" cmdmode)
)
(princ "ntc:V45 loaded. Start command with V45.")
相关文章
- 2021-09-08BIM技术丛书Revit软件应用系列Autodesk Revit族详解 [
- 2021-09-08全国专业技术人员计算机应用能力考试用书 AutoCAD2004
- 2021-09-08EXCEL在工作中的应用 制表、数据处理及宏应用PDF下载
- 2021-08-30从零开始AutoCAD 2014中文版机械制图基础培训教程 [李
- 2021-08-30从零开始AutoCAD 2014中文版建筑制图基础培训教程 [朱
- 2021-08-30电气CAD实例教程AutoCAD 2010中文版 [左昉 等编著] 20
- 2021-08-30电影风暴2:Maya影像实拍与三维合成攻略PDF下载
- 2021-08-30高等院校艺术设计案例教程中文版AutoCAD 建筑设计案例
- 2021-08-29环境艺术制图AutoCAD [徐幼光 编著] 2013年PDF下载
- 2021-08-29机械AutoCAD 项目教程 第3版 [缪希伟 主编] 2012年PDF