- '根据另一点的相对直角坐标创建直线
- 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
|