- 积分
- 243
- 明经币
- 个
- 注册时间
- 2004-12-20
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
请教Utility.getpoint的用法
初次接触VBA 因为课程设计里面要用 所以有点着急 题目是画轴 我在窗体上面加了8个文字框 4个是轴的直径4个是轴的分段长度 但是在获取插入点的时候不会了 找参考书的说是用 insertPt = ThisDrawing.Utility.GetPoint(, "输入插入点:") 语句 但是编译的时候总是出错 请大家教我一下
或者说不用输入插入点,直接设置默认的插入点
还有 请教一下 VB里面数组如何初始化 举例说明 谢谢 Private Sub cmdsure_Click() Dim D1 As Double Dim D2 As Double Dim D3 As Double Dim D4 As Double Dim L1 As Double Dim L2 As Double Dim L3 As Double Dim L4 As Double D1 = txtd1.Text D2 = txtd2.Text D3 = txtd3.Text D4 = txtd4.Text L1 = txtl1.Text L2 = txtl2.Text L3 = txtl3.Text L4 = txtl4.Text Dim sysOSMODE As Integer sysOSMODE = ThisDrawing.GetVariable("osmode") ThisDrawing.SetVariable "osmode", 0 Dim p1, p2, p3, p4, p5, p6, p7, p8, insertPt(1) As Variant Dim utilObj As Object Set utilObj = ThisDrawing.Utility insertPt = ThisDrawing.Utility.GetPoint(, "输入插入点:") utilObj.CreateTypedArray p1, vbDouble, insertPt(0), insertPt(1),
0 utilObj.CreateTypedArray p2, vbDouble, insertPt(0), insertPt(1)
+ D1, 0 utilObj.CreateTypedArray p3, vbDouble, insertPt(0) + L1,
insertPt(1) - (D2 - D1) / 2, 0 utilObj.CreateTypedArray p4, vbDouble, insertPt(0) + L1,
insertPt(1) + (D2 + D1) / 2, 0 utilObj.CreateTypedArray p5, vbDouble, insertPt(0) + L1 + L2,
insertPt(1) - (D3 - D1) / 2, 0 utilObj.CreateTypedArray p6, vbDouble, insertPt(0) + L1 + L2,
insertPt(1) + (D3 + D2) / 2, 0 utilObj.CreateTypedArray p7, vbDouble, insertPt(0) + L1 + L2 +
L3, insertPt(1) - (D4 - D3) / 2, 0 utilObj.CreateTypedArray p8, vbDouble, insertPt(0) + L1 + L2 +
L3, insertPt(1) + (D4 + D3) / 2, 0 Dim mx As String mx = hehe 'create the block Set blockobj = ThisDrawing.Blocks.Add(insertPt, mx) Dim linea, lineb, linec, lined, linee As AcadLine Set linea = blockobj.AddLine(p1, p2) Set lineb = blockobj.AddLine(p3, p4) Set linec = blockobj.AddLine(p5, p6) Set lined = blockobj.AddLine(p7, p8) Dim blockrefobj As AcadBlockReference Set blockrefobj = ThisDrawing.ModelSpace.InsertBlock(insertPt,
mx, 1#, 1#, 1#, 0) ThisDrawing.Regen acActiveViewport End Sub |
|