<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Detach in AutoCAD Map 3D Developer Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/detach/m-p/624692#M5076</link>
    <description>Hello Bart.&lt;BR /&gt;
&lt;BR /&gt;
Here are a couple of functions I use to detach dwgs via the VBA O.M.&lt;BR /&gt;
Notice the 'RefreshWorkspace' function...&lt;BR /&gt;
What the other fellow was commenting on was a result of a problem with the&lt;BR /&gt;
Project Workspace not refreshing after certain actions from VBA.  I have&lt;BR /&gt;
found that if you force a 'refresh', you can call actuions like this from&lt;BR /&gt;
VBA&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps&lt;BR /&gt;
Warren M&lt;BR /&gt;
&lt;BR /&gt;
**************** Start Snippet *****************&lt;BR /&gt;
&lt;BR /&gt;
Public Function MapDetachDwgByName(strFileName As String)&lt;BR /&gt;
&lt;BR /&gt;
  On Error GoTo ErrorHandler&lt;BR /&gt;
    Dim AutoCADMap As AcadMap&lt;BR /&gt;
    Set AutoCADMap = GetObject(,&lt;BR /&gt;
"AutoCAD.Application").GetInterfaceObject("AutocadMap.Application")&lt;BR /&gt;
&lt;BR /&gt;
    AutoCADMap.Projects.item(ThisDrawing).DrawingSet.Remove strFileName&lt;BR /&gt;
&lt;BR /&gt;
    Call RefreshWorkspace&lt;BR /&gt;
    Set AutoCADMap = Nothing&lt;BR /&gt;
&lt;BR /&gt;
'If the operation was unsuccessful the following code tries to&lt;BR /&gt;
'show the error stack or the last error code from AutoCAD MAP&lt;BR /&gt;
ErrorHandler:&lt;BR /&gt;
    MsgBox ("Last AutoCAD Error Code: " &amp;amp; AutoCADMap.ErrorStack.LastErrCode)&lt;BR /&gt;
&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Public Function RefreshWorkspace()&lt;BR /&gt;
  ThisDrawing.SendCommand "MAPWSREFRESH" &amp;amp; vbCr&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
**************** End Snippet *****************&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"B Wells" &lt;BART.WELLS&gt; wrote in message&lt;BR /&gt;
news:A3F8E38FB5EE8A75836F894BE8CE8830@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; is there method for detaching a drawing from a project through VBA or&lt;BR /&gt;
LISP?&lt;BR /&gt;
&amp;gt; I have searched the Object Lib.  and cannot find anything there.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thank you in advance.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Bart&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/BART.WELLS&gt;</description>
    <pubDate>Fri, 11 Apr 2003 09:15:09 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2003-04-11T09:15:09Z</dc:date>
    <item>
      <title>Detach</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/detach/m-p/624690#M5074</link>
      <description>is there method for detaching a drawing from a project through VBA or LISP?&lt;BR /&gt;
I have searched the Object Lib.  and cannot find anything there.&lt;BR /&gt;
&lt;BR /&gt;
Thank you in advance.&lt;BR /&gt;
&lt;BR /&gt;
Bart</description>
      <pubDate>Mon, 07 Apr 2003 13:57:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/detach/m-p/624690#M5074</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-04-07T13:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Detach</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/detach/m-p/624691#M5075</link>
      <description>You can do it in VBA with the Map Object Model but when I used this method I found this part of the object model has a bug so I use the following SendCommand method: ThisDrawing.SendCommand "ADEDRAWINGS" &amp;amp; vbCr &amp;amp; "DE" &amp;amp; vbCr &amp;amp; "*" &amp;amp; vbCr &amp;amp; "X" &amp;amp; vbCr - This exaple detaches all drawings. You can substitute the * wildcard with a file name. Regards Nathan Taylor.</description>
      <pubDate>Mon, 07 Apr 2003 15:03:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/detach/m-p/624691#M5075</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-04-07T15:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: Detach</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/detach/m-p/624692#M5076</link>
      <description>Hello Bart.&lt;BR /&gt;
&lt;BR /&gt;
Here are a couple of functions I use to detach dwgs via the VBA O.M.&lt;BR /&gt;
Notice the 'RefreshWorkspace' function...&lt;BR /&gt;
What the other fellow was commenting on was a result of a problem with the&lt;BR /&gt;
Project Workspace not refreshing after certain actions from VBA.  I have&lt;BR /&gt;
found that if you force a 'refresh', you can call actuions like this from&lt;BR /&gt;
VBA&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps&lt;BR /&gt;
Warren M&lt;BR /&gt;
&lt;BR /&gt;
**************** Start Snippet *****************&lt;BR /&gt;
&lt;BR /&gt;
Public Function MapDetachDwgByName(strFileName As String)&lt;BR /&gt;
&lt;BR /&gt;
  On Error GoTo ErrorHandler&lt;BR /&gt;
    Dim AutoCADMap As AcadMap&lt;BR /&gt;
    Set AutoCADMap = GetObject(,&lt;BR /&gt;
"AutoCAD.Application").GetInterfaceObject("AutocadMap.Application")&lt;BR /&gt;
&lt;BR /&gt;
    AutoCADMap.Projects.item(ThisDrawing).DrawingSet.Remove strFileName&lt;BR /&gt;
&lt;BR /&gt;
    Call RefreshWorkspace&lt;BR /&gt;
    Set AutoCADMap = Nothing&lt;BR /&gt;
&lt;BR /&gt;
'If the operation was unsuccessful the following code tries to&lt;BR /&gt;
'show the error stack or the last error code from AutoCAD MAP&lt;BR /&gt;
ErrorHandler:&lt;BR /&gt;
    MsgBox ("Last AutoCAD Error Code: " &amp;amp; AutoCADMap.ErrorStack.LastErrCode)&lt;BR /&gt;
&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
Public Function RefreshWorkspace()&lt;BR /&gt;
  ThisDrawing.SendCommand "MAPWSREFRESH" &amp;amp; vbCr&lt;BR /&gt;
End Function&lt;BR /&gt;
&lt;BR /&gt;
**************** End Snippet *****************&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"B Wells" &lt;BART.WELLS&gt; wrote in message&lt;BR /&gt;
news:A3F8E38FB5EE8A75836F894BE8CE8830@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; is there method for detaching a drawing from a project through VBA or&lt;BR /&gt;
LISP?&lt;BR /&gt;
&amp;gt; I have searched the Object Lib.  and cannot find anything there.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thank you in advance.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Bart&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/BART.WELLS&gt;</description>
      <pubDate>Fri, 11 Apr 2003 09:15:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/detach/m-p/624692#M5076</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-04-11T09:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Detach</title>
      <link>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/detach/m-p/624693#M5077</link>
      <description>Hi Bart,&lt;BR /&gt;
&lt;BR /&gt;
There are functions in both VBA and LISP. One thing to remember is to&lt;BR /&gt;
refresh the project window. Below is a sample lisp code.&lt;BR /&gt;
&lt;BR /&gt;
Hope this helps,&lt;BR /&gt;
-PG.&lt;BR /&gt;
&lt;BR /&gt;
;;*********************************************************&lt;BR /&gt;
(defun test ()&lt;BR /&gt;
  ;; create a drive alias&lt;BR /&gt;
  (ade_aliasadd&lt;BR /&gt;
    "test_drive"&lt;BR /&gt;
    "c:\\Program Files\\Autodesk Map 2004\\MAPTUT"&lt;BR /&gt;
  )&lt;BR /&gt;
  ;; attach a drawing&lt;BR /&gt;
  (setq dwg_id&lt;BR /&gt;
  (ade_dsattach "test_drive:\\Tutorial I\\citymap.dwg")&lt;BR /&gt;
  )&lt;BR /&gt;
  ;; make visisble the drawing in Project Window&lt;BR /&gt;
  (if dwg_id&lt;BR /&gt;
    (refreshWspace)&lt;BR /&gt;
  )&lt;BR /&gt;
  (getint "\nPress Enter...")&lt;BR /&gt;
  ;; detach the drawing&lt;BR /&gt;
  (if (ade_dsdetach dwg_id)&lt;BR /&gt;
    (refreshWspace)&lt;BR /&gt;
  )&lt;BR /&gt;
)&lt;BR /&gt;
(defun refreshWspace ()&lt;BR /&gt;
  (command "_mapwspace" "")&lt;BR /&gt;
)&lt;BR /&gt;
;;*********************************************************&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"B Wells" &lt;BART.WELLS&gt; wrote in message&lt;BR /&gt;
news:A3F8E38FB5EE8A75836F894BE8CE8830@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; is there method for detaching a drawing from a project through VBA or&lt;BR /&gt;
LISP?&lt;BR /&gt;
&amp;gt; I have searched the Object Lib.  and cannot find anything there.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thank you in advance.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Bart&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/BART.WELLS&gt;</description>
      <pubDate>Mon, 21 Apr 2003 09:47:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-map-3d-developer-forum/detach/m-p/624693#M5077</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-04-21T09:47:27Z</dc:date>
    </item>
  </channel>
</rss>

