Utility
A series of methods provided for utility purposes.
Utility functions that allow you to request input from the user or perform geometric calculations.
getPoint()
VBAGets the point selected in AutoCAD.
Dim pt As Variantpt = ThisDrawing.Utility.getPoint(,"点选...")
C#pt = AcadApp.ActiveDocument.Utility.GetPoint(Type.Missing, "点选...");
AngleFromXAxis()
Gets the angle of a line from the X axis.
Dim pt1 As Variantpt1 = ThisDrawing.Utility.getPoint(,"点1")Dim pt2 As Variantpt2 = ThisDrawing.Utility.getPoint(,"点2") retAngle = ThisDrawing.Utility.AngleFromXAxis(pt1, pt2)
getEntity()
VBAGets an object interactively.
Dim getObj As AcadObjectDim pt As Variant ThisDrawing.Utility.getEntity getObj, pt, "选取物件..."getObj.Update
AngleToReal()
VBAConverts an angle as a string to a real (double) value.
Dim angAsStr As StringDim unit As IntegerangAsStr = "45"unit = acDegreesDim Ang As DoubleAng = ThisDrawing.Utility.AngleToReal(angAsStr, unit)
AngleToString()
Converts an angle from a real (double) value to a string.
Dim angAsRad As DoubleDim unit As IntegerDim precision As LongangAsRad = 0.785398163397448unit = acDegreesprecision = 6Dim angAsString As StringangAsString = ThisDrawing.Utility.AngleToString(angAsRad, unit, precision) End Sub
PolarPoint()
VBAGets the point at a specified angle and distance from a given point.
Dim Pt As Variantpt1 = ThisDrawing.Utility.getPoint(, "点选...")'AngleToReal() Dim angAsStr As String Dim unit As Integer angAsStr=30 unit = acDegrees Dim Ang As Double Ang = ThisDrawing.Utility.AngleToReal(angAsStr, unit)Dim Dic As DoubleDic = 100pt2 = ThisDrawing.Utility.getPoint.polarPoint(pt1, Ang, Dic)
Prompt()
VBADisplays a prompt on the command line.
ThisDrawing.Utility.Prompt "提示文字"
上一篇
下一篇