ObjectARX

Reply
Mentor
diagodose2009
Posts: 262
Registered: ‎12-04-2009
Message 1 of 2 (208 Views)

: pSolid->setSubentColor(dbsubEntId,culo); has failed.in autocad

208 Views, 1 Replies
01-09-2013 11:31 PM

Title: pSolid->setSubentColor(dbsubEntId,culo); has failed.in autocad
My source , in c++arx, work fine , the  color has changed.
I try the command at line-command
                Command: saveas…
or  / and
                Command: save…
The programe acad.exe have bug…
The “pSolid->close()” broken the acad.exe, please, you replace “????” with c++ source..
Please  help. me…….

 [source=cpp]
#include “brepapi.h”
//here ,open pAcDbObject in AcDb::kForRead
………………………..
// here   subentPath got value and  okai…

    rb=nil;
    AcDbObjectId objId=pAcDbObject->objectId();
    pAcDbObject->close();   // close  pAcDbObject in mode=AcDb::kForRead

    // Get the subentIds for the faces.
    AcCmColor culo;
    culo.setRGB(200,120,70u);
    
    AcDb3dSolid* pSolid = NULL;
    con_ercad = acdbOpenObject(pAcDbObject, objId, AcDb::kForWrite);
    if (con_ercad != Acad::eOk) {
        DEBUG_PRINT(_T("g403.error %d: Can't open entity. "), con_ercad);
        return (rr);
    }

   pSolid = AcDb3dSolid::cast(pAcDbObject);
    AcDbSubentId dbsubEntId = subentPath.subentId();
    con_ercad=pSolid->setSubentColor(dbsubEntId,culo);
    if (con_ercad != Acad::eOk)
      { ads_retint(RTKWORD);
            pAcDbObject->close();
        exitif(1,"g403.error rmv");
      };
   
    pAcDbObject->close();
    pSolid->close();    // ????????

    ads_retint(RTNORM);
    //ads_retint(subentPath.subentId().index());
    return(AcRx::kRetOK);    
[/source=cpp]
Regards……….


Moderator
Alexander.Rivilis
Posts: 1,412
Registered: ‎04-09-2008
Message 2 of 2 (198 Views)

Re: : pSolid->setSubentColor(dbsubEntId,culo); has failed.in autocad

01-10-2013 01:17 AM in reply to: diagodose2009

pAcDbObject and pSolid is the same object. That is why you are closing this object twice.

Try to delete (or comment) line:

 pSolid->close();

 

 


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.