Guys,
some where in the docs i saw there is a way to downClose an object if it is had multireaders
How?
thanX
moshe
Solved! Go to Solution.
Solved by owenwengerd. Go to Solution.
It has nothing to do with multiple readers, but maybe you are thinking of downgradeOpen().
Owen hi,
No i thought about AcDbObject::isReallyClosing() but this does not solved the problem i encounter...
i have a dynamic block (inserted in ) with 3 Visibility options and i want to set it but always gets
eHadMultipleReaders error so i thought the AcDbBlockReference is opened more than one time
but with AcDbObject::isReallyClosing() it turns out it is open only one
here is the function i call to do that....BlkRefId is the block id that is open for read only once
openDirValue has the new value to set
bool setDynamicBlockPropertyValue(AcDbObjectId BlkRefId, AcDbEvalVariant openDirValue) { AcDbDynBlockReferencePropertyArray DynBlkRefPropArray; DynBlkRefPropArray.setLogicalLength(0); AcDbDynBlockReference DynBlkRef(BlkRefId); DynBlkRef.getBlockProperties(DynBlkRefPropArray); AcDbDynBlockReferenceProperty DynBlockReferenceProp; for (inti = 0; i < DynBlkRefPropArray.length(); i++) { DynBlockReferenceProp = DynBlkRefPropArray.at(i); if (DynBlockReferenceProp.propertyName() == _T("Visibility") && DynBlockReferenceProp.propertyType() == AcDbEvalVariant::kString && DynBlockReferenceProp.readOnly() == false&& DynBlockReferenceProp.show() == true) { DynBlockReferenceProp.setValue(openDirValue); // set visibility returns eHadMultipleReaders return true; } } return false; }
Moshe
Why did you leave the BlkRefId object open for read? Did you try closing it before calling setDynamicBlockPropertyValue()?
Owen
As always you got the sharp senses...you are the one of the bests.
thank you very much
moshe
Thank you. BTW, based on your usage of the function arguments, you should change the function signature like so:
bool setDynamicBlockPropertyValue(const AcDbObjectId& BlkRefId, const AcDbEvalVariant& openDirValue)
why? i do not set these arguments in getDynamicBlockPropertyValue() and do not need them in the caller
but i do have an issue with openDirValue...
here is what i do before calling setDynamicBlockPropertyValue()
AcDbEvalVariant openDirValue; AcDbObjectId ObjId = pEnt->objectId(); pEnt->close(); getDynamicBlockPropertyValue(ObjId, openDirValue) if (_tcsicmp(openDirValue.resval.rstring, _T("Left Openning")) == NULL) openDirValue = _T("Right Openning"); else if (_tcsicmp(openDirValue.resval.rstring, _T("Right Openning")) == NULL) openDirValue = _T("Left Openning"); setDynamicBlockPropertyValue(ObjId, openDirValue);
the compare with openDirValue string value fails because is contains a space.
how can i solve it? (i prefer to keep the visibility options as the are)
moshe
The arguments should be const because you're not changing them, and by reference so you don't create and discard copies for no reason. I doubt that the space has any bearing on your string comparison. I think the misspelled word "Opening" is more likely the reason.
Ok i accept your rermark on const and by reference
regarding openDirValue, for a while instead of space i put there a dash and it start to work
after a while it stops working although DynBlockReferenceProp.setValue(openDirValue) returns
Acad::eOk do not know why? or how? it was frustrating...
after you turned my attention for the misspelled 'openning' i also removed the dash and restored the space
there i discoved that there was and extra space in the visibility parameter (you can not see it by eye)
than i fix it it its now working
again, thank you very much for your help, i turly appreciate it.
Moshe
Can't find what you're looking for? Ask the community or share your knowledge.