⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 Please read your package and describe it at least 40 bytes.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "VB调用ACAD绘制图形示例"
   ClientHeight    =   3195
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   ScaleHeight     =   159.75
   ScaleMode       =   2  'Point
   ScaleWidth      =   234
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command3 
      Caption         =   "交互输入"
      Height          =   555
      Left            =   405
      TabIndex        =   4
      Top             =   2205
      Width           =   1905
   End
   Begin VB.CommandButton Command2 
      Caption         =   "写入文本"
      Height          =   495
      Left            =   360
      TabIndex        =   3
      Top             =   1620
      Width           =   1950
   End
   Begin VB.CheckBox cmdVisible 
      Caption         =   "ACAD可见"
      Height          =   615
      Left            =   2835
      TabIndex        =   2
      Top             =   585
      Width           =   1095
   End
   Begin VB.CommandButton cmdQuit 
      Caption         =   "退出ACAD"
      Height          =   495
      Left            =   360
      TabIndex        =   1
      Top             =   990
      Width           =   1935
   End
   Begin VB.CommandButton Command1 
      Caption         =   "启动ACAD"
      Height          =   495
      Left            =   360
      TabIndex        =   0
      Top             =   360
      Width           =   1935
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'欢迎访问“中国VB网”(http://www.vbchina.com),有大量VB源代码、控件供下载
'另有留言簿、计数器、友情链接等提供免费申请服务
Private Sub cmdQuit_Click()
 acadObj.Quit
End Sub

Private Sub cmdVisible_Click()
acadObj.Visible = True
End Sub


Private Sub CmdStart_Click()
  Call AcadOpen
End Sub

Private Sub Command1_Click()
  Call AcadOpen
End Sub

Private Sub Command2_Click()
   Dim inspnt(0 To 2) As Double
   Dim texthight As Double
   Dim textstr As String
   Dim pt1(0 To 2) As Double
   Dim pt2(0 To 2) As Double
   
   Call AcadOpen
   
   Set AcadDoc = acadObj.ActiveDocument
   
   Set MSpace = AcadDoc.ModelSpace
   
   inspnt(0) = 4
   inspnt(1) = 0
   texthight = 1
   textstr = "喂,您好,写入成功!"
   Set TextObj = MSpace.AddText(textstr, inspnt, texthight)
   pt1(0) = 1
   pt1(1) = 1
   pt2(0) = 5
   pt2(1) = 10
   Call AcadLine(pt1, pt2)
End Sub

Private Sub Command3_Click()
    Dim startPoint(0 To 2) As Double
    Dim endPoint(0 To 2) As Double
    Dim textString As String
    Dim radius As Double
    Dim i As Integer
    
    Call AcadOpen
   
    Set AcadDoc = acadObj.ActiveDocument
   
    Set MSpace = AcadDoc.ModelSpace
   
    
    Dim acadUtil As Object
    Set acadUtil = AcadDoc.Utility     'acadDoc must have been defined earlier


    Dim stPnt, enPnt As Variant          'Define variables to receive return values
    Dim prompt1, prompt2 As String       'Define variables for prompt strings
    prompt1 = NL & "开始点: "
    prompt2 = NL & "结束点: "

    'Use GetPoint without the 'from point' to request a start point
    stPnt = acadUtil.GetPoint(, prompt1)

    'Use GetPoint using the start point as the 'from point' and request an end point
    enPnt = acadUtil.GetPoint(stPnt, prompt2)

    'To use the values returned by GetPoint as a point you must transfer each
    'element from the variant array to a double array
    startPoint(0) = stPnt(0)             'Copy element 0 from variant to double
    startPoint(1) = stPnt(1)             'Copy element 1 from variant to double

    startPoint(2) = stPnt(2)             'Copy element 2 from variant to double
    endPoint(0) = enPnt(0)               'Copy element 0 from variant to double
    endPoint(1) = enPnt(1)               'Copy element 1 from variant to double
    endPoint(2) = enPnt(2)               'Copy element 2 from variant to double

    Call AcadLine(startPoint, endPoint)

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -