创建后,您可以查询射线以确定用于创建对象的点。 该属性可用于获取光线的第一个点。虽然用于创建光线的第二个点不与对象一起存储,但可以使用该属性来获取光线的方向向量。BasePointDirectionVector 添加、查询和编辑 Ray 对象下面的示例代码使用两点 (5, 0, 0) 和 (1, 1, 0) 创建一个对象。然后,它查询当前基点和方向向量,并在消息框中显示结果。然后更改方向向量,查询并显示基点和新方向向量。Ray Sub Ch3_EditRay() Dim rayObj As AcadRay Dim basePoint(0 To 2) As Double Dim secondPoint(0 To 2) As Double ' Define the ray basePoint(0) = 3#: basePoint(1) = 3#: basePoint(2) = 0# secondPoint(0) = 4#: secondPoint(1) = 4#: secondPoint(2) = 0# ' Creates a Ray object in model space Set rayObj = ThisDrawing.ModelSpace.AddRay(basePoint, secondPoint) ThisDrawing.Application.ZoomAll ' Find the current status of the Ray MsgBox "The base point of the ray is: " & _ rayObj.basePoint(0) & ", " & _ rayObj.basePoint(1) & ", " & _ rayObj.basePoint(2) & vbCrLf & _ "The directional vector for the ray is: " & _ rayObj.DirectionVector(0) & ", " & _ rayObj.DirectionVector(1) & ", " & _ rayObj.DirectionVector(2), , "Edit Ray" ' Change the directional vector for the ray Dim newVector(0 To 2) As Double newVector(0) = -1 newVector(1) = 1 newVector(2) = 0 rayObj.DirectionVector = newVector ThisDrawing.Regen False MsgBox "The base point of the ray is: " & _ rayObj.basePoint(0) & ", " & _ rayObj.basePoint(1) & ", " & _ rayObj.basePoint(2) & vbCrLf & _ "The directional vector for the ray is: " & _ rayObj.DirectionVector(0) & ", " & _ rayObj.DirectionVector(1) & ", " & _ rayObj.DirectionVector(2), , "Edit Ray" End Sub |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:25
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.