请教大虾
请问斑竹,有没有一个函数可以实现以下功能:已知一点坐标及另一点相对于他的x增量与y增量,化出的下一点坐标。就象autocad下line命令,然后给定起点,当要求输入下一点时,可以利用@20.30化出下一点,问有没有这样的函数? '根据另一点的相对直角坐标创建直线Public Function AddLineReXY(ByVal ptSt As Variant, ByVal x As Double, ByVal y As Double) As AcadLine
'定义终点
Dim ptEn As Variant
ptEn = GetPoint(ptSt, x, y)
Set AddLineReXY = AddLine(ptSt, ptEn)
End Function
'创建直线的基准函数
Public Function AddLine(ByVal ptSt As Variant, ByVal ptEn As Variant) As AcadLine
Set AddLine = ThisDrawing.ModelSpace.AddLine(ptSt, ptEn)
End Function
'获得相对已经点偏移一定距离的点
Public Function GetPoint(pt As Variant, x As Double, y As Double) As Variant
Dim ptTarget(0 To 2) As Double
ptTarget(0) = pt(0) + x
ptTarget(1) = pt(1) + y
ptTarget(2) = 0
GetPoint = ptTarget
End Function xiexie
页:
[1]