- 积分
- 203
- 明经币
- 个
- 注册时间
- 2011-10-27
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
Public Sub TXPJ()
On Error GoTo e1
Set acadApp = GetObject(, "AutoCAD.Application")
Set ThisDrawing = acadApp.ActiveDocument
Dim objDBX As Object
Dim fileName As String
Dim ent() As Object
Dim lngCount As Long, i As Long
Dim GetInterfaceObject As Object
Do
Set objDBX = GetInterfaceObject("ObjectDBX.AxDbDocument.tt")
ThisDrawing.SendCommand "(setvar " & """users1""" & "(getfiled " & """Select a DWG File""" & """E:/工作/全图/142-KB/""" & """dwg""" & "8)) "
fileName = ThisDrawing.GetVariable("users1")
objDBX.Open fileName
lngCount = objDBX.ModelSpace.Count
ReDim ent(lngCount - 1) As Object
For i = 0 To lngCount - 1
Set ent(i) = objDBX.ModelSpace.Item(i)
Next i
objDBX.CopyObjects ent, ThisDrawing.ModelSpace
Set objDBX = Nothing
If MsgBox("是否继续?", vbYesNo, "Microsoft Excel") = vbNo Then
Dim S
Dim t As String
Dim lay0 As Object
t = "图例"
Do
S = MsgBox("是否删除" & t & "层吗?", vbOKCancel, "提示")
If S = vbOK Then
findlay = 0
For Each lay0 In ThisDrawing.Layers '在所有的图层中进行循环
If lay0.Name = t Then '如果找到图层名
findlay = 1
Dim l As Object
Set l = ThisDrawing.Layers(t)
ThisDrawing.ActiveLayer = ThisDrawing.Layers("0")
Dim e As Object
For Each e In ThisDrawing.ModelSpace
If e.Layer = t Then
e.Delete
End If
Next
'L.Delete '当图层中有参照时删不掉
ThisDrawing.Regen acActiveViewport
Exit For
End If
Next lay0
If findlay = 0 Then '没有找到图层
MsgBox "没有找到" & t & " 图层"
End If
If t = "图例" Then
t = "内图廓线"
Else
Exit Sub
End If
Else
If t = "图例" Then
t = "内图廓线"
Else
Exit Sub
End If
End If
Loop
Exit Sub
End If
Loop
e1:
Exit Sub
End Sub
这段图形拼接程序如何改为后期邦定?请高手帮忙修改一下!!!
|
|