DrawingSet.Remove method

AutoCAD Map 3D ActiveX

DrawingSet.Remove method

Detaches an attached drawing.

Remove(AttachedDwg As Variant) As Boolean

Returns True on success.

AttachedDwg

Either the index, starting at 0, of the drawing in the DrawingSet collection, or the full path and file name of the drawing to be detached.

The following example attaches two drawings, detaches the first one using the path, and detaches the other one using the item number.

Dim prj As Project

Dim drset As DrawingSet

Dim atdr As AttachedDrawing

Dim amap As AcadMap

Dim boolVal As Boolean

Dim cDrset As Integer, i As Integer

 

Set amap = ThisDrawing.Application. _

GetInterfaceObject("AutoCADMap.Application") 

Set prj = amap.Projects(ThisDrawing)

Set drset = prj.DrawingSet

Set atdr = drset.Add("ALIASNAME:\\DirName\\DwgName1.dwg")

Set atdr = drset.Add("ALIASNAME:\\DirName\\DwgName2.dwg")

boolVal = drset.Remove("ALIASNAME:\\DirName\\DwgName1.dwg")

If boolVal = True Then

Debug.Print "Removed " & "DwgName1.dwg" 

End If

cDrset = drset.Count

For i = 0 To cDrSet - 1

Set atdr = drset.Item(i) 

If atdr.AliasPath = "ALIASNAME:\\DirName\\DwgName2.dwg" Then 

drset.Remove (i) 

Debug.Print "Removed " & "DwgName2.dwg" 

End If 

Next i

ThisDrawing.Application.ZoomExtents