<?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 Xref clipping in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/xref-clipping/m-p/330990#M41063</link>
    <description>I am working on a few utilities that deal with xrefs and want to be able to&lt;BR /&gt;
handle clipped boundaries.... The following code works pretty well with one&lt;BR /&gt;
exception. If the xref is moved from its original insertion BEFORE the xclip&lt;BR /&gt;
is applied then the points gathered in the following manner are off by the&lt;BR /&gt;
distance the xref was moved. The 'ACAD_FILTER' dictionary seems to contain&lt;BR /&gt;
the data to create a transformation matrix to use for correcting this,&lt;BR /&gt;
anyone have any suggestions on the best way to retrieve this data and place&lt;BR /&gt;
it in an AcGeMatrix3d or of another method to retrieve the difference in the&lt;BR /&gt;
points returned by getDefinition and the current insertion point of the&lt;BR /&gt;
block reference? I am not really trying to draw the clipped boundary,&lt;BR /&gt;
AutoCAD can do that, this is just a test to see if I can get the proper&lt;BR /&gt;
points that make up the boundary.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
bool drawClippedBoundary(AcDbObjectId xrefID){&lt;BR /&gt;
 AcDbObjectId dictionaryID,filterID, spatialID;&lt;BR /&gt;
 // data values for spatial filter....&lt;BR /&gt;
 AcGePoint2dArray points;&lt;BR /&gt;
 AcGeVector3d normVector;&lt;BR /&gt;
 double elevation,frontClip,backClip;&lt;BR /&gt;
 Adesk::Boolean enabled;&lt;BR /&gt;
&lt;BR /&gt;
 AcDbObjectPointer&lt;ACDBBLOCKREFERENCE&gt; pBlock(xrefID,AcDb::kForRead);&lt;BR /&gt;
 if(Acad::eOk == pBlock.openStatus()){&lt;BR /&gt;
  dictionaryID = pBlock-&amp;gt;extensionDictionary();&lt;BR /&gt;
  AcDbObjectPointer&lt;ACDBDICTIONARY&gt;&lt;BR /&gt;
pDictionary(dictionaryID,AcDb::kForRead);&lt;BR /&gt;
  if(Acad::eOk == pDictionary.openStatus()){&lt;BR /&gt;
   pDictionary-&amp;gt;getAt("ACAD_FILTER",filterID);&lt;BR /&gt;
   AcDbObjectPointer&lt;ACDBDICTIONARY&gt; pFilter(filterID,AcDb::kForRead);&lt;BR /&gt;
   if(Acad::eOk == pFilter.openStatus()){&lt;BR /&gt;
    pFilter-&amp;gt;getAt("SPATIAL",spatialID);&lt;BR /&gt;
    AcDbObjectPointer&lt;ACDBSPATIALFILTER&gt; pSpatial(spatialID,AcDb::kForRead);&lt;BR /&gt;
    if(Acad::eOk == pSpatial.openStatus()){&lt;BR /&gt;
     if(Acad::eOk ==&lt;BR /&gt;
pSpatial-&amp;gt;getDefinition(points,normVector,elevation,frontClip,backClip,enabl&lt;BR /&gt;
ed)){&lt;BR /&gt;
      // The following is temporary code to add a polyline around a&lt;BR /&gt;
      // clipped xref. This is for testing purposes only!&lt;BR /&gt;
      AcDbPolyline *pLine = new AcDbPolyline;&lt;BR /&gt;
      int pointLoop;&lt;BR /&gt;
      for(pointLoop = 0; pointLoop &amp;lt; points.logicalLength(); pointLoop++){&lt;BR /&gt;
       pLine-&amp;gt;addVertexAt(0,points[pointLoop]);&lt;BR /&gt;
      }&lt;BR /&gt;
      pLine-&amp;gt;setClosed(true);&lt;BR /&gt;
      pLine-&amp;gt;transformBy(pBlock-&amp;gt;blockTransform());&lt;BR /&gt;
      // get the modelspace record ID....&lt;BR /&gt;
      AcDbBlockTable *pBlockTable;&lt;BR /&gt;
      AcDbObjectId modelSpaceID, pLineID;&lt;BR /&gt;
&lt;BR /&gt;
acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;getSymbolTable(pBlockTable&lt;BR /&gt;
,AcDb::kForRead);&lt;BR /&gt;
      pBlockTable-&amp;gt;getAt(ACDB_MODEL_SPACE,modelSpaceID);&lt;BR /&gt;
      AcDbObjectPointer&lt;ACDBBLOCKTABLERECORD&gt;&lt;BR /&gt;
pModelSpace(modelSpaceID,AcDb::kForWrite);&lt;BR /&gt;
      if(Acad::eOk == pModelSpace.openStatus()){&lt;BR /&gt;
       if(Acad::eOk != pModelSpace-&amp;gt;appendAcDbEntity(pLineID, pLine)){&lt;BR /&gt;
        delete pLine;&lt;BR /&gt;
        return false;&lt;BR /&gt;
       }&lt;BR /&gt;
      }&lt;BR /&gt;
      pLine-&amp;gt;close();&lt;BR /&gt;
      pBlockTable-&amp;gt;close();&lt;BR /&gt;
      return true;&lt;BR /&gt;
     }&lt;BR /&gt;
    }&lt;BR /&gt;
   }&lt;BR /&gt;
  }&lt;BR /&gt;
 }&lt;BR /&gt;
 return false;&lt;BR /&gt;
}&lt;/ACDBBLOCKTABLERECORD&gt;&lt;/ACDBSPATIALFILTER&gt;&lt;/ACDBDICTIONARY&gt;&lt;/ACDBDICTIONARY&gt;&lt;/ACDBBLOCKREFERENCE&gt;</description>
    <pubDate>Thu, 25 Apr 2002 13:16:23 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2002-04-25T13:16:23Z</dc:date>
    <item>
      <title>Xref clipping</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/xref-clipping/m-p/330990#M41063</link>
      <description>I am working on a few utilities that deal with xrefs and want to be able to&lt;BR /&gt;
handle clipped boundaries.... The following code works pretty well with one&lt;BR /&gt;
exception. If the xref is moved from its original insertion BEFORE the xclip&lt;BR /&gt;
is applied then the points gathered in the following manner are off by the&lt;BR /&gt;
distance the xref was moved. The 'ACAD_FILTER' dictionary seems to contain&lt;BR /&gt;
the data to create a transformation matrix to use for correcting this,&lt;BR /&gt;
anyone have any suggestions on the best way to retrieve this data and place&lt;BR /&gt;
it in an AcGeMatrix3d or of another method to retrieve the difference in the&lt;BR /&gt;
points returned by getDefinition and the current insertion point of the&lt;BR /&gt;
block reference? I am not really trying to draw the clipped boundary,&lt;BR /&gt;
AutoCAD can do that, this is just a test to see if I can get the proper&lt;BR /&gt;
points that make up the boundary.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
bool drawClippedBoundary(AcDbObjectId xrefID){&lt;BR /&gt;
 AcDbObjectId dictionaryID,filterID, spatialID;&lt;BR /&gt;
 // data values for spatial filter....&lt;BR /&gt;
 AcGePoint2dArray points;&lt;BR /&gt;
 AcGeVector3d normVector;&lt;BR /&gt;
 double elevation,frontClip,backClip;&lt;BR /&gt;
 Adesk::Boolean enabled;&lt;BR /&gt;
&lt;BR /&gt;
 AcDbObjectPointer&lt;ACDBBLOCKREFERENCE&gt; pBlock(xrefID,AcDb::kForRead);&lt;BR /&gt;
 if(Acad::eOk == pBlock.openStatus()){&lt;BR /&gt;
  dictionaryID = pBlock-&amp;gt;extensionDictionary();&lt;BR /&gt;
  AcDbObjectPointer&lt;ACDBDICTIONARY&gt;&lt;BR /&gt;
pDictionary(dictionaryID,AcDb::kForRead);&lt;BR /&gt;
  if(Acad::eOk == pDictionary.openStatus()){&lt;BR /&gt;
   pDictionary-&amp;gt;getAt("ACAD_FILTER",filterID);&lt;BR /&gt;
   AcDbObjectPointer&lt;ACDBDICTIONARY&gt; pFilter(filterID,AcDb::kForRead);&lt;BR /&gt;
   if(Acad::eOk == pFilter.openStatus()){&lt;BR /&gt;
    pFilter-&amp;gt;getAt("SPATIAL",spatialID);&lt;BR /&gt;
    AcDbObjectPointer&lt;ACDBSPATIALFILTER&gt; pSpatial(spatialID,AcDb::kForRead);&lt;BR /&gt;
    if(Acad::eOk == pSpatial.openStatus()){&lt;BR /&gt;
     if(Acad::eOk ==&lt;BR /&gt;
pSpatial-&amp;gt;getDefinition(points,normVector,elevation,frontClip,backClip,enabl&lt;BR /&gt;
ed)){&lt;BR /&gt;
      // The following is temporary code to add a polyline around a&lt;BR /&gt;
      // clipped xref. This is for testing purposes only!&lt;BR /&gt;
      AcDbPolyline *pLine = new AcDbPolyline;&lt;BR /&gt;
      int pointLoop;&lt;BR /&gt;
      for(pointLoop = 0; pointLoop &amp;lt; points.logicalLength(); pointLoop++){&lt;BR /&gt;
       pLine-&amp;gt;addVertexAt(0,points[pointLoop]);&lt;BR /&gt;
      }&lt;BR /&gt;
      pLine-&amp;gt;setClosed(true);&lt;BR /&gt;
      pLine-&amp;gt;transformBy(pBlock-&amp;gt;blockTransform());&lt;BR /&gt;
      // get the modelspace record ID....&lt;BR /&gt;
      AcDbBlockTable *pBlockTable;&lt;BR /&gt;
      AcDbObjectId modelSpaceID, pLineID;&lt;BR /&gt;
&lt;BR /&gt;
acdbHostApplicationServices()-&amp;gt;workingDatabase()-&amp;gt;getSymbolTable(pBlockTable&lt;BR /&gt;
,AcDb::kForRead);&lt;BR /&gt;
      pBlockTable-&amp;gt;getAt(ACDB_MODEL_SPACE,modelSpaceID);&lt;BR /&gt;
      AcDbObjectPointer&lt;ACDBBLOCKTABLERECORD&gt;&lt;BR /&gt;
pModelSpace(modelSpaceID,AcDb::kForWrite);&lt;BR /&gt;
      if(Acad::eOk == pModelSpace.openStatus()){&lt;BR /&gt;
       if(Acad::eOk != pModelSpace-&amp;gt;appendAcDbEntity(pLineID, pLine)){&lt;BR /&gt;
        delete pLine;&lt;BR /&gt;
        return false;&lt;BR /&gt;
       }&lt;BR /&gt;
      }&lt;BR /&gt;
      pLine-&amp;gt;close();&lt;BR /&gt;
      pBlockTable-&amp;gt;close();&lt;BR /&gt;
      return true;&lt;BR /&gt;
     }&lt;BR /&gt;
    }&lt;BR /&gt;
   }&lt;BR /&gt;
  }&lt;BR /&gt;
 }&lt;BR /&gt;
 return false;&lt;BR /&gt;
}&lt;/ACDBBLOCKTABLERECORD&gt;&lt;/ACDBSPATIALFILTER&gt;&lt;/ACDBDICTIONARY&gt;&lt;/ACDBDICTIONARY&gt;&lt;/ACDBBLOCKREFERENCE&gt;</description>
      <pubDate>Thu, 25 Apr 2002 13:16:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/xref-clipping/m-p/330990#M41063</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2002-04-25T13:16:23Z</dc:date>
    </item>
  </channel>
</rss>

