#------ OCCT ------
# Defaults
-export CSF_PluginDefaults=${CAS_ROOT_DIR}/src/StdResource
-export CSF_StandardDefaults=${CAS_ROOT_DIR}/src/StdResource
+export CSF_PluginDefaults=${CAS_ROOT_DIR}/share/opencascade/resources
+export CSF_StandardDefaults=${CAS_ROOT_DIR}/share/opencascade/resources
# For CMake
export LIB=${LD_LIBRARY_PATH}
export PATH=${CASROOT}:${PATH}
}
}
// store the selected as primitive
- TNaming_Builder aBuilder(selectionLabel());
- aBuilder.Generated(aSubShape);
- registerSubShape(
- selectionLabel(), aSubShape, 0, aContextFeature, aMyDoc, anOrientations, aSubNames, aRefs);
+ registerSubShape(
+ selectionLabel(), aSubShape, 0, aContextFeature, aMyDoc, anOrientations, aSubNames, aRefs);
}
bool Model_AttributeSelection::selectPart(
// that this one and is really modifies the referenced result to refer to it
ResultPtr aModifierResFound;
TNaming_Iterator aPairIter(aContNS);
+ if (!aPairIter.More())
+ return;
TopoDS_Shape aNewShape = aPairIter.NewShape();
bool anIterate = true;
// trying to update also the sub-shape selected
aShapePairs.push_front(std::pair<TopoDS_Shape, TopoDS_Shape>
(anIter.OldShape(), anIter.NewShape()));
}
- }
- // create new
- TNaming_Builder aBuilder(theLab);
- TNaming_Evolution anEvol = (TNaming_Evolution)(anEvolution);
- std::list<std::pair<TopoDS_Shape, TopoDS_Shape> >::iterator aPairsIter = aShapePairs.begin();
- for(; aPairsIter != aShapePairs.end(); aPairsIter++) {
- if (theFlag) { // disabled => make selection
- aBuilder.Select(aPairsIter->second, aPairsIter->first);
- } else if (anEvol == TNaming_GENERATED) {
- aBuilder.Generated(aPairsIter->first, aPairsIter->second);
- } else if (anEvol == TNaming_MODIFY) {
- aBuilder.Modify(aPairsIter->first, aPairsIter->second);
- } else if (anEvol == TNaming_DELETE) {
- aBuilder.Delete(aPairsIter->first);
- } else if (anEvol == TNaming_PRIMITIVE) {
- aBuilder.Generated(aPairsIter->second);
- } else if (anEvol == TNaming_SELECTED) {
- aBuilder.Select(aPairsIter->second, aPairsIter->first);
+
+ // create new
+ TNaming_Builder aBuilder(theLab);
+ TNaming_Evolution anEvol = (TNaming_Evolution)(anEvolution);
+ std::list<std::pair<TopoDS_Shape, TopoDS_Shape> >::iterator aPairsIter = aShapePairs.begin();
+ for(; aPairsIter != aShapePairs.end(); aPairsIter++) {
+ if (theFlag) { // disabled => make selection
+ aBuilder.Select(aPairsIter->second, aPairsIter->first);
+ } else if (anEvol == TNaming_GENERATED) {
+ aBuilder.Generated(aPairsIter->first, aPairsIter->second);
+ } else if (anEvol == TNaming_MODIFY) {
+ aBuilder.Modify(aPairsIter->first, aPairsIter->second);
+ } else if (anEvol == TNaming_DELETE) {
+ aBuilder.Delete(aPairsIter->first);
+ } else if (anEvol == TNaming_PRIMITIVE) {
+ aBuilder.Generated(aPairsIter->second);
+ } else if (anEvol == TNaming_SELECTED) {
+ aBuilder.Select(aPairsIter->second, aPairsIter->first);
+ }
}
}
// recursive call for all sub-labels
#include <TDF_ListIteratorOfLabelList.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_DeltaOnAddition.hxx>
+#include <TNaming_Builder.hxx>
#include <TNaming_SameShapeIterator.hxx>
#include <TNaming_Iterator.hxx>
#include <TNaming_NamedShape.hxx>
if (!isError) {
myDoc = aLoaded;
myDoc->SetUndoLimit(UNDO_LIMIT);
+
+ // TODO: remove after fix in OCCT.
+ // All named shapes are stored in reversed order, so to fix this we reverse them back.
+ for(TDF_ChildIDIterator aChildIter(myDoc->Main(), TNaming_NamedShape::GetID(), true);
+ aChildIter.More();
+ aChildIter.Next()) {
+ Handle(TNaming_NamedShape) aNamedShape =
+ Handle(TNaming_NamedShape)::DownCast(aChildIter.Value());
+ if (aNamedShape.IsNull()) {
+ continue;
+ }
+
+ TopoDS_Shape aShape = aNamedShape->Get();
+ if(aShape.IsNull() || aShape.ShapeType() != TopAbs_COMPOUND) {
+ continue;
+ }
+
+ TNaming_Evolution anEvol = aNamedShape->Evolution();
+ std::list<std::pair<TopoDS_Shape, TopoDS_Shape> > aShapePairs; // to store old and new shapes
+ for(TNaming_Iterator anIter(aNamedShape); anIter.More(); anIter.Next()) {
+ aShapePairs.push_back(
+ std::pair<TopoDS_Shape, TopoDS_Shape>(anIter.OldShape(), anIter.NewShape()));
+ }
+
+ // Add in reverse order.
+ TDF_Label aLabel = aNamedShape->Label();
+ TNaming_Builder aBuilder(aLabel);
+ for(std::list<std::pair<TopoDS_Shape, TopoDS_Shape> >::iterator aPairsIter =
+ aShapePairs.begin();
+ aPairsIter != aShapePairs.end();
+ aPairsIter++) {
+ if (anEvol == TNaming_GENERATED) {
+ aBuilder.Generated(aPairsIter->first, aPairsIter->second);
+ } else if (anEvol == TNaming_MODIFY) {
+ aBuilder.Modify(aPairsIter->first, aPairsIter->second);
+ } else if (anEvol == TNaming_DELETE) {
+ aBuilder.Delete(aPairsIter->first);
+ } else if (anEvol == TNaming_PRIMITIVE) {
+ aBuilder.Generated(aPairsIter->second);
+ } else if (anEvol == TNaming_SELECTED) {
+ aBuilder.Select(aPairsIter->second, aPairsIter->first);
+ }
+ }
+ }
+
// to avoid the problem that feature is created in the current, not this, document
aSession->setActiveDocument(anApp->document(myID), false);
aSession->setCheckTransactions(false);
{
return ROOT_DOC->transactionID();
}
-
-void Model_Session::forceLoadPlugin(const std::string& thePluginName)
-{
- // load all information about plugins, features and attributes
- LoadPluginsInfo();
-
- // store name of current plugin for further restoring,
- // because forceLoadPlugin may be called while loading another plugin
- std::string aCurrentPluginName = myCurrentPluginName;
-
- myCurrentPluginName = thePluginName;
- if (myPluginObjs.find(myCurrentPluginName) == myPluginObjs.end()) {
- // load plugin library if not yet done
- Config_ModuleReader::loadPlugin(myCurrentPluginName);
- }
-
- // restore current plugin
- myCurrentPluginName = aCurrentPluginName;
-}
/// Returns the global identifier of the current transaction (needed for the update algo)
MODEL_EXPORT virtual int transactionID();
- /// Load plugin by its name
- MODEL_EXPORT virtual void forceLoadPlugin(const std::string& thePluginName);
-
protected:
/// Loads (if not done yet) the information about the features and plugins
void LoadPluginsInfo();
/// Returns the global identifier of the current transaction (needed for the update algo)
virtual int transactionID() = 0;
- /// Load plugin by its name
- virtual void forceLoadPlugin(const std::string& thePluginName) = 0;
-
protected:
/// Sets the session interface implementation (once per application launch)
static void setSession(std::shared_ptr<ModelAPI_Session> theManager);
theDumper.myDumpBuffer << theEndl;
if (!theDumper.myEntitiesStack.empty()) {
- // Name for composite feature is dumped when all sub-entities are dumped
- // (see method ModelHighAPI_Dumper::processSubs).
- const ModelHighAPI_Dumper::LastDumpedEntity& aLastDumped = theDumper.myEntitiesStack.top();
- CompositeFeaturePtr aComposite =
- std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aLastDumped.myEntity);
- if (!aComposite)
- theDumper.dumpEntitySetName();
+ bool isCopy;
+ // all copies have been stored into stack, pop them all
+ do {
+ isCopy = false;
+ // Name for composite feature is dumped when all sub-entities are dumped
+ // (see method ModelHighAPI_Dumper::processSubs).
+ const ModelHighAPI_Dumper::LastDumpedEntity& aLastDumped = theDumper.myEntitiesStack.top();
+ CompositeFeaturePtr aComposite =
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aLastDumped.myEntity);
+ if (!aComposite) {
+ theDumper.dumpEntitySetName();
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aLastDumped.myEntity);
+ if (aFeature) {
+ AttributeBooleanPtr aCopyAttr = aFeature->boolean("Copy");
+ isCopy = aCopyAttr.get() && aCopyAttr->value();
+ }
+ }
+ } while (isCopy);
}
// store all not-dumped entities first
"""Package for Sketch plugin for the Parametric Geometry API of the Modeler.
"""
-# DEBIAN 6.0 WORKAROUND START
-"""
- Following code is used to support Debian 6.0.
- It is kept, because SketchPlugin should be loaded before SketchAPI is first used.
- Otherwise, the runtime error will be generated while some static inline methods are broken.
-"""
-from ModelAPI import ModelAPI_Session
-aSession = ModelAPI_Session.get()
-aSession.forceLoadPlugin("SketchPlugin")
-# DEBIAN 6.0 WORKAROUND FINISH
-
from SketchAPI import addSketch
from tools import addPolyline, addPolygon
TestSplit.py
TestHighload.py
TestSnowflake.py
- TestArcBehavior.py )
+ TestArcBehavior.py
+ Test1924.py )
--- /dev/null
+"""
+ Test1924.py
+ Test case for issue #1924 "Wrong naming of multiple-rotated sketch edges on python dump"
+"""
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(70, 120, 50, 25)
+SketchLine_2 = Sketch_1.addLine(50, 25, 170, 50)
+SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin"))
+SketchMultiRotation_1_objects = [SketchLine_1.result(), SketchLine_2.result()]
+# names of rotated objects: "SketchLine_3", "SketchLine_4"
+SketchMultiRotation_1 = Sketch_1.addRotation(SketchMultiRotation_1_objects, SketchPoint_1.coordinates(), 90, 2)
+# line named "SketchLine_5"
+SketchLine_5 = Sketch_1.addLine(0, 100, 100, 100)
+# change number of rotated objects.
+# names of rotated objects: "SketchLine_3", "SketchLine_4", "SketchLine_6", "SketchLine_7"
+SketchMultiRotation_1.numberOfObjects().setValue(3)
+
+model.end()
+
+assert(model.checkPythonDump())
// Additionally check redundant constraints
if (aResult == GCS::Success || aResult == GCS::Converged) {
+ bool isSolveWithoutTangent = !aRedundantID.empty();
GCS::VEC_I aRedundantLocal;
myEquationSystem->getRedundant(aRedundantLocal);
aRedundantID.insert(aRedundantID.end(), aRedundantLocal.begin(), aRedundantLocal.end());
// if the entities are coupled smoothly.
// Sometimes tangent constraints are fall to both conflicting and redundant constraints.
// Need to check if there are redundant constraints without these tangencies.
- if (!aRedundantID.empty())
+ if (!aRedundantID.empty() && !isSolveWithoutTangent) {
+ GCS::VEC_I::iterator aCIt = aRedundantID.begin();
+ for (; aCIt != aRedundantID.end(); ++ aCIt)
+ if (myTangent.find(*aCIt) != myTangent.end()) {
+ isSolveWithoutTangent = true;
+ break;
+ }
+ }
+ if (isSolveWithoutTangent)
aResult = myTangent.empty() ? GCS::Failed : solveWithoutTangent();
else
aResult = GCS::Success;
#include <SketchPlugin_ConstraintCoincidence.h>
#include <SketchPlugin_ConstraintMirror.h>
#include <SketchPlugin_ConstraintRigid.h>
+#include <SketchPlugin_Projection.h>
/// \brief Verify two vectors of constraints are equal.
return false;
bool aResult = theFeature->isCopy();
if (aResult) {
- std::map<ConstraintPtr, std::list<ConstraintWrapperPtr> >::const_iterator
- anIt = theConstraints.begin();
- for (; anIt != theConstraints.end() && aResult; ++anIt) {
- if (anIt->first->getKind() != SketchPlugin_ConstraintMirror::ID())
- continue;
- AttributeRefListPtr aRefList = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
- anIt->first->attribute(SketchPlugin_Constraint::ENTITY_C()));
- std::list<ObjectPtr> aMirroredList = aRefList->list();
- std::list<ObjectPtr>::const_iterator aMIt = aMirroredList.begin();
- for (; aMIt != aMirroredList.end() && aResult; ++aMIt) {
- FeaturePtr aFeat = ModelAPI_Feature::feature(*aMIt);
- if (aFeat == theFeature)
- aResult = false;
- }
+ const std::set<AttributePtr>& aRefs = theFeature->data()->refsToMe();
+ for (std::set<AttributePtr>::const_iterator aRefIt = aRefs.begin();
+ aRefIt != aRefs.end() && aResult; ++aRefIt) {
+ FeaturePtr anOwner = ModelAPI_Feature::feature((*aRefIt)->owner());
+ if ((anOwner->getKind() == SketchPlugin_ConstraintMirror::ID() &&
+ (*aRefIt)->id() == SketchPlugin_Constraint::ENTITY_C()) ||
+ (anOwner->getKind() == SketchPlugin_Projection::ID()))
+ aResult = false;
}
}
return aResult;
aBnd.Clear();
for (int i = 1; i <= myPntArray->ItemNumber(); i++) {
aVert = myPntArray->Vertice(i);
- aBnd.Add (Graphic3d_Vec4((float)aVert.X(), (float)aVert.Y(), (float)aVert.Z(), 1.0f));
+ aBnd.Add(Graphic3d_Vec4((float)aVert.X(), (float)aVert.Y(), (float)aVert.Z(), 1.0f));
}
// Pint the group with custom procedure (see Render)
aGroup->AddElement(aElem);
// Disable frustum culling for this object by marking it as mutable
- //aGroup->Structure()->SetMutable(true);
+ aGroup->Structure()->SetMutable(true);
if (!aReadyToDisplay)
SketcherPrs_Tools::sendEmptyPresentationError(myConstraint,