iT邦幫忙

0

AutoCAD ActiveX #2 AcadUtility

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()

Gets the point selected in AutoCAD.

  • VBA
Dim pt As Variant
pt = 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 Variant
pt1 = ThisDrawing.Utility.getPoint(,"點1")

Dim pt2 As Variant
pt2 = ThisDrawing.Utility.getPoint(,"點2")
    
retAngle = ThisDrawing.Utility.AngleFromXAxis(pt1, pt2)

getEntity()

Gets an object interactively.

  • VBA
Dim getObj As AcadObject
Dim pt As Variant
    
ThisDrawing.Utility.getEntity getObj, pt, "選取物件..."
getObj.Update

AngleToReal()

Converts an angle as a string to a real (double) value.

  • VBA
Dim angAsStr As String
Dim unit As Integer

angAsStr = "45"
unit = acDegrees

Dim Ang As Double
Ang = ThisDrawing.Utility.AngleToReal(angAsStr, unit)

AngleToString()

Converts an angle from a real (double) value to a string.

Dim angAsRad As Double
Dim unit As Integer
Dim precision As Long

angAsRad = 0.785398163397448
unit = acDegrees
precision = 6

Dim angAsString As String
angAsString = ThisDrawing.Utility.AngleToString(angAsRad, unit, precision)
    
End Sub

PolarPoint()

Gets the point at a specified angle and distance from a given point.

  • VBA
Dim Pt As Variant
pt1 = 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 Double
Dic = 100
pt2 = ThisDrawing.Utility.getPoint.polarPoint(pt1, Ang, Dic)

Prompt()

Displays a prompt on the command line.

  • VBA
ThisDrawing.Utility.Prompt "提示文字"

上一篇
下一篇


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言