求图层变换程序
<p>请问高手。</p><p>图层建好后 有 1 2 3 4 5 6.....</p><p>在选择对象后通过键盘输入1 2 3 4 6 ....中任意一个数字被选对象就变到数字相对应的图层中去了。</p> <a href="http://bbs.mjtd.com/forum.php?mod=viewthread&tid=60228">http://bbs.mjtd.com/forum.php?mod=viewthread&tid=60228</a> <p>我这里有一些你看看!</p><p>(defun c:00 () (command "LAYER""S""00""")) </p><p>(defun c:01 () (command "LAYER""S""01"""))<br/>(defun c:02() (command "LAYER""S""02"""))<br/>(defun c:03 () (command "LAYER""S""03"""))<br/>(defun c:04 () (command "LAYER""S""04"""))<br/>(defun c:05 () (command "LAYER""S""05"""))<br/>(defun c:1 () (command "LAYER""S""1"""))<br/>(defun c:11 () (command "LAYER""T""11""S""11"""))<br/>(defun c:12 () (command "LAYER""S""12"""))<br/>(defun c:13 () (command "LAYER""S""13"""))<br/>(defun c:14 () (command "LAYER""S""14"""))<br/>(defun c:15() (command "LAYER""S""15"""))<br/>(defun c:16 () (command "LAYER""S""16"""))<br/>(defun c:17 () (command "LAYER""S""17"""))<br/>(defun c:18 () (command "LAYER""S""18"""))<br/>(defun c:2 () (command "LAYER""S""2"""))<br/>(defun c:3 () (command "LAYER""S""3"""))<br/>(defun c:5 () (command "LAYER""S""5"""))<br/>(defun c:51 () (command "LAYER""S""51"""))<br/>(defun c:52 () (command "LAYER""S""52"""))<br/>(defun c:53 () (command "LAYER""S""53"""))<br/>(defun c:54 () (command "LAYER""S""54"""))<br/>(defun c:55 () (command "LAYER""S""55"""))<br/>(defun c:56 () (command "LAYER""S""56"""))<br/>(defun c:57 () (command "LAYER""S""57"""))<br/>(defun c:58 () (command "LAYER""S""58"""))<br/>(defun c:6 () (command "LAYER""S""6"""))<br/>(defun c:7 () (command "LAYER""S""7"""))<br/>(defun c:71 () (command "LAYER""S""71"""))<br/>(defun c:72 () (command "LAYER""S""72"""))<br/>(defun c:73 () (command "LAYER""S""73"""))<br/>(defun c:75 () (command "LAYER""S""75"""))<br/>(defun c:76 () (command "LAYER""S""76"""))<br/>(defun c:77 () (command "LAYER""S""77"""))<br/>(defun c:78 () (command "LAYER""S""78"""))<br/>(defun c:8 () (command "LAYER""S""8"""))</p> <p>都是lsp</p><p>来个vba的</p><p>Sub Example_layer()</p><p> Dim layerobj As AcadLayer<br/> Dim obj As AcadEntity<br/> Dim pt As Variant<br/> </p><p> '创建图层<br/> For i = 1 To 10<br/> Set layerobj = ThisDrawing.Layers.Add(CStr(i))<br/> Next i<br/> <br/> On Error Resume Next<br/> ThisDrawing.Utility.GetEntity obj, pt, "选择对象:"<br/> If Err <> 0 Then<br/> Exit Sub<br/> End If<br/> <br/> Dim LayerName As String<br/> Do<br/> LayerName = ThisDrawing.Utility.GetString(5, "输入图层名:")<br/> <br/> For i = 0 To Layers.Count - 1<br/> If UCase(Layers.Item(i).Name) = UCase(LayerName) Then<br/> obj.Layer = LayerName<br/> Exit Do<br/> End If<br/> Next i<br/> <br/> ThisDrawing.Utility.Prompt "输入的图层不存在,重新输入!" & vbCr<br/> Loop</p><p>End Sub<br/></p>
页:
[1]