本帖最后由 vitalgg 于 2022-12-23 11:38 编辑
- Sub makeArcLwpl()
-
- Dim plineObj As AcadLWPolyline
- Dim points(0 To 3) As Double
-
- points(0) = 1: points(1) = 1
- points(2) = 1: points(3) = 2
-
- Set plineObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
-
- plineObj.SetBulge 0, -0.5
- plineObj.Update
-
- End Sub
- (defun entity:make-lwpline-bold (plist convexity elevation closed bold / lst-dxf i)
- "生成固定宽度的二维多段线.LWPOLYLINE
- 参数:
- plist:端点坐标点表,如:((x1 y1 z1)(x2 y2 z2)(x2 y2 z2))或((x1 y1)(x2 y2)(x2 y2))
- convexity:各点与下一点的凸度(个数同坐标点表),可为nil
- elevation:标高
- closed:是否闭合,1:闭合,0:不闭合"
- "返回值: 生成的多段线的图元名"
- (setq lst-dxf
- (list (quote (0 . "LWPOLYLINE"))
- (quote (100 . "AcDbEntity"))
- (quote (62 . 1))
- (quote (370 . 30))
- (quote (100 . "AcDbPolyline"))
- (cons 90 (length plist))
- (if (= closed 1)
- (quote (70 . 1))
- (quote (70 . 0)))
- (cons 43 bold)
- (quote (38 . 0.0))
- (quote (39 . 0.0))))
- (setq i 0)
- (foreach
- x plist
- (setq lst-dxf
- (append lst-dxf
- (list (cons 10 x)
- (cons 40 bold)
- (cons 41 bold)
- (cons 42 (if (null convexity)
- 0 (nth i convexity)))
- (cons 91 0))))
- (setq i (1+ i)))
- (entmake lst-dxf)
- (entlast))
安装 @lisp 自动加载上面的函数定义
在坐标 0,0 到 1,1 处 绘制一段弧形多段线。
- (entity:make-lwpline-bold '((0 0 0)(1 1 0)) '(0.5 0 ) nil 0 0)
|