- 积分
- 568
- 明经币
- 个
- 注册时间
- 2003-10-18
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2004-6-22 23:57:00
|
显示全部楼层
'下列代码可能对你有用,sqh@njau.edu.cn
Dim pnt4 As Double, pnt5 As Double Dim pnt6 As Single, texthgt1 As Single Dim str1 As String Dim wei As Integer Dim gcd As AcadBlockReference Dim gcd_text As AcadText Dim gcd_layer As AcadLayer
colornum = 1 If ComboBox1.Text = "国标" Then texthgt1 = 2# * (ThisDrawing.GetVariable("userr5")) Else texthgt1 = Val(ComboBox1.Text) * (ThisDrawing.GetVariable("userr5")) End If Set gcd_layer = ThisDrawing.Layers.Add("gcd") '设置高程层 ThisDrawing.ActiveLayer = gcd_layer '设为当前层 Set gcd_layer = Nothing
wei = ComboBox2.Text CommonDialog1.Action = 1 Dim filename1 As String filename1 = CommonDialog1.FileName If Trim(filename1) = "" Then Exit Sub 'Me.Hide os_mode = ThisDrawing.GetVariable("osmode") Call ThisDrawing.SetVariable("osmode", 0) Open filename1 For Input As #1
Dim shpname As String Dim shpscale As Single shpscale = ThisDrawing.GetVariable("userr5") shpname = "c:\acad2000\block\128.dwg" pnt(2) = 0 Do Until EOF(1) Input #1, pnt4, pnt4, pnt4, pnt5, pnt6 pnt1(0) = pnt4: pnt1(1) = pnt5: pnt1(2) = pnt6 pnt(0) = pnt4 + 1.5 * (ThisDrawing.GetVariable("userr5")): pnt(1) = pnt5 str1 = ThisDrawing.Utility.RealToString(pnt6, 2, wei) If CheckBox1.Value = True Then pnt1(2) = 0 '展二维点 If zdd.OptionButton1.Value = True Then '展绘高程为0的点 ''展点 Set gcd = ThisDrawing.ModelSpace.InsertBlock(pnt1, shpname, shpscale, shpscale, shpscale, 0) gcd.Color = colornum Set gcd = Nothing Set gcd_text = ThisDrawing.ModelSpace.AddText(str1, pnt, texthgt1) '注记 gcd_text.Color = colornum gcd_text.ScaleFactor = 0.8 gcd_text.StyleName = "HT" Set gcd_text = Nothing ElseIf (zdd.OptionButton2.Value = True And pnt6 <> 0) Then '不展绘高程为0的点 Set gcd = ThisDrawing.ModelSpace.InsertBlock(pnt1, shpname, shpscale, shpscale, shpscale, 0) gcd.Color = colornum Set gcd = Nothing Set gcd_text = ThisDrawing.ModelSpace.AddText(str1, pnt, texthgt1) '注记 gcd_text.Color = colornum gcd_text.ScaleFactor = 0.8 gcd_text.StyleName = "HT" Set gcd_text = Nothing zdd.Caption = "请您等候" & "...当前点高程=" & CStr(pnt6) 'ThisDrawing.Application.Update '更新数据 'ThisDrawing.Application.ZoomExtents '全窗口 End If Loop Close #1 Call ThisDrawing.SetVariable("osmode", os_mode) ThisDrawing.ActiveLayer = ThisDrawing.Layers("0") |
|