明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1432|回复: 3

怎样取得一个封闭图形端点的坐标

[复制链接]
发表于 2007-11-13 15:10:00 | 显示全部楼层 |阅读模式

图形是多边形

要取各个顶点的坐标.

谢谢

发表于 2007-11-16 21:46:00 | 显示全部楼层

Polyline和LWPolyline有Coordinates属性,可以参看VBA例子:

Sub Example_Coordinates()
    ' This example creates a polyline. It then uses the Coordinates
    ' property to return all the coordinates  in the polyline. It then
    ' resets one of the vertices using the Coordinates property.
    
    Dim plineObj As AcadPolyline

    ' Create Polyline
    Dim points(5) As Double
    points(0) = 3: points(1) = 7: points(2) = 0
    points(3) = 9: points(4) = 2: points(5) = 0
    Set plineObj = ThisDrawing.ModelSpace.AddPolyline(points)
    ThisDrawing.Regen True

    ' Return all the coordinates of the polyline
    Dim retCoord As Variant
    retCoord = plineObj.Coordinates

    ' Display current coordinates for the first vertex
    MsgBox "The current coordinates of the second vertex are: " & points(3) & ", " & points(4) & ", " & points(5), vbInformation, "Coordinates Example"

    ' Modify the coordinate of the second vertex to (5,5,0). Note that in
    ' case of a lightweight Polyline, indices will be different because the points are 2D only.
    points(3) = 5
    points(4) = 5
    points(5) = 0
    plineObj.Coordinates = points

    ' Update display
    ThisDrawing.Regen True

    MsgBox "The new coordinates have been set to " & points(3) & ", " & points(4) & ", " & points(5), vbInformation, "Coordinates Example"
End Sub
发表于 2007-11-16 23:17:00 | 显示全部楼层
以上例子是经典例子。
 楼主| 发表于 2007-11-22 09:45:00 | 显示全部楼层

谢谢

不过

我的问题是

对已经画好的图形(边数不定,画法不定,是闭和的)

取出各个顶点坐标

目前用的

ThisDrawing.SendCommand "-Boundary" & vbCr & ptcao & "," & a(2) & vbCr & vbCr

其中"ptcao"和"a(2)"是其这个闭和区域中的一个坐标

但是无法创建

比较费解

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-26 12:21 , Processed in 0.161815 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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