Hi @Alexander.Rivilis and @tbrammer ,
the code now is working thank you but I'm troubling with xdata editing in the reactor's methods:
- bref.openstatus() never eOk
void ReattoreRotazione::openedForModify(const AcDbObject * dbObj)
{
acutPrintf(L"APERTO PER MODIFICA\n");
AcDbObjectId objId;
objId = dbObj->objectId();
AcDbObjectPointer<AcDbBlockReference> bref(objId, AcDb::kForRead);
acutPrintf(L"MODIFIED\n");
if (bref.openStatus() == Acad::eOk) {
acutPrintf(L"SONO QUI\n");
Adesk::Boolean write = Adesk::kTrue;
bref->upgradeFromNotify(write);
deleteXdataRecord(bref);
}
}
2. I was thinking that bref->upgradeFromNotify was usefull to edit metadata but seems not work properly because when I call bref->setXdata(appNAme) i got : Exception thrown at 0x00007FFB5755DA32 (mscordacwks.dll) in acad.exe: 0xC0000005: Access violation reading location 0x0000000000000000.
void ReattoreRotazione::modified(const AcDbObject * dbObj)
{
AcDbObjectId objId;
objId = dbObj->objectId();
AcDbObjectPointer<AcDbBlockReference> bref(objId, AcDb::kForRead);
acutPrintf(L"MODIFIED\n");
if (bref.openStatus() == Acad::eOk) {
acutPrintf(L"DENTRO\n");
bref->rotation();
acutPrintf(L"Rotazione di: \n");
acutPrintf(ACRX_T("%f"), bref->rotation());
acutPrintf(L"Radianti");
Adesk::Boolean write = Adesk::kTrue;
bref->upgradeFromNotify(write);
writeRotation(bref);
}
else {
acutPrintf(L"NOPE\n");
}
}
and the skeleton for writeRotation() function is :
void ReattoreRotazione::writeRotation(AcDbBlockReference* bref) {
resbuf *rb = acutBuildList(
AcDb::kDxfRegAppName, myAppName,
0
);
if (bref->setXData(rb) == Acad::eOk) {
acutPrintf(L"SCRITTO\n");
}
else {
acutPrintf(L"NON SCRITTO\n");
}
}
3. The reactor is invoked for every action performed on my BlockReference, could I trigger my reactor after rotate command ?
Thank You,
Marco