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 "提示文字"

上一篇
下一篇


<<:  伸缩自如的Flask [day10] 将资料写进DB(pymongo)

>>:  AutoCAD ActiveX #3 Draw

Day09【Web】跨来源资源共用 CORS

CORS 全称 Cross-Origin Resource Sharing, 中文为「跨来源资源共用...

[2021铁人赛 Day24] Forensics 监识学题目 01

小勘误: 前几天提到我们会把六大类都至少做过一题,但是 picoCTF 的 Misc 类 -- U...

渗透测试-列举可用的服务和资源

-渗透测试方法 使用 CVE 进行漏洞扫描通常遵循识别和枚举端口、服务和资源的情况。进行渗透测试并...

Day#29 对话(2)

前言 前一天终於把bug都修好,让模拟器可以顺利地打开喔。今天继续把想要的主要功能做出来。 Conv...

[Day08] CH06:重复的力量——回圈(上)

有时候同样一个程序需要执行多次,那我们总不可能把同样的一段程序码复制贴上吧?这样未免太没效率,也会使...