ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1 REPLY 1
Reply
Message 1 of 2
diagodose2009
500 Views, 1 Reply

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

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……….


1 REPLY 1
Message 2 of 2

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

Try to delete (or comment) line:

 pSolid->close();

 

 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost