在cad内坐标展点是用VBA好还是用LISp方便?
我现在想开始学习编程,正好碰到需要把许多记事本内的坐标输到cad内,我不可能用手工一个一个的输,所以想询问前辈们在cad内坐标展点是用VBA好还是用LISp方便?还有,有没有人知道相同的过程如何在arcinfo或arcmap里面实行呢?
这样展点
你那里有cass吗?你可以用cass,不用编程序,如果编程序的话,用lisp和vba都挺容易的. 我没有cass。我的目的一个是想高效地完成工作,另外就是想学习cad的二次开发。可是我现在感觉不知如何下手好。 如果你的数据需要编辑,则用VBA好;如果数据格式比较规范,则用LISP也好.因为VB比LISP处理数据的能力要强. 同意楼上的看法,而且lisp也好学,兼容性好,不用总调来调去的,省了许多的麻烦事儿 展点是AUTOCAD二次开发中最简单的一个了,用什么都不所谓! VBA效率高 VBA速度快些! 其实不会编程也可以将批量坐标输入到CAD中,你可以将你的坐标转到excel中,然后选取所有的坐标数据,执行复制,回到CAD中,在命令行中输入PLINE命令,在人求你指定点时,将光标移到命令行,用快捷菜单中粘贴功能即可。-----------
树木掩映中没有发出歌声的清泉。 '下列代码可能对你有用,sqh@njau.edu.cn
Dim pnt4 As Double, pnt5 As Double<BR>Dim pnt6 As Single, texthgt1 As Single<BR>Dim str1 As String<BR>Dim wei As Integer<BR>Dim gcd As AcadBlockReference<BR>Dim gcd_text As AcadText<BR>Dim gcd_layer As AcadLayer
colornum = 1<BR>If ComboBox1.Text = "国标" Then<BR> texthgt1 = 2# * (ThisDrawing.GetVariable("userr5"))<BR> Else<BR> texthgt1 = Val(ComboBox1.Text) * (ThisDrawing.GetVariable("userr5"))<BR> End If<BR>Set gcd_layer = ThisDrawing.Layers.Add("gcd") '设置高程层<BR>ThisDrawing.ActiveLayer = gcd_layer '设为当前层<BR>Set gcd_layer = Nothing
wei = ComboBox2.Text<BR>CommonDialog1.Action = 1<BR>Dim filename1 As String<BR>filename1 = CommonDialog1.FileName<BR>If Trim(filename1) = "" Then Exit Sub<BR>'Me.Hide<BR>os_mode = ThisDrawing.GetVariable("osmode")<BR>Call ThisDrawing.SetVariable("osmode", 0)<BR>Open filename1 For Input As #1
Dim shpname As String<BR>Dim shpscale As Single<BR>shpscale = ThisDrawing.GetVariable("userr5")<BR>shpname = "c:\acad2000\block\128.dwg"<BR>pnt(2) = 0<BR>Do Until EOF(1)<BR> Input #1, pnt4, pnt4, pnt4, pnt5, pnt6<BR> pnt1(0) = pnt4: pnt1(1) = pnt5: pnt1(2) = pnt6<BR> pnt(0) = pnt4 + 1.5 * (ThisDrawing.GetVariable("userr5")): pnt(1) = pnt5<BR> str1 = ThisDrawing.Utility.RealToString(pnt6, 2, wei)<BR> If CheckBox1.Value = True Then pnt1(2) = 0 '展二维点<BR> <BR> If zdd.OptionButton1.Value = True Then '展绘高程为0的点<BR> ''展点<BR> Set gcd = ThisDrawing.ModelSpace.InsertBlock(pnt1, shpname, shpscale, shpscale, shpscale, 0)<BR> gcd.Color = colornum<BR> Set gcd = Nothing<BR> <BR> Set gcd_text = ThisDrawing.ModelSpace.AddText(str1, pnt, texthgt1) '注记<BR> gcd_text.Color = colornum<BR> gcd_text.ScaleFactor = 0.8<BR> gcd_text.StyleName = "HT"<BR> Set gcd_text = Nothing<BR> <BR> ElseIf (zdd.OptionButton2.Value = True And pnt6 <> 0) Then '不展绘高程为0的点<BR> Set gcd = ThisDrawing.ModelSpace.InsertBlock(pnt1, shpname, shpscale, shpscale, shpscale, 0)<BR> gcd.Color = colornum<BR> Set gcd = Nothing<BR> <BR> Set gcd_text = ThisDrawing.ModelSpace.AddText(str1, pnt, texthgt1) '注记<BR> gcd_text.Color = colornum<BR> gcd_text.ScaleFactor = 0.8<BR> gcd_text.StyleName = "HT"<BR> Set gcd_text = Nothing<BR> zdd.Caption = "请您等候" & "...当前点高程=" & CStr(pnt6)<BR> 'ThisDrawing.Application.Update '更新数据<BR> 'ThisDrawing.Application.ZoomExtents '全窗口<BR> End If<BR> <BR> Loop<BR>Close #1<BR>Call ThisDrawing.SetVariable("osmode", os_mode)<BR>ThisDrawing.ActiveLayer = ThisDrawing.Layers("0")
页:
[1]
2