dyxcad 发表于 2022-12-19 08:53:52

如何绘制带弧段的多段线?

求教大佬们,弧形多段线该如何绘制?

d1742647821 发表于 2022-12-23 09:15:45

vitalgg 发表于 2022-12-19 09:32
安装 @lisp 自动加载上面的函数定义




总能看到这种2B

vitalgg 发表于 2022-12-19 09:32:20

本帖最后由 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)



czb203 发表于 2022-12-19 09:36:23

vitalgg 发表于 2022-12-19 09:32
在坐标 0,0 到 1,1 处 绘制一段弧形多段线。

感谢大佬分享,学习下载~

vitalgg 发表于 2022-12-19 10:12:03

本帖最后由 vitalgg 于 2022-12-19 10:13 编辑

(entity:make-lwpolyline '((0 0) (2 2)) '(0.3 0) '((0.5 1.0)(0 0)) 0 nil)

重新写了一个函数,可以定义不同段的凸度和起止宽度

https://atlisp.cn/function/entity:make-lwpolyline


vitalgg 发表于 2022-12-19 17:57:14

czb203 发表于 2022-12-19 09:36
感谢大佬分享,学习下载~

重新写了一个函数,可以定义不同段的凸度和起止宽度

https://atlisp.cn/function/entity:make-lwpolyline

见样式见上楼

轮回 发表于 2022-12-20 09:02:23

Polyline pl = new Polyline();
pl.AddVertexAt(0, new Point2d(1, 0), 1, 0, 0);
pl.AddVertexAt(1, new Point2d(-1, 0), 1, 0, 0);

c#是这样的,

这个代码就会生成一个圆形 的多段线

QWQWQWQ 发表于 2022-12-20 15:39:48

轮回 发表于 2022-12-20 09:02
Polyline pl = new Polyline();
pl.AddVertexAt(0, new Point2d(1, 0), 1, 0, 0);
pl.AddVertexAt(1, new ...

请问VBA格式怎么写
页: [1]
查看完整版本: 如何绘制带弧段的多段线?