马特,谢谢,但不是;这些位是初始化输入的吗 ;我试图使用InputBox,但找不到任何关于设置其使用位的文档
MJF该框的功能是放置在具有高程的块中的更大功能的一部分 ;我写了一个程序来绘制一个三维的电力变电站
- Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
- Public Sub AddPT()
- Const VK_ESCAPE = &H1B
- Const VK_LBUTTON = &H1
- Const VK_SPACE = &H20
- Const VK_RETURN = &HD
- Const VK_LEFT = &H25
- Dim inspt As Variant
- Dim intOSMode As Integer
- Dim dblRotation As Double
- Dim objBlockRef As AcadBlockReference, dblTOC As Double
- Dim varCancel As Variant, oCurrLayeR As AcadLayer
- On Error GoTo Err_Control
- Set oCurrLayeR = ThisDrawing.ActiveLayer
- IsSetup
- Start:
- dblTOC = CDbl(InputBox("What is T.O.C. elevation? ie 12 or 0 or -12"))
- ThisDrawing.SetVariable "ORTHOMODE", 1
-
- intOSMode = ThisDrawing.GetVariable("OSMODE")
- ThisDrawing.SetVariable "OSMODE", 32
- inspt = ThisDrawing.Utility.GetPoint(, "Pick Insertion Point: ")
- inspt(2) = inspt(2) + dblTOC
- ThisDrawing.SetVariable "OSMODE", intOSMode
- dblRotation = ThisDrawing.Utility.GetAngle(inspt, "Pick Front Side of PT: ")
- Set objBlockRef = ThisDrawing.ModelSpace.InsertBlock(inspt, Path & "138kv-PT-ASSEMBLY.dwg", 1, 1, 1, dblRotation)
- ThisDrawing.Regen acActiveViewport
- Exit_Here:
- ThisDrawing.ActiveLayer = oCurrLayeR
- ThisDrawing.SetVariable "OSMODE", intOSMode
- ThisDrawing.SetVariable "INSUNITS", 1
- Exit Sub
- Err_Control:
- Select Case Err.Number
- Case -2147352567
- 'Debug.Print Err.Number, Err.Description
- varCancel = ThisDrawing.GetVariable("LASTPROMPT")
- If InStr(1, varCancel, "*Cancel*") 0 Then
- If GetAsyncKeyState(VK_ESCAPE) And 8000 > 0 Then
- Err.Clear
- Resume Exit_Here
- ElseIf GetAsyncKeyState(VK_LBUTTON) > 0 Then
- Err.Clear
- Resume
- End If
- Else
- If GetAsyncKeyState(VK_SPACE) Then
- Resume Exit_Here
- End If
- 'Missed the pick, send them back!
- Err.Clear
- Resume
- End If
- Case 13
- GoTo Start
- Case Else
- MsgBox Err.Description
- Resume Exit_Here
- End Select
- End Sub
正如你所见,这是一个基本的功能,但我从来没有想过我的用户不输入值。 |