乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 114|回复: 6

如何获得矩形的4个点的坐标

[复制链接]

1

主题

1

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2007-7-12 15:39:00 | 显示全部楼层 |阅读模式
用什么样的命令可以获得中一个矩形的四个点的坐标,并且在其中的一个点上建立新的坐标系。
回复

使用道具 举报

25

主题

219

帖子

6

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
319
发表于 2007-7-12 16:37:00 | 显示全部楼层

object.GetBoundingBox MinPoint, MaxPoint
回复

使用道具 举报

4

主题

5

帖子

2

银币

初来乍到

Rank: 1

铜币
21
发表于 2007-7-12 17:49:00 | 显示全部楼层
如果是不平行于坐标系的呢?
回复

使用道具 举报

25

主题

219

帖子

6

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
319
发表于 2007-7-13 10:31:00 | 显示全部楼层
矩形就是多义线,用多义线的命令。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 示例"
    ' 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 示例"
End Sub
回复

使用道具 举报

25

主题

219

帖子

6

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
319
发表于 2007-7-13 10:31:00 | 显示全部楼层
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 示例"
    ' 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 示例"
End Sub
回复

使用道具 举报

8

主题

31

帖子

3

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
63
发表于 2007-8-13 22:02:00 | 显示全部楼层
谢谢楼上精彩的解答
我顺便问一下如何获取图形里所有圆的圆心坐标呢
是遍历所有图元吗?
具体如何实现呢?
谢谢
回复

使用道具 举报

5

主题

58

帖子

8

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
78
发表于 2007-8-16 15:57:00 | 显示全部楼层
建立圆选择集,遍历所有图元,取圆心
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-6 10:36 , Processed in 0.750225 second(s), 66 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表