<?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: Change xref color with overrules in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/change-xref-color-with-overrules/m-p/7008394#M8491</link>
    <description>&lt;P&gt;Thank you for the replay.&lt;/P&gt;&lt;P&gt;After doing some tests i've found out i was doing the "xref detection" part wrong.&lt;/P&gt;&lt;P&gt;I've changed my code like this and now it works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        AcDbEntity *asEnt = AcDbEntity::cast(pSubject);
        if (asEnt) {
            if(asEnt-&amp;gt;database() != acdbCurDwg())
                wd-&amp;gt;subEntityTraits().setColor(3);
        }
        Adesk::Boolean retValue = AcGiDrawableOverrule::worldDraw(pSubject, wd);&lt;/PRE&gt;&lt;P&gt;Thank you again&lt;/P&gt;</description>
    <pubDate>Tue, 11 Apr 2017 07:20:32 GMT</pubDate>
    <dc:creator>danipon71</dc:creator>
    <dc:date>2017-04-11T07:20:32Z</dc:date>
    <item>
      <title>Change xref color with overrules</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/change-xref-color-with-overrules/m-p/6970158#M8489</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;i need to color some entities using overrules.&lt;/P&gt;&lt;P&gt;Now I’m using AcGiDrawableOverrule::worldDraw.&lt;/P&gt;&lt;P&gt;It works fine with all entities but overrules.&lt;/P&gt;&lt;P&gt;Is there any way to color xref with AcGiDrawableOverrule?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code (cleaned) + xref detection&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;    virtual Adesk::Boolean  worldDraw(AcGiDrawable* pSubject, AcGiWorldDraw * wd)
    {
        bool xref = false;
        AcDbEntity *asEnt = AcDbEntity::cast(pSubject);
        if (asEnt) {
            if (asEnt-&amp;gt;isKindOf(AcDbBlockReference::desc())) {
                AcDbBlockReference *pBR = AcDbBlockReference::cast(asEnt);
                AcDbObjectId idBlk = pBR-&amp;gt;blockTableRecord();
                AcDbObject *pObj;
                acdbOpenObject(pObj, idBlk, AcDb::kForRead);
                AcDbBlockTableRecord * pBTR = AcDbBlockTableRecord::cast(pObj);
                if (pBTR != NULL) {
                    if (pBTR-&amp;gt;isFromExternalReference()) {
                        xref = true;
                    }
                }
                pObj-&amp;gt;close();
            }

            AcDbDatabase *db = asEnt-&amp;gt;database();
            if (db) {
                TopDwgStatus* dwgstatus = TopDwgStatus::find(db);
                if (dwgstatus) {
                    AcDbObjectId idLay = asEnt-&amp;gt;layerId();
                    wd-&amp;gt;subEntityTraits().setColor(3);
                }
            }
        }

        Adesk::Boolean retValue = inherited::worldDraw(pSubject, wd);
        return retValue;
    }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Mar 2017 09:53:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/change-xref-color-with-overrules/m-p/6970158#M8489</guid>
      <dc:creator>danipon71</dc:creator>
      <dc:date>2017-03-24T09:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Change xref color with overrules</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/change-xref-color-with-overrules/m-p/6997134#M8490</link>
      <description>&lt;P&gt;Thank you for your patience.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#3366FF"&gt;&lt;EM&gt;Is there any way to &lt;/EM&gt;color Xref&lt;EM&gt; with AcGiDrawableOverrule?&lt;/EM&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached is a simple project to add overrule to the AcDbEntity, where :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Adesk::Boolean testOverrule::worldDraw(AcGiDrawable* pSubject, AcGiWorldDraw* wd)
{
	
	AcDbEntity *asEnt = AcDbEntity::cast(pSubject);
	if (asEnt) {	
		wd-&amp;gt;subEntityTraits().setColor(3);
	}
	return AcGiDrawableOverrule::worldDraw(pSubject, wd);
}
&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;Having tested the project (&amp;nbsp;&lt;STRONG&gt;&lt;A href="http://autode.sk/2p0je9E" target="_blank" rel="nofollow noopener noreferrer"&gt;http://autode.sk/2p0je9E&lt;/A&gt;&amp;nbsp;&lt;/STRONG&gt;), it works for changing the color&amp;nbsp;of attached&amp;nbsp;XRef&amp;nbsp;.&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Apr 2017 12:37:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/change-xref-color-with-overrules/m-p/6997134#M8490</guid>
      <dc:creator>deepak.a.s.nadig</dc:creator>
      <dc:date>2017-04-05T12:37:02Z</dc:date>
    </item>
    <item>
      <title>Re: Change xref color with overrules</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/change-xref-color-with-overrules/m-p/7008394#M8491</link>
      <description>&lt;P&gt;Thank you for the replay.&lt;/P&gt;&lt;P&gt;After doing some tests i've found out i was doing the "xref detection" part wrong.&lt;/P&gt;&lt;P&gt;I've changed my code like this and now it works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        AcDbEntity *asEnt = AcDbEntity::cast(pSubject);
        if (asEnt) {
            if(asEnt-&amp;gt;database() != acdbCurDwg())
                wd-&amp;gt;subEntityTraits().setColor(3);
        }
        Adesk::Boolean retValue = AcGiDrawableOverrule::worldDraw(pSubject, wd);&lt;/PRE&gt;&lt;P&gt;Thank you again&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 07:20:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/change-xref-color-with-overrules/m-p/7008394#M8491</guid>
      <dc:creator>danipon71</dc:creator>
      <dc:date>2017-04-11T07:20:32Z</dc:date>
    </item>
  </channel>
</rss>

