return;
Quantity_Color aColor = anAIS->Color();
-- theR = aColor.Red()*255.;
-- theG = aColor.Green()*255.;
-- theB = aColor.Blue()*255.;
++ theR = (int)(aColor.Red()*255.);
++ theG = (int)(aColor.Green()*255.);
++ theB = (int)(aColor.Blue()*255.);
}
bool GeomAPI_AISObject::empty() const
// Calculate transformation
gp_Trsf aTrsf;
- gp_Vec aSrcDir(aSourceDir->x(), aSourceDir->y(), aSourceDir->z());
- gp_Vec aDstDir(aDestDir->x(), aDestDir->y(), aDestDir->z());
+ gp_Vec aSrcDir = aSrcDstNormals[0];
+ gp_Vec aDstDir = aSrcDstNormals[1];
++ gp_Vec aSrcDir = aSrcDstNormals[0];
++ gp_Vec aDstDir = aSrcDstNormals[1];
+ // Calculate rotation
gp_Quaternion aRot(aSrcDir, aDstDir);
aTrsf.SetRotation(aRot);
- gp_Vec aSrcCenter(aSourceLoc->x(), aSourceLoc->y(), aSourceLoc->z());
- aSrcCenter.Transform(aTrsf);
- gp_Vec aTrans(aDestLoc->x() - aSrcCenter.X(),
- aDestLoc->y() - aSrcCenter.Y(),
- aDestLoc->z() - aSrcCenter.Z());
+ // Calculate translation
+ gp_Vec aSrcLoc(aSrcDstPoints[0].XYZ());
+ gp_Vec aDstLoc(aSrcDstPoints[1].XYZ());
+ if (!theIsCentering)
+ aDstLoc = aSrcLoc + gp_Vec(aDstDir) * (aDstLoc-aSrcLoc).Dot(aDstDir);
+ aSrcLoc.Transform(aTrsf);
+ gp_Vec aTrans = aDstLoc - aSrcLoc;
aTrsf.SetTransformation(aRot, aTrans);
// Transform the shape with copying it
{
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theObject->data());
myRef->Append(aData->label().Father()); // store label of the object
++ // do it before the transaction finish to make just created/removed objects know dependencies
++ // and reference from composite feature is removed automatically
++ FeaturePtr anOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
++ if (anOwnerFeature.get()) {
++ aData->addBackReference(anOwnerFeature, id());
++ }
owner()->data()->sendAttributeUpdated(this);
}
if(!theObject)
return;
if (!myIsInitialized || value() != theObject) {
-- std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
-- theObject->data());
-- TDF_Label anObjLab = aData->label().Father(); // object label
++ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
++ theObject->data());
++ TDF_Label anObjLab = aData->label().Father(); // object label
if (owner()->document() == theObject->document()) { // same document, use reference attribute
TDF_Tool::Entry(anObjLab, anEntry);
TDataStd_AsciiString::Set(myRef->Label(), anEntry);
}
++ // do it before the transaction finish to make just created/removed objects know dependencies
++ // and reference from composite feature is removed automatically
++ FeaturePtr anOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
++ if (anOwnerFeature.get()) {
++ aData->addBackReference(anOwnerFeature, id());
++ }
owner()->data()->sendAttributeUpdated(this);
}
}
bool SketchPlugin_Arc::isFixed() {
-- return data()->selection(EXTERNAL_ID())->context().get();
++ return data()->selection(EXTERNAL_ID())->context().get() != NULL;
}
bool SketchPlugin_Arc::isFeatureValid()
}
bool SketchPlugin_Circle::isFixed() {
-- return data()->selection(EXTERNAL_ID())->context().get();
++ return data()->selection(EXTERNAL_ID())->context().get() != NULL;
}
void SketchPlugin_Circle::attributeChanged(const std::string& theID) {
}
bool SketchPlugin_Line::isFixed() {
-- return data()->selection(EXTERNAL_ID())->context().get();
++ return data()->selection(EXTERNAL_ID())->context().get() != NULL;
}
void SketchPlugin_Line::attributeChanged(const std::string& theID) {
}
bool SketchPlugin_Point::isFixed() {
-- return data()->selection(EXTERNAL_ID())->context().get();
++ return data()->selection(EXTERNAL_ID())->context().get() != NULL;
}
void SketchPlugin_Point::attributeChanged(const std::string& theID) {
for (; aShapeIt != aFeaturesPreview.end(); ++aShapeIt) {
aBigWire->addEdge(*aShapeIt);
}
- aBigWire->setPlane(anOrigin->pnt(), aDirX->dir(), aDirY->dir(), aNorm->dir());
+ aBigWire->setPlane(anOrigin->pnt(), aDirX->dir(), aNorm->dir());
-
-// GeomAlgoAPI_SketchBuilder::createFaces(anOrigin->pnt(), aDirX->dir(), aDirY->dir(), aNorm->dir(),
-// aFeaturesPreview, aLoops, aWires);
std::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
aConstr->setShape(aBigWire);
setResult(aConstr);