#include "Model_AttributeRefAttr.h"
#include "Model_Application.h"
#include "Model_Data.h"
+#include "Model_Objects.h"
#include <ModelAPI_Feature.h>
using namespace std;
{
// the back reference from the previous object to the attribute should be removed
ObjectPtr anObject = object();
- if (theObject && (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject)) {
+ if (theObject.get() && (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject)) {
REMOVE_BACK_REF(anObject);
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
owner()->document());
if (aDoc) {
TDF_Label aRefLab = myRef->Get();
- return aDoc->object(aRefLab);
+ return aDoc->objects()->object(aRefLab);
}
}
// not initialized
return ObjectPtr();
}
+bool Model_AttributeRefAttr::isInitialized()
+{
+ if (myRef->Get() == myRef->Label()) { // empty is not initialized: sketch parallelity
+ return false;
+ }
+ return ModelAPI_AttributeRefAttr::isInitialized();
+}
+
Model_AttributeRefAttr::Model_AttributeRefAttr(TDF_Label& theLabel)
{
myIsInitialized = theLabel.FindAttribute(TDataStd_Comment::GetID(), myID) == Standard_True;