ObjectARX

ObjectARX

Reply
Mentor
263 Posts
3 Kudos
Registered: ‎12-04-2009
Post 1 of 2

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

215 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
1,465 Posts
277 Kudos
Registered: ‎04-09-2008
Post 2 of 2

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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!