<?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: Opening and Closing drawings with ARX in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/opening-and-closing-drawings-with-arx/m-p/330147#M41420</link>
    <description>Matt,&lt;BR /&gt;
&lt;BR /&gt;
You may use the COM API to do that.&lt;BR /&gt;
It will allows you to manage drawings (open / close / save), perform zoom&lt;BR /&gt;
operations, create entities, customize menus and toolbars and much more.&lt;BR /&gt;
&lt;BR /&gt;
Here is a little example:&lt;BR /&gt;
&lt;BR /&gt;
// Utility function to build a double array&lt;BR /&gt;
HRESULT GetVariantFromDblArray(VARIANT* pVal, const double pt[3])&lt;BR /&gt;
{&lt;BR /&gt;
 pVal-&amp;gt;vt = VT_ARRAY | VT_R8;&lt;BR /&gt;
&lt;BR /&gt;
 SAFEARRAYBOUND rgsaBound;&lt;BR /&gt;
 rgsaBound.lLbound = 0L;&lt;BR /&gt;
 rgsaBound.cElements = 3;&lt;BR /&gt;
&lt;BR /&gt;
 pVal-&amp;gt;parray = SafeArrayCreate(VT_R8, 1, &amp;amp;rgsaBound);&lt;BR /&gt;
 if (! pVal-&amp;gt;parray)&lt;BR /&gt;
  return E_OUTOFMEMORY;&lt;BR /&gt;
&lt;BR /&gt;
 HRESULT hr;&lt;BR /&gt;
 for (long i = 0; i &amp;lt; 3; i++)&lt;BR /&gt;
  if ((hr = SafeArrayPutElement(pVal-&amp;gt;parray, &amp;amp;i, (void*)&amp;amp;pt&lt;I&gt;)) != S_OK)&lt;BR /&gt;
   return hr;&lt;BR /&gt;
 return S_OK;&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
// Performs ZOOM with the corners of zoom window&lt;BR /&gt;
void ZoomDWG(AcGePoint3d&amp;amp; pti,AcGePoint3d&amp;amp; ptj)&lt;BR /&gt;
{&lt;BR /&gt;
 CWinApp* pWinApp = acedGetAcadWinApp();&lt;BR /&gt;
 if(!pWinApp) return;&lt;BR /&gt;
 CComPtr&lt;IDISPATCH&gt; pDisp = pWinApp-&amp;gt;GetIDispatch(TRUE);&lt;BR /&gt;
 if(!pDisp) return;&lt;BR /&gt;
&lt;BR /&gt;
 CComPtr&lt;IACADAPPLICATION&gt; pComApp;&lt;BR /&gt;
 HRESULT hr = pDisp-&amp;gt;QueryInterface(IID_IAcadApplication,(void**)&amp;amp;pComApp);&lt;BR /&gt;
 if(FAILED(hr)) return;&lt;BR /&gt;
&lt;BR /&gt;
 CComPtr&lt;IACADDOCUMENT&gt; pDoc;&lt;BR /&gt;
 hr = pComApp-&amp;gt;get_ActiveDocument(&amp;amp;pDoc);&lt;BR /&gt;
 if(FAILED(hr)) return;&lt;BR /&gt;
&lt;BR /&gt;
 VARIANT lowerLeft,upperRight;&lt;BR /&gt;
 double pti_[3] = {pti&lt;X&gt;,pti&lt;Y&gt;,pti&lt;Z&gt;};&lt;BR /&gt;
 double ptj_[3] = {ptj&lt;X&gt;,ptj&lt;Y&gt;,ptj&lt;Z&gt;};&lt;BR /&gt;
&lt;BR /&gt;
 GetVariantFromDblArray(&amp;amp;lowerLeft, pti_);&lt;BR /&gt;
 GetVariantFromDblArray(&amp;amp;upperRight, ptj_);&lt;BR /&gt;
&lt;BR /&gt;
 pComApp-&amp;gt;ZoomWindow(lowerLeft,upperRight);&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
To get more information about what is possible to do, see the VBA help on&lt;BR /&gt;
AutoCAD and see the COM Automation subject on VC++ Help.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Fernando.&lt;BR /&gt;
&lt;BR /&gt;
"Matt Reath" &lt;REATHM&gt; wrote in message&lt;BR /&gt;
news:92CDBD5ADE601ED300C18C1039457B4A@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I am currently working on a project that will need to create a new&lt;BR /&gt;
drawing,&lt;BR /&gt;
&amp;gt; add some stuff, and the save it.  I will be doing this multiple times (in&lt;BR /&gt;
a&lt;BR /&gt;
&amp;gt; loop) and really need to get some insight from the discussion group.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; What functions need to be used to do this.  appContextNewDocument() seems&lt;BR /&gt;
to&lt;BR /&gt;
&amp;gt; be a good idea but I don't know how to use it properly even after reading&lt;BR /&gt;
&amp;gt; the documentation.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks,&lt;BR /&gt;
&amp;gt; Matt&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/REATHM&gt;&lt;/Z&gt;&lt;/Y&gt;&lt;/X&gt;&lt;/Z&gt;&lt;/Y&gt;&lt;/X&gt;&lt;/IACADDOCUMENT&gt;&lt;/IACADAPPLICATION&gt;&lt;/IDISPATCH&gt;&lt;/I&gt;</description>
    <pubDate>Fri, 05 Apr 2002 03:03:00 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2002-04-05T03:03:00Z</dc:date>
    <item>
      <title>Opening and Closing drawings with ARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/opening-and-closing-drawings-with-arx/m-p/330146#M41419</link>
      <description>I am currently working on a project that will need to create a new drawing,&lt;BR /&gt;
add some stuff, and the save it.  I will be doing this multiple times (in a&lt;BR /&gt;
loop) and really need to get some insight from the discussion group.&lt;BR /&gt;
&lt;BR /&gt;
What functions need to be used to do this.  appContextNewDocument() seems to&lt;BR /&gt;
be a good idea but I don't know how to use it properly even after reading&lt;BR /&gt;
the documentation.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Matt</description>
      <pubDate>Thu, 04 Apr 2002 10:32:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/opening-and-closing-drawings-with-arx/m-p/330146#M41419</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-04-04T10:32:45Z</dc:date>
    </item>
    <item>
      <title>Re: Opening and Closing drawings with ARX</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/opening-and-closing-drawings-with-arx/m-p/330147#M41420</link>
      <description>Matt,&lt;BR /&gt;
&lt;BR /&gt;
You may use the COM API to do that.&lt;BR /&gt;
It will allows you to manage drawings (open / close / save), perform zoom&lt;BR /&gt;
operations, create entities, customize menus and toolbars and much more.&lt;BR /&gt;
&lt;BR /&gt;
Here is a little example:&lt;BR /&gt;
&lt;BR /&gt;
// Utility function to build a double array&lt;BR /&gt;
HRESULT GetVariantFromDblArray(VARIANT* pVal, const double pt[3])&lt;BR /&gt;
{&lt;BR /&gt;
 pVal-&amp;gt;vt = VT_ARRAY | VT_R8;&lt;BR /&gt;
&lt;BR /&gt;
 SAFEARRAYBOUND rgsaBound;&lt;BR /&gt;
 rgsaBound.lLbound = 0L;&lt;BR /&gt;
 rgsaBound.cElements = 3;&lt;BR /&gt;
&lt;BR /&gt;
 pVal-&amp;gt;parray = SafeArrayCreate(VT_R8, 1, &amp;amp;rgsaBound);&lt;BR /&gt;
 if (! pVal-&amp;gt;parray)&lt;BR /&gt;
  return E_OUTOFMEMORY;&lt;BR /&gt;
&lt;BR /&gt;
 HRESULT hr;&lt;BR /&gt;
 for (long i = 0; i &amp;lt; 3; i++)&lt;BR /&gt;
  if ((hr = SafeArrayPutElement(pVal-&amp;gt;parray, &amp;amp;i, (void*)&amp;amp;pt&lt;I&gt;)) != S_OK)&lt;BR /&gt;
   return hr;&lt;BR /&gt;
 return S_OK;&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
// Performs ZOOM with the corners of zoom window&lt;BR /&gt;
void ZoomDWG(AcGePoint3d&amp;amp; pti,AcGePoint3d&amp;amp; ptj)&lt;BR /&gt;
{&lt;BR /&gt;
 CWinApp* pWinApp = acedGetAcadWinApp();&lt;BR /&gt;
 if(!pWinApp) return;&lt;BR /&gt;
 CComPtr&lt;IDISPATCH&gt; pDisp = pWinApp-&amp;gt;GetIDispatch(TRUE);&lt;BR /&gt;
 if(!pDisp) return;&lt;BR /&gt;
&lt;BR /&gt;
 CComPtr&lt;IACADAPPLICATION&gt; pComApp;&lt;BR /&gt;
 HRESULT hr = pDisp-&amp;gt;QueryInterface(IID_IAcadApplication,(void**)&amp;amp;pComApp);&lt;BR /&gt;
 if(FAILED(hr)) return;&lt;BR /&gt;
&lt;BR /&gt;
 CComPtr&lt;IACADDOCUMENT&gt; pDoc;&lt;BR /&gt;
 hr = pComApp-&amp;gt;get_ActiveDocument(&amp;amp;pDoc);&lt;BR /&gt;
 if(FAILED(hr)) return;&lt;BR /&gt;
&lt;BR /&gt;
 VARIANT lowerLeft,upperRight;&lt;BR /&gt;
 double pti_[3] = {pti&lt;X&gt;,pti&lt;Y&gt;,pti&lt;Z&gt;};&lt;BR /&gt;
 double ptj_[3] = {ptj&lt;X&gt;,ptj&lt;Y&gt;,ptj&lt;Z&gt;};&lt;BR /&gt;
&lt;BR /&gt;
 GetVariantFromDblArray(&amp;amp;lowerLeft, pti_);&lt;BR /&gt;
 GetVariantFromDblArray(&amp;amp;upperRight, ptj_);&lt;BR /&gt;
&lt;BR /&gt;
 pComApp-&amp;gt;ZoomWindow(lowerLeft,upperRight);&lt;BR /&gt;
}&lt;BR /&gt;
&lt;BR /&gt;
To get more information about what is possible to do, see the VBA help on&lt;BR /&gt;
AutoCAD and see the COM Automation subject on VC++ Help.&lt;BR /&gt;
&lt;BR /&gt;
Regards,&lt;BR /&gt;
Fernando.&lt;BR /&gt;
&lt;BR /&gt;
"Matt Reath" &lt;REATHM&gt; wrote in message&lt;BR /&gt;
news:92CDBD5ADE601ED300C18C1039457B4A@in.WebX.maYIadrTaRb...&lt;BR /&gt;
&amp;gt; I am currently working on a project that will need to create a new&lt;BR /&gt;
drawing,&lt;BR /&gt;
&amp;gt; add some stuff, and the save it.  I will be doing this multiple times (in&lt;BR /&gt;
a&lt;BR /&gt;
&amp;gt; loop) and really need to get some insight from the discussion group.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; What functions need to be used to do this.  appContextNewDocument() seems&lt;BR /&gt;
to&lt;BR /&gt;
&amp;gt; be a good idea but I don't know how to use it properly even after reading&lt;BR /&gt;
&amp;gt; the documentation.&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks,&lt;BR /&gt;
&amp;gt; Matt&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt;&lt;/REATHM&gt;&lt;/Z&gt;&lt;/Y&gt;&lt;/X&gt;&lt;/Z&gt;&lt;/Y&gt;&lt;/X&gt;&lt;/IACADDOCUMENT&gt;&lt;/IACADAPPLICATION&gt;&lt;/IDISPATCH&gt;&lt;/I&gt;</description>
      <pubDate>Fri, 05 Apr 2002 03:03:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/opening-and-closing-drawings-with-arx/m-p/330147#M41420</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-04-05T03:03:00Z</dc:date>
    </item>
  </channel>
</rss>

