明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1516|回复: 3

如何得到矩形GROUP的四个端点?

[复制链接]
发表于 2004-12-23 09:25:00 | 显示全部楼层 |阅读模式
我图中有个矩形的GROUP实体,如何通过程序得到这个GROUP的四个端点坐标?
 楼主| 发表于 2004-12-23 09:53:00 | 显示全部楼层
上传一个例图,望高手指教

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2004-12-23 10:45:00 | 显示全部楼层
写了一点,没时间写了,你自己再改改吧. Sub test()
Dim group(0 To 3) As AcadLine
Dim point As Variant
Dim sset As AcadSelectionSet
Dim entry As AcadEntity
Dim i As Integer
ThisDrawing.SendCommand "prompt" & "请选择"
point = ThisDrawing.Utility.GetPoint()
For i = 0 To ThisDrawing.SelectionSets.Count - 1
If ThisDrawing.SelectionSets.Item(i).Name = "ss1" Then ThisDrawing.SelectionSets.Item("ss1").Delete
Next i
Set sset = ThisDrawing.SelectionSets.Add("ss1")
sset.SelectAtPoint point
Set group(0) = sset.Item(0)
Set group(1) = sset.Item(1)
Set group(2) = sset.Item(2)
Set group(3) = sset.Item(3)
Dim pos(0 To 7) As Variant
pos(0) = group(0).StartPoint
pos(1) = group(1).StartPoint
pos(2) = group(2).StartPoint
pos(3) = group(3).StartPoint
MsgBox pos(0)(0) & " " & pos(0)(1) & " " & pos(0)(2) & vbCrLf & pos(1)(0) & " " & pos(1)(1) & " " & pos(1)(2) & vbCrLf & pos(2)(0) & " " & pos(2)(1) & " " & pos(2)(2) & vbCrLf & pos(3)(0) & " " & pos(3)(1) & " " & pos(3)(2)
ThisDrawing.SelectionSets.Item("ss1").Delete
End Sub
 楼主| 发表于 2004-12-23 11:34:00 | 显示全部楼层
谢谢老大。非常感谢,我改改
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 23:36 , Processed in 0.168397 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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