为花园路径应用程序指定的一个要求是允许用户将边界轮廓绘制为轻量级折线或旧式折线。你写的第一个版本总是使用轻量级折线来绘制边界。现在对话框界面已准备就绪,您还可以内置用于绘制旧式折线的选项。为此,必须确定要绘制哪种折线,然后必须绘制它。gp:drawOutlinegp:drawOutline 必要的更改包含在以下代码片段中。从粗体表示的gpdraw.lsp文件进行修改:gp:drawOutline (setq PathAngle (cdr (assoc 50 BoundaryData)) Width (cdr (assoc 40 BoundaryData)) HalfWidth (/ Width 2.00) StartPt (cdr (assoc 10 BoundaryData)) PathLength (cdr (assoc 41 BoundaryData)) angp90 (+ PathAngle (Degrees->Radians 90)) angm90 (- PathAngle (Degrees->Radians 90)) p1 (polar StartPt angm90 HalfWidth) p2 (polar p1 PathAngle PathLength) p3 (polar p2 angp90 Width) p4 (polar p3 (+ PathAngle (Degrees->Radians 180)) PathLength) poly2Dpoints (apply 'append (mapcar '3dPoint->2dPoint (list p1 p2 p3 p4)) ) poly3Dpoints (mapcar 'float (append p1 p2 p3 p4)) ;; get the polyline style plineStyle (strcase (cdr (assoc 4 BoundaryData))) ) ;_ end of setq ;; Add polyline to the model space using ActiveX automation (setq pline (if (= plineStyle "LIGHT") ;; create a lightweight polyline (vla-addLightweightPolyline *ModelSpace* ; Global Definition for Model Space (gp:list->variantArray poly2Dpoints) ;data conversion ) ;_ end of vla-addLightweightPolyline ;; or create an old-style polyline (vla-addPolyline *ModelSpace* (gp:list->variantArray poly3Dpoints) ;data conversion ) ;_ end of vla-addPolyline ) ;_ end of if ) ;_ end of setq 在代码中键入更改可能非常棘手,因为您不仅需要添加代码,还需要删除一些现有行并重新排列其他行。建议从联机教程中复制整个重述并将其粘贴到代码中。setq |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:44
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.