感谢楼主写了这个LISP展点程序,可惜我的LISP学得不好。有那个编程技术好的,能不能将这个展点程序用VBA重写一下。我自已写了一个,可是展上去的点没办法写上扩展属性,不能让CASS识别。我的原程序如下,请各位高手指点:
Sub zgcd() Dim pn As Variant Dim pnt(0 To 2) As Double Dim blockRefObj As AcadBlockReference Dim textObj As AcadText Dim dh As String Dim x As Double Dim y As Double Dim z As Double Dim pcode As String Dim ly As AcadLayer UserForm4.Show Dim texth As Double
Set ly = ThisDrawing.Layers.Add("高程") ly.color = acGreen Set ly = ThisDrawing.Layers.Add("点号") ly.color = acMagenta Set ly = ThisDrawing.Layers.Add("GCD") ly.color = acRed UserForm1.CommonDialog1.Filter = "All Files|*.*|*.dat|*.dat|" UserForm1.CommonDialog1.FilterIndex = 2 UserForm1.CommonDialog1.DefaultExt = ".dat" UserForm1.CommonDialog1.Action = 1 fl1 = UserForm1.CommonDialog1.FileName If fl1 = "" Then Exit Sub Open fl1 For Input As #1 Line Input #1, dh I = InStr(1, dh, ",") If I > 0 Then Close #1 Open fl1 For Input As #1 End If I = 0 Do While Not EOF(1) On Error GoTo ex1 Input #1, dh, pcode, x, y, z pnt(0) = x pnt(1) = y pnt(2) = z If pnt(0) * pnt(1) * pnt(2) <> 0 Then Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(pnt, "GC200", 0.1, 0.1, 1#, 0) blockRefObj.Layer = "GCD" blockRefObj.color = acByLayer
'这里应该写点什么才能将点的SOUTH属性设成202101
Set textObj = ThisDrawing.ModelSpace.AddText(pnt(2), pnt, 0.2) textObj.Layer = "高程" textObj.color = acByLayer
I = I + 1 End If Loop ThisDrawing.Utility.prompt ("共展高程点:" & Str(I) & "个" & Chr$(13) + Chr$(10)) Close #1 ex1: ThisDrawing.Application.ZoomExtents End Sub