关于CAD基于VBA二次开发的问题
PrivateSubCommandButton24_Click()DimAAsStringDimBAsStringDimCAsStringDimDAsStringDimE...
Private Sub CommandButton24_Click()
Dim A As String
Dim B As String
Dim C As String
Dim D As String
Dim E As String
Dim F As String
Dim G As String
Dim H As String
Dim I As String
'设定以上A—I为字符
Dim VarRet As Variant
Dim PT1(0 To 2) As Double
Dim DCC As AcadBlockReference
'设定一个自定点,为非标准使用
If Label6 = "平头加硬自攻" Then
A = "ZG"
E = "D:\YZ_ZCAD\TK\AZG\"
End If
If Label6 = "圆头加硬自攻" Then
A = "BYBZ"
E = "D:\YZ_ZCAD\TK\BYZG\"
End If
If Label6 = "平头公制螺丝" Then
A = "PG"
E = "D:\YZ_ZCAD\TK\CPG\"
End If
If Label6 = "圆头公制螺丝" Then
A = "YG"
E = "D:\YZ_ZCAD\TK\DYG\"
End If
If Label6 = "平头不锈钢自攻" Then
A = "PBZ"
E = "D:\YZ_ZCAD\TK\EPBZ\"
End If
If Label6 = "圆头不锈钢自攻" Then
A = "YBZ"
E = "D:\YZ_ZCAD\TK\FYBZ\"
End If
If Label6 = "机米螺丝" Then
A = "JM"
E = "D:\YZ_ZCAD\TK\GJM\"
End If
'根据设定当前螺丝的种类来决定A与E的字串符文字
C = TextBox1.Text
If TextBox1.Text = "" Then
C = Label9.Caption
Else
Label9.Caption = TextBox1.Text
Label7.Caption = TextBox1.Text
End If
'如果输出入框为空,则忽略输入框,如果输入框非空,则显示输入框文本
B = Label8.Caption
D = A + B + C
F = "_"
G = "x"
I = ".dwg"
'设定各字母的值,以后路径及判定用
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ThisDrawing.SendCommand "ORTHOMODE 0" & vbCr
ThisDrawing.SendCommand "-insert" & vbCr
ThisDrawing.SendCommand H & vbCr
ThisDrawing.SendCommand "0,0,0 1 1 0 "
ThisDrawing.SendCommand "move L 0,0,0 "
此段是在以后的一段代码,CAD执行CAD标准命令,我想直接改为用VBA中的插入模块进行调用,整个函要如何改呢?
你是不是这个意思,在按扭上不能用呀
Sub ZhInsertingABlock()
Dim DCC As AcadBlockReference
Dim VR As Variant
Dim PO(0 To 2) As Double
VR = Utility.GetPoint(, "请指定放置点: ")
PO(0) = VR(0)
PO(1) = VR(1)
PO(2) = VR(2)
Set DCC = ThisDrawing.ModelSpace.InsertBlock _
(insertionPnt, "D:\001.dwg", 1#, 1#, 1#, 0)
End Sub
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
参看:
http://user.qzone.qq.com/307862408/blog/1236749778 展开
Dim A As String
Dim B As String
Dim C As String
Dim D As String
Dim E As String
Dim F As String
Dim G As String
Dim H As String
Dim I As String
'设定以上A—I为字符
Dim VarRet As Variant
Dim PT1(0 To 2) As Double
Dim DCC As AcadBlockReference
'设定一个自定点,为非标准使用
If Label6 = "平头加硬自攻" Then
A = "ZG"
E = "D:\YZ_ZCAD\TK\AZG\"
End If
If Label6 = "圆头加硬自攻" Then
A = "BYBZ"
E = "D:\YZ_ZCAD\TK\BYZG\"
End If
If Label6 = "平头公制螺丝" Then
A = "PG"
E = "D:\YZ_ZCAD\TK\CPG\"
End If
If Label6 = "圆头公制螺丝" Then
A = "YG"
E = "D:\YZ_ZCAD\TK\DYG\"
End If
If Label6 = "平头不锈钢自攻" Then
A = "PBZ"
E = "D:\YZ_ZCAD\TK\EPBZ\"
End If
If Label6 = "圆头不锈钢自攻" Then
A = "YBZ"
E = "D:\YZ_ZCAD\TK\FYBZ\"
End If
If Label6 = "机米螺丝" Then
A = "JM"
E = "D:\YZ_ZCAD\TK\GJM\"
End If
'根据设定当前螺丝的种类来决定A与E的字串符文字
C = TextBox1.Text
If TextBox1.Text = "" Then
C = Label9.Caption
Else
Label9.Caption = TextBox1.Text
Label7.Caption = TextBox1.Text
End If
'如果输出入框为空,则忽略输入框,如果输入框非空,则显示输入框文本
B = Label8.Caption
D = A + B + C
F = "_"
G = "x"
I = ".dwg"
'设定各字母的值,以后路径及判定用
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ThisDrawing.SendCommand "ORTHOMODE 0" & vbCr
ThisDrawing.SendCommand "-insert" & vbCr
ThisDrawing.SendCommand H & vbCr
ThisDrawing.SendCommand "0,0,0 1 1 0 "
ThisDrawing.SendCommand "move L 0,0,0 "
此段是在以后的一段代码,CAD执行CAD标准命令,我想直接改为用VBA中的插入模块进行调用,整个函要如何改呢?
你是不是这个意思,在按扭上不能用呀
Sub ZhInsertingABlock()
Dim DCC As AcadBlockReference
Dim VR As Variant
Dim PO(0 To 2) As Double
VR = Utility.GetPoint(, "请指定放置点: ")
PO(0) = VR(0)
PO(1) = VR(1)
PO(2) = VR(2)
Set DCC = ThisDrawing.ModelSpace.InsertBlock _
(insertionPnt, "D:\001.dwg", 1#, 1#, 1#, 0)
End Sub
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
参看:
http://user.qzone.qq.com/307862408/blog/1236749778 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询