明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1934|回复: 2

提示输入点创建一条轻多段线

[复制链接]
发表于 2013-2-6 13:59 | 显示全部楼层 |阅读模式
本帖最后由 yjr111 于 2013-2-6 14:15 编辑

rem 模拟cad的pline命令
Option Explicit
Public ms As AcadModelSpace, utiobj As Object
'提示输入点创建一条轻多段线
Private Sub AddLWPline()
    Dim p1 As Variant, ptCurrent As Variant, ptPrevious As Variant
    Dim points(3) As Double, objPline As AcadLWPolyline
    Set utiobj = ThisDrawing.Utility
    Set ms = ThisDrawing.ModelSpace

    On Error Resume Next
    p1 = utiobj.GetPoint(, "输入第一点:")
    If Err.Number = -2145320928 Then
        Err.Clear
        Exit Sub
    End If
    ptPrevious = p1
    While true
        On Error Resume Next
        ptCurrent = utiobj.GetPoint(ptPrevious, "输入下一点:")
        If Err.Number = -2145320928 Then
            Err.Clear
            Exit Sub
        End If
        points(0) = ptPrevious(0)
        points(1) = ptPrevious(1)
        points(2) = ptCurrent(0)
        points(3) = ptCurrent(1)
        Set objPline = ms.AddLightWeightPolyline(points)
        ptPrevious = ptCurrent
    Wend
End Sub


发表于 2013-2-27 18:07 | 显示全部楼层
最好把每一段轻量多一线连成一条整线
发表于 2018-8-21 19:52 | 显示全部楼层
提示: 该帖被管理员或版主屏蔽
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-19 06:22 , Processed in 0.426007 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表