明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1608|回复: 3

[求助]直线的起点和终点的获得

[复制链接]
发表于 2005-3-31 12:47:00 | 显示全部楼层 |阅读模式
请问 在vba进行二次开发时如何获得一条直线的起点和终点
发表于 2005-3-31 13:17:00 | 显示全部楼层
<RE class=Code>Sub Example_StartPoint()
    ' This example creates an elliptical arc and then
    ' finds the coordinates of its start point and endpoint.
    Dim ellObj As AcadEllipse
    Dim majAxis(0 To 2) As Double
    Dim center(0 To 2) As Double
    Dim radRatio As Double
    Dim startPoint As Variant
    Dim endPoint As Variant
   
    ' Create an ellipse in model space
    center(0) = 5#: center(1) = 5#: center(2) = 0#
    majAxis(0) = 10: majAxis(1) = 20#: majAxis(2) = 0#
    radRatio = 0.3
    Set ellObj = ThisDrawing.ModelSpace.AddEllipse(center, majAxis, radRatio)
   
    ' Enter a start angle of 45 degrees, and an end angle of 270 degrees
    ellObj.startAngle = 45 * (3.14 / 180)
    ellObj.endAngle = 270 * (3.14 / 180)
    ZoomAll
   
    ' Find the start and endpoints for the ellipse
    startPoint = ellObj.startPoint
    endPoint = ellObj.endPoint
    MsgBox "This ellipse has a start point of " &amp; startPoint(0) &amp; ", " &amp; startPoint(1) &amp; ", " &amp; startPoint(2) &amp; " and an endpoint of " &amp; endPoint(0) &amp; ", " &amp; endPoint(1) &amp; ", " &amp; endPoint(2), vbInformation, "StartPoint Example"
End Sub</PRE>
 楼主| 发表于 2005-3-31 16:03:00 | 显示全部楼层
上面的程序好像不对         我说的是这条直线已存在         要获得起点坐标(x,y)的值
发表于 2005-3-31 19:59:00 | 显示全部楼层
startPoint = ellObj.startPoint
endPoint = ellObj.endPoint 就是这个属性
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 18:34 , Processed in 0.173207 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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