ADD_SUBDIRECTORY (src/Config)
ADD_SUBDIRECTORY (src/Events)
+ADD_SUBDIRECTORY (src/Selector)
ADD_SUBDIRECTORY (src/Model)
ADD_SUBDIRECTORY (src/XAO)
ADD_SUBDIRECTORY (src/GeomAPI)
.. centered::\r
Construction pop-up menu\r
\r
-The order of features can be changed using *Move to the end* pop-up menu command. The selected feature will be moved to the end of feature list.\r
+The order of features can be changed using *Move to the end* pop-up menu command. It works only for Group features. The selected group will be moved to the end of features list.\r
\r
Folders can be used to arrange long Tree View for features.\r
\r
Model parametrization can be done using parameters.\r
\r
A parameter can be created in the active partset or part by:\r
+\r
- :ref:`parameter`;\r
- :ref:`parameters`;\r
- :ref:`parameter_expression`.\r
Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
# Step5. Extrusion.
-Wire = model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r")
-To = model.selection("FACE", "Revolution_1_1/Generated_Face_6")
-From = model.selection("FACE", "Revolution_1_1/Generated_Face_1")
+Wire = model.selection("WIRE", "Sketch_1/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_1r_wire")
+To = model.selection("FACE", "Revolution_1_1/Generated_Face&Face_1_1/Edge_2")
+From = model.selection("FACE", "Revolution_1_1/Generated_Face&Face_1_1/Edge_7")
Extrusion_1 = model.addExtrusion(Part_1_doc, [Wire], model.selection("EDGE", "PartSet/OZ"), To, 0, From, 0)
Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Revolution_1_1"), model.selection("SOLID", "Extrusion_1_1")])
# Step7. Fillet.
-Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Common_1_1/Modified_Face_11")], 10)
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Face_1_1/Edge_3][Common_1_1/Modified_Face&Face_1_1/Edge_4]")], 10)
# Step8. Box.
Box_1 = model.addBox(Part_1_doc, 20, 120, 20)
#!/bin/bash -x
-export SALOME_DIR=/dn46/SALOME/series9x/current-2018-09-28
+export SALOME_DIR=/dn46/SALOME/series9x/current-2018-11-16
# Path to sources
cd ${BUILD_DIR}
-lcov --capture --directory /data/mpv/build --no-external --base-directory=/data/mpv/sources --output-file coverage.info.noext -q
+lcov --capture --directory ${BUILD_DIR} --no-external --base-directory ${SOURCES_DIR} --output-file coverage.info.noext -q
# make a working copy of report
cp -f coverage.info.noext covfile
# remove all reports of GUI and external parts (for all the next kinds of reports)
-for MASK in '*wrap*' 'moc_*' 'XAO_*' 'SketcherPrs_*' 'GeomAlgoImpl_*' 'ModuleBase_*' 'Primitives*' '*Widget*' '*Splitter*'; do
+for MASK in '*wrap*' 'moc_*' 'XAO_*' 'SketcherPrs_*' 'GeomAlgoImpl_*' 'ModuleBase_*' '*Widget*' '*Splitter*'; do
lcov -r covfile ${MASK} --output-file covfile_res -q
mv -f covfile_res covfile
done
# prepare API report
cp -f covfile covAPI
# remove plugins
-for MASK in 'Build' 'Collection' 'Construction' 'Exchange' 'Features' 'GDML' 'Initialization' 'Parameters' 'PartSet' 'Sketch'; do
+for MASK in 'Build' 'Collection' 'Construction' 'Exchange' 'Features' 'GDML' 'Primitives' 'Initialization' 'Parameters' 'PartSet' 'Sketch'; do
lcov -r covAPI *${MASK}Plugin* --output-file covAPI_res -q
mv -f covAPI_res covAPI
done
# remove low level API
-for MASK in 'GDML' 'Geom' 'GeomAlgo' 'GeomData' 'Model'; do
+for MASK in 'Geom' 'GeomAlgo' 'GeomData' 'Model'; do
lcov -r covAPI *${MASK}API* --output-file covAPI_res -q
mv -f covAPI_res covAPI
done
# remove others
-for MASK in 'Config' 'Events' 'GeomData' 'GeomValidators' 'Model_' 'ModelGeomAlgo' 'SketchSolver'; do
+for MASK in 'Config' 'Events' 'GeomData' 'GeomValidators' 'Model_' 'ModelGeomAlgo' 'Selector' 'SketchSolver'; do
lcov -r covAPI *${MASK}* --output-file covAPI_res -q
mv -f covAPI_res covAPI
done
# prepare Direct report
cp -f covfile covDirect
# remove plugins
-for MASK in 'Build' 'Collection' 'Construction' 'Exchange' 'Features' 'GDML' 'Initialization' 'Parameters' 'PartSet' 'Sketch'; do
+for MASK in 'Build' 'Collection' 'Construction' 'Exchange' 'Features' 'GDML' 'Primitives' 'Initialization' 'Parameters' 'PartSet' 'Sketch'; do
str=$startmask$MASK$endmask
lcov -r covDirect *${MASK}Plugin* --output-file covDirect_res -q
mv -f covDirect_res covDirect
done
# remove low level API
-for MASK in 'GDML' 'Builder' 'Collection' 'Connector' 'Construction' 'Model' 'Exchange' 'Features' 'ModelHigh' 'Parameters' 'PartSet' 'Sketch' 'Build' 'GeomData'; do
+for MASK in 'GDML' 'Primitives' 'Builder' 'Collection' 'Connector' 'Construction' 'Model' 'Exchange' 'Features' 'ModelHigh' 'Parameters' 'PartSet' 'Sketch' 'Build' 'GeomData'; do
lcov -r covDirect *${MASK}API* --output-file covDirect_res -q
mv -f covDirect_res covDirect
done
# remove others
-for MASK in 'Config' 'Events' 'GeomValidators' 'Model_' 'ModelGeomAlgo' 'SketchSolver' 'GeomData'; do
+for MASK in 'Config' 'Events' 'GeomValidators' 'Model_' 'ModelGeomAlgo' 'Selector' 'SketchSolver' 'GeomData'; do
lcov -r covDirect *${MASK}* --output-file covDirect_res -q
mv -f covDirect_res covDirect
done
# prepare Else report
cp -f covfile covElse
-# remove plugins
-for MASK in 'GDML'; do
-str=$startmask$MASK$endmask
-lcov -r covElse *${MASK}Plugin* --output-file covElse_res -q
-mv -f covElse_res covElse
-done
# remove low level API
-for MASK in 'Geom' 'GeomAlgo' 'GDML' 'Builder' 'Collection' 'Connector' 'Construction' 'Exchange' 'Features' 'ModelHigh' 'Parameters' 'PartSet' 'Sketch' 'Build'; do
+for MASK in 'Geom' 'GeomAlgo' 'GDML' 'Primitives' 'Builder' 'Collection' 'Connector' 'Construction' 'Exchange' 'Features' 'ModelHigh' 'Parameters' 'PartSet' 'Sketch' 'Build'; do
lcov -r covElse *${MASK}API* --output-file covElse_res -q
mv -f covElse_res covElse
done
+# remove SketchPlugin's Ellipse feature (unsupported yet)
+lcov -r covElse SketchPlugin*Ellipse* --output-file covElse_res -q
+mv -f covElse_res covElse
+# remove GUI related files from Config plugin
+for MASK in 'DataModelReader' 'FeatureMessage' 'Translator' 'PointerMessage'; do
+lcov -r covElse *Config_${MASK}* --output-file covElse_res -q
+mv -f covElse_res covElse
+done
rm -rf lcov_htmlElse
genhtml covElse --output-directory lcov_htmlElse -q
const std::list<ModelHighAPI_Selection>& theBaseObjects)
: ModelHighAPI_Interface(theFeature)
{
- if(initialize())
+ if (initialize()) {
+ setAdvancedOptions(false);
setBase(theBaseObjects);
+ }
}
BuildAPI_Filling::BuildAPI_Filling(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const bool theApproximate)
: ModelHighAPI_Interface(theFeature)
{
- if(initialize()) {
+ if (initialize()) {
setOrientationMethod(theOrientCorrection);
setMinDegree(theMinDegree);
setMaxDegree(theMaxDegree);
execIfBaseNotEmpty();
}
-void BuildAPI_Filling::setAdvancedOptions()
+void BuildAPI_Filling::setAdvancedOptions(bool isEnabled)
{
- feature()->string(BuildPlugin_Filling::ADVANCED_OPTIONS_ID())->setValue("true");
+ feature()->string(BuildPlugin_Filling::ADVANCED_OPTIONS_ID())->setValue(isEnabled ? "true" : "");
}
void BuildAPI_Filling::dump(ModelHighAPI_Dumper& theDumper) const
private:
void execIfBaseNotEmpty();
- void setAdvancedOptions();
+ void setAdvancedOptions(bool isEnabled = true);
};
/// Pointer on Face object.
// Build compound.
GeomShapePtr aCompound = GeomAlgoAPI_CompoundBuilder::compound(anOriginalShapes);
// Copy shape.
- GeomAlgoAPI_Copy aCopyAlgo(aCompound);
- GeomShapePtr aCopyCompound = aCopyAlgo.shape();
+ GeomMakeShapePtr aCopyAlgo(new GeomAlgoAPI_Copy(aCompound));
+ GeomShapePtr aCopyCompound = aCopyAlgo->shape();
int anIndexToRemove = 0;
if (aCopyCompound) {
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfShapes = aCopyAlgo.mapOfSubShapes();
-
ResultBodyPtr aResultBody = document()->createBody(data(), anIndexToRemove++);
aResultBody->store(aCopyCompound);
- aResultBody->loadAndOrientModifiedShapes(&aCopyAlgo, aCompound, GeomAPI_Shape::VERTEX,
- 1, "Modified_Vertex", *aMapOfShapes.get(),
- true, false, true);
- aResultBody->loadAndOrientModifiedShapes(&aCopyAlgo, aCompound, GeomAPI_Shape::EDGE,
- 100000, "Modified_Edge", *aMapOfShapes.get(),
- true, false, true);
- aResultBody->loadAndOrientModifiedShapes(&aCopyAlgo, aCompound, GeomAPI_Shape::FACE,
- 200000, "Modified_Face", *aMapOfShapes.get(),
- true, false, true);
+ aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, GeomAPI_Shape::VERTEX);
+ aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, GeomAPI_Shape::EDGE);
+ aResultBody->loadModifiedShapes(aCopyAlgo, aCompound, GeomAPI_Shape::FACE);
setResult(aResultBody);
}
removeResults(anIndexToRemove);
#include <ModelAPI_ResultBody.h>
#include <GeomAlgoAPI_Copy.h>
+#include <GeomAlgoAPI_Tools.h>
//=================================================================================================
BuildPlugin_Edge::BuildPlugin_Edge()
}
// Copy shape.
- GeomAlgoAPI_Copy aCopyAlgo(aShape);
+ GeomMakeShapePtr aCopyAlgo(new GeomAlgoAPI_Copy(aShape));
- // Check that algo is done.
- if(!aCopyAlgo.isDone()) {
- setError("Error: " + getKind() + " algorithm failed.");
- return;
- }
-
- // Check if shape is not null.
- if(!aCopyAlgo.shape().get() || aCopyAlgo.shape()->isNull()) {
- setError("Error: Resulting shape is null.");
- return;
- }
-
- // Check that resulting shape is valid.
- if(!aCopyAlgo.isValid()) {
- setError("Error: Resulting shape is not valid.");
+ std::string anError;
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCopyAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
// Store result.
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- aResultBody->storeModified(aShape, aCopyAlgo.shape());
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = aCopyAlgo.mapOfSubShapes();
- int aModVertexTag = 1;
- std::string aModVertexName = "Modified_Vertex";
- aResultBody->loadAndOrientModifiedShapes(&aCopyAlgo, aShape, GeomAPI_Shape::VERTEX,
- aModVertexTag, aModVertexName, *aSubShapes.get(),
- true);
+ aResultBody->storeModified(aShape, aCopyAlgo->shape());
+ aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::VERTEX);
setResult(aResultBody, aResultIndex);
++aResultIndex;
int anEdgeIndex = 1;
for(GeomAPI_ShapeExplorer anExp(aShape, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
GeomShapePtr anEdge = anExp.current();
- aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeIndex), anEdgeIndex);
+ aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeIndex));
++anEdgeIndex;
}
#include <GeomAlgoAPI_Copy.h>
#include <GeomAlgoAPI_Filling.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_Pnt.h>
#include <GeomAPI_ShapeExplorer.h>
data()->addAttribute(TOLERANCE_3D_ID(), ModelAPI_AttributeDouble::typeId());
data()->addAttribute(APPROXIMATION_ID(), ModelAPI_AttributeBoolean::typeId());
- restoreDefaultParameters();
- string(ADVANCED_OPTIONS_ID())->setValue("");
+ if (string(ADVANCED_OPTIONS_ID())->value().empty())
+ restoreDefaultParameters();
}
//=================================================================================================
// get base objects list
AttributeSelectionListPtr aSelectionList = selectionList(BASE_OBJECTS_ID());
- if (aSelectionList->size() <= 1)
+ if (aSelectionList->size() <= 1) {
+ setError("Not enough objects is selected");
return;
+ }
// collect base shapes
for(int anIndex = 0; anIndex < aSelectionList->size(); ++anIndex) {
// build result
aFilling->build(aParameters.isApprox);
- if (isAlgorithmFailed(aFilling)) {
+ std::string anError;
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilling, getKind(), anError)) {
+ setError(anError);
removeResults(0);
return;
}
int anEdgeInd = 0;
for(GeomAPI_ShapeExplorer anExp(aCreatedFace, GeomAPI_Shape::EDGE); anExp.more(); anExp.next()) {
GeomShapePtr anEdge = anExp.current();
- aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeInd), ++anEdgeInd);
+ aResultBody->generated(anEdge, "Edge_" + std::to_string((long long)anEdgeInd));
}
setResult(aResultBody, 0);
}
-bool BuildPlugin_Filling::isAlgorithmFailed(
- const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm)
-{
- if (!theAlgorithm->isDone()) {
- static const std::string aFeatureError = "Error: filling algorithm failed.";
- std::string anAlgoError = theAlgorithm->getError();
- if (anAlgoError.empty())
- anAlgoError = aFeatureError;
- else
- anAlgoError = aFeatureError + " " + anAlgoError;
- setError(anAlgoError);
- return true;
- }
- if (theAlgorithm->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape of filling is Null.";
- setError(aShapeError);
- return true;
- }
- if (!theAlgorithm->isValid()) {
- std::string aFeatureError = "Error: Resulting shape of filling is not valid.";
- setError(aFeatureError);
- return true;
- }
- return false;
-}
-
//=================================================================================================
void BuildPlugin_Filling::attributeChanged(const std::string& theID)
{
BUILDPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
private:
- /// Check the filling algorithm is failed
- bool isAlgorithmFailed(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm);
-
/// Convert shape to edge according to construction method
std::shared_ptr<GeomAPI_Edge> toEdge(const std::shared_ptr<GeomAPI_Shape>& theShape,
const std::string& theMethod);
ResultBodyPtr aResultBody = document()->createBody(data());
std::set<GeomShapePtr>::const_iterator aContextIt = aContexts.begin();
for (; aContextIt != aContexts.end(); aContextIt++) {
- aResultBody->storeModified(*aContextIt, anEdge, aContextIt == aContexts.begin() ? 0 : -2);
+ aResultBody->storeModified(*aContextIt, anEdge, aContextIt == aContexts.begin());
}
int aVertexIndex = 1;
for (GeomAPI_ShapeExplorer anExp(anEdge, GeomAPI_Shape::VERTEX); anExp.more(); anExp.next()) {
std::string aVertexName = "Vertex_" + std::to_string((long long)aVertexIndex);
- aResultBody->generated(anExp.current(), aVertexName, aVertexIndex++);
+ aResultBody->generated(anExp.current(), aVertexName);
}
setResult(aResultBody);
// Create wire from edges
GeomShapePtr aWire = GeomAlgoAPI_WireBuilder::wire(anEdges);
- if (!aWire.get()) {
- setError("Error: Result polyline is empty.");
- return;
- }
+ if (!aWire.get()) {
+ setError("Error: Result polyline is empty.");
+ return;
+ }
// Check the wire.
if (GeomAlgoAPI_WireBuilder::isSelfIntersected(aWire)) {
ResultBodyPtr aResultBody = document()->createBody(data());
std::set<GeomShapePtr>::const_iterator aContextIt = aContexts.begin();
for (; aContextIt != aContexts.end(); aContextIt++) {
- aResultBody->storeModified(*aContextIt, aWire, aContextIt == aContexts.begin() ? 0 : -2);
+ aResultBody->storeModified(*aContextIt, aWire, aContextIt == aContexts.begin());
}
aPointsIt = aPoints.cbegin();
for (; anExp.more() && aPointsIt != aPoints.cend(); anExp.next(), ++aPointsIt) {
GeomShapePtr aPoint = *aPointsIt;
GeomShapePtr anEdge = anExp.current();
- aResultBody->generated(aPoint, anEdge, "Edge", 1);
+ aResultBody->generated(aPoint, anEdge);
}
if (!isClosed) {
aResPoints.push_back(anExp.current());
}
- aResultBody->generated(aResPoints.front(), "FirstVertex", 2);
- aResultBody->generated(aResPoints.back(), "LastVertex", 3);
+ aResultBody->generated(aResPoints.front(), "FirstVertex");
+ aResultBody->generated(aResPoints.back(), "LastVertex");
}
setResult(aResultBody);
#include <ModelAPI_ResultConstruction.h>
#include <GeomAlgoAPI_Sewing.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_ShapeExplorer.h>
//=================================================================================================
}
// Sew faces.
- GeomAlgoAPI_Sewing aSewingAlgo(aShapes);
+ GeomMakeShapePtr aSewingAlgo(new GeomAlgoAPI_Sewing(aShapes));
- // Check that algo is done.
- if(!aSewingAlgo.isDone()) {
- setError("Error: " + getKind() + " algorithm failed.");
- return;
- }
-
- // Check if shape is not null.
- if(!aSewingAlgo.shape().get() || aSewingAlgo.shape()->isNull()) {
- setError("Error: Resulting shape is null.");
- return;
- }
-
- // Check that resulting shape is valid.
- if(!aSewingAlgo.isValid()) {
- setError("Error: Resulting shape is not valid.");
+ std::string anError;
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSewingAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
// Store result.
- GeomShapePtr aResult = aSewingAlgo.shape();
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfShapes = aSewingAlgo.mapOfSubShapes();
+ GeomShapePtr aResult = aSewingAlgo->shape();
int anIndex = 0;
for(GeomAPI_ShapeExplorer anExp(aResult, GeomAPI_Shape::SHELL); anExp.more(); anExp.next()) {
ResultBodyPtr aResultBody = document()->createBody(data(), anIndex);
aResultBody->store(aShell);
for(ListOfShape::const_iterator anIt = aShapes.cbegin(); anIt != aShapes.cend(); ++anIt) {
- for(GeomAPI_ShapeExplorer
- aFaceExp(*anIt, GeomAPI_Shape::FACE); aFaceExp.more(); aFaceExp.next()) {
+ for (GeomAPI_ShapeExplorer aFaceExp(*anIt, GeomAPI_Shape::FACE);
+ aFaceExp.more();
+ aFaceExp.next())
+ {
GeomShapePtr aFace = aFaceExp.current();
ListOfShape aHistory;
- aSewingAlgo.modified(aFace, aHistory);
- for(ListOfShape::const_iterator aHistoryIt = aHistory.cbegin();
- aHistoryIt != aHistory.cend();
- ++aHistoryIt) {
+ aSewingAlgo->modified(aFace, aHistory);
+ for (ListOfShape::const_iterator aHistoryIt = aHistory.cbegin();
+ aHistoryIt != aHistory.cend();
+ ++aHistoryIt)
+ {
GeomShapePtr aHistoryShape = *aHistoryIt;
- if(aMapOfShapes->isBound(aHistoryShape)) {
- aHistoryShape = aMapOfShapes->find(aHistoryShape);
- }
- if(aShell->isSubShape(aHistoryShape)) {
- aResultBody->loadAndOrientModifiedShapes(&aSewingAlgo, aFace, GeomAPI_Shape::EDGE,
- 1, "Modified_Edge", *aMapOfShapes.get());
- aResultBody->loadAndOrientModifiedShapes(&aSewingAlgo, aFace, GeomAPI_Shape::FACE,
- 2, "Modified_Face", *aMapOfShapes.get());
+ if (aShell->isSubShape(aHistoryShape, false)) {
+ aResultBody->loadModifiedShapes(aSewingAlgo,
+ aFace,
+ GeomAPI_Shape::EDGE);
+ aResultBody->loadModifiedShapes(aSewingAlgo,
+ aFace,
+ GeomAPI_Shape::FACE);
break;
}
}
void BuildPlugin_Solid::storeResult(const ListOfShape& theOriginalShapes,
const GeomShapePtr& theResultShape,
- const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm)
+ const GeomMakeShapePtr& theAlgorithm)
{
ResultBodyPtr aResultBody = document()->createBody(data());
aResultBody->store(theResultShape);
// Store faces
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubs = theAlgorithm->mapOfSubShapes();
- int aModifiedTag = 1;
- for(ListOfShape::const_iterator anIt = theOriginalShapes.cbegin();
- anIt != theOriginalShapes.cend(); ++anIt) {
+ for (ListOfShape::const_iterator anIt = theOriginalShapes.cbegin();
+ anIt != theOriginalShapes.cend();
+ ++anIt)
+ {
GeomShapePtr aShape = *anIt;
- aResultBody->loadAndOrientModifiedShapes(theAlgorithm.get(), aShape, GeomAPI_Shape::FACE,
- aModifiedTag, "Modified_Face", *aMapOfSubs.get(), false, true, true);
+ aResultBody->loadModifiedShapes(theAlgorithm, aShape, GeomAPI_Shape::FACE);
}
setResult(aResultBody);
}
if(!aBaseShape.get()) {
return;
}
- GeomAlgoAPI_ShapeBuilder aBuilder;
- aBuilder.removeInternal(aBaseShape);
- GeomShapePtr aResultShape = aBuilder.shape();
+ std::shared_ptr<GeomAlgoAPI_ShapeBuilder> aBuilder(new GeomAlgoAPI_ShapeBuilder());
+ aBuilder->removeInternal(aBaseShape);
+ GeomShapePtr aResultShape = aBuilder->shape();
// Get list of shapes.
ListOfShape aShapesToAdd;
// Copy sub-shapes from list to new shape.
if(!aShapesToAdd.empty()) {
- aBuilder.addInternal(aResultShape, aShapesToAdd);
- aResultShape = aBuilder.shape();
+ aBuilder->addInternal(aResultShape, aShapesToAdd);
+ aResultShape = aBuilder->shape();
}
// Store result.
const int aModEdgeTag = 2;
ResultBodyPtr aResultBody = document()->createBody(data());
aResultBody->storeModified(aBaseShape, aResultShape);
- aResultBody->loadAndOrientModifiedShapes(&aBuilder, aBaseShape, GeomAPI_Shape::EDGE, aModEdgeTag,
- "Modified_Edge", *aBuilder.mapOfSubShapes().get());
- for(ListOfShape::const_iterator
- anIt = aShapesToAdd.cbegin(); anIt != aShapesToAdd.cend(); ++anIt) {
+ aResultBody->loadModifiedShapes(aBuilder, aBaseShape, GeomAPI_Shape::EDGE);
+ for (ListOfShape::const_iterator anIt = aShapesToAdd.cbegin();
+ anIt != aShapesToAdd.cend();
+ ++anIt)
+ {
GeomAPI_Shape::ShapeType aShType = (*anIt)->shapeType();
- aResultBody->loadAndOrientModifiedShapes(&aBuilder, *anIt, aShType,
- aShType == GeomAPI_Shape::VERTEX ? aModVertexTag : aModEdgeTag,
- aShType == GeomAPI_Shape::VERTEX ? "Modified_Vertex" : "Modified_Edge",
- *aBuilder.mapOfSubShapes().get());
+ aResultBody->loadModifiedShapes(aBuilder,
+ *anIt,
+ aShType);
}
setResult(aResultBody);
}
#include <GeomAPI_PlanarEdges.h>
#include <GeomAPI_Pln.h>
#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAlgoAPI_CompoundBuilder.h>
#include <GeomAlgoAPI_PaveFiller.h>
#include <GeomAlgoAPI_SketchBuilder.h>
#include <GeomAlgoAPI_WireBuilder.h>
#include <GeomAlgoAPI_MakeVolume.h>
-#include <GeomAPI_ShapeIterator.h>
-#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomValidators_FeatureKind.h>
#include <GeomValidators_ShapeType.h>
std::shared_ptr<GeomAlgoAPI_MakeVolume> anAlgorithm(
new GeomAlgoAPI_MakeVolume(anOriginalShapes, false));
- if (!anAlgorithm->isDone()) {
- theError = "MakeVolume algorithm failed.";
- return false;
- }
- if (anAlgorithm->shape()->isNull()) {
- theError = "Resulting shape of MakeVolume is Null.";
- return false;
- }
- if (!anAlgorithm->isValid()) {
- theError = "Resulting shape of MakeVolume is not valid.";
+ std::string anErr;
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgorithm, "MakeVolume", anErr)) {
+ theError = anErr;
return false;
}
#include <ModelAPI_ResultBody.h>
#include <GeomAlgoAPI_Copy.h>
+#include <GeomAlgoAPI_Tools.h>
//=================================================================================================
BuildPlugin_Vertex::BuildPlugin_Vertex()
}
// Copy shape.
- GeomAlgoAPI_Copy aCopyAlgo(aShape);
+ std::shared_ptr<GeomAlgoAPI_Copy> aCopyAlgo(new GeomAlgoAPI_Copy(aShape));
- // Check that algo is done.
- if(!aCopyAlgo.isDone()) {
- setError("Error: " + getKind() + " algorithm failed.");
- return;
- }
-
- // Check if shape is not null.
- if(!aCopyAlgo.shape().get() || aCopyAlgo.shape()->isNull()) {
- setError("Error: Resulting shape is null.");
- return;
- }
-
- // Check that resulting shape is valid.
- if(!aCopyAlgo.isValid()) {
- setError("Error: Resulting shape is not valid.");
+ std::string anError;
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCopyAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
// Store result.
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- aResultBody->storeModified(aShape, aCopyAlgo.shape());
+ aResultBody->storeModified(aShape, aCopyAlgo->shape());
setResult(aResultBody, aResultIndex);
++aResultIndex;
}
for(ListOfShape::const_iterator anIt = anEdges.cbegin(); anIt != anEdges.cend(); ++anIt) {
std::shared_ptr<GeomAPI_Edge> anEdgeInList(new GeomAPI_Edge(*anIt));
if(anEdgeInList->isEqual(anEdgeInResult)) {
- aResultBody->modified(anEdgeInList, anEdgeInResult, "Edge");
+ aResultBody->modified(anEdgeInList, anEdgeInResult);
break;
}
}
INSTALL(DIRECTORY icons/ DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}/icons/Build)
ADD_UNIT_TESTS(TestVertex.py
+ TestVertex_ErrorMsg.py
TestEdge.py
+ TestEdge_ErrorMsg.py
TestWire.py
+ TestWire_ErrorMsg.py
TestPolyline.py
TestInterpolation.py
TestFace.py
+ TestFace_ErrorMsg.py
TestShell.py
TestSolid.py
+ TestSolid_ErrorMsg.py
TestCompSolid.py
TestCompound.py
+ TestCompound_ErrorMsg.py
TestSubShapes.py
+ TestSubShapes_ErrorMsg.py
+ TestFilling.py
TestFilling_ByEdges.py
TestFilling_ByWires.py
TestFilling_Mixed.py
+ TestFilling_ErrorMsg.py
Test1920.py
Test2398.py
Test2415.py
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result())
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_5f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_5r-SketchLine_1r_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OY"), 100)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Translation_1_1/Translated_Edge_1"), model.selection("EDGE", "Translation_1_1/Translated_Edge_2"), model.selection("EDGE", "Translation_1_1/Translated_Edge_3"), model.selection("EDGE", "Translation_1_1/Translated_Edge_4"), model.selection("EDGE", "Translation_1_2/Translated_Edge_1"), model.selection("EDGE", "Translation_1_2/Translated_Edge_2"), model.selection("EDGE", "Translation_1_2/Translated_Edge_3"), model.selection("EDGE", "Translation_1_2/Translated_Edge_4")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Translation_1_1/ME:Translated&Face_1_1/Edge_4"), model.selection("EDGE", "Translation_1_1/ME:Translated&Face_1_1/Edge_3"), model.selection("EDGE", "Translation_1_1/ME:Translated&Face_1_1/Edge_2"), model.selection("EDGE", "Translation_1_1/ME:Translated&Face_1_1/Edge_1"), model.selection("EDGE", "Translation_1_2/ME:Translated&Face_2_1/Edge_4"), model.selection("EDGE", "Translation_1_2/ME:Translated&Face_2_1/Edge_3"), model.selection("EDGE", "Translation_1_2/ME:Translated&Face_2_1/Edge_2"), model.selection("EDGE", "Translation_1_2/ME:Translated&Face_2_1/Edge_1")])
aGroupFeature = Group_1.feature()
aSelectionList = aGroupFeature.selectionList("group_list")
model.end()
assert(shape.isEdge())
assert(name)
-assert(model.checkPythonDump())
\ No newline at end of file
+assert(model.checkPythonDump())
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 100, 100)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2f_wire")], model.selection(), 100, 100)
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchConstraintMiddle_1 = Sketch_3.setMiddlePoint(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_5.result())
model.do()
-Edge_1_objects = [model.selection("EDGE", "Sketch_3/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_3")]
+Edge_1_objects = [model.selection("EDGE", "Sketch_3/SketchLine_2"), model.selection("EDGE", "Sketch_3/SketchLine_1"), model.selection("EDGE", "Sketch_3/SketchLine_4"), model.selection("EDGE", "Sketch_3/SketchLine_3")]
Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("EDGE", "PartSet/OZ"), 135)
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 80)
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 150)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchArc_1_2r")], model.selection(), 200, 0)
-Compound_1_objects = [model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_4")]
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection(), 200, 0)
+Compound_1_objects = [model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5")]
Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
-Compound_2_objects = [model.selection("EDGE", "Compound_1_1_2/Modified_Edge_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Compound_1_1_3/Modified_Edge_2")]
+Compound_2_objects = [model.selection("EDGE", "[Compound_1_1_2/Compound_1_1_2&Sketch_1/SketchLine_4][weak_name_4]"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "[Compound_1_1_3/Compound_1_1_3&Sketch_1/SketchLine_5][weak_name_4]")]
Compound_2 = model.addCompound(Part_1_doc, Compound_2_objects)
model.do()
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 100, 0)
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1")])
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f_wire")], model.selection(), 100, 0)
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")])
model.do()
model.testHaveNamingSubshapes(Edge_1, model, Part_1_doc)
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchCircle_1 = Sketch_1.addCircle(0.1822176134072968, -1.34047565209109, 35.08968954114807)
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 100, 0)
Recover_1 = model.addRecover(Part_1_doc, Extrusion_1, [Wire_1.result()])
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Recover_1_1")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/To_Edge_1")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/To_Edge")])
Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_2_1")])
model.end()
SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result())
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
SketchLine_5 = Sketch_2.addLine(20, 0, 0, 0)
SketchLine_6 = Sketch_2.addLine(0, 0, 0, 20)
SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
SketchLine_9 = SketchProjection_2.createdFeature()
SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchLine_5.startPoint(), SketchLine_9.result())
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_5.endPoint())
SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result())
SketchConstraintEqual_3 = Sketch_2.setEqual(SketchLine_6.result(), SketchLine_12.result())
model.do()
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r_wire")])
AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OZ"), 270, 2)
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "AngularCopy_1_1_1"), model.selection("FACE", "AngularCopy_1_1_2")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7f-SketchLine_10f-SketchLine_11f-SketchLine_12f")], model.selection(), 40, 0)
SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
SketchConstraintHorizontal_7 = Sketch_3.setHorizontal(SketchLine_15.result())
SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_16.result())
-SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_5s-SketchLine_15s-SketchLine_8e-SketchLine_14e"), False)
+SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_5_StartVertex"), False)
SketchPoint_2 = SketchProjection_3.createdFeature()
SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates())
-SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_11s-SketchLine_10e"), False)
+SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_10_EndVertex"), False)
SketchPoint_3 = SketchProjection_4.createdFeature()
SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchAPI_Point(SketchPoint_3).coordinates())
-SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"), False)
+SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"), False)
SketchPoint_4 = SketchProjection_5.createdFeature()
SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_13.startPoint(), SketchAPI_Point(SketchPoint_4).coordinates())
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r")], model.selection(), 20, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r")], model.selection(), 20, 0)
Box_1 = model.addBox(Part_1_doc, 20, 20, 20)
model.do()
# =============================================================================
boundaries1 = [model.selection("FACE", "Face_1_1"),
model.selection("SHELL", "Shell_1_1"),
- model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r"),
- model.selection("FACE", "Extrusion_1_1/Generated_Face_4"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_2"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_3"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_4"),
- model.selection("FACE", "Extrusion_2_1/To_Face_1"),
+ model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r"),
+ model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_14"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_15"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_16"),
+ model.selection("FACE", "Extrusion_2_1/To_Face"),
model.selection("FACE", "Box_1_1/Front")]
expectType1 = [GeomAPI_Shape.SHAPE,
GeomAPI_Shape.SHAPE,
# =============================================================================
boundaries2 = [model.selection("FACE", "Face_1_1"),
model.selection("SHELL", "Shell_1_1"),
- model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r"),
- model.selection("FACE", "Extrusion_1_1/Generated_Face_4"),
- model.selection("FACE", "Extrusion_1_1/Generated_Face_3"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_3"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_4"),
- model.selection("FACE", "Extrusion_2_1/To_Face_1"),
+ model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r"),
+ model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"),
+ model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_10"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_15"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_16"),
+ model.selection("FACE", "Extrusion_2_1/To_Face"),
model.selection("FACE", "Box_1_1/Front"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_2"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_14"),
model.selection("SOLID", "Extrusion_1_1")]
expectType2 = [GeomAPI_Shape.SHAPE,
GeomAPI_Shape.SHAPE,
SketchCircle_2 = Sketch_1.addCircle(57.27434431552349, -55.3477547099222, 30.40870102508203)
model.do()
Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "PartSet/Origin")])
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_5")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_2_2")])
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_5")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_2_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
SketchLine_6 = Sketch_2.addLine(73.69205241424749, 19.68979803478298, 29.86213888681927, 19.68979803478298)
SketchLine_7 = Sketch_2.addLine(29.86213888681927, 19.68979803478298, 29.86213888681927, 46.16063196348271)
SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_8.result())
SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result())
model.do()
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r")])
-AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_6"), 120, 2)
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r_wire")])
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "Sketch_2/SketchLine_6"), 120, 2)
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "AngularCopy_1_1_1"), model.selection("FACE", "AngularCopy_1_1_2")])
Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 50)
Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_2_1/Front"), 5, True)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_2_1"), model.selection("FACE", "Plane_1")])
-Compound_1_objects = [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"),
- model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"),
- model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"),
- model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"),
+Compound_1_objects = [model.selection("VERTEX", "Sketch_1/SketchPoint_1"),
+ model.selection("EDGE", "Sketch_1/SketchLine_1"),
+ model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire"),
+ model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"),
model.selection("VERTEX", "Vertex_1_1"),
model.selection("EDGE", "Edge_1_1"),
model.selection("WIRE", "Wire_1_1"),
--- /dev/null
+## Copyright (C) 2017-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+aSession.startOperation()
+Compound_1 = aPart.addFeature("Compound")
+Compound_1.execute()
+assert(Compound_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList = Compound_1.selectionList("base_objects")
+aBaseObjectsList.append("", "EDGE")
+Compound_1.execute()
+assert(Compound_1.error() != "")
+aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2017-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+aBoxResult = aBox.firstResult()
+aBoxShape = aBoxResult.shape()
+
+aSession.startOperation()
+Edge_1 = aPart.addFeature("Edge")
+Edge_1.execute()
+assert(Edge_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList = Edge_1.selectionList("base_objects")
+aBaseObjectsList.append("", "EDGE")
+Edge_1.execute()
+assert(Edge_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList.removeLast()
+aBaseObjectsList.append("Box_1_1/Top", "FACE")
+Edge_1.execute()
+assert(Edge_1.error() != "")
+aSession.finishOperation()
aSession.startOperation()
aFaceFeature2 = aPart.addFeature("Face")
aBaseObjectsList = aFaceFeature2.selectionList("base_objects")
-aBaseObjectsList.append("Cylinder_1_1/Face_1&Cylinder_1_1/Face_2", "EDGE")
+aBaseObjectsList.append("[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]", "EDGE")
aSession.finishOperation()
assert (len(aFaceFeature2.results()) > 0)
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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(30, -30, -30, -30)
+SketchLine_2 = Sketch_1.addLine(-30, -30, -30, 30)
+SketchLine_3 = Sketch_1.addLine(-30, 30, 30, 30)
+SketchLine_4 = Sketch_1.addLine(30, 30, 30, -30)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+assert(Face_1.feature().error() != "")
+Part_1_doc.removeFeature(Face_1.feature())
+
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "PartSet/XOY")])
+assert(Face_1.feature().error() != "")
+Part_1_doc.removeFeature(Face_1.feature())
+
+model.end()
--- /dev/null
+## Copyright (C) 2017-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Point_2 = model.addPoint(Part_1_doc, 10, 0, 0)
+Point_3 = model.addPoint(Part_1_doc, 20, 10, 0)
+Point_4 = model.addPoint(Part_1_doc, 0, 20, 10)
+Point_5 = model.addPoint(Part_1_doc, 30, 0, 10)
+Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], False)
+Polyline_2 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_4")], False)
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Polyline_1_1/Generated_Edge&Point_1/Point_1"), model.selection("EDGE", "Polyline_2_1/Generated_Edge&Point_3/Point_3")])
+Filling_2 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Polyline_1_1/Generated_Edge&Point_1/Point_1"), model.selection("EDGE", "Polyline_2_1/Generated_Edge&Point_3/Point_3")], "curve_info", 5, 8, 0, 0.0001, 0.0001, True)
+model.do()
+
+assert(Filling_1.feature().error() == "")
+assert(Filling_2.feature().error() == "")
+
+model.end()
# Create filling
aSession.startOperation()
aFillingFeature = aPart.addFeature("Filling")
+aFillingFeature.string("advanced_options").setValue("")
aBaseObjectsList = aFillingFeature.selectionList("base_objects")
aBaseObjectsList.append(aSketch1Result, anArc.lastResult().shape())
aSession.finishOperation()
# Create filling
aSession.startOperation()
aFillingFeature = aPart.addFeature("Filling")
+aFillingFeature.string("advanced_options").setValue("")
aBaseObjectsList = aFillingFeature.selectionList("base_objects")
aBaseObjectsList.append(aWire1.lastResult(), None)
aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2017-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Point_2 = model.addPoint(Part_1_doc, 10, 0, 0)
+Point_3 = model.addPoint(Part_1_doc, 20, 10, 0)
+Point_4 = model.addPoint(Part_1_doc, 0, 20, 10)
+Point_5 = model.addPoint(Part_1_doc, 30, 0, 10)
+Polyline_1 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2")], False)
+Polyline_2 = model.addPolyline3D(Part_1_doc, [model.selection("VERTEX", "Point_3"), model.selection("VERTEX", "Point_4")], False)
+model.do()
+
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Polyline_1_1/Generated_Edge&Point_1/Point_1"), model.selection("EDGE", "Polyline_2_1/Generated_Edge&Point_3/Point_3")], "curve_info", 9, 8, 0, 0.0001, 0.0001, True)
+assert(Filling_1.feature().error() != "")
+Part_1_doc.removeFeature(Filling_1.feature())
+
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Polyline_1_1/Generated_Edge&Point_1/Point_1")])
+assert(Filling_1.feature().error() != "")
+Part_1_doc.removeFeature(Filling_1.feature())
+
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("FACE", "Box_1_1/Top")])
+assert(Filling_1.feature().error() != "")
+Part_1_doc.removeFeature(Filling_1.feature())
+
+model.end()
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+
+aSession.startOperation()
+aFillingFeature = featureToCompositeFeature(Part_1.feature()).addFeature("Filling")
+aFillingFeature.string("advanced_options").setValue("")
+aFillingFeature.execute()
+assert(aFillingFeature.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList = aFillingFeature.selectionList("base_objects")
+aBaseObjectsList.append("Polyline_1_1/Generated_Edge&Point_1/Point_1", "EDGE")
+aBaseObjectsList.append("Box_1_1/Top", "FACE")
+aFillingFeature.execute()
+assert(aFillingFeature.error() != "")
+aSession.finishOperation()
+
+
+model.begin()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(30, -30, -30, -30)
+SketchLine_2 = Sketch_1.addLine(-30, -30, -30, 30)
+SketchLine_3 = Sketch_1.addLine(-30, 30, 30, 30)
+SketchLine_4 = Sketch_1.addLine(30, 30, 30, -30)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", ""), model.selection("EDGE", "Sketch_1/SketchLine_1")], "auto_correct", 1, 1, 0, 0.0001, 0.0001, False)
+assert(Filling_1.feature().error() != "")
+Part_1_doc.removeFeature(Filling_1.feature())
+
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_1")], "auto_correct", 1, 1, 0, 0.0001, 0.0001, False)
+assert(Filling_1.feature().error() != "")
+model.end()
# Create filling
aSession.startOperation()
aFillingFeature = aPart.addFeature("Filling")
+aFillingFeature.string("advanced_options").setValue("")
aBaseObjectsList = aFillingFeature.selectionList("base_objects")
aBaseObjectsList.append(aSketch1Result, anArc.lastResult().shape())
aSession.finishOperation()
model.do()
# Get sketch points
-base_name = "Sketch_1/Vertex-SketchPoint_"
+base_name = "Sketch_1/SketchPoint_"
p_1, p_2, p_3, p_4, p_5 = [model.selection("VERTEX", base_name + str(i + 1)) for i in range(0, 5)]
# Get sketch edges
-Tangent_1 = model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")
-Tangent_2 = model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")
+Tangent_1 = model.selection("EDGE", "Sketch_1/SketchLine_1")
+Tangent_2 = model.selection("EDGE", "Sketch_1/SketchLine_2")
# =============================================================================
# Test 1. Create curve 1-2-3-4-5, closed off, reorder off, without tangents
Part_2_doc = Part_2.document()
Box_1 = model.addBox(Part_2_doc, 10, 10, 10)
-point_names = ("Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom",
- "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top",
- "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top",
- "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom",
- "Box_1_1/Front&Box_1_1/Right&Box_1_1/Bottom",
- "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top",
- "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top",
- "Box_1_1/Back&Box_1_1/Right&Box_1_1/Bottom")
+point_names = ("[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]",
+ "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]",
+ "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]",
+ "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]",
+ "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]",
+ "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]",
+ "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]",
+ "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]")
points = [model.selection("VERTEX", name) for name in point_names]
Interpolation_8 = model.addInterpolation(Part_2_doc, points, False, False)
Box_1 = model.addBox(Part_3_doc, 20, 30, 40)
points = [model.selection("VERTEX", name) for name in point_names]
-Tangent_1 = model.selection("EDGE", "Box_1_1/Back&Box_1_1/Top")
-Tangent_2 = model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top")
+Tangent_1 = model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]")
+Tangent_2 = model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")
Interpolation_9 = model.addInterpolation(Part_3_doc, points,
Tangent_1, Tangent_2, False, False)
# =============================================================================
# Test 12. Check Python dump
# =============================================================================
-assert(model.checkPythonDump())
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
model.do()
# Get sketch points
-base_name = "Sketch_1/Vertex-SketchPoint_"
+base_name = "Sketch_1/SketchPoint_"
p_1, p_2, p_3, p_4, p_5 = [model.selection("VERTEX", base_name + str(i + 1)) for i in range(0, 5)]
# =============================================================================
Part_2_doc = Part_2.document()
Box_1 = model.addBox(Part_2_doc, 10, 10, 10)
-point_names = ("Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom",
- "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top",
- "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top",
- "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom",
- "Box_1_1/Front&Box_1_1/Right&Box_1_1/Bottom",
- "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top",
- "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top",
- "Box_1_1/Back&Box_1_1/Right&Box_1_1/Bottom")
+point_names = ("[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]",
+ "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]",
+ "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]",
+ "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]",
+ "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]",
+ "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]",
+ "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]",
+ "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]")
points = [model.selection("VERTEX", name) for name in point_names]
Polyline_7 = model.addPolyline3D(Part_2_doc, points, False)
# =============================================================================
# Test 11. Check Python dump
# =============================================================================
-assert(model.checkPythonDump())
\ No newline at end of file
+assert(model.checkPythonDump())
SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_2.result())
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
SketchLine_5 = Sketch_2.addLine(20, 0, 0, 0)
SketchLine_6 = Sketch_2.addLine(0, 0, 0, 20)
SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
SketchLine_9 = SketchProjection_2.createdFeature()
SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchLine_5.startPoint(), SketchLine_9.result())
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_5.endPoint())
SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result())
SketchConstraintEqual_3 = Sketch_2.setEqual(SketchLine_6.result(), SketchLine_12.result())
model.do()
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r_wire")])
AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OZ"), 270, 2)
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "AngularCopy_1_1_1"), model.selection("FACE", "AngularCopy_1_1_2")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7f-SketchLine_10f-SketchLine_11f-SketchLine_12f")], model.selection(), 40, 0)
SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
SketchConstraintHorizontal_7 = Sketch_3.setHorizontal(SketchLine_15.result())
SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_16.result())
-SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_5s-SketchLine_15s-SketchLine_8e-SketchLine_14e"), False)
+SketchProjection_3 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_5_StartVertex"), False)
SketchPoint_2 = SketchProjection_3.createdFeature()
SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates())
-SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_11s-SketchLine_10e"), False)
+SketchProjection_4 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_10_EndVertex"), False)
SketchPoint_3 = SketchProjection_4.createdFeature()
SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchAPI_Point(SketchPoint_3).coordinates())
-SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"), False)
+SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"), False)
SketchPoint_4 = SketchProjection_5.createdFeature()
SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_13.startPoint(), SketchAPI_Point(SketchPoint_4).coordinates())
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r")], model.selection(), 20, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r")], model.selection(), 20, 0)
Box_1 = model.addBox(Part_1_doc, 20, 20, 20)
model.do()
# =============================================================================
boundaries1 = [model.selection("FACE", "Face_1_1"),
model.selection("SHELL", "Shell_1_1"),
- model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r"),
- model.selection("FACE", "Extrusion_1_1/Generated_Face_4"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_2"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_3"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_4"),
- model.selection("FACE", "Extrusion_2_1/To_Face_1"),
+ model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r"),
+ model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_14"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_15"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_16"),
+ model.selection("FACE", "Extrusion_2_1/To_Face"),
model.selection("FACE", "Box_1_1/Front")]
expectSolid1 = [False, False, False, False, False, False, False, True, False]
Solid_1 = createSolidStepByStep(boundaries1, expectSolid1)
# =============================================================================
boundaries2 = [model.selection("FACE", "Face_1_1"),
model.selection("SHELL", "Shell_1_1"),
- model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16r"),
- model.selection("FACE", "Extrusion_1_1/Generated_Face_4"),
- model.selection("FACE", "Extrusion_1_1/Generated_Face_3"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_3"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_4"),
- model.selection("FACE", "Extrusion_2_1/To_Face_1"),
+ model.selection("FACE", "Sketch_3/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_13r"),
+ model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"),
+ model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_10"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_15"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_3/SketchLine_16"),
+ model.selection("FACE", "Extrusion_2_1/To_Face"),
model.selection("FACE", "Box_1_1/Front")]
expectSolid2 = [False, False, False, False, False, False, False, False, True]
Solid_2 = createSolidStepByStep(boundaries2, expectSolid2)
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+aSession.startOperation()
+Solid_1 = aPart.addFeature("Solid")
+aSession.finishOperation()
+assert(Solid_1.error() != "")
SketchPoint_1 = Sketch_1.addPoint(-490.566037735849, 50.600343053173)
SketchPoint_2 = Sketch_1.addPoint(-423.670668953688, 50.600343053173)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_2_2r")])
-SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("FACE", "Face_1_1"), [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_2_2")])
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("FACE", "Face_1_1"), [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_2")])
SubShapes_1.setBaseShape(model.selection("FACE", "Face_2_1"))
model.end()
--- /dev/null
+## Copyright (C) 2017-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Polyline_1_objects = [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]")]
+Polyline_1 = model.addPolyline3D(Part_1_doc, Polyline_1_objects, False)
+model.do()
+
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("WIRE", "Polyline_1_1"), [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")])
+assert(SubShapes_1.feature().error() != "")
+Part_1_doc.removeFeature(SubShapes_1.feature())
+
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("WIRE", "Polyline_1_1"), [model.selection("EDGE", "Polyline_1_1/Generated_Edge&weak_name_4")])
+assert(SubShapes_1.feature().error() == "")
+
+model.end()
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+
+aSession.startOperation()
+SubShapes_2 = featureToCompositeFeature(Part_1.feature()).addFeature("SubShapes")
+SubShapes_2.execute()
+assert(SubShapes_2.error() == "")
+aSession.finishOperation()
+
+model.begin()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(30, -30, -30, -30)
+SketchLine_2 = Sketch_1.addLine(-30, -30, -30, 30)
+SketchLine_3 = Sketch_1.addLine(-30, 30, 30, 30)
+SketchLine_4 = Sketch_1.addLine(30, 30, 30, -30)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine4r-SketchLine3r-SketchLine2r-SketchLine1r"), [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+assert(SubShapes_1.feature().error() != "")
+Part_1_doc.removeFeature(SubShapes_1.feature())
+
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("WIRE", "Polyline_1_1"), [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+assert(SubShapes_1.feature().error() != "")
+Part_1_doc.removeFeature(SubShapes_1.feature())
+
+SubShapes_1 = model.addSubShapes(Part_1_doc, model.selection("WIRE", "Polyline_1_1"), [model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex")])
+assert(SubShapes_1.feature().error() != "")
+Part_1_doc.removeFeature(SubShapes_1.feature())
+
+model.end()
--- /dev/null
+## Copyright (C) 2017-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+aSession.startOperation()
+Vertex_1 = aPart.addFeature("Vertex")
+Vertex_1.execute()
+assert(Vertex_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList = Vertex_1.selectionList("base_objects")
+aBaseObjectsList.append("", "EDGE")
+Vertex_1.execute()
+assert(Vertex_1.error() != "")
+aSession.finishOperation()
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
Wire_1.addContour()
model.end()
aSession.startOperation()
aWireFeature2 = aPart.addFeature("Wire")
aBaseObjectsList = aWireFeature2.selectionList("base_objects")
-aBaseObjectsList.append("Box_1_1/Front&Box_1_1/Bottom", "EDGE")
-aBaseObjectsList.append("Box_1_1/Front&Box_1_1/Right", "EDGE")
-aBaseObjectsList.append("Box_1_1/Right&Box_1_1/Top", "EDGE")
-aBaseObjectsList.append("Box_1_1/Back&Box_1_1/Top", "EDGE")
-aBaseObjectsList.append("Box_1_1/Back&Box_1_1/Left", "EDGE")
-aBaseObjectsList.append("Box_1_1/Left&Box_1_1/Bottom", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Front][Box_1_1/Bottom]", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Front][Box_1_1/Right]", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Right][Box_1_1/Top]", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Back][Box_1_1/Top]", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Back][Box_1_1/Left]", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Left][Box_1_1/Bottom]", "EDGE")
aSession.finishOperation()
# Test results
aPart.removeFeature(aWireFeature3)
aSession.finishOperation()
-assert(model.checkPythonDump())
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
--- /dev/null
+## Copyright (C) 2017-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+aBoxResult = aBox.firstResult()
+aBoxShape = aBoxResult.shape()
+
+aSession.startOperation()
+Wire_1 = aPart.addFeature("Wire")
+Wire_1.execute()
+assert(Wire_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList = Wire_1.selectionList("base_objects")
+aBaseObjectsList.append("[Box_1_1/Left][Box_1_1/Top]", "EDGE")
+aBaseObjectsList.append("[Box_1_1/Right][Box_1_1/Top]", "EDGE")
+Wire_1.execute()
+assert(Wire_1.error() != "")
+aSession.finishOperation()
+
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+
+Wire_1 = model.addWire(Part_1_doc, [])
+Wire_1.addContour()
+Part_1_doc.removeFeature(Wire_1.feature())
+
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")])
+Wire_1.addContour()
+Part_1_doc.removeFeature(Wire_1.feature())
+
+Wire_1 = model.addWire(Part_1_doc, [model.selection("FACE", "Box_1_1/Top")])
+Wire_1.addContour()
+Part_1_doc.removeFeature(Wire_1.feature())
+
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(26.2037104714363, 14.67693246486999, 44.63854591961698, 30.23007341140914)
+SketchLine_2 = Sketch_1.addLine(44.63854591961698, 30.23007341140914, 20.93564110678636, 53.45762191102688)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+model.do()
+
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Wire_1.addContour()
+Part_1_doc.removeFeature(Wire_1.feature())
+
+model.end()
AttributeSelectionListPtr anAttrList = aBase->selectionList(CollectionPlugin_Group::LIST_ID());
- theDumper << aBase << " = model.addGroup(" << aDocName << ", " << anAttrList << ")" << std::endl;
+ theDumper << aBase << " = model.addGroup(" << aDocName << ", " << anAttrList;
+ if (anAttrList->isGeometricalSelection())
+ theDumper <<", True";
+ theDumper << ")" << std::endl;
}
//==================================================================================================
GroupPtr addGroup(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theGroupList)
+ const std::list<ModelHighAPI_Selection>& theGroupList,
+ const bool theShareSameTopology)
{
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(CollectionAPI_Group::ID());
+ if (theShareSameTopology)
+ aFeature->selectionList(CollectionPlugin_Group::LIST_ID())->setGeometricalSelection(true);
return GroupPtr(new CollectionAPI_Group(aFeature, theGroupList));
}
/// \brief Create Group feature.
COLLECTIONAPI_EXPORT
GroupPtr addGroup(const std::shared_ptr<ModelAPI_Document>& thePart,
- const std::list<ModelHighAPI_Selection>& theGroupList);
+ const std::list<ModelHighAPI_Selection>& theGroupList,
+ const bool theShareSameTopology = false);
#endif // CollectionAPI_Group_H_
TestGroup1799.py
TestGroupMove.py
TestGroupMove2.py
+ TestGroupShareTopology.py
)
aSession.finishOperation()
# Build sketch faces
aSession.startOperation()
-aSketchResult = aTriangleSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aTriangleSketchFeature.firstResult())
# Create extrusion on them
anExtrusionFt = aPart.addFeature("Extrusion")
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(50)
aField = aSession.activeDocument().addFeature("Field")
aSelectionListAttr = aField.selectionList("selected")
aSelectionListAttr.setSelectionType("vertex")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]")
aComponentNames = aField.stringArray("components_names")
aComponentNames.setSize(2) # two components
aComponentNames.setValue(0, "temperatue")
aField = aSession.activeDocument().addFeature("Field")
aSelectionListAttr = aField.selectionList("selected")
aSelectionListAttr.setSelectionType("face")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1")
aComponentNames = aField.stringArray("components_names")
aComponentNames.setSize(1) # one component
aComponentNames.setValue(0, "description")
aField = aSession.activeDocument().addFeature("Field")
aSelectionListAttr = aField.selectionList("selected")
aSelectionListAttr.setSelectionType("face")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1")
aComponentNames = aField.stringArray("components_names")
aComponentNames.setSize(1) # one component
aComponentNames.setValue(0, "description")
aField = aSession.activeDocument().addFeature("Field")
aSelectionListAttr = aField.selectionList("selected")
aSelectionListAttr.setSelectionType("face")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3")
+aSelectionListAttr.append("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1")
aComponentNames = aField.stringArray("components_names")
aComponentNames.setSize(1) # one component
aComponentNames.setValue(0, "description")
aSession.finishOperation()
# Build sketch faces
aSession.startOperation()
-aSketchResult = aTriangleSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aTriangleSketchFeature.firstResult())
# Create extrusion on them
anExtrusionFt = aPart.addFeature("Extrusion")
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(50)
-anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
-anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
anExtrusionFt.execute()
aSession.finishOperation()
anExtrusionBody = modelAPI_ResultBody(anExtrusionFt.firstResult())
aGroupFeature = aSession.activeDocument().addFeature("Group")
aSelectionListAttr = aGroupFeature.selectionList("group_list")
aSelectionListAttr.setSelectionType("vertex")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]")
aSession.finishOperation()
#=========================================================================
# Check results
aGroupFeature = aSession.activeDocument().addFeature("Group")
aSelectionListAttr = aGroupFeature.selectionList("group_list")
aSelectionListAttr.setSelectionType("edge")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1")
-aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1_1")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]")
+aSelectionListAttr.append("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]")
aSession.finishOperation()
#=========================================================================
# Check results
aGroupFeature = aSession.activeDocument().addFeature("Group")
aSelectionListAttr = aGroupFeature.selectionList("group_list")
aSelectionListAttr.setSelectionType("face")
-aSelectionListAttr.append("Extrusion_1_1/To_Face_1_1")
+aSelectionListAttr.append("Extrusion_1_1/To_Face")
aSession.finishOperation()
#=========================================================================
# Check results
# Make extrusion on circle
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert(len(aCircleSketchFaces) > 0)
-assert(aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert(aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
-anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(50)
-anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
-anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
anExtrusionFt.execute()
aSession.finishOperation()
aCylinderBody = modelAPI_ResultBody(anExtrusionFt.firstResult())
SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_9.result(), SketchLine_11.result())
SketchConstraintEqual_5 = Sketch_1.setEqual(SketchLine_7.result(), SketchLine_2.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_5f-SketchLine_6f-SketchLine_9r-SketchLine_10r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchCircle_1_2r-SketchLine_7f-SketchLine_9f-SketchLine_12r"), model.selection("FACE", "Sketch_1/Face-SketchLine_4f-SketchCircle_1_2r-SketchLine_8f-SketchLine_11r-SketchLine_12f"), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchCircle_1_2r-SketchLine_10f-SketchLine_11f")], model.selection(), 150, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/To_Face_4"), model.selection("FACE", "Extrusion_1_1/To_Face_3"), model.selection("FACE", "Extrusion_1_1/To_Face_2")])
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_15"), 150, True)
-Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_7"), 150, True)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_10r-SketchCircle_1_2r-SketchLine_9r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_9f-SketchCircle_1_2r-SketchLine_12r-SketchLine_7f"), model.selection("FACE", "Sketch_1/Face-SketchLine_4f-SketchLine_12f-SketchCircle_1_2r-SketchLine_11r-SketchLine_8f"), model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchLine_11f-SketchCircle_1_2r-SketchLine_10f")], model.selection(), 150, 0)
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1_4/To_Face"), model.selection("FACE", "Extrusion_1_1_3/To_Face"), model.selection("FACE", "Extrusion_1_1_2/To_Face")])
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_6"), 150, True)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_4"), 150, True)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_1"), model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("FACE", "Plane_2")])
-Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_7/Modified_Face_2_4"), 110, True)
-Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_5/Modified_Face_3_4"), 380, True)
+Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_7/Modified_Face&Sketch_1/SketchLine_3"), 110, True)
+Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Partition_1_1_5/Modified_Face&Sketch_1/SketchLine_8"), 380, True)
Partition_2 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_3"), model.selection("COMPSOLID", "Partition_1_1"), model.selection("FACE", "Plane_4")])
model.do()
Part_1_doc = Part_1.document()
Box_1 = model.addBox(Part_1_doc, 20, 10, 10)
Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), 10, True)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top")])
-Group_2 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]")])
+Group_2 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]")])
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")])
model.do()
# move groups
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
Box_1 = model.addBox(Part_1_doc, 10, 10, 20)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top"), model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top"), model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom"))
-Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Top")])
+Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"))
+Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Top]")])
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")])
Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPSOLID", "Partition_1_1"))
Remove_SubShapes_1.setSubShapesToKeep([model.selection("SOLID", "Partition_1_1_2")])
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from GeomAPI import *
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 3, [model.selection("SOLID", "Box_1_1")])
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
+SketchCircle_1 = Sketch_1.addCircle(4.69238908106919, 4.989364948318125, 5.746414396356567)
+ExtrusionCut_1.setNestedSketch(Sketch_1)
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Box_1_1/Top&weak_name_1")])
+model.do()
+# enable geometrical selection mode => 4 faces must be selected as one compound
+Group_1.groupList().setGeometricalSelection(True)
+model.do()
+assert(Group_1.groupList().size() == 1)
+assert(Group_1.groupList().value(0).value().shapeType() == GeomAPI_Shape.COMPOUND)
+
+# disable geometrical selection mode => 4 faces must be selected as 4 group elements
+Group_1.groupList().setGeometricalSelection(False)
+model.end()
+
+assert(Group_1.groupList().size() == 4)
+assert(Group_1.groupList().value(0).value().shapeType() == GeomAPI_Shape.FACE)
+assert(Group_1.groupList().value(1).value().shapeType() == GeomAPI_Shape.FACE)
+assert(Group_1.groupList().value(2).value().shapeType() == GeomAPI_Shape.FACE)
+assert(Group_1.groupList().value(3).value().shapeType() == GeomAPI_Shape.FACE)
:align: left
Solids;
-- The list of selected entities of the given type. Multiple selection can be done manually in OCC 3D Viewer by mouse click with Shift button pressed or by rectangle selection.
-
-To delete entities from the list, select them and call pop-up menu *Delete* item.
+- The list of selected entities of the given type. Multiple selection can be done manually in OCC 3D Viewer by mouse click with Shift button pressed or by rectangle selection. To delete entities from the list, select them and call pop-up menu *Delete* item.
+- Control **Add elements that share the same topology** allows to add automatically all elements laying on the same topology that was selected and remove these elements if they are disappeared due to the parametrical update. They will be represented as one line in the list of selection and managed in the viewer as one object if this flag is enabled. If flag becomes disabled when such elements are already in the list, they will become divided in one line per one shape.
**TUI Command**: *model.addGroup(Part_1_doc, [model.selection("EDGE", "Cone_1_1/Face_1&Cone_1_1/Face_2"), model.selection("EDGE", "Cone_1_1/Face_1")])*
type_choice="Vertices Edges Faces Solids"
use_choice="true"
clear_in_neutral_point="false"
- filter_points="false" >
+ filter_points="false"
+ same_topology="true">
<validator id="GeomValidators_BodyShapes"/>
</multi_selector>
</source>
\ No newline at end of file
##
INCLUDE(Common)
+INCLUDE(UnitTest)
INCLUDE(XMLProcessing)
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
INSTALL(TARGETS _ConfigAPI DESTINATION ${SHAPER_INSTALL_SWIG})
INSTALL(FILES ${SWIG_SCRIPTS} DESTINATION ${SHAPER_INSTALL_SWIG})
+
+
+ADD_UNIT_TESTS(
+ TestConfig.py
+)
#define CONFIG_EXPORT
%include "typemaps.i"
+%include "std_list.i"
%include "std_string.i"
+%include "std_vector.i"
%include "Config_ModuleReader.h"
%include "Config_PropManager.h"
%include "Config_Prop.h"
+
+// std::list -> []
+%template(ListOfString) std::list< std::string >;
+%template(listOfProp) std::list< Config_Prop* >;
+// std::vector -> []
+%template(VectorOfInteger) std::vector<int>;
myFeatureId = std::string(); // Feature unique id
myIsObligatory = true;
myIsConcealment = false;
+ myIsGeometricalSelection = false;
}
Config_AttributeMessage::~Config_AttributeMessage()
{
myIsMainArgument = isMainArg;
}
+
+bool Config_AttributeMessage::isGeometricalSelection() const
+{
+ return myIsGeometricalSelection;
+}
+
+void Config_AttributeMessage::setGeometricalSelection(bool isGeometricalSelection)
+{
+ myIsGeometricalSelection = isGeometricalSelection;
+}
bool myIsObligatory; ///< Required to be set by user, else it's feature is invalid.
bool myIsConcealment; ///< If true, conceals features used as input
bool myIsMainArgument; ///< Mark attribute as a main argument of the feature
+ bool myIsGeometricalSelection; ///< If true selects geometry instead of shape;
///< a list of pairs, if the attribute is placed inside paged containers: (case, switch)
std::list<std::pair<std::string, std::string> > myCases;
CONFIG_EXPORT bool isConcealment() const;
/// Returns true if attribute is a main argument of the feature
CONFIG_EXPORT bool isMainArgument() const;
+ /// Returns true if attribute selects geometry instead of shape;
+ CONFIG_EXPORT bool isGeometricalSelection() const;
/// Returns container of ids of pair of a case and switches
CONFIG_EXPORT const std::list<std::pair<std::string, std::string> >& getCases() const;
/// Sets ids of pair of a case and switches
CONFIG_EXPORT void setObligatory(bool isObligatory);
/// Set a state that the attribute is a main argument of the feature
CONFIG_EXPORT void setMainArgument(bool isMainArg);
+ /// Set attribute's geometrical selection state
+ CONFIG_EXPORT void setGeometricalSelection(bool isGeometricalSelection);
};
#endif // ATTRIBUTE_MESSAGE_H
aMessage->setConcealment(isConcealment);
bool isMainArg = isConcealment && getBooleanAttribute(theNode, ATTR_MAIN_ARG, false);
aMessage->setMainArgument(isMainArg);
+ aMessage->setGeometricalSelection(getBooleanAttribute(theNode,
+ ATTR_GEOMETRICAL_SELECTION,
+ false));
std::list<std::pair<std::string, std::string> > aCases;
xmlNodePtr aCaseNode = hasParentRecursive(theNode,
const static char* ATTR_GREED = "greed";
const static char* ATTR_MODIFIED_IN_EDIT = "modified_in_edit";
const static char* ATTR_MAIN_ARG = "main_argument";
+const static char* ATTR_GEOMETRICAL_SELECTION = "geometrical_selection";
+
// WDG_INFO properties
const static char* INFO_WDG_TEXT = FEATURE_TEXT;
int stringToInteger(const std::string& theInt);
bool stringToBoolean(const std::string& theInt);
-Config_Properties Config_PropManager::myProps;
+Config_Properties& Config_PropManager::props() {
+ static Config_Properties* confProps = new Config_Properties();
+ return *confProps;
+}
Config_Prop* Config_PropManager::registerProp(const std::string& theSection,
else {
aProp =
new Config_Prop(theSection, theName, theTitle, theType, theDefaultValue, theMin, theMax);
- myProps.push_back(aProp);
+ props().push_back(aProp);
}
return aProp;
}
Config_Prop* Config_PropManager::findProp(const std::string& theSection, const std::string& theName)
{
Config_Properties::const_iterator aIt;
- for (aIt = myProps.cbegin(); aIt != myProps.cend(); ++aIt) {
+ Config_Properties aProps = props();
+ for (aIt = aProps.cbegin(); aIt != aProps.cend(); ++aIt) {
Config_Prop* aProp = (*aIt);
if ((aProp->section() == theSection) && (aProp->name() == theName))
return aProp;
{
Config_Properties aRes;
Config_Properties::const_iterator aIt;
- for (aIt = myProps.cbegin(); aIt != myProps.cend(); aIt++) {
+ Config_Properties aProps = props();
+ for (aIt = aProps.cbegin(); aIt != aProps.cend(); aIt++) {
Config_Prop* aProp = (*aIt);
if (aProp->type() != Config_Prop::Disabled)
aRes.push_back(aProp);
// Return only non disabled sections
std::list<std::string> aSections;
Config_Properties::const_iterator aIt;
- for (aIt = myProps.cbegin(); aIt != myProps.cend(); aIt++) {
+ Config_Properties aProps = props();
+ for (aIt = aProps.cbegin(); aIt != aProps.cend(); aIt++) {
const Config_Prop* aProp = (*aIt);
if (aProp->type() != Config_Prop::Disabled)
aSections.push_back(aProp->section());
{
Config_Properties aRes;
Config_Properties::iterator aIt;
- for (aIt = myProps.begin(); aIt != myProps.end(); aIt++) {
+ Config_Properties aProps = props();
+ for (aIt = aProps.begin(); aIt != aProps.end(); aIt++) {
Config_Prop* aProp = (*aIt);
if ((aProp->section() == theSection) && (aProp->type() != Config_Prop::Disabled))
aRes.push_back(aProp);
CONFIG_EXPORT static double stringToDouble(const std::string& theDouble);
private:
- CONFIG_EXPORT static Config_Properties myProps; ///< List of all stored properties
+ CONFIG_EXPORT static Config_Properties& props(); ///< List of all stored properties
};
#endif
xmlFreeDoc(myXmlDoc);
}
+// LCOV_EXCL_START
std::string Config_XMLReader::resourcesConfigFile()
{
std::string aValue;
}
return aValue;
}
+// LCOV_EXCL_STOP
std::string Config_XMLReader::findConfigFile(const std::string theFileName, const int theFindIndex)
{
if (!anEnv)
continue;
if (aSolution > 2) { // there may be several paths separated by ";" symbol
+// LCOV_EXCL_START
std::string anEnvPart = anEnv;
size_t aPosStart = 0, aPosEnd;
for(int aSubNum = 0; aSubNum < aSolution - 3; aSubNum++) {
aPosEnd = anEnvPart.find(';', aPosStart);
aFileName = anEnvPart.substr(aPosStart,
aPosEnd == std::string::npos ? aPosEnd : aPosEnd - aPosStart) + FSEP;
+// LCOV_EXCL_STOP
} else {
aFileName = std::string(anEnv) + FSEP;
}
// do nothing;
}
+// LCOV_EXCL_START
bool Config_XMLReader::processChildren(xmlNodePtr aNode)
{
return true;
}
+// LCOV_EXCL_STOP
xmlNodePtr Config_XMLReader::findRoot(const std::string theDocumentPath)
{
}
}
+// LCOV_EXCL_START
xmlNodePtr Config_XMLReader::node(void* theNode)
{
return static_cast<xmlNodePtr>(theNode);
}
+// LCOV_EXCL_STOP
std::string Config_XMLReader::getNodeName(xmlNodePtr theNode)
{
}
}
+// LCOV_EXCL_START
std::string Config_XMLReader::restoreAttribute(xmlNodePtr theNode, const char* theAttribute)
{
return restoreAttribute(getNodeName(theNode).c_str(), theAttribute);
}
+// LCOV_EXCL_STOP
std::string Config_XMLReader::restoreAttribute(const char* theNodeName, const char* theAttribute)
{
return result;
}
+// LCOV_EXCL_START
const char* Config_XMLReader::encoding() const
{
return (const char*) myXmlDoc->encoding;
-}
\ No newline at end of file
+}
+// LCOV_EXCL_STOP
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+from ConfigAPI import *
+
+# register boolean property
+Config_PropManager().registerProp("TestSection", "PropBool", "PropTitle", Config_Prop.Boolean)
+# check property once again
+Config_PropManager().registerProp("TestSection", "PropBool", "PropTitle", Config_Prop.Boolean, "true")
+# check property value
+assert(Config_PropManager().boolean("TestSection", "PropBool"))
+
+# register real property
+Config_PropManager().registerProp("TestSection", "PropDouble", "PropTitle", Config_Prop.Double, "12,5")
+# check property (',' should be substituted by ".")
+assert(Config_PropManager().real("TestSection", "PropDouble") == 12.5)
+
+# register color property
+Config_PropManager().registerProp("TestSection", "PropColor", "PropTitle", Config_Prop.Color, "#B00F00")
+assert(len(Config_PropManager().color("TestSection", "PropColor")) == 3)
+
+# check sections and properties are not empty
+assert(len(Config_PropManager().getSections()) > 0)
+assert(len(Config_PropManager().getProperties()) > 0)
Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
Box_2 = model.addBox(Part_1_doc, 20, 20, 20)
Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), -10)
- Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Box_2_1")])
- Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Partition_1_1_1/Modified_Face_1_2"), model.selection("FACE", "Box_2_1/Top")])
+ Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Translation_1_1"), model.selection("SOLID", "Box_2_1")])
+ Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Box_2_1/Top")])
model.do()
model.end()
Box_3 = model.addBox(Part_1_doc, 10, 10, 10)
Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OX"), 20)
Translation_2.result().setName("Translation_2_1")
- Group_1_objects = [model.selection("FACE", "Translation_1_1/Translated_Face_1"), model.selection("FACE", "Box_2_1/Top"), model.selection("FACE", "Translation_2_1/Translated_Face_1")]
+ Group_1_objects = [model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), model.selection("FACE", "Box_2_1/Top"), model.selection("FACE", "Translation_2_1/MF:Translated&Box_3_1/Top")]
Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
Group_1.result().setName("faces_top")
- Group_2_objects = [model.selection("EDGE", "Partition_1_1_1/Modified_Face_1_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("EDGE", "Partition_1_1_2/Modified_Face_2_2&Partition_1_1_2/Modified_Face_2_1"), model.selection("EDGE", "Translation_2_1/Translated_Face_4&Translation_2_1/Translated_Face_2")]
+ Group_2_objects = [model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Left][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]"), model.selection("EDGE", "[Translation_2_1/MF:Translated&Box_3_1/Left][Translation_2_1/MF:Translated&Box_3_1/Bottom]")]
Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
Group_2.result().setName("edges_x")
- Group_3_objects = [model.selection("VERTEX", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_4&Translation_2_1/Translated_Face_2"), model.selection("VERTEX", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_3&Translation_2_1/Translated_Face_2"), model.selection("VERTEX", "Translation_2_1/Translated_Face_6&Translation_2_1/Translated_Face_3&Translation_2_1/Translated_Face_2"), model.selection("VERTEX", "Box_2_1/Front&Box_2_1/Right&Partition_1_1_2/Modified_Face_2_1"), model.selection("VERTEX", "Partition_1_1_2/Modified_Face_2_divided_1_1&Box_2_1/Right&Partition_1_1_2/Modified_Face_2_1"), model.selection("VERTEX", "Partition_1_1_1/Modified_Face_1_1&Translation_1_1/Translated_Face_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("VERTEX", "Translation_1_1/Translated_Face_6&Translation_1_1/Translated_Face_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("VERTEX", "Translation_1_1/Translated_Face_6&Partition_1_1_1/Modified_Face_1_3&Partition_1_1_1/Modified_Face_1_2")]
+ Group_3_objects = [model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Left][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Right][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Back][Translation_2_1/MF:Translated&Box_3_1/Right][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("VERTEX", "[Box_2_1/Front][Box_2_1/Right][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]"), model.selection("VERTEX", "[(Partition_1_1_2/Modified_Face&Box_2_1/Back&Box_1_1/Front)(Partition_1_1_2/Modified_Face&Box_2_1/Left)(Box_2_1/Right)(Partition_1_1_2/Modified_Face&Box_2_1/Bottom)(Box_2_1/Top)][Box_2_1/Right][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_2_1/Back&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Right][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[Translation_1_1/MF:Translated&Box_1_1/Back][Translation_1_1/MF:Translated&Box_1_1/Right][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[Translation_1_1/MF:Translated&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]")]
Group_3 = model.addGroup(Part_1_doc, Group_3_objects)
Group_3.result().setName("vertices_bottom")
Group_4 = model.addGroup(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Translation_2_1")])
Field_1 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], Field_1_objects)
Field_1.result().setName("Field_solids")
Field_1.addStep(0, 0, [[0], [1], [2], [3]])
- Field_2_objects = [model.selection("FACE", "Partition_1_1_1/Modified_Face_1_2"), model.selection("FACE", "Partition_1_1_2/Modified_Face_2_1"), model.selection("FACE", "Translation_2_1/Translated_Face_2"), model.selection("FACE", "Translation_1_1/Translated_Face_1"), model.selection("FACE", "Box_2_1/Top"), model.selection("FACE", "Translation_2_1/Translated_Face_1")]
+ Field_2_objects = [model.selection("FACE", "Partition_1_1_1/Modified_Face&Box_1_1/Bottom"), model.selection("FACE", "Partition_1_1_2/Modified_Face&Box_2_1/Bottom"), model.selection("FACE", "Translation_2_1/MF:Translated&Box_3_1/Bottom"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_1_1/Top"), model.selection("FACE", "Box_2_1/Top"), model.selection("FACE", "Translation_2_1/MF:Translated&Box_3_1/Top")]
Field_2 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], Field_2_objects)
Field_2.result().setName("Field_faces")
Field_2.addStep(0, 0, [[0], [1], [1], [1], [2], [2], [2]])
- Field_3_objects = [model.selection("EDGE", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_4"), model.selection("EDGE", "Translation_2_1/Translated_Face_4&Translation_2_1/Translated_Face_2"), model.selection("EDGE", "Partition_1_1_2/Modified_Face_2_2&Partition_1_1_2/Modified_Face_2_1"), model.selection("EDGE", "Partition_1_1_1/Modified_Face_1_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("EDGE", "Translation_1_1/Translated_Face_6&Partition_1_1_1/Modified_Face_1_3"), model.selection("EDGE", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_3"), model.selection("EDGE", "Translation_1_1/Translated_Face_6&Translation_1_1/Translated_Face_3"), model.selection("EDGE", "Box_2_1/Front&Box_2_1/Right"), model.selection("EDGE", "Box_2_1/Right&Box_2_1/Top"), model.selection("EDGE", "Partition_1_1_2/Modified_Face_2_divided_1_1&Box_2_1/Right"), model.selection("EDGE", "Box_2_1/Right&Partition_1_1_2/Modified_Face_2_1")]
+ Field_3_objects = [model.selection("EDGE", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Left]"), model.selection("EDGE", "[Translation_2_1/MF:Translated&Box_3_1/Left][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("EDGE", "[Partition_1_1_2/Modified_Face&Box_2_1/Left][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]"), model.selection("EDGE", "[Partition_1_1_1/Modified_Face&Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("EDGE", "[Translation_1_1/MF:Translated&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Left]"), model.selection("EDGE", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Right]"), model.selection("EDGE", "[Translation_1_1/MF:Translated&Box_1_1/Back][Translation_1_1/MF:Translated&Box_1_1/Right]"), model.selection("EDGE", "[Box_2_1/Front][Box_2_1/Right]"), model.selection("EDGE", "[Box_2_1/Right][Box_2_1/Top]"), model.selection("EDGE", "[(Partition_1_1_2/Modified_Face&Box_2_1/Back&Box_1_1/Front)(Partition_1_1_2/Modified_Face&Box_2_1/Left)(Box_2_1/Right)(Partition_1_1_2/Modified_Face&Box_2_1/Bottom)(Box_2_1/Top)][Box_2_1/Right]"), model.selection("EDGE", "[Box_2_1/Right][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]")]
Field_3 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], Field_3_objects)
Field_3.result().setName("Field_edges")
Field_3.addStep(0, 0, [[0], [1], [1], [1], [2], [2], [2], [2], [3], [3], [3], [3]])
- Field_4_objects = [model.selection("VERTEX", "Translation_1_1/Translated_Face_6&Partition_1_1_1/Modified_Face_1_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("VERTEX", "Translation_1_1/Translated_Face_6&Translation_1_1/Translated_Face_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("VERTEX", "Partition_1_1_1/Modified_Face_1_1&Translation_1_1/Translated_Face_3&Partition_1_1_1/Modified_Face_1_2"), model.selection("VERTEX", "Partition_1_1_2/Modified_Face_2_divided_1_1&Box_2_1/Right&Partition_1_1_2/Modified_Face_2_1"), model.selection("VERTEX", "Box_2_1/Front&Box_2_1/Right&Partition_1_1_2/Modified_Face_2_1"), model.selection("VERTEX", "Translation_2_1/Translated_Face_6&Translation_2_1/Translated_Face_3&Translation_2_1/Translated_Face_2"), model.selection("VERTEX", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_3&Translation_2_1/Translated_Face_2"), model.selection("VERTEX", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_4&Translation_2_1/Translated_Face_2"), model.selection("VERTEX", "Translation_1_1/Translated_Face_6&Partition_1_1_1/Modified_Face_1_3&Translation_1_1/Translated_Face_1"), model.selection("VERTEX", "Translation_1_1/Translated_Face_6&Translation_1_1/Translated_Face_3&Translation_1_1/Translated_Face_1"), model.selection("VERTEX", "Partition_1_1_2/Modified_Face_2_divided_1_1&Partition_1_1_2/Modified_Face_2_2&Box_2_1/Top"), model.selection("VERTEX", "Partition_1_1_2/Modified_Face_2_divided_1_1&Box_2_1/Right&Box_2_1/Top"), model.selection("VERTEX", "Box_2_1/Front&Partition_1_1_2/Modified_Face_2_2&Box_2_1/Top"), model.selection("VERTEX", "Box_2_1/Front&Box_2_1/Right&Box_2_1/Top"), model.selection("VERTEX", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_4&Translation_2_1/Translated_Face_1"), model.selection("VERTEX", "Translation_2_1/Translated_Face_5&Translation_2_1/Translated_Face_3&Translation_2_1/Translated_Face_1")]
+ Field_4_objects = [model.selection("VERTEX", "[Translation_1_1/MF:Translated&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Left][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[Translation_1_1/MF:Translated&Box_1_1/Back][Translation_1_1/MF:Translated&Box_1_1/Right][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&Box_2_1/Back&Box_1_1/Front][Translation_1_1/MF:Translated&Box_1_1/Right][Partition_1_1_1/Modified_Face&Box_1_1/Bottom]"), model.selection("VERTEX", "[(Partition_1_1_2/Modified_Face&Box_2_1/Back&Box_1_1/Front)(Partition_1_1_2/Modified_Face&Box_2_1/Left)(Box_2_1/Right)(Partition_1_1_2/Modified_Face&Box_2_1/Bottom)(Box_2_1/Top)][Box_2_1/Right][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]"), model.selection("VERTEX", "[Box_2_1/Front][Box_2_1/Right][Partition_1_1_2/Modified_Face&Box_2_1/Bottom]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Back][Translation_2_1/MF:Translated&Box_3_1/Right][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Right][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Left][Translation_2_1/MF:Translated&Box_3_1/Bottom]"), model.selection("VERTEX", "[Translation_1_1/MF:Translated&Box_1_1/Back][Partition_1_1_1/Modified_Face&Box_1_1/Left][Translation_1_1/MF:Translated&Box_1_1/Top]"), model.selection("VERTEX", "[Translation_1_1/MF:Translated&Box_1_1/Back][Translation_1_1/MF:Translated&Box_1_1/Right][Translation_1_1/MF:Translated&Box_1_1/Top]"), model.selection("VERTEX", "[(Partition_1_1_2/Modified_Face&Box_2_1/Back&Box_1_1/Front)(Partition_1_1_2/Modified_Face&Box_2_1/Left)(Box_2_1/Right)(Partition_1_1_2/Modified_Face&Box_2_1/Bottom)(Box_2_1/Top)][Partition_1_1_2/Modified_Face&Box_2_1/Left][Box_2_1/Top]"), model.selection("VERTEX", "[(Partition_1_1_2/Modified_Face&Box_2_1/Back&Box_1_1/Front)(Partition_1_1_2/Modified_Face&Box_2_1/Left)(Box_2_1/Right)(Partition_1_1_2/Modified_Face&Box_2_1/Bottom)(Box_2_1/Top)][Box_2_1/Right][Box_2_1/Top]"), model.selection("VERTEX", "[Box_2_1/Front][Partition_1_1_2/Modified_Face&Box_2_1/Left][Box_2_1/Top]"), model.selection("VERTEX", "[Box_2_1/Front][Box_2_1/Right][Box_2_1/Top]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Left][Translation_2_1/MF:Translated&Box_3_1/Top]"), model.selection("VERTEX", "[Translation_2_1/MF:Translated&Box_3_1/Front][Translation_2_1/MF:Translated&Box_3_1/Right][Translation_2_1/MF:Translated&Box_3_1/Top]")]
Field_4 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], Field_4_objects)
Field_4.result().setName("Field_vertices")
Field_4.addStep(0, 0, [[0], [1], [1], [1], [1], [1], [1], [1], [1], [2], [2], [2], [2], [3], [3], [3], [3]])
ADD_UNIT_TESTS(TestAxisCreation.py
+ TestAxis_ErrorMsg.py
UnitTestAxis.py
TestPoint_XYZ.py
TestPoint_IntersectLines.py
TestPoint_GeometricalPropertyCenterOfCircle.py
TestPoint_VertexSelection.py
TestPointName.py
- TestPlane.py)
+ TestPoint_ErrorMsg.py
+ TestPoint_FiniteValidator.py
+ TestPlane.py
+ TestPlane_ErrorMsg.py
+ TestPlane_FaceValidator.py
+)
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
#include <GeomAPI_Pln.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_Vertex.h>
+#include <GeomAPI_XYZ.h>
#include <GeomAlgoAPI_EdgeBuilder.h>
#include <GeomAlgoAPI_PointBuilder.h>
void ConstructionPlugin_Axis::createAxisByCylindricalFace()
{
- std::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(CYLINDRICAL_FACE())->value();
- // update arguments due to the selection value
- if (aSelection && !aSelection->isNull() && aSelection->isFace()) {
- std::shared_ptr<GeomAPI_Edge> anEdge = GeomAlgoAPI_EdgeBuilder::cylinderAxis(aSelection);
-
- ResultConstructionPtr aConstr = document()->createConstruction(data());
- aConstr->setInfinite(true);
- aConstr->setShape(anEdge);
- setResult(aConstr);
- }
+ std::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(CYLINDRICAL_FACE())->value();
+ // update arguments due to the selection value
+
+ if (!aSelection.get() || aSelection->isNull()) {
+ return;
+ }
+
+ if (aSelection->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aSelection);
+ aSelection = anIt.current();
+ }
+
+ if (aSelection->isFace()) {
+ std::shared_ptr<GeomAPI_Edge> anEdge = GeomAlgoAPI_EdgeBuilder::cylinderAxis(aSelection);
+
+ ResultConstructionPtr aConstr = document()->createConstruction(data());
+ aConstr->setInfinite(true);
+ aConstr->setShape(anEdge);
+ setResult(aConstr);
+ }
}
void ConstructionPlugin_Axis::createAxisByDimensions()
if(!aLineShape.get()) {
aLineShape = anEdgeSelection->context()->shape();
}
- std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aLineShape));
+ GeomEdgePtr anEdge;
+ if (aLineShape->isEdge()) {
+ anEdge = aLineShape->edge();
+ }
+ else if (aLineShape->isCompound()) {
+ // create an edge which covers all edges from compounds (they are on the same line)
+ GeomPointPtr aFirst, aLast;
+ GeomXYZPtr aLineVec;
+ for(GeomAPI_ShapeIterator anIt(aLineShape); anIt.more(); anIt.next()) {
+ GeomEdgePtr aSub = anIt.current()->edge();
+ if (aSub.get() && aSub->isLine()) {
+ if (!aLineVec.get()) {
+ aFirst = aSub->firstPoint();
+ aLast = aSub->lastPoint();
+ } else { // set aFirst and aLast by extreme points
+ GeomXYZPtr aFirstVec = aSub->firstPoint()->xyz()->decreased(aFirst->xyz());
+ bool aSameDirection =
+ aSub->lastPoint()->xyz()->decreased(aSub->firstPoint()->xyz())->dot(aLineVec) > 0;
+ if (aLineVec->dot(aFirstVec) < -1.e-7) { // first point is changed
+ aFirst = aSameDirection ? aSub->firstPoint() : aSub->lastPoint();
+ } else { // last point is changed
+ aLast = aSameDirection ? aSub->lastPoint() : aSub->firstPoint();
+ }
+ }
+ aLineVec = aLast->xyz()->decreased(aFirst->xyz());
+ }
+ }
+ if (aLineVec.get())
+ anEdge = GeomAlgoAPI_EdgeBuilder::line(aFirst, aLast);
+ }
ResultConstructionPtr aConstr = document()->createConstruction(data());
aConstr->setInfinite(true);
if(!aFaceShape.get()) {
aFaceShape = aFaceSelection->context()->shape();
}
- std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aFaceShape));
+ GeomFacePtr aFace;
+ if (aFaceShape->isFace()) {
+ aFace = aFaceShape->face();
+ }
+ else if (aFaceShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aFaceShape);
+ aFace = anIt.current()->face();
+ }
+ if (!aFace)
+ return;
std::shared_ptr<GeomAPI_Pln> aPln = aFace->getPlane();
// Get point.
if(!aFaceShape1.get()) {
aFaceShape1 = aFaceSelection1->context()->shape();
}
- std::shared_ptr<GeomAPI_Face> aFace1(new GeomAPI_Face(aFaceShape1));
+ std::shared_ptr<GeomAPI_Face> aFace1;
+ if (aFaceShape1->isFace()) {
+ aFace1 = aFaceShape1->face();
+ }
+ else if (aFaceShape1->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aFaceShape1);
+ aFace1 = anIt.current()->face();
+ }
+ if (!aFace1)
+ return;
std::shared_ptr<GeomAPI_Pln> aPln1 = aFace1->getPlane();
std::string useOffset1 = string(USE_OFFSET1())->value();
if(!aFaceShape2.get()) {
aFaceShape2 = aFaceSelection2->context()->shape();
}
- std::shared_ptr<GeomAPI_Face> aFace2(new GeomAPI_Face(aFaceShape2));
+ std::shared_ptr<GeomAPI_Face> aFace2;
+ if (aFaceShape2->isFace()) {
+ aFace2 = aFaceShape2->face();
+ }
+ else if (aFaceShape2->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aFaceShape2);
+ aFace2 = anIt.current()->face();
+ }
+ if (!aFace2)
+ return;
std::shared_ptr<GeomAPI_Pln> aPln2 = aFace2->getPlane();
std::string useOffset2 = string(USE_OFFSET2())->value();
#include <GeomAPI_Pln.h>
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Pnt2d.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_Vertex.h>
#include <GeomAPI_XYZ.h>
if(!aLineShape.get()) {
aLineShape = anEdgeSelection->context()->shape();
}
- std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aLineShape));
+ std::shared_ptr<GeomAPI_Edge> anEdge;
+ if (aLineShape->isEdge()) {
+ anEdge = aLineShape->edge();
+ }
+ else if (aLineShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aLineShape);
+ anEdge = anIt.current()->edge();
+ }
+ if (!anEdge)
+ return GeomShapePtr();
// Get point.
AttributeSelectionPtr aPointSelection = selection(POINT());
bool anIsReverse = boolean(REVERSE())->value();
if(anIsReverse) aDist = -aDist;
GeomShapePtr aShape = aFaceAttr->value();
- if (!aShape.get()) {
+ if (!aShape.get() && aFaceAttr->context()) {
aShape = aFaceAttr->context()->shape();
}
return aPlane;
}
- std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aShape));
+ std::shared_ptr<GeomAPI_Face> aFace;
+ if (aShape->isFace()) {
+ aFace = aShape->face();
+ }
+ else if (aShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aShape);
+ aFace = anIt.current()->face();
+ }
+ if (!aFace)
+ return GeomShapePtr();
std::shared_ptr<GeomAPI_Pln> aPln = aFace->getPlane();
std::shared_ptr<GeomAPI_Pnt> aOrig = aPln->location();
if(!aFaceShape.get()) {
aFaceShape = aFaceSelection->context()->shape();
}
- std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aFaceShape));
+ std::shared_ptr<GeomAPI_Face> aFace;
+ if (aFaceShape->isFace()) {
+ aFace = aFaceShape->face();
+ }
+ else if (aFaceShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aFaceShape);
+ aFace = anIt.current()->face();
+ }
// Get point.
AttributeSelectionPtr aPointSelection = selection(COINCIDENT_POINT());
if(!aPointShape.get()) {
aPointShape = aPointSelection->context()->shape();
}
- std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aPointShape));
+ std::shared_ptr<GeomAPI_Vertex> aVertex = aPointShape->vertex();
+ if (!aVertex)
+ return GeomShapePtr();
std::shared_ptr<GeomAPI_Pnt> anOrig = aVertex->point();
std::shared_ptr<GeomAPI_Pln> aPln = aFace->getPlane();
if(!aFaceShape.get()) {
aFaceShape = aFaceSelection->context()->shape();
}
- std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aFaceShape));
+ std::shared_ptr<GeomAPI_Face> aFace;
+ if (aFaceShape->isFace()) {
+ aFace = aFaceShape->face();
+ }
+ else if (aFaceShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aFaceShape);
+ aFace = anIt.current()->face();
+ }
+ if (!aFace)
+ return GeomShapePtr();
aFace = makeRectangularFace(aFace, aFace->getPlane());
// Get axis.
if(!anAxisShape.get()) {
anAxisShape = anAxisSelection->context()->shape();
}
- std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(anAxisShape));
+ std::shared_ptr<GeomAPI_Edge> anEdge;
+ if (anAxisShape->isEdge()) {
+ anEdge = anAxisShape->edge();
+ }
+ else if (anAxisShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(anAxisShape);
+ anEdge = anIt.current()->edge();
+ }
+ if (!anEdge)
+ return GeomShapePtr();
std::shared_ptr<GeomAPI_Ax1> anAxis =
std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
if(!aFaceShape1.get()) {
aFaceShape1 = aFaceSelection1->context()->shape();
}
- std::shared_ptr<GeomAPI_Face> aFace1(new GeomAPI_Face(aFaceShape1));
+ std::shared_ptr<GeomAPI_Face> aFace1;
+ if (aFaceShape1->isFace()) {
+ aFace1 = aFaceShape1->face();
+ }
+ else if (aFaceShape1->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aFaceShape1);
+ aFace1 = anIt.current()->face();
+ }
+ if (!aFace1)
+ return GeomShapePtr();
std::shared_ptr<GeomAPI_Pln> aPln1 = aFace1->getPlane();
// Get plane 2.
if(!aFaceShape2.get()) {
aFaceShape2 = aFaceSelection2->context()->shape();
}
- std::shared_ptr<GeomAPI_Face> aFace2(new GeomAPI_Face(aFaceShape2));
+ std::shared_ptr<GeomAPI_Face> aFace2;
+ if (aFaceShape2->isFace()) {
+ aFace2 = aFaceShape2->face();
+ }
+ else if (aFaceShape2->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aFaceShape2);
+ aFace2 = anIt.current()->face();
+ }
+ if (!aFace2)
+ return GeomShapePtr();
std::shared_ptr<GeomAPI_Pln> aPln2 = aFace2->getPlane();
std::shared_ptr<GeomAPI_Pnt> anOrig1 = aPln1->location();
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Vertex.h>
#include <GeomAPI_Pln.h>
+#include <GeomAPI_ShapeIterator.h>
//==================================================================================================
ConstructionPlugin_Point::ConstructionPlugin_Point()
removeResults(1); // for case the point type was switched from multi-results type
std::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
+ aConstr->setInfinite(true);
aConstr->setShape(aShape);
setResult(aConstr);
}
if(!aLineShape.get()) {
aLineShape = aLineSelection->context()->shape();
}
- std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aLineShape));
+ GeomEdgePtr anEdge;
+ if (aLineShape->isEdge()) {
+ anEdge = aLineShape->edge();
+ }
+ else if (aLineShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aLineShape);
+ anEdge = anIt.current()->edge();
+ }
// Get plane.
AttributeSelectionPtr aPlaneSelection= selection(INTERSECTION_PLANE());
if(!aPlaneShape.get()) {
aPlaneShape = aPlaneSelection->context()->shape();
}
- std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aPlaneShape));
+ GeomFacePtr aFace;
+ if (aPlaneShape->isFace()) {
+ aFace = aPlaneShape->face();
+ }
+ else if (aPlaneShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aPlaneShape);
+ aFace = anIt.current()->face();
+ }
if (!string(USE_OFFSET())->value().empty()) {
double anOffset = real(OFFSET())->value();
#include <GeomAPI_Pln.h>
#include <GeomAPI_Vertex.h>
#include <GeomAPI_Pnt.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAlgoAPI_ShapeTools.h>
#include <ModelAPI_AttributeSelection.h>
#include <Events_InfoMessage.h>
static std::shared_ptr<GeomAPI_Edge> getEdge(const GeomShapePtr theShape);
+static std::shared_ptr<GeomAPI_Face> getFace(const GeomShapePtr theShape);
static std::shared_ptr<GeomAPI_Lin> getLin(const GeomShapePtr theShape);
static std::shared_ptr<GeomAPI_Pln> getPln(const GeomShapePtr theShape);
static std::shared_ptr<GeomAPI_Pnt> getPnt(const GeomShapePtr theShape);
AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front());
std::shared_ptr<GeomAPI_Edge> anEdge;
- std::shared_ptr<GeomAPI_Pln> aPln;
+ std::shared_ptr<GeomAPI_Face> aFace;
GeomShapePtr aShape1 = anAttribute1->value();
ResultPtr aContext1 = anAttribute1->context();
bool isPlaneFirst = false;
anEdge = getEdge(aShape1);
- aPln = getPln(aShape2);
- if(!anEdge.get() || !aPln.get()) {
+
+ aFace = getFace(aShape2);
+ if(!anEdge.get() || !aFace.get()) {
anEdge = getEdge(aShape2);
- aPln = getPln(aShape1);
+ aFace = getFace(aShape1);
isPlaneFirst = true;
}
- if(!anEdge.get() || !aPln.get()) {
+ if(!anEdge.get() || !aFace.get()) {
theError = "Wrong shape types selected.";
return false;
}
- std::shared_ptr<GeomAPI_Face> aPlaneFace(new GeomAPI_Face(isPlaneFirst ? aShape1 : aShape2));
- if(GeomAlgoAPI_ShapeTools::isParallel(anEdge, aPlaneFace)) {
+ if(GeomAlgoAPI_ShapeTools::isParallel(anEdge, aFace)) {
theError = "Plane and edge are parallel.";
return false;
}
std::shared_ptr<GeomAPI_Edge> getEdge(const GeomShapePtr theShape)
{
- if(!theShape->isEdge()) {
- return std::shared_ptr<GeomAPI_Edge>();
- }
+ GeomEdgePtr anEdge;
- std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(theShape));
+ if(theShape->isEdge()) {
+ anEdge = theShape->edge();
+ }
+ else if (theShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(theShape);
+ anEdge = anIt.current()->edge();
+ }
return anEdge;
}
+GeomFacePtr getFace(const GeomShapePtr theShape)
+{
+ GeomFacePtr aFace;
+
+ if (theShape->isFace()) {
+ aFace = theShape->face();
+ }
+ else if (theShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(theShape);
+ aFace = anIt.current()->face();
+ }
+
+ return aFace;
+}
+
std::shared_ptr<GeomAPI_Lin> getLin(const GeomShapePtr theShape)
{
std::shared_ptr<GeomAPI_Lin> aLin;
- if(!theShape->isEdge()) {
+ GeomEdgePtr anEdge;
+
+ if (theShape->isEdge()) {
+ anEdge = theShape->edge();
+ }
+ else if (theShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(theShape);
+ anEdge = anIt.current()->edge();
+ }
+ else {
return aLin;
}
- std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(theShape));
-
if(!anEdge->isLine()) {
return aLin;
}
{
std::shared_ptr<GeomAPI_Pln> aPln;
- if(!theShape->isFace()) {
+ GeomFacePtr aFace;
+
+ if(theShape->isFace()) {
+ aFace = theShape->face();
+ }
+ else if (theShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(theShape);
+ aFace = anIt.current()->face();
+ }
+ else {
return aPln;
}
- std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(theShape));
-
- if(!aFace->isPlanar()) {
+ if(!aFace || !aFace->isPlanar()) {
return aPln;
}
# Make extrusion on circle
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
-anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(100)
anExtrusionFt.real("from_size").setValue(0)
anAxisFeatureData = anAxisFeature.data()
assert(anAxisFeatureData is not None)
anAxisFeatureData.string("CreationMethod").setValue("AxisByCylindricalFaceCase")
-anAxisFeatureData.selection("CylindricalFace").selectSubShape("face", "Extrusion_1_1/Generated_Face_1")
+anAxisFeatureData.selection("CylindricalFace").selectSubShape("face", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2")
anAxisFeature.execute()
aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompoundList = aCompound.selectionList("base_objects")
+aCompoundList.append("Box_1_1/Front", "FACE")
+aCompoundList.append("[Box_1_1/Left][Box_1_1/Top]", "EDGE")
+aSession.finishOperation()
+
+# Create auxiliary box 2
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound 2
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompoundList = aCompound.selectionList("base_objects")
+aCompoundList.append("[Box_2_1/Left][Box_2_1/Top]", "EDGE")
+aCompoundList.append("Box_2_1/Front", "FACE")
+aSession.finishOperation()
+
+
+# Axis by cylindrical face
+aSession.startOperation()
+Axis_1 = aPart.addFeature("Axis")
+Axis_1.string("CreationMethod").setValue("AxisByCylindricalFaceCase")
+Axis_1.selection("CylindricalFace").selectSubShape("COMPOUND", "Compound_2_1")
+Axis_1.execute()
+aSession.finishOperation()
+assert(Axis_1.error() != "")
+
+# Axis by dimensions
+aSession.startOperation()
+Axis_1.string("CreationMethod").setValue("AxisByDimensionsCase")
+Axis_1.real("DX").setValue(0)
+Axis_1.real("DY").setValue(0)
+Axis_1.real("DZ").setValue(0)
+Axis_1.execute()
+assert(Axis_1.error() != "")
+aSession.finishOperation()
+
+# Axis by line
+aSession.startOperation()
+Axis_1.string("CreationMethod").setValue("by_line")
+Axis_1.selection("line").selectSubShape("COMPOUND", "Compound_1_1")
+Axis_1.execute()
+assert(Axis_1.error() != "")
+aSession.finishOperation()
+
+# Axis by plane and point
+aSession.startOperation()
+Axis_1.string("CreationMethod").setValue("by_plane_and_point")
+Axis_1.selection("point").selectSubShape("COMPOUND", "Compound_1_1")
+Axis_1.selection("plane").selectSubShape("COMPOUND", "Compound_2_1")
+Axis_1.execute()
+assert(Axis_1.error() != "")
+aSession.finishOperation()
+
+# Axis by two planes
+aSession.startOperation()
+Axis_1.string("CreationMethod").setValue("by_two_planes")
+Axis_1.selection("plane1").selectSubShape("COMPOUND", "Compound_2_1")
+Axis_1.selection("plane2").selectSubShape("COMPOUND", "Compound_2_1")
+Axis_1.execute()
+assert(Axis_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+Axis_1.selection("plane1").selectSubShape("COMPOUND", "Compound_1_1")
+Axis_1.string("use_offset1").setValue("true")
+Axis_1.real("offset1").setValue(10)
+Axis_1.boolean("reverse_offset1").setValue(True)
+Axis_1.execute()
+assert(Axis_1.error() != "")
+aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompoundList = aCompound.selectionList("base_objects")
+aCompoundList.append("Box_1_1/Front", "FACE")
+aCompoundList.append("[Box_1_1/Left][Box_1_1/Top]", "EDGE")
+aSession.finishOperation()
+
+# Create auxiliary box 2
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound 2
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompoundList = aCompound.selectionList("base_objects")
+aCompoundList.append("[Box_2_1/Left][Box_2_1/Top]", "EDGE")
+aCompoundList.append("Box_2_1/Front", "FACE")
+aSession.finishOperation()
+
+
+# Plane by line and point
+aSession.startOperation()
+Plane_1 = aPart.addFeature("Plane")
+Plane_1.string("creation_method").setValue("by_line_and_point")
+Plane_1.selection("line").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.selection("point").selectSubShape("VERTEX", "PartSet/Origin")
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+# Unsupported type
+aSession.startOperation()
+Plane_1.string("creation_method").setValue("by_rotation")
+Plane_1.selection("plane").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.selection("axis").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+# By two parallel planes
+aSession.startOperation()
+Plane_1.string("creation_method").setValue("by_two_parallel_planes")
+Plane_1.selection("plane1").selectSubShape("COMPOUND", "Compound_2_1")
+Plane_1.selection("plane2").selectSubShape("COMPOUND", "Compound_2_1")
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+Plane_1.selection("plane1").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+# By distance from other plane
+aSession.startOperation()
+Plane_1.string("creation_method").setValue("by_other_plane")
+Plane_1.string("by_other_plane_option").setValue("by_distance_from_other")
+Plane_1.selection("plane").selectSubShape("COMPOUND", "Compound_2_1")
+Plane_1.real("distance").setValue(10)
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+# By coincident point
+aSession.startOperation()
+Plane_1.string("by_other_plane_option").setValue("by_coincident_to_point")
+Plane_1.selection("coincident_point").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+# By rotation
+aSession.startOperation()
+Plane_1.string("by_other_plane_option").setValue("by_rotation")
+Plane_1.selection("axis").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.real("angle").setValue(90)
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+Plane_1.selection("plane").selectSubShape("COMPOUND", "Compound_1_1")
+Plane_1.execute()
+assert(Plane_1.error() != "")
+aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Sphere_1_1/Face_1")])
+
+Plane_1 = model.addPlane(Part_1_doc, model.selection("COMPOUND", (0, 0, 0)), 10, False)
+assert(Plane_1.feature().error() != "")
+Part_1_doc.removeFeature(Plane_1.feature())
+
+Plane_1 = model.addPlane(Part_1_doc, model.selection("EDGE", "[Compound_1_1_1/Compound_1_1_1&Sphere_1_1/Face_1][weak_name_3]"), 10, False)
+assert(Plane_1.feature().error() != "")
+Part_1_doc.removeFeature(Plane_1.feature())
+
+model.end()
"""
from salome.shaper import model
-from GeomAPI import *
model.begin()
partSet = model.moduleDocument()
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result())
model.do()
-Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 50, False, False)
-Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 0.4, True, False)
-Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 0.4, True, True)
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), 50, False, False)
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), 0.4, True, False)
+Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), 0.4, True, True)
Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 50, 10)
-Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), 0.25, True, False)
-Point_6 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), 0.25, True, True)
+Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), 0.25, True, False)
+Point_6 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), 0.25, True, True)
model.do()
model.end()
+from GeomAPI import GeomAPI_Vertex
+
assert (len(Point_2.results()) > 0)
rightPosition = GeomAPI_Vertex(35.3553390593, 35.3553390593, 0)
assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompoundList = aCompound.selectionList("base_objects")
+aCompoundList.append("Box_1_1/Front", "FACE")
+aCompoundList.append("[Box_1_1/Left][Box_1_1/Top]", "EDGE")
+aSession.finishOperation()
+
+# Create auxiliary box 2
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound 2
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompoundList = aCompound.selectionList("base_objects")
+aCompoundList.append("[Box_2_1/Left][Box_2_1/Top]", "EDGE")
+aCompoundList.append("Box_2_1/Front", "FACE")
+aSession.finishOperation()
+
+
+# Point by line and plane
+aSession.startOperation()
+Point_1 = aPart.addFeature("Point")
+Point_1.string("creation_method").setValue("by_intersection")
+Point_1.string("intersection_type").setValue("intersection_type_by_line_and_plane")
+Point_1.selection("intersection_line").selectSubShape("COMPOUND", "Compound_1_1")
+Point_1.selection("intersection_plane").selectSubShape("COMPOUND", "Compound_2_1")
+Point_1.execute()
+assert(Point_1.error() != "")
+aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "PartSet/OZ"), 10, False, False)
+assert(Point_2.feature().error() != "")
+
+model.end()
"""
from salome.shaper import model
-from GeomAPI import *
model.begin()
partSet = model.moduleDocument()
SketchArc_1 = Sketch_1.addArc(50, 25, 25, 25, 75, 25, True)
model.do()
Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 100)
-Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"), True)
-Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), True)
-Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), True)
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), True)
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchArc_1_2"), True)
+Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), True)
model.do()
model.end()
+from GeomAPI import GeomAPI_Vertex
+
assert (len(Point_2.results()) > 0)
rightPosition = GeomAPI_Vertex(-50, 25, 0)
assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
"""
from salome.shaper import model
-from GeomAPI import *
model.begin()
partSet = model.moduleDocument()
Point_2 = model.addPoint(Part_1_doc, model.selection("COMPOUND", "Sketch_1"))
Point_3 = model.addPoint(Part_1_doc, model.selection("SOLID", "Box_1_1"))
Point_4 = model.addPoint(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
-Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top"))
+Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"))
model.do()
model.end()
+from GeomAPI import GeomAPI_Vertex
+
assert (len(Point_2.results()) > 0)
rightPosition = GeomAPI_Vertex(0, 0, 25)
assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
model.do()
# point by sketch face and a line
-Point_1 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"))
+Point_1 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/SketchLine_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"))
model.do()
# check the point position
rightPosition = GeomAPI_Vertex(-15, 0, 0)
assert(rightPosition.isEqual(Point_1.results()[0].resultSubShapePair()[0].shape()))
# point by sketch face and an arc, intersection outside of the face, offset is defined
-Point_2 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchArc_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, True)
+Point_2 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/SketchArc_1_2"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, True)
# check the point position
rightPosition = GeomAPI_Vertex(-89.442719099991606, 0, -10)
assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
"""
from salome.shaper import model
-from GeomAPI import *
model.begin()
partSet = model.moduleDocument()
SketchLine_1 = Sketch_1.addLine(-50, 50, 50, 50)
model.do()
Box_1 = model.addBox(Part_1_doc, 25, 100, 100)
-Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Box_1_1/Back&Box_1_1/Bottom"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
-Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"))
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Bottom]"), model.selection("EDGE", "Sketch_1/SketchLine_1"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"))
model.do()
model.end()
+from GeomAPI import GeomAPI_Vertex
+
assert (len(Point_2.results()) > 0)
rightPosition = GeomAPI_Vertex(0, 50, 0)
assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
"""
from salome.shaper import model
-from GeomAPI import *
model.begin()
partSet = model.moduleDocument()
SketchPoint_1 = Sketch_1.addPoint(100, 100)
model.do()
Box_1 = model.addBox(Part_1_doc, 50, 50, 50)
-Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"))
-Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("EDGE", "Box_1_1/Front&Box_1_1/Right"))
+Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("EDGE", "Sketch_1/SketchCircle_1_2"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"))
model.do()
model.end()
+from GeomAPI import GeomAPI_Vertex
+
assert (len(Point_2.results()) > 0)
rightPosition = GeomAPI_Vertex(70.7106781187, 70.7106781187, 0)
assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
"""
from salome.shaper import model
-from GeomAPI import *
model.begin()
partSet = model.moduleDocument()
SketchPoint_1 = Sketch_1.addPoint(50, 50)
model.do()
Box_1 = model.addBox(Part_1_doc, 10, 100, 100)
-Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("FACE", "Box_1_1/Front"))
-Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("FACE", "PartSet/XOY"))
+Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("FACE", "Box_1_1/Front"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("FACE", "PartSet/XOY"))
model.do()
model.end()
+from GeomAPI import GeomAPI_Vertex
+
assert (len(Point_2.results()) > 0)
rightPosition = GeomAPI_Vertex(10, 0, 50)
assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
-from GeomAPI import *
model.begin()
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
-Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top"))
+Point_2 = model.addPoint(Part_1_doc, 10, 0, 10)
model.do()
model.end()
+from GeomAPI import GeomAPI_Vertex
+
assert (len(Point_2.results()) > 0)
rightPosition = GeomAPI_Vertex(10, 0, 10)
assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
label="Line"
tooltip="Select line."
icon="icons/Construction/edge.png"
- shape_types="edge">
+ shape_types="edge"
+ geometrical_selection="true">
<validator id="GeomValidators_ShapeType" parameters="line"/>
</shape_selector>
</box>
label="Main object"
icon="icons/Construction/circle.png"
tooltip="Select a cylindrical object"
- shape_types="face">
+ shape_types="face"
+ geometrical_selection="true">
<validator id="GeomValidators_Face" parameters="cylinder"/>
</shape_selector>
</box>
label="Plane"
tooltip="Select a planar face."
icon="icons/Construction/face.png"
- shape_types="face">
+ shape_types="face"
+ geometrical_selection="true">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
<shape_selector id="point"
label="1st plane"
tooltip="Select a planar face."
icon="icons/Construction/face.png"
- shape_types="face">
+ shape_types="face"
+ geometrical_selection="true">
<validator id="GeomValidators_Face" parameters="plane"/>
<validator id="ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes" parameters="plane2"/>
</shape_selector>
label="2nd plane"
tooltip="Select a planar face."
icon="icons/Construction/face.png"
- shape_types="face">
+ shape_types="face"
+ geometrical_selection="true">
<validator id="GeomValidators_Face" parameters="plane"/>
<validator id="ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes" parameters="plane1"/>
</shape_selector>
label="Line"
tooltip="Select line."
icon="icons/Construction/edge.png"
- shape_types="edge">
+ shape_types="edge"
+ geometrical_selection="true">
<validator id="GeomValidators_ShapeType" parameters="line"/>
<validator id="ConstructionPlugin_ValidatorPlaneLinePoint" parameters="point,perpendicular"/>
</shape_selector>
label="Plane"
tooltip="Select a planar face."
icon="icons/Construction/face.png"
- shape_types="face">
+ shape_types="face"
+ geometrical_selection="true">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
<toolbox id="by_other_plane_option">
label="Axis"
tooltip="Select line for axis."
icon="icons/Construction/axis.png"
- shape_types="edge">
+ shape_types="edge"
+ geometrical_selection="true">
<validator id="GeomValidators_ShapeType" parameters="line"/>
</shape_selector>
<doublevalue id="angle"
label="1st plane"
tooltip="Select a planar face."
icon="icons/Construction/face.png"
- shape_types="face">
+ shape_types="face"
+ geometrical_selection="true">
<validator id="GeomValidators_Face" parameters="plane"/>
<validator id="ConstructionPlugin_ValidatorPlaneTwoParallelPlanes" parameters="plane2"/>
</shape_selector>
label="2nd plane"
tooltip="Select a planar face."
icon="icons/Construction/face.png"
- shape_types="face">
+ shape_types="face"
+ geometrical_selection="true">
<validator id="GeomValidators_Face" parameters="plane"/>
<validator id="ConstructionPlugin_ValidatorPlaneTwoParallelPlanes" parameters="plane1"/>
</shape_selector>
label="Line"
tooltip="Line for intersection."
icon="icons/Construction/edge.png"
- shape_types="edge">
+ shape_types="edge"
+ geometrical_selection="true">
<validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel"
parameters="intersection_plane"/>
</shape_selector>
label="Plane"
tooltip="Plane for intersection."
icon="icons/Construction/face.png"
- shape_types="face">
+ shape_types="face"
+ geometrical_selection="true">
<validator id="GeomValidators_Face" parameters="plane"/>
<validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel"
parameters="intersection_line"/>
TestExport.py
Test2290.py
Test2459.py
- TestExportToXAOWithGroupNotUpdated.py)
+ TestExportToXAOWithGroupNotUpdated.py
+ TestExport_FiniteValidator.py
+)
int aTag(1);
std::string aNameMS = "Shape";
- theResultBody->loadFirstLevel(theGeomShape, aNameMS, aTag);
+ theResultBody->loadFirstLevel(theGeomShape, aNameMS);
}
SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_15.startPoint(), SketchAPI_Arc(SketchArc_12).startPoint())
SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchAPI_Arc(SketchArc_6).endPoint())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchArc_1_2f-SketchArc_2_2f-SketchArc_3_2f-SketchArc_4_2r-SketchArc_5_2r-SketchCircle_1_2r-SketchArc_6_2r-SketchArc_7_2r-SketchLine_6f-SketchLine_7f-SketchArc_8_2f-SketchArc_9_2f-SketchLine_8f-SketchLine_9f-SketchArc_10_2f-SketchArc_11_2f-SketchLine_10f-SketchLine_11f-SketchArc_12_2r-SketchArc_13_2r-SketchCircle_2_2r-SketchCircle_3_2r-SketchArc_14_2f-SketchArc_15_2f")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchArc_1_2f-SketchLine_3f-SketchArc_2_2f-SketchLine_4f-SketchArc_5_2r-SketchArc_3_2f-SketchArc_6_2r-SketchLine_6f-SketchArc_8_2f-SketchLine_8f-SketchArc_10_2f-SketchLine_10f-SketchArc_12_2r-SketchArc_15_2f-SketchArc_7_2r-SketchLine_7f-SketchArc_9_2f-SketchLine_9f-SketchArc_11_2f-SketchLine_11f-SketchArc_13_2r-SketchArc_14_2f-SketchArc_4_2r-SketchCircle_1_2r-SketchCircle_2_2r-SketchCircle_3_2r")], model.selection(), 10, 0)
model.do()
model.end()
aGroupFeature.data().setName("")
aSelectionListAttr = aGroupFeature.selectionList("group_list")
aSelectionListAttr.setSelectionType("face")
- aSelectionListAttr.append("box1_1/Shape1")
- aSelectionListAttr.append("box1_1/Shape2")
+ aSelectionListAttr.append("box1_1/Shape_1")
+ aSelectionListAttr.append("box1_1/Shape_2")
aSession.finishOperation()
aSession.startOperation("Create a field")
aField = aSession.activeDocument().addFeature("Field")
aSelectionListAttr = aField.selectionList("selected")
aSelectionListAttr.setSelectionType("face")
- aSelectionListAttr.append("box1_1/Shape1")
- aSelectionListAttr.append("box1_1/Shape2")
+ aSelectionListAttr.append("box1_1/Shape_1")
+ aSelectionListAttr.append("box1_1/Shape_2")
aComponentNames = aField.stringArray("components_names")
aComponentNames.setSize(2) # two components
aComponentNames.setValue(0, "temperatue")
SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result())
SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 50, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 50, 0)
# Create a group with the faces of the box
-Group_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_3")]
+Group_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3")]
Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
Group_1.setName("Group_faces")
Group_1.result().setName("Group_faces")
# Create a field on the box
-Field_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_3")]
+Field_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3")]
Field_1 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], Field_1_objects)
Field_1.addStep(0, 0, [[0], [1], [2], [3], [4], [5], [6]])
# Create a plane to split the box in two parts
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+
+aSession = ModelAPI_Session.get()
+
+# Import a reference part
+aSession.startOperation("Add part")
+aPartFeature = aSession.moduleDocument().addFeature("Part")
+aSession.finishOperation()
+aPart = aSession.activeDocument()
+
+# Export a part
+aSession.startOperation("Export part")
+anExportFeature = aPart.addFeature("Export")
+anExportFeature.string("file_format").setValue("BREP")
+anExportFeature.string("file_path").setValue("file.brep")
+anExportFeature.string("ExportType").setValue("Regular")
+aSelectionListAttr = anExportFeature.selectionList("selection_list")
+aSelectionListAttr.setSelectionType("solids")
+aSelectionListAttr.append("PartSet/OX", "EDGE")
+aSession.finishOperation()
+assert(anExportFeature.error() != "")
aSelectionList = aFeature2.selectionList("group_list")
assert aSelectionList.selectionType() == "face"
assert aSelectionList.size() == 2
- assert aSelectionList.value(0).namingName("") == "mygeom_1/Shape1"
- print(aSelectionList.value(1).namingName(""))
- assert aSelectionList.value(1).namingName("") == "mygeom_1/Shape2"
+ assert aSelectionList.value(0).namingName("") == "mygeom_1/Shape_1"
+ assert aSelectionList.value(1).namingName("") == "mygeom_1/Shape_2"
aFeature3 = aCompositeFeature.subFeature(2, False)
assert aFeature3.getKind() == "Field"
FeaturesPlugin_BooleanFuse.cpp
FeaturesPlugin_BooleanCommon.cpp
FeaturesPlugin_BooleanSmash.cpp
+ FeaturesPlugin_BooleanFill.cpp
FeaturesPlugin_Intersection.cpp
FeaturesPlugin_Partition.cpp
FeaturesPlugin_Pipe.cpp
ADD_UNIT_TESTS(TestExtrusion.py
TestExtrusionCut.py
TestExtrusionFuse.py
+ TestExtrusion_ErrorMsg.py
+ TestExtrusion_ZeroOffsetError.py
TestRevolution.py
TestRevolutionCut.py
TestRevolutionFuse.py
TestCompositeFeaturesOnCompSolids.py
TestPartition.py
- TestPlacement.py
+ TestPartition_ErrorMsg.py
+ TestPlacement_Vertex_Vertex.py
+ TestPlacement_Edge_Vertex.py
+ TestPlacement_Edge_Edge.py
+ TestPlacement_Face_Vertex.py
+ TestPlacement_Face_Edge.py
+ TestPlacement_Face_Face.py
+ TestPlacement_Part_Part.py
+ TestPlacement_ErrorMsg.py
+ TestPlacement_BodyShapesValidator.py
TestTranslation.py
+ TestTranslation_Part.py
TestRotation.py
- TestBoolean.py
+ TestRotation_ErrorMsg.py
+ TestMultiRotation_Part.py
+ TestMultiRotation_ErrorMsg.py
+ TestMultiTranslation_Part.py
+ TestMultiTranslation_ErrorMsg.py
+ TestSymmetry_Part.py
+ TestBoolean1.py
+ TestBoolean2.py
+ TestBoolean3.py
TestBooleanCompSolids.py
TestBooleanSmash.py
TestBooleanFill.py
TestBooleanFillWithPlane.py
+ TestBooleanFill_ErrorMsg.py
TestMultiBoolean.py
TestSerialBoolean.py
+ TestBoolean_ErrorMsg.py
TestIntersection.py
+ TestIntersection_ErrorMsg.py
TestUnion.py
TestUnionFaces.py
+ TestUnion_ErrorMsg.py
TestRemoveSubShapes.py
TestRemoveSubShapes2.py
TestRemoveSubShapes3.py
TestRemoveSubShapes5.py
TestRemoveSubShapes6.py
TestPipe.py
+ TestPipe_Edge.py
+ TestPipe_Wire.py
+ TestPipe_Compound.py
+ TestPipe_ErrorMsg.py
TestRecover.py
TestRecover1798.py
TestFillEdgeVertex.py
TestFillSolidCompFace.py
TestFillSolidShell.py
TestFillSolidCompShell.py
+ TestFillCompsolidPlane.py
TestPartition2Faces.py
TestPartition2Solids.py
TestPartition2Wires.py
TestMeasurementDistance.py
TestMeasurementRadius.py
TestMeasurementAngle.py
+ TestMeasurementAngle3Points.py
+ TestMeasurementPresentation.py
TestFusionFaces.py
Test1379.py
Test1922.py
TestBooleanCut_Wire_Face.py
TestBooleanCut_Wire_Wire.py
TestBooleanCut_WireCompound_WireCompound.py
+ TestBooleanCut_Compound_Solid.py
+ TestBooleanCut_ErrorMsg.py
TestBooleanSmash_Face_Face.py
+ TestBooleanSmash_SubSolid_Solid.py
+ TestBooleanSmash_CompSolid_Solid.py
+ TestBooleanSmash_ErrorMsg.py
TestBooleanFuse_SimpleMode.py
TestBooleanFuse_RemoveEdges.py
+ TestBooleanFuse_ErrorMsg.py
TestBooleanCommon_Vertex_Vertex.py
TestBooleanCommon_VertexCompound_VertexCompound.py
TestBooleanCommon_Edge_Edge.py
TestBooleanCommon_Wire_Wire.py
TestBooleanCommon_WireCompound_WireCompound.py
TestBooleanCommon_Face_Face.py
+ TestBooleanCommon_Face_Plane.py
TestBooleanCommon_FaceCompound_FaceCompound.py
TestBooleanCommon_Shell_Shell.py
TestBooleanCommon_ShellCompound_ShellCompound.py
TestBooleanCommon_SolidCompound_Face.py
TestBooleanCommon_SolidCompound_Shell.py
TestBooleanCommon_SolidCompound_SolidCompound.py
+ TestBooleanCommon_SubCompound_Solid.py
+ TestBooleanCommon_SubSolid_Solid.py
TestBooleanCommon_CompSolid_Face.py
TestBooleanCommon_CompSolid_Shell.py
TestBooleanCommon_CompSolid_CompSolid.py
TestBooleanCommon_CompSolidCompound_Face.py
TestBooleanCommon_CompSolidCompound_Shell.py
TestBooleanCommon_CompSolidCompound_CompSolidCompound.py
+ TestBooleanCommon_ErrorMsg.py
Test2596.py
Test2592.py
Test2588.py
Test1467.py
- TestPartitionSubCompsolidWithCompsolid1.py
- TestPartitionSubCompsolidWithCompsolid2.py
- TestPartitionSubCompsolidWithCompsolid3.py
+ TestPartitionSubCompsolidWithCompSolid1.py
+ TestPartitionSubCompsolidWithCompSolid2.py
+ TestPartitionSubCompsolidWithCompSolid3.py
TestPartitionSubCompsolidWithSolid1.py
TestPartitionSubCompsolidWithSolid2.py
TestPartitionSubCompsolidWithSolid3.py
TestBooleanFuse_ShellCompound_ShellCompound.py
TestBooleanFuse_Solid_Solid.py
TestBooleanFuse_SolidCompound_SolidCompound.py
+ TestBooleanFuse_CompSolid_Face.py
TestBooleanFuse_CompSolid_CompSolid.py
TestBooleanFuse_CompSolidCompound_CompSolidCompound.py
+ TestFillet.py
+ TestFillet1.py
+ TestFillet_ErrorMsg.py
Test1816.py
Test2631.py
Test2650.py
+ Test2681.py
+ Test2686.py
+ Test2689.py
+ Test2693.py
+ Test2698.py
+ Test2701.py
+ Test2724.py
+ Test2692.py
+ Test2617.py
+ Test2729.py
+ Test2751.py
)
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TOOL_LIST_ID());
}
-//=================================================================================================
-std::shared_ptr<GeomAPI_Shape> FeaturesPlugin_Boolean::getShape(const std::string& theAttrName)
-{
- std::shared_ptr<ModelAPI_AttributeReference> aObjRef = std::dynamic_pointer_cast<
- ModelAPI_AttributeReference>(data()->attribute(theAttrName));
- if (aObjRef) {
- std::shared_ptr<ModelAPI_ResultBody> aConstr = std::dynamic_pointer_cast<
- ModelAPI_ResultBody>(aObjRef->value());
- if (aConstr)
- return aConstr->shape();
- }
- return std::shared_ptr<GeomAPI_Shape>();
-}
-
//=================================================================================================
FeaturesPlugin_Boolean::OperationType FeaturesPlugin_Boolean::operationType()
{
return myOperationType;
}
-//=================================================================================================
-void FeaturesPlugin_Boolean::execute()
-{
- ListOfShape anObjects, aTools, anEdgesAndFaces, aPlanes;
- std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
-
- // Getting objects.
- AttributeSelectionListPtr anObjectsSelList =
- selectionList(FeaturesPlugin_Boolean::OBJECT_LIST_ID());
- for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
- AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex);
- std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
- if(!anObject.get()) {
- return;
- }
- ResultPtr aContext = anObjectAttr->context();
- ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
- if(aResCompSolidPtr.get()
- && aResCompSolidPtr->shape()->shapeType() == GeomAPI_Shape::COMPSOLID) {
- std::shared_ptr<GeomAPI_Shape> aContextShape = aResCompSolidPtr->shape();
- std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
- anIt = aCompSolidsObjects.begin();
- for(; anIt != aCompSolidsObjects.end(); anIt++) {
- if(anIt->first->isEqual(aContextShape)) {
- aCompSolidsObjects[anIt->first].push_back(anObject);
- break;
- }
- }
- if(anIt == aCompSolidsObjects.end()) {
- aCompSolidsObjects[aContextShape].push_back(anObject);
- }
- } else {
- if(myOperationType != BOOL_FILL
- && (anObject->shapeType() == GeomAPI_Shape::EDGE
- || anObject->shapeType() == GeomAPI_Shape::FACE))
- {
- anEdgesAndFaces.push_back(anObject);
- }
- else
- {
- anObjects.push_back(anObject);
- }
- }
- }
-
- // Getting tools.
- AttributeSelectionListPtr aToolsSelList = selectionList(FeaturesPlugin_Boolean::TOOL_LIST_ID());
- for(int aToolsIndex = 0; aToolsIndex < aToolsSelList->size(); aToolsIndex++) {
- AttributeSelectionPtr aToolAttr = aToolsSelList->value(aToolsIndex);
- GeomShapePtr aTool = aToolAttr->value();
- if(!aTool.get()) {
- // It could be a construction plane.
- ResultPtr aContext = aToolAttr->context();
- aPlanes.push_back(aToolAttr->context()->shape());
- }
- else if (myOperationType != BOOL_FILL
- && (aTool->shapeType() == GeomAPI_Shape::EDGE
- || aTool->shapeType() == GeomAPI_Shape::FACE))
- {
- anEdgesAndFaces.push_back(aTool);
- } else {
- aTools.push_back(aTool);
- }
- }
-
- int aResultIndex = 0;
-
- switch(myOperationType) {
- case BOOL_CUT:
- case BOOL_COMMON:
- case BOOL_FILL: {
- if((anObjects.empty() && aCompSolidsObjects.empty())
- || (aTools.empty() && aPlanes.empty())) {
- std::string aFeatureError = "Error: Not enough objects for boolean operation.";
- setError(aFeatureError);
- return;
- }
-
- // For solids cut each object with all tools.
- for(ListOfShape::iterator
- anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); anObjectsIt++) {
- std::shared_ptr<GeomAPI_Shape> anObject = *anObjectsIt;
- ListOfShape aListWithObject;
- aListWithObject.push_back(anObject);
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
- std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
- GeomShapePtr aResShape;
-
- switch(myOperationType) {
- case BOOL_CUT: {
- aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aListWithObject,
- aTools,
- GeomAlgoAPI_Boolean::BOOL_CUT));
- aResShape = aBoolAlgo->shape();
- break;
- }
- case BOOL_COMMON: {
- aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aListWithObject,
- aTools,
- GeomAlgoAPI_Boolean::BOOL_COMMON));
- aResShape = aBoolAlgo->shape();
- break;
- }
- case BOOL_FILL: {
- std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints =
- GeomAlgoAPI_ShapeTools::getBoundingBox(aListWithObject, 1.0);
-
- // Resize planes.
- ListOfShape aToolsWithPlanes = aTools;
- for(ListOfShape::const_iterator anIt = aPlanes.cbegin();
- anIt != aPlanes.cend();
- ++anIt)
- {
- GeomShapePtr aPlane = *anIt;
- GeomShapePtr aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints);
- std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMkShCustom(
- new GeomAlgoAPI_MakeShapeCustom);
- aMkShCustom->addModified(aPlane, aTool);
- aMakeShapeList.appendAlgo(aMkShCustom);
- aToolsWithPlanes.push_back(aTool);
- }
-
- aBoolAlgo.reset(new GeomAlgoAPI_Partition(aListWithObject, aToolsWithPlanes));
- aResShape = aBoolAlgo->shape();
- if (aResShape.get() && aResShape->shapeType() == GeomAPI_Shape::COMPOUND) {
- int aSubResultsNb = 0;
- GeomAPI_ShapeIterator anIt(aResShape);
- for(; anIt.more(); anIt.next()) {
- ++aSubResultsNb;
- }
- if(aSubResultsNb == 1) {
- anIt.init(aResShape);
- if(anIt.more()) {
- aResShape = anIt.current();
- }
- }
- }
- break;
- }
- }
-
- // Checking that the algorithm worked properly.
- if(!aBoolAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Boolean algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if(aResShape->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if(!aBoolAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
- return;
- }
-
- aMakeShapeList.appendAlgo(aBoolAlgo);
-
- if(GeomAlgoAPI_ShapeTools::volume(aResShape) > 1.e-27
- || (myOperationType != BOOL_CUT && myOperationType != BOOL_COMMON))
- {
- std::shared_ptr<ModelAPI_ResultBody> aResultBody =
- document()->createBody(data(), aResultIndex);
-
- ListOfShape aUsedTools = aTools;
- if (myOperationType == BOOL_FILL) {
- aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
- }
-
- loadNamingDS(aResultBody, anObject, aUsedTools, aResShape,
- aMakeShapeList, *(aBoolAlgo->mapOfSubShapes()),
- myOperationType == BOOL_FILL);
- setResult(aResultBody, aResultIndex);
- aResultIndex++;
- }
- }
-
- // Compsolids handling
- for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
- anIt = aCompSolidsObjects.begin();
- anIt != aCompSolidsObjects.end(); anIt++) {
- std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
- ListOfShape& aUsedInOperationSolids = anIt->second;
-
- // Collecting solids from compsolids which will not be modified in boolean operation.
- ListOfShape aNotUsedSolids;
- for(GeomAPI_ShapeExplorer
- anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
- std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
- ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
- for(; anIt != aUsedInOperationSolids.end(); anIt++) {
- if(aSolidInCompSolid->isEqual(*anIt)) {
- break;
- }
- }
- if(anIt == aUsedInOperationSolids.end()) {
- aNotUsedSolids.push_back(aSolidInCompSolid);
- }
- }
-
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
- std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
-
- switch(myOperationType) {
- case BOOL_CUT: {
- aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aUsedInOperationSolids,
- aTools,
- GeomAlgoAPI_Boolean::BOOL_CUT));
- break;
- }
- case BOOL_COMMON: {
- aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aUsedInOperationSolids,
- aTools,
- GeomAlgoAPI_Boolean::BOOL_COMMON));
- break;
- }
- case BOOL_FILL: {
- std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints =
- GeomAlgoAPI_ShapeTools::getBoundingBox(aUsedInOperationSolids, 1.0);
-
- // Resize planes.
- ListOfShape aToolsWithPlanes = aTools;
- for(ListOfShape::const_iterator anIt = aPlanes.cbegin();
- anIt != aPlanes.cend();
- ++anIt)
- {
- GeomShapePtr aPlane = *anIt;
- GeomShapePtr aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints);
- std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMkShCustom(
- new GeomAlgoAPI_MakeShapeCustom);
- aMkShCustom->addModified(aPlane, aTool);
- aMakeShapeList.appendAlgo(aMkShCustom);
- aToolsWithPlanes.push_back(aTool);
- }
-
- aBoolAlgo.reset(new GeomAlgoAPI_Partition(aUsedInOperationSolids, aToolsWithPlanes));
- break;
- }
- }
-
- // Checking that the algorithm worked properly.
- if(!aBoolAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Boolean algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if(aBoolAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if(!aBoolAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
- return;
- }
-
- aMakeShapeList.appendAlgo(aBoolAlgo);
- GeomAPI_DataMapOfShapeShape aMapOfShapes;
- aMapOfShapes.merge(aBoolAlgo->mapOfSubShapes());
- GeomShapePtr aResultShape = aBoolAlgo->shape();
-
- // Add result to not used solids from compsolid.
- if(!aNotUsedSolids.empty()) {
- ListOfShape aShapesToAdd = aNotUsedSolids;
- aShapesToAdd.push_back(aBoolAlgo->shape());
- std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
- new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
- if(!aFillerAlgo->isDone()) {
- std::string aFeatureError = "Error: PaveFiller algorithm failed.";
- setError(aFeatureError);
- return;
- }
-
- aMakeShapeList.appendAlgo(aFillerAlgo);
- aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
- aResultShape = aFillerAlgo->shape();
- }
-
- if(GeomAlgoAPI_ShapeTools::volume(aResultShape) > 1.e-27
- || (myOperationType != BOOL_CUT && myOperationType != BOOL_COMMON))
- {
- std::shared_ptr<ModelAPI_ResultBody> aResultBody =
- document()->createBody(data(), aResultIndex);
-
- ListOfShape aUsedTools = aTools;
- if (myOperationType == BOOL_FILL) {
- aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
- }
-
- loadNamingDS(aResultBody,
- aCompSolid,
- aUsedTools,
- aResultShape,
- aMakeShapeList,
- aMapOfShapes,
- myOperationType == BOOL_FILL);
- setResult(aResultBody, aResultIndex);
- aResultIndex++;
- }
- }
- break;
- }
- case BOOL_FUSE: {
- if((anObjects.size() + aTools.size() +
- aCompSolidsObjects.size() + anEdgesAndFaces.size()) < 2) {
- std::string aFeatureError = "Error: Not enough objects for boolean operation.";
- setError(aFeatureError);
- return;
- }
-
- // Collecting all solids which will be fused.
- ListOfShape aSolidsToFuse;
- aSolidsToFuse.insert(aSolidsToFuse.end(), anObjects.begin(), anObjects.end());
- aSolidsToFuse.insert(aSolidsToFuse.end(), aTools.begin(), aTools.end());
-
- // Collecting solids from compsolids which will not be modified
- // in boolean operation and will be added to result.
- ListOfShape aShapesToAdd;
- for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
- anIt = aCompSolidsObjects.begin();
- anIt != aCompSolidsObjects.end(); anIt++) {
- std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
- ListOfShape& aUsedInOperationSolids = anIt->second;
- aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedInOperationSolids.begin(),
- aUsedInOperationSolids.end());
-
- // Collect solids from compsolid which will not be modified in boolean operation.
- for(GeomAPI_ShapeExplorer
- anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
- std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
- ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
- for(; anIt != aUsedInOperationSolids.end(); anIt++) {
- if(aSolidInCompSolid->isEqual(*anIt)) {
- break;
- }
- }
- if(anIt == aUsedInOperationSolids.end()) {
- aShapesToAdd.push_back(aSolidInCompSolid);
- }
- }
- }
-
- ListOfShape anOriginalShapes = aSolidsToFuse;
- anOriginalShapes.insert(anOriginalShapes.end(), aShapesToAdd.begin(), aShapesToAdd.end());
-
- // Cut edges and faces(if we have any) with solids.
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
- GeomAPI_DataMapOfShapeShape aMapOfShapes;
- std::shared_ptr<GeomAPI_Shape> aCuttedEdgesAndFaces;
- if(!anEdgesAndFaces.empty()) {
- std::shared_ptr<GeomAlgoAPI_Boolean> aCutAlgo(new GeomAlgoAPI_Boolean(anEdgesAndFaces,
- anOriginalShapes, GeomAlgoAPI_Boolean::BOOL_CUT));
- if(aCutAlgo->isDone()) {
- aCuttedEdgesAndFaces = aCutAlgo->shape();
- aMakeShapeList.appendAlgo(aCutAlgo);
- aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
- }
- }
- anOriginalShapes.insert(anOriginalShapes.end(), anEdgesAndFaces.begin(),
- anEdgesAndFaces.end());
-
- // If we have compsolids then cut with not used solids all others.
- if(!aShapesToAdd.empty()) {
- aSolidsToFuse.clear();
- for(ListOfShape::iterator
- anIt = anOriginalShapes.begin(); anIt != anOriginalShapes.end(); anIt++) {
- ListOfShape aOneObjectList;
- aOneObjectList.push_back(*anIt);
- std::shared_ptr<GeomAlgoAPI_Boolean> aCutAlgo(
- new GeomAlgoAPI_Boolean(aOneObjectList, aShapesToAdd, GeomAlgoAPI_Boolean::BOOL_CUT));
-
- if(GeomAlgoAPI_ShapeTools::volume(aCutAlgo->shape()) > 1.e-27) {
- aSolidsToFuse.push_back(aCutAlgo->shape());
- aMakeShapeList.appendAlgo(aCutAlgo);
- aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
- }
- }
- }
-
- if(!aSolidsToFuse.empty()) {
- anObjects.clear();
- anObjects.push_back(aSolidsToFuse.back());
- aSolidsToFuse.pop_back();
- aTools = aSolidsToFuse;
- }
-
- // Fuse all objects and all tools.
- std::shared_ptr<GeomAPI_Shape> aShape;
- if(anObjects.size() == 1 && aTools.empty()) {
- aShape = anObjects.front();
- } else if(anObjects.empty() && aTools.size() == 1) {
- aShape = aTools.front();
- } else if((anObjects.size() + aTools.size()) > 1){
- std::shared_ptr<GeomAlgoAPI_Boolean> aFuseAlgo(new GeomAlgoAPI_Boolean(anObjects,
- aTools,
- GeomAlgoAPI_Boolean::BOOL_FUSE));
-
- // Checking that the algorithm worked properly.
- if(!aFuseAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Boolean algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if(aFuseAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if(!aFuseAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
- return;
- }
-
- aShape = aFuseAlgo->shape();
- aMakeShapeList.appendAlgo(aFuseAlgo);
- aMapOfShapes.merge(aFuseAlgo->mapOfSubShapes());
- }
-
- // Combine result with not used solids from compsolid and edges and faces (if we have any).
- if(aCuttedEdgesAndFaces.get() && !aCuttedEdgesAndFaces->isNull()) {
- aShapesToAdd.push_back(aCuttedEdgesAndFaces);
- } else {
- aShapesToAdd.insert(aShapesToAdd.end(), anEdgesAndFaces.begin(), anEdgesAndFaces.end());
- }
- if(!aShapesToAdd.empty()) {
- if(aShape.get()) {
- aShapesToAdd.push_back(aShape);
- }
- std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
- new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
- if(!aFillerAlgo->isDone()) {
- std::string aFeatureError = "Error: PaveFiller algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if(aFillerAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if(!aFillerAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
- return;
- }
-
- aShape = aFillerAlgo->shape();
- aMakeShapeList.appendAlgo(aFillerAlgo);
- aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
- }
-
- std::shared_ptr<GeomAPI_Shape> aBackShape = anOriginalShapes.back();
- anOriginalShapes.pop_back();
- std::shared_ptr<ModelAPI_ResultBody> aResultBody =
- document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody, aBackShape, anOriginalShapes,
- aShape, aMakeShapeList, aMapOfShapes);
- setResult(aResultBody, aResultIndex);
- aResultIndex++;
- break;
- }
- case BOOL_SMASH: {
- if((anObjects.empty() && aCompSolidsObjects.empty()) || aTools.empty()) {
- std::string aFeatureError = "Error: Not enough objects for boolean operation.";
- setError(aFeatureError);
- return;
- }
-
- // List of original solids for naming.
- ListOfShape anOriginalShapes;
- anOriginalShapes.insert(anOriginalShapes.end(), anObjects.begin(), anObjects.end());
- anOriginalShapes.insert(anOriginalShapes.end(), aTools.begin(), aTools.end());
-
- // Collecting all solids which will be smashed.
- ListOfShape aShapesToSmash;
- aShapesToSmash.insert(aShapesToSmash.end(), anObjects.begin(), anObjects.end());
-
- // Collecting solids from compsolids which will not be modified in
- // boolean operation and will be added to result.
- ListOfShape aShapesToAdd;
- for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
- anIt = aCompSolidsObjects.begin();
- anIt != aCompSolidsObjects.end(); anIt++) {
- std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
- ListOfShape& aUsedInOperationSolids = anIt->second;
- anOriginalShapes.push_back(aCompSolid);
- aShapesToSmash.insert(aShapesToSmash.end(), aUsedInOperationSolids.begin(),
- aUsedInOperationSolids.end());
-
- // Collect solids from compsolid which will not be modified in boolean operation.
- for(GeomAPI_ShapeExplorer
- anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
- std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
- ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
- for(; anIt != aUsedInOperationSolids.end(); anIt++) {
- if(aSolidInCompSolid->isEqual(*anIt)) {
- break;
- }
- }
- if(anIt == aUsedInOperationSolids.end()) {
- aShapesToAdd.push_back(aSolidInCompSolid);
- }
- }
- }
-
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
- GeomAPI_DataMapOfShapeShape aMapOfShapes;
- if(!aShapesToAdd.empty()) {
- // Cut objects with not used solids.
- std::shared_ptr<GeomAlgoAPI_Boolean> anObjectsCutAlgo(new GeomAlgoAPI_Boolean(
- aShapesToSmash,
- aShapesToAdd,
- GeomAlgoAPI_Boolean::BOOL_CUT));
-
- if(GeomAlgoAPI_ShapeTools::volume(anObjectsCutAlgo->shape()) > 1.e-27) {
- aShapesToSmash.clear();
- aShapesToSmash.push_back(anObjectsCutAlgo->shape());
- aMakeShapeList.appendAlgo(anObjectsCutAlgo);
- aMapOfShapes.merge(anObjectsCutAlgo->mapOfSubShapes());
- }
-
- // Cut tools with not used solids.
- std::shared_ptr<GeomAlgoAPI_Boolean> aToolsCutAlgo(new GeomAlgoAPI_Boolean(aTools,
- aShapesToAdd,
- GeomAlgoAPI_Boolean::BOOL_CUT));
-
- if(GeomAlgoAPI_ShapeTools::volume(aToolsCutAlgo->shape()) > 1.e-27) {
- aTools.clear();
- aTools.push_back(aToolsCutAlgo->shape());
- aMakeShapeList.appendAlgo(aToolsCutAlgo);
- aMapOfShapes.merge(aToolsCutAlgo->mapOfSubShapes());
- }
- }
-
- // Cut objects with tools.
- std::shared_ptr<GeomAlgoAPI_Boolean> aBoolAlgo(new GeomAlgoAPI_Boolean(aShapesToSmash,
- aTools,
- GeomAlgoAPI_Boolean::BOOL_CUT));
-
- // Checking that the algorithm worked properly.
- if(!aBoolAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Boolean algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if(aBoolAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if(!aBoolAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
- return;
- }
- aMakeShapeList.appendAlgo(aBoolAlgo);
- aMapOfShapes.merge(aBoolAlgo->mapOfSubShapes());
-
- // Put all (cut result, tools and not used solids) to PaveFiller.
- aShapesToAdd.push_back(aBoolAlgo->shape());
- aShapesToAdd.insert(aShapesToAdd.end(), aTools.begin(), aTools.end());
-
- std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(new GeomAlgoAPI_PaveFiller(aShapesToAdd,
- true));
- if(!aFillerAlgo->isDone()) {
- std::string aFeatureError = "Error: PaveFiller algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if(aFillerAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if(!aFillerAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
- return;
- }
-
- std::shared_ptr<GeomAPI_Shape> aShape = aFillerAlgo->shape();
- aMakeShapeList.appendAlgo(aFillerAlgo);
- aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
-
- std::shared_ptr<GeomAPI_Shape> aFrontShape = anOriginalShapes.front();
- anOriginalShapes.pop_front();
- std::shared_ptr<ModelAPI_ResultBody> aResultBody =
- document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody, aFrontShape, anOriginalShapes,
- aShape, aMakeShapeList, aMapOfShapes);
- setResult(aResultBody, aResultIndex);
- aResultIndex++;
-
- break;
- }
- default: {
- std::string anOperationError = "Error: Wrong type of operation";
- setError(anOperationError);
- return;
- }
- }
- // remove the rest results if there were produced in the previous pass
- removeResults(aResultIndex);
-}
-
//=================================================================================================
void FeaturesPlugin_Boolean::loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
const std::shared_ptr<GeomAPI_Shape> theBaseShape,
const ListOfShape& theTools,
const std::shared_ptr<GeomAPI_Shape> theResultShape,
- GeomAlgoAPI_MakeShape& theMakeShape,
- GeomAPI_DataMapOfShapeShape& theMapOfShapes,
- const bool theIsStoreAsGenerated)
+ const GeomMakeShapePtr& theMakeShape)
{
//load result
if(theBaseShape->isEqual(theResultShape)) {
theResultBody->store(theResultShape, false);
- } else {
- const int aModifyTag = 1;
- const int aModifyEdgeTag = 2;
- const int aModifyFaceTag = 3;
- const int aDeletedTag = 4;
- /// sub solids will be placed at labels 5, 6, etc. if result is compound of solids
- const int aSubsolidsTag = 5;
+ return;
+ }
+
+ theResultBody->storeModified(theBaseShape, theResultShape);
- theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
+ theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::EDGE);
+ theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE);
- const std::string aModName = "Modified";
- const std::string aModEName = "Modified_Edge";
- const std::string aModFName = "Modified_Face";
+ theResultBody->loadDeletedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE);
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::EDGE,
- aModifyEdgeTag, aModEName, theMapOfShapes, false, theIsStoreAsGenerated, true);
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
- aModifyFaceTag, aModFName, theMapOfShapes, false, theIsStoreAsGenerated, true);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::FACE, aDeletedTag);
+ for (ListOfShape::const_iterator anIter = theTools.begin();
+ anIter != theTools.end();
+ ++anIter)
+ {
+ GeomAPI_Shape::ShapeType aShapeType =
+ (*anIter)->shapeType() <= GeomAPI_Shape::FACE ? GeomAPI_Shape::FACE
+ : GeomAPI_Shape::EDGE;
+ theResultBody->loadModifiedShapes(theMakeShape, *anIter, aShapeType);
- int aTag;
- std::string aName;
- for(ListOfShape::const_iterator
- anIter = theTools.begin(); anIter != theTools.end(); anIter++) {
- if((*anIter)->shapeType() <= GeomAPI_Shape::FACE) {
- aTag = aModifyFaceTag;
- aName = aModFName;
- } else {
- aTag = aModifyEdgeTag;
- aName = aModEName;
- }
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter,
- aName == aModEName ? GeomAPI_Shape::EDGE : GeomAPI_Shape::FACE,
- aTag, aName, theMapOfShapes, false, theIsStoreAsGenerated, true);
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
- }
+ theResultBody->loadDeletedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE);
}
}
/// \return boolean operation type.
FEATURESPLUGIN_EXPORT OperationType operationType();
- /// Creates a new part document if needed.
- FEATURESPLUGIN_EXPORT virtual void execute();
-
/// Request for initialization of data model of the feature: adding all attributes.
FEATURESPLUGIN_EXPORT virtual void initAttributes();
/// Use plugin manager for features creation.
FeaturesPlugin_Boolean(const OperationType theOperationType);
-private:
- std::shared_ptr<GeomAPI_Shape> getShape(const std::string& theAttrName);
-
/// Load Naming data structure of the feature to the document
void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
const std::shared_ptr<GeomAPI_Shape> theBaseShape,
const ListOfShape& theTools,
const std::shared_ptr<GeomAPI_Shape> theResultShape,
- GeomAlgoAPI_MakeShape& theMakeShape,
- GeomAPI_DataMapOfShapeShape& theMapOfShapes,
- const bool theIsStoreAsGenerated = false);
+ const GeomMakeShapePtr& theMakeShape);
private:
OperationType myOperationType;
#include "FeaturesPlugin_BooleanCommon.h"
+#include "FeaturesPlugin_Tools.h"
+
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_AttributeString.h>
#include <GeomAPI_ShapeExplorer.h>
#include <GeomAlgoAPI_PaveFiller.h>
#include <GeomAlgoAPI_CompoundBuilder.h>
+#include <GeomAlgoAPI_Tools.h>
//==================================================================================================
}
ResultPtr aContext = anObjectAttr->context();
ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
- if (aResCompSolidPtr.get())
+ if (!isSimpleMode
+ && aResCompSolidPtr.get())
{
std::shared_ptr<GeomAPI_Shape> aContextShape = aResCompSolidPtr->shape();
GeomAPI_Shape::ShapeType aShapeType = aResCompSolidPtr->shape()->shapeType();
}
}
- if ((anObjects.empty() && aCompSolidsObjects.empty())
+ if ((anObjects.empty() && aCompSolidsObjects.empty() && aCompoundObjects.empty())
|| (!isSimpleMode && aTools.empty() && aPlanes.empty())) {
std::string aFeatureError = "Error: Not enough objects for boolean operation.";
setError(aFeatureError);
}
int aResultIndex = 0;
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
- GeomAPI_DataMapOfShapeShape aMapOfShapes;
+ std::string anError;
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
+ std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
+ ListOfShape aResultShapesList;
if (isSimpleMode)
{
*anObjectsIt,
GeomAlgoAPI_Boolean::BOOL_COMMON));
- if (!aCommonAlgo->isDone()) {
- std::string aFeatureError = "Error: An algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if (aCommonAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!aCommonAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCommonAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
aShape = aCommonAlgo->shape();
- aMakeShapeList.appendAlgo(aCommonAlgo);
- aMapOfShapes.merge(aCommonAlgo->mapOfSubShapes());
+ aMakeShapeList->appendAlgo(aCommonAlgo);
}
GeomAPI_ShapeIterator aShapeIt(aShape);
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody, anObjects.front(), anObjects, aShape, aMakeShapeList, aMapOfShapes);
+ GeomShapePtr aBaseShape = anObjects.front();
+ anObjects.pop_front();
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ aBaseShape,
+ anObjects,
+ aMakeShapeList,
+ aShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
+
+ aTools = anObjects;
+ FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+ aRBA.resultBody = aResultBody;
+ aRBA.baseShape = aBaseShape;
+ aRBA.makeShape = aMakeShapeList;
+ aResultBaseAlgoList.push_back(aRBA);
+ aResultShapesList.push_back(aShape);
}
} else {
for (ListOfShape::iterator anObjectsIt = anObjects.begin();
std::shared_ptr<GeomAPI_Shape> anObject = *anObjectsIt;
ListOfShape aListWithObject;
aListWithObject.push_back(anObject);
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
GeomShapePtr aResShape;
std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMkShCustom(
new GeomAlgoAPI_MakeShapeCustom);
aMkShCustom->addModified(aPlane, aTool);
- aMakeShapeList.appendAlgo(aMkShCustom);
+ aMakeShapeList->appendAlgo(aMkShCustom);
aToolsWithPlanes.push_back(aTool);
}
aResShape = aBoolAlgo->shape();
// Checking that the algorithm worked properly.
- if (!aBoolAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Boolean algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if (aResShape->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!aBoolAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
- aMakeShapeList.appendAlgo(aBoolAlgo);
+ aMakeShapeList->appendAlgo(aBoolAlgo);
GeomAPI_ShapeIterator aShapeIt(aResShape);
if (aShapeIt.more() || aResShape->shapeType() == GeomAPI_Shape::VERTEX) {
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody, anObject, aTools, aResShape,
- aMakeShapeList, *(aBoolAlgo->mapOfSubShapes()));
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ anObject,
+ aTools,
+ aMakeShapeList,
+ aResShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
+
+ FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+ aRBA.resultBody = aResultBody;
+ aRBA.baseShape = anObject;
+ aRBA.makeShape = aMakeShapeList;
+ aResultBaseAlgoList.push_back(aRBA);
+ aResultShapesList.push_back(aResShape);
}
}
GeomAlgoAPI_Boolean::BOOL_COMMON));
// Checking that the algorithm worked properly.
- if (!aCommonAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Boolean algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if (aCommonAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!aCommonAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCommonAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
aMakeShapeList->appendAlgo(aCommonAlgo);
- GeomAPI_DataMapOfShapeShape aMapOfShapes;
- aMapOfShapes.merge(aCommonAlgo->mapOfSubShapes());
GeomShapePtr aResultShape = aCommonAlgo->shape();
// Add result to not used solids from compsolid.
}
aMakeShapeList->appendAlgo(aFillerAlgo);
- aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
aResultShape = aFillerAlgo->shape();
}
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody,
- aCompSolid,
- aTools,
- aResultShape,
- *aMakeShapeList,
- aMapOfShapes);
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ aCompSolid,
+ aTools,
+ aMakeShapeList,
+ aResultShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
+
+ FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+ aRBA.resultBody = aResultBody;
+ aRBA.baseShape = aCompSolid;
+ aRBA.makeShape = aMakeShapeList;
+ aResultBaseAlgoList.push_back(aRBA);
+ aResultShapesList.push_back(aResultShape);
}
}
GeomAlgoAPI_Boolean::BOOL_COMMON));
// Checking that the algorithm worked properly.
- if (!aCommonAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Boolean algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if (aCommonAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!aCommonAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCommonAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
aMakeShapeList->appendAlgo(aCommonAlgo);
- GeomAPI_DataMapOfShapeShape aMapOfShapes;
- aMapOfShapes.merge(aCommonAlgo->mapOfSubShapes());
GeomShapePtr aResultShape = aCommonAlgo->shape();
// Add result to not used shape from compound.
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody,
- aCompound,
- aTools,
- aResultShape,
- *aMakeShapeList,
- aMapOfShapes);
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ aCompound,
+ aTools,
+ aMakeShapeList,
+ aResultShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
+
+ FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
+ aRBA.resultBody = aResultBody;
+ aRBA.baseShape = aCompound;
+ aRBA.makeShape = aMakeShapeList;
+ aResultBaseAlgoList.push_back(aRBA);
+ aResultShapesList.push_back(aResultShape);
}
}
}
+ // Store deleted shapes after all results has been proceeded. This is to avoid issue when in one
+ // result shape has been deleted, but in another it was modified or stayed.
+ GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
+ FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList, aTools, aResultShapesCompound);
+
// remove the rest results if there were produced in the previous pass
removeResults(aResultIndex);
}
-
-//==================================================================================================
-void FeaturesPlugin_BooleanCommon::loadNamingDS(ResultBodyPtr theResultBody,
- const GeomShapePtr theBaseShape,
- const ListOfShape& theTools,
- const GeomShapePtr theResultShape,
- GeomAlgoAPI_MakeShape& theMakeShape,
- GeomAPI_DataMapOfShapeShape& theMapOfShapes)
-{
- //load result
- if (theBaseShape->isEqual(theResultShape)) {
- theResultBody->store(theResultShape, false);
- } else {
- const int aModifyVTag = 1;
- const int aModifyETag = 2;
- const int aModifyFTag = 3;
- const int aDeletedTag = 4;
- /// sub solids will be placed at labels 5, 6, etc. if result is compound of solids
- const int aSubsolidsTag = 5;
-
- theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
-
- const std::string aModVName = "Modified_Vertex";
- const std::string aModEName = "Modified_Edge";
- const std::string aModFName = "Modified_Face";
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX,
- aModifyVTag, aModVName, theMapOfShapes, false,
- false, true);
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::EDGE,
- aModifyETag, aModEName, theMapOfShapes, false,
- false, true);
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
- aModifyFTag, aModFName, theMapOfShapes, false,
- false, true);
-
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::VERTEX, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::EDGE, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::FACE, aDeletedTag);
-
- for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
- {
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX,
- aModifyVTag, aModVName, theMapOfShapes, false,
- false, true);
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE,
- aModifyETag, aModEName, theMapOfShapes, false,
- false, true);
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE,
- aModifyFTag, aModFName, theMapOfShapes, false,
- false, true);
-
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
- }
- }
-}
/// Use plugin manager for features creation.
FeaturesPlugin_BooleanCommon();
-
-private:
-
- /// Load Naming data structure of the feature to the document
- void loadNamingDS(ResultBodyPtr theResultBody,
- const GeomShapePtr theBaseShape,
- const ListOfShape& theTools,
- const GeomShapePtr theResultShape,
- GeomAlgoAPI_MakeShape& theMakeShape,
- GeomAPI_DataMapOfShapeShape& theMapOfShapes);
-
};
#endif
#include "FeaturesPlugin_BooleanCut.h"
+#include "FeaturesPlugin_Tools.h"
+
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
#include <GeomAlgoAPI_MakeShapeList.h>
#include <GeomAlgoAPI_PaveFiller.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
+
#include <GeomAPI_ShapeExplorer.h>
#include <GeomAPI_ShapeIterator.h>
-//==================================================================================================
-const int ModifyVTag = 1;
-const int ModifyETag = 2;
-const int ModifyFTag = 3;
-const int DeletedTag = 4;
-/// sub solids will be placed at labels 5, 6, etc. if result is compound of solids
-const int SubsolidsTag = 5;
-
-
//==================================================================================================
FeaturesPlugin_BooleanCut::FeaturesPlugin_BooleanCut()
: FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_CUT)
return;
}
- std::vector<ResultBaseAlgo> aResultBaseAlgoList;
+ std::vector<FeaturesPlugin_Tools::ResultBaseAlgo> aResultBaseAlgoList;
ListOfShape aResultShapesList;
+ std::string anError;
// For solids cut each object with all tools.
for(ListOfShape::iterator anObjectsIt = anObjects.begin();
GeomShapePtr aResShape = aCutAlgo->shape();
// Checking that the algorithm worked properly.
- if (!aCutAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Boolean algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if(aResShape->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!aCutAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCutAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody, anObject, aTools, aResShape,
- *aMakeShapeList, *(aCutAlgo->mapOfSubShapes()),
- false);
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ anObject,
+ aTools,
+ aMakeShapeList,
+ aResShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
- ResultBaseAlgo aRBA;
+ FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
aRBA.resultBody = aResultBody;
aRBA.baseShape = anObject;
aRBA.makeShape = aMakeShapeList;
GeomAlgoAPI_Boolean::BOOL_CUT));
// Checking that the algorithm worked properly.
- if (!aCutAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Boolean algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if (aCutAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!aCutAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCutAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
aMakeShapeList->appendAlgo(aCutAlgo);
- GeomAPI_DataMapOfShapeShape aMapOfShapes;
- aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
GeomShapePtr aResultShape = aCutAlgo->shape();
// Add result to not used solids from compsolid.
}
aMakeShapeList->appendAlgo(aFillerAlgo);
- aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
aResultShape = aFillerAlgo->shape();
}
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody,
- aCompSolid,
- aTools,
- aResultShape,
- *aMakeShapeList,
- aMapOfShapes,
- false);
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ aCompSolid,
+ aTools,
+ aMakeShapeList,
+ aResultShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
- ResultBaseAlgo aRBA;
+ FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
aRBA.resultBody = aResultBody;
aRBA.baseShape = aCompSolid;
aRBA.makeShape = aMakeShapeList;
GeomAlgoAPI_Boolean::BOOL_CUT));
// Checking that the algorithm worked properly.
- if (!aCutAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Boolean algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if (aCutAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!aCutAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCutAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
aMakeShapeList->appendAlgo(aCutAlgo);
- GeomAPI_DataMapOfShapeShape aMapOfShapes;
- aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
GeomShapePtr aResultShape = aCutAlgo->shape();
// Add result to not used shape from compound.
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody,
- aCompound,
- aTools,
- aResultShape,
- *aMakeShapeList,
- aMapOfShapes,
- false);
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ aCompound,
+ aTools,
+ aMakeShapeList,
+ aResultShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
- ResultBaseAlgo aRBA;
+ FeaturesPlugin_Tools::ResultBaseAlgo aRBA;
aRBA.resultBody = aResultBody;
aRBA.baseShape = aCompound;
aRBA.makeShape = aMakeShapeList;
// Store deleted shapes after all results has been proceeded. This is to avoid issue when in one
// result shape has been deleted, but in another it was modified or stayed.
GeomShapePtr aResultShapesCompound = GeomAlgoAPI_CompoundBuilder::compound(aResultShapesList);
- storeDeletedShapes(aResultBaseAlgoList, aTools, aResultShapesCompound);
+ FeaturesPlugin_Tools::loadDeletedShapes(aResultBaseAlgoList, aTools, aResultShapesCompound);
// remove the rest results if there were produced in the previous pass
removeResults(aResultIndex);
}
-
-//==================================================================================================
-void FeaturesPlugin_BooleanCut::loadNamingDS(ResultBodyPtr theResultBody,
- const GeomShapePtr theBaseShape,
- const ListOfShape& theTools,
- const GeomShapePtr theResultShape,
- GeomAlgoAPI_MakeShape& theMakeShape,
- GeomAPI_DataMapOfShapeShape& theMapOfShapes,
- const bool theIsStoreAsGenerated)
-{
- //load result
- if(theBaseShape->isEqual(theResultShape)) {
- theResultBody->store(theResultShape, false);
- } else {
- theResultBody->storeModified(theBaseShape, theResultShape, SubsolidsTag);
-
- const std::string aModVName = "Modified_Vertex";
- const std::string aModEName = "Modified_Edge";
- const std::string aModFName = "Modified_Face";
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX,
- ModifyVTag, aModVName, theMapOfShapes, false,
- theIsStoreAsGenerated, true);
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::EDGE,
- ModifyETag, aModEName, theMapOfShapes, false,
- theIsStoreAsGenerated, true);
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
- ModifyFTag, aModFName, theMapOfShapes, false,
- theIsStoreAsGenerated, true);
-
- for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
- {
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX,
- ModifyVTag, aModVName, theMapOfShapes, false,
- theIsStoreAsGenerated, true);
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE,
- ModifyETag, aModEName, theMapOfShapes, false,
- theIsStoreAsGenerated, true);
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE,
- ModifyFTag, aModFName, theMapOfShapes, false,
- theIsStoreAsGenerated, true);
- }
- }
-}
-
-//==================================================================================================
-void FeaturesPlugin_BooleanCut::storeDeletedShapes(
- std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
- const ListOfShape& theTools,
- const GeomShapePtr theResultShapesCompound)
-{
- for (std::vector<ResultBaseAlgo>::iterator anIt = theResultBaseAlgoList.begin();
- anIt != theResultBaseAlgoList.end();
- ++anIt)
- {
- ResultBaseAlgo& aRCA = *anIt;
- aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
- aRCA.baseShape,
- GeomAPI_Shape::VERTEX,
- DeletedTag,
- theResultShapesCompound);
- aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
- aRCA.baseShape,
- GeomAPI_Shape::EDGE,
- DeletedTag,
- theResultShapesCompound);
- aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
- aRCA.baseShape,
- GeomAPI_Shape::FACE,
- DeletedTag,
- theResultShapesCompound);
-
- for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
- {
- aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
- *anIter,
- GeomAPI_Shape::VERTEX,
- DeletedTag,
- theResultShapesCompound);
- aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
- *anIter,
- GeomAPI_Shape::EDGE,
- DeletedTag,
- theResultShapesCompound);
- aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
- *anIter,
- GeomAPI_Shape::FACE,
- DeletedTag,
- theResultShapesCompound);
- }
- }
-}
/// Use plugin manager for features creation.
FeaturesPlugin_BooleanCut();
-private:
-
- struct ResultBaseAlgo {
- ResultBodyPtr resultBody;
- GeomShapePtr baseShape;
- std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape;
- };
-
-private:
-
- /// Load Naming data structure of the feature to the document
- void loadNamingDS(ResultBodyPtr theResultBody,
- const GeomShapePtr theBaseShape,
- const ListOfShape& theTools,
- const GeomShapePtr theResultShape,
- GeomAlgoAPI_MakeShape& theMakeShape,
- GeomAPI_DataMapOfShapeShape& theMapOfShapes,
- const bool theIsStoreAsGenerated = false);
-
- /// Stores deleted shapes.
- void storeDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
- const ListOfShape& theTools,
- const GeomShapePtr theResultShapesCompound);
-
};
#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesPlugin_BooleanFill.h"
+
+#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_Tools.h>
+
+#include <GeomAlgoAPI_Boolean.h>
+#include <GeomAlgoAPI_MakeShapeCustom.h>
+#include <GeomAlgoAPI_MakeShapeList.h>
+#include <GeomAlgoAPI_Partition.h>
+#include <GeomAlgoAPI_PaveFiller.h>
+#include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
+
+#include <GeomAPI_Face.h>
+#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
+
+#include <algorithm>
+#include <map>
+
+//=================================================================================================
+FeaturesPlugin_BooleanFill::FeaturesPlugin_BooleanFill()
+ : FeaturesPlugin_Boolean(FeaturesPlugin_Boolean::BOOL_FILL)
+{
+}
+
+//=================================================================================================
+void FeaturesPlugin_BooleanFill::execute()
+{
+ std::string anError;
+ ListOfShape anObjects, aTools, anEdgesAndFaces, aPlanes;
+ std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
+
+ // Getting objects.
+ AttributeSelectionListPtr anObjectsSelList =
+ selectionList(FeaturesPlugin_Boolean::OBJECT_LIST_ID());
+ for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
+ AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex);
+ std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
+ if(!anObject.get()) {
+ return;
+ }
+ ResultPtr aContext = anObjectAttr->context();
+ ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
+ if(aResCompSolidPtr.get()
+ && aResCompSolidPtr->shape()->shapeType() == GeomAPI_Shape::COMPSOLID) {
+ std::shared_ptr<GeomAPI_Shape> aContextShape = aResCompSolidPtr->shape();
+ std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
+ anIt = aCompSolidsObjects.begin();
+ for(; anIt != aCompSolidsObjects.end(); anIt++) {
+ if(anIt->first->isEqual(aContextShape)) {
+ aCompSolidsObjects[anIt->first].push_back(anObject);
+ break;
+ }
+ }
+ if(anIt == aCompSolidsObjects.end()) {
+ aCompSolidsObjects[aContextShape].push_back(anObject);
+ }
+ } else {
+ anObjects.push_back(anObject);
+ }
+ }
+
+ // Getting tools.
+ AttributeSelectionListPtr aToolsSelList = selectionList(FeaturesPlugin_Boolean::TOOL_LIST_ID());
+ for(int aToolsIndex = 0; aToolsIndex < aToolsSelList->size(); aToolsIndex++) {
+ AttributeSelectionPtr aToolAttr = aToolsSelList->value(aToolsIndex);
+ GeomShapePtr aTool = aToolAttr->value();
+ if(!aTool.get()) {
+ // It could be a construction plane.
+ ResultPtr aContext = aToolAttr->context();
+ aPlanes.push_back(aToolAttr->context()->shape());
+ }
+ else {
+ aTools.push_back(aTool);
+ }
+ }
+
+ int aResultIndex = 0;
+
+ if ((anObjects.empty() && aCompSolidsObjects.empty())
+ || (aTools.empty() && aPlanes.empty())) {
+ std::string aFeatureError = "Error: Not enough objects for boolean operation.";
+ setError(aFeatureError);
+ return;
+ }
+
+ // For solids cut each object with all tools.
+ for(ListOfShape::iterator
+ anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end(); anObjectsIt++) {
+ std::shared_ptr<GeomAPI_Shape> anObject = *anObjectsIt;
+ ListOfShape aListWithObject;
+ aListWithObject.push_back(anObject);
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
+ std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
+ GeomShapePtr aResShape;
+
+ std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints =
+ GeomAlgoAPI_ShapeTools::getBoundingBox(aListWithObject, 1.0);
+
+ // Resize planes.
+ ListOfShape aToolsWithPlanes = aTools;
+ for(ListOfShape::const_iterator anIt = aPlanes.cbegin();
+ anIt != aPlanes.cend();
+ ++anIt)
+ {
+ GeomShapePtr aPlane = *anIt;
+ GeomShapePtr aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints);
+ std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMkShCustom(
+ new GeomAlgoAPI_MakeShapeCustom);
+ aMkShCustom->addModified(aPlane, aTool);
+ aMakeShapeList->appendAlgo(aMkShCustom);
+ aToolsWithPlanes.push_back(aTool);
+ }
+
+ aBoolAlgo.reset(new GeomAlgoAPI_Partition(aListWithObject, aToolsWithPlanes));
+ aResShape = aBoolAlgo->shape();
+ if (aResShape.get() && aResShape->shapeType() == GeomAPI_Shape::COMPOUND) {
+ int aSubResultsNb = 0;
+ GeomAPI_ShapeIterator anIt(aResShape);
+ for(; anIt.more(); anIt.next()) {
+ ++aSubResultsNb;
+ }
+ if(aSubResultsNb == 1) {
+ anIt.init(aResShape);
+ if(anIt.more()) {
+ aResShape = anIt.current();
+ }
+ }
+ }
+
+ // Checking that the algorithm worked properly.
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) {
+ setError(anError);
+ return;
+ }
+
+ aMakeShapeList->appendAlgo(aBoolAlgo);
+
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody =
+ document()->createBody(data(), aResultIndex);
+
+ ListOfShape aUsedTools = aTools;
+ aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
+
+ loadNamingDS(aResultBody, anObject, aUsedTools, aResShape, aMakeShapeList);
+ setResult(aResultBody, aResultIndex);
+ aResultIndex++;
+ }
+
+ // Compsolids handling
+ for(std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
+ anIt = aCompSolidsObjects.begin();
+ anIt != aCompSolidsObjects.end(); anIt++) {
+ std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
+ ListOfShape& aUsedInOperationSolids = anIt->second;
+
+ // Collecting solids from compsolids which will not be modified in boolean operation.
+ ListOfShape aNotUsedSolids;
+ for(GeomAPI_ShapeExplorer
+ anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
+ std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
+ ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
+ for(; anIt != aUsedInOperationSolids.end(); anIt++) {
+ if(aSolidInCompSolid->isEqual(*anIt)) {
+ break;
+ }
+ }
+ if(anIt == aUsedInOperationSolids.end()) {
+ aNotUsedSolids.push_back(aSolidInCompSolid);
+ }
+ }
+
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
+ std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
+
+ std::list<std::shared_ptr<GeomAPI_Pnt> > aBoundingPoints =
+ GeomAlgoAPI_ShapeTools::getBoundingBox(aUsedInOperationSolids, 1.0);
+
+ // Resize planes.
+ ListOfShape aToolsWithPlanes = aTools;
+ for(ListOfShape::const_iterator anIt = aPlanes.cbegin();
+ anIt != aPlanes.cend();
+ ++anIt)
+ {
+ GeomShapePtr aPlane = *anIt;
+ GeomShapePtr aTool = GeomAlgoAPI_ShapeTools::fitPlaneToBox(aPlane, aBoundingPoints);
+ std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aMkShCustom(
+ new GeomAlgoAPI_MakeShapeCustom);
+ aMkShCustom->addModified(aPlane, aTool);
+ aMakeShapeList->appendAlgo(aMkShCustom);
+ aToolsWithPlanes.push_back(aTool);
+ }
+
+ aBoolAlgo.reset(new GeomAlgoAPI_Partition(aUsedInOperationSolids, aToolsWithPlanes));
+
+ // Checking that the algorithm worked properly.
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) {
+ setError(anError);
+ return;
+ }
+
+ aMakeShapeList->appendAlgo(aBoolAlgo);
+ GeomShapePtr aResultShape = aBoolAlgo->shape();
+
+ // Add result to not used solids from compsolid.
+ if(!aNotUsedSolids.empty()) {
+ ListOfShape aShapesToAdd = aNotUsedSolids;
+ aShapesToAdd.push_back(aBoolAlgo->shape());
+ std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
+ new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
+ if(!aFillerAlgo->isDone()) {
+ std::string aFeatureError = "Error: PaveFiller algorithm failed.";
+ setError(aFeatureError);
+ return;
+ }
+
+ aMakeShapeList->appendAlgo(aFillerAlgo);
+ aResultShape = aFillerAlgo->shape();
+ }
+
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody =
+ document()->createBody(data(), aResultIndex);
+
+ ListOfShape aUsedTools = aTools;
+ aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
+
+ loadNamingDS(aResultBody,
+ aCompSolid,
+ aUsedTools,
+ aResultShape,
+ aMakeShapeList);
+ setResult(aResultBody, aResultIndex);
+ aResultIndex++;
+ }
+
+ // remove the rest results if there were produced in the previous pass
+ removeResults(aResultIndex);
+}
return MY_KIND;
}
+ /// Creates a new part document if needed.
+ FEATURESPLUGIN_EXPORT virtual void execute();
+
public:
/// Use plugin manager for features creation.
- FeaturesPlugin_BooleanFill(): FeaturesPlugin_Boolean(BOOL_FILL) {};
+ FeaturesPlugin_BooleanFill();
};
#include "FeaturesPlugin_BooleanFuse.h"
+#include "FeaturesPlugin_Tools.h"
+
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeBoolean.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <GeomAlgoAPI_MakeShapeList.h>
#include <GeomAlgoAPI_PaveFiller.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAlgoAPI_UnifySameDomain.h>
#include <GeomAPI_ShapeExplorer.h>
//==================================================================================================
void FeaturesPlugin_BooleanFuse::execute()
{
+ std::string anError;
ListOfShape anObjects, aTools, anEdgesAndFaces;
- std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
+ std::map<GeomShapePtr, ListOfShape> aCompSolidsObjects;
bool isSimpleCreation = false;
AttributeStringPtr aCreationMethodAttr = string(CREATION_METHOD());
if (aCreationMethodAttr.get()
- && aCreationMethodAttr->value() == CREATION_METHOD_SIMPLE()) {
+ && aCreationMethodAttr->value() == CREATION_METHOD_SIMPLE())
+ {
isSimpleCreation = true;
}
selectionList(FeaturesPlugin_Boolean::OBJECT_LIST_ID());
for (int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
AttributeSelectionPtr anObjectAttr = anObjectsSelList->value(anObjectsIndex);
- std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
+ GeomShapePtr anObject = anObjectAttr->value();
if (!anObject.get()) {
return;
}
ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
if (!isSimpleCreation
&& aResCompSolidPtr.get()
- && aResCompSolidPtr->shape()->shapeType() == GeomAPI_Shape::COMPSOLID) {
- std::shared_ptr<GeomAPI_Shape> aContextShape = aResCompSolidPtr->shape();
- std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
+ && aResCompSolidPtr->shape()->shapeType() == GeomAPI_Shape::COMPSOLID)
+ {
+ GeomShapePtr aContextShape = aResCompSolidPtr->shape();
+ std::map<GeomShapePtr, ListOfShape>::iterator
anIt = aCompSolidsObjects.begin();
for (; anIt != aCompSolidsObjects.end(); anIt++) {
if (anIt->first->isEqual(aContextShape)) {
// Collecting solids from compsolids which will not be modified
// in boolean operation and will be added to result.
ListOfShape aShapesToAdd;
- for (std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape>::iterator
- anIt = aCompSolidsObjects.begin();
- anIt != aCompSolidsObjects.end(); anIt++) {
- std::shared_ptr<GeomAPI_Shape> aCompSolid = anIt->first;
+ for (std::map<GeomShapePtr, ListOfShape>::iterator anIt = aCompSolidsObjects.begin();
+ anIt != aCompSolidsObjects.end();
+ ++anIt)
+ {
+ GeomShapePtr aCompSolid = anIt->first;
ListOfShape& aUsedInOperationSolids = anIt->second;
aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedInOperationSolids.begin(),
aUsedInOperationSolids.end());
// Collect solids from compsolid which will not be modified in boolean operation.
for (GeomAPI_ShapeExplorer
anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
- std::shared_ptr<GeomAPI_Shape> aSolidInCompSolid = anExp.current();
+ GeomShapePtr aSolidInCompSolid = anExp.current();
ListOfShape::iterator anIt = aUsedInOperationSolids.begin();
for (; anIt != aUsedInOperationSolids.end(); anIt++) {
if (aSolidInCompSolid->isEqual(*anIt)) {
anOriginalShapes.insert(anOriginalShapes.end(), aShapesToAdd.begin(), aShapesToAdd.end());
// Cut edges and faces(if we have any) with solids.
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
- GeomAPI_DataMapOfShapeShape aMapOfShapes;
- std::shared_ptr<GeomAPI_Shape> aCuttedEdgesAndFaces;
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
+ GeomShapePtr aCuttedEdgesAndFaces;
if (!anEdgesAndFaces.empty()) {
std::shared_ptr<GeomAlgoAPI_Boolean> aCutAlgo(new GeomAlgoAPI_Boolean(anEdgesAndFaces,
anOriginalShapes, GeomAlgoAPI_Boolean::BOOL_CUT));
if (aCutAlgo->isDone()) {
aCuttedEdgesAndFaces = aCutAlgo->shape();
- aMakeShapeList.appendAlgo(aCutAlgo);
- aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
+ aMakeShapeList->appendAlgo(aCutAlgo);
}
}
anOriginalShapes.insert(anOriginalShapes.end(), anEdgesAndFaces.begin(),
if (GeomAlgoAPI_ShapeTools::volume(aCutAlgo->shape()) > 1.e-27) {
aSolidsToFuse.push_back(aCutAlgo->shape());
- aMakeShapeList.appendAlgo(aCutAlgo);
- aMapOfShapes.merge(aCutAlgo->mapOfSubShapes());
+ aMakeShapeList->appendAlgo(aCutAlgo);
}
}
}
}
// Fuse all objects and all tools.
- std::shared_ptr<GeomAPI_Shape> aShape;
+ GeomShapePtr aShape;
if (anObjects.size() == 1 && aTools.empty()) {
aShape = anObjects.front();
} else if (anObjects.empty() && aTools.size() == 1) {
GeomAlgoAPI_Boolean::BOOL_FUSE));
// Checking that the algorithm worked properly.
- if (!aFuseAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Boolean algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if (aFuseAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!aFuseAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFuseAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
aShape = aFuseAlgo->shape();
- aMakeShapeList.appendAlgo(aFuseAlgo);
- aMapOfShapes.merge(aFuseAlgo->mapOfSubShapes());
+ aMakeShapeList->appendAlgo(aFuseAlgo);
}
// Combine result with not used solids from compsolid and edges and faces (if we have any).
}
std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
- if (!aFillerAlgo->isDone()) {
- std::string aFeatureError = "Error: PaveFiller algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if (aFillerAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!aFillerAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFillerAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
aShape = aFillerAlgo->shape();
- aMakeShapeList.appendAlgo(aFillerAlgo);
- aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
+ aMakeShapeList->appendAlgo(aFillerAlgo);
}
bool isRemoveEdges = false;
std::shared_ptr<GeomAlgoAPI_UnifySameDomain> aUnifyAlgo(
new GeomAlgoAPI_UnifySameDomain(aShape));
- if (!aUnifyAlgo->isDone()) {
- std::string aFeatureError = "Error: PaveFiller algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if (aUnifyAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!aUnifyAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aUnifyAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
aShape = aUnifyAlgo->shape();
- aMakeShapeList.appendAlgo(aUnifyAlgo);
- aMapOfShapes.merge(aUnifyAlgo->mapOfSubShapes());
+ aMakeShapeList->appendAlgo(aUnifyAlgo);
}
int aResultIndex = 0;
- std::shared_ptr<GeomAPI_Shape> aBackShape = anOriginalShapes.back();
+ GeomShapePtr aBackShape = anOriginalShapes.back();
anOriginalShapes.pop_back();
- std::shared_ptr<ModelAPI_ResultBody> aResultBody =
- document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody, aBackShape, anOriginalShapes,
- aShape, aMakeShapeList, aMapOfShapes);
+ ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
+
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ aBackShape,
+ anOriginalShapes,
+ aMakeShapeList,
+ aShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
+ FeaturesPlugin_Tools::loadDeletedShapes(aResultBody,
+ aBackShape,
+ anOriginalShapes,
+ aMakeShapeList,
+ aShape);
+
// remove the rest results if there were produced in the previous pass
removeResults(aResultIndex);
}
-
-//==================================================================================================
-void FeaturesPlugin_BooleanFuse::loadNamingDS(ResultBodyPtr theResultBody,
- const GeomShapePtr theBaseShape,
- const ListOfShape& theTools,
- const GeomShapePtr theResultShape,
- GeomAlgoAPI_MakeShape& theMakeShape,
- GeomAPI_DataMapOfShapeShape& theMapOfShapes)
-{
- //load result
- if (theBaseShape->isEqual(theResultShape)) {
- theResultBody->store(theResultShape, false);
- } else {
- const int aModifyVTag = 1;
- const int aModifyETag = 2;
- const int aModifyFTag = 3;
- const int aDeletedTag = 4;
- /// sub solids will be placed at labels 5, 6, etc. if result is compound of solids
- const int aSubsolidsTag = 5;
-
- theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
-
- const std::string aModVName = "Modified_Vertex";
- const std::string aModEName = "Modified_Edge";
- const std::string aModFName = "Modified_Face";
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX,
- aModifyVTag, aModVName, theMapOfShapes, false,
- false, true);
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::EDGE,
- aModifyETag, aModEName, theMapOfShapes, false,
- false, true);
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
- aModifyFTag, aModFName, theMapOfShapes, false,
- false, true);
-
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::VERTEX, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::EDGE, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::FACE, aDeletedTag);
-
- for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
- {
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX,
- aModifyVTag, aModVName, theMapOfShapes, false,
- false, true);
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE,
- aModifyETag, aModEName, theMapOfShapes, false,
- false, true);
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE,
- aModifyFTag, aModFName, theMapOfShapes, false,
- false, true);
-
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
- }
- }
-}
/// Use plugin manager for features creation.
FeaturesPlugin_BooleanFuse();
-
-private:
- /// Load Naming data structure of the feature to the document
- void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const ListOfShape& theTools,
- const std::shared_ptr<GeomAPI_Shape> theResultShape,
- GeomAlgoAPI_MakeShape& theMakeShape,
- GeomAPI_DataMapOfShapeShape& theMapOfShapes);
};
#endif
#include "FeaturesPlugin_BooleanSmash.h"
+#include "FeaturesPlugin_Tools.h"
+
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Tools.h>
#include <GeomAlgoAPI_MakeShapeList.h>
#include <GeomAlgoAPI_PaveFiller.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
+
#include <GeomAPI_ShapeExplorer.h>
#include <GeomAPI_ShapeIterator.h>
//==================================================================================================
void FeaturesPlugin_BooleanSmash::execute()
{
+ std::string anError;
ListOfShape anObjects, aTools;
std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
}
}
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
- GeomAPI_DataMapOfShapeShape aMapOfShapes;
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
if (!aShapesToAdd.empty()) {
// Cut objects with not used solids.
std::shared_ptr<GeomAlgoAPI_Boolean> anObjectsCutAlgo(
if (GeomAlgoAPI_ShapeTools::volume(anObjectsCutAlgo->shape()) > 1.e-27) {
aShapesToSmash.clear();
aShapesToSmash.push_back(anObjectsCutAlgo->shape());
- aMakeShapeList.appendAlgo(anObjectsCutAlgo);
- aMapOfShapes.merge(anObjectsCutAlgo->mapOfSubShapes());
+ aMakeShapeList->appendAlgo(anObjectsCutAlgo);
}
// Cut tools with not used solids.
if (GeomAlgoAPI_ShapeTools::volume(aToolsCutAlgo->shape()) > 1.e-27) {
aTools.clear();
aTools.push_back(aToolsCutAlgo->shape());
- aMakeShapeList.appendAlgo(aToolsCutAlgo);
- aMapOfShapes.merge(aToolsCutAlgo->mapOfSubShapes());
+ aMakeShapeList->appendAlgo(aToolsCutAlgo);
}
}
GeomAlgoAPI_Boolean::BOOL_CUT));
// Checking that the algorithm worked properly.
- if (!aBoolAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Boolean algorithm failed.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aBoolAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
- if (aBoolAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!aBoolAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
- return;
- }
- aMakeShapeList.appendAlgo(aBoolAlgo);
- aMapOfShapes.merge(aBoolAlgo->mapOfSubShapes());
+
+ aMakeShapeList->appendAlgo(aBoolAlgo);
// Put all (cut result, tools and not used solids) to PaveFiller.
GeomShapePtr aShape = aBoolAlgo->shape();
else {
std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
- if (!aFillerAlgo->isDone()) {
- std::string aFeatureError = "Error: PaveFiller algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if (aFillerAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!aFillerAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFillerAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
aShape = aFillerAlgo->shape();
- aMakeShapeList.appendAlgo(aFillerAlgo);
- aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
+ aMakeShapeList->appendAlgo(aFillerAlgo);
}
std::shared_ptr<GeomAPI_Shape> aFrontShape = anOriginalShapes.front();
anOriginalShapes.pop_front();
std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody,
- aFrontShape,
- anOriginalShapes,
- aShape,
- aMakeShapeList,
- aMapOfShapes);
+
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ aFrontShape,
+ anOriginalShapes,
+ aMakeShapeList,
+ aShape);
setResult(aResultBody, aResultIndex);
aResultIndex++;
+ FeaturesPlugin_Tools::loadDeletedShapes(aResultBody,
+ aFrontShape,
+ anOriginalShapes,
+ aMakeShapeList,
+ aShape);
+
// remove the rest results if there were produced in the previous pass
removeResults(aResultIndex);
}
-
-//==================================================================================================
-void FeaturesPlugin_BooleanSmash::loadNamingDS(ResultBodyPtr theResultBody,
- const GeomShapePtr theBaseShape,
- const ListOfShape& theTools,
- const GeomShapePtr theResultShape,
- GeomAlgoAPI_MakeShape& theMakeShape,
- GeomAPI_DataMapOfShapeShape& theMapOfShapes)
-{
- //load result
- if (theBaseShape->isEqual(theResultShape)) {
- theResultBody->store(theResultShape, false);
- } else if (theResultShape->isEqual(theTools.front())) {
- theResultBody->store(theResultShape, false);
- } else {
- const int aModifyVTag = 1;
- const int aModifyETag = 2;
- const int aModifyFTag = 3;
- const int aDeletedTag = 4;
- /// sub solids will be placed at labels 5, 6, etc. if result is compound of solids
- const int aSubsolidsTag = 5;
-
- theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
-
- const std::string aModVName = "Modified_Vertex";
- const std::string aModEName = "Modified_Edge";
- const std::string aModFName = "Modified_Face";
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX,
- aModifyVTag, aModVName, theMapOfShapes, false,
- true, true);
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::EDGE,
- aModifyETag, aModEName, theMapOfShapes, false,
- true, true);
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, theBaseShape, GeomAPI_Shape::FACE,
- aModifyFTag, aModFName, theMapOfShapes, false,
- true, true);
-
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::VERTEX, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::EDGE, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, theBaseShape,
- GeomAPI_Shape::FACE, aDeletedTag);
-
- for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
- {
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX,
- aModifyVTag, aModVName, theMapOfShapes, false,
- true, true);
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE,
- aModifyETag, aModEName, theMapOfShapes, false,
- true, true);
-
- theResultBody->loadAndOrientModifiedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE,
- aModifyFTag, aModFName, theMapOfShapes, false,
- true, true);
-
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::VERTEX, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::EDGE, aDeletedTag);
- theResultBody->loadDeletedShapes(&theMakeShape, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
- }
- }
-}
/// Use plugin manager for features creation.
FeaturesPlugin_BooleanSmash();
-
-private:
-
- /// Load Naming data structure of the feature to the document
- void loadNamingDS(ResultBodyPtr theResultBody,
- const GeomShapePtr theBaseShape,
- const ListOfShape& theTools,
- const GeomShapePtr theResultShape,
- GeomAlgoAPI_MakeShape& theMakeShape,
- GeomAPI_DataMapOfShapeShape& theMapOfShapes);
-
};
#endif
#include <GeomAlgoAPI_PaveFiller.h>
#include <GeomAlgoAPI_ShapeTools.h>
-#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
#include <map>
for(; aBoolObjIt != aBooleanObjects.cend() && aBoolMSIt != aBooleanMakeShapes.cend();
++aBoolObjIt, ++aBoolMSIt) {
- int aTag = 1;
-
ResultBodyPtr aResultBody = myFeature->document()->createBody(myFeature->data(), aResultIndex);
if((*aBoolObjIt)->isEqual((*aBoolMSIt)->shape())) {
}
else
{
- aResultBody->storeModified(*aBoolObjIt, (*aBoolMSIt)->shape(), aTag);
-
- aTag += 5000;
+ aResultBody->storeModified(*aBoolObjIt, (*aBoolMSIt)->shape());
// Store generation history.
ListOfShape::const_iterator aGenBaseIt = aGenBaseShapes.cbegin();
ListOfMakeShape::const_iterator aGenMSIt = aGenMakeShapes.cbegin();
for(; aGenBaseIt != aGenBaseShapes.cend() && aGenMSIt != aGenMakeShapes.cend();
++aGenBaseIt, ++aGenMSIt) {
- storeGenerationHistory(aResultBody, *aGenBaseIt, *aGenMSIt, aTag);
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMSList(new GeomAlgoAPI_MakeShapeList());
+ aMSList->appendAlgo(*aGenMSIt);
+ aMSList->appendAlgo(*aBoolMSIt);
+ storeGenerationHistory(aResultBody, *aGenBaseIt, aMSList);
}
- int aModTag = aTag;
- storeModificationHistory(aResultBody, *aBoolObjIt, aTools, *aBoolMSIt, aModTag);
+ storeModificationHistory(aResultBody, *aBoolObjIt, aTools, *aBoolMSIt);
ResultBaseAlgo aRBA;
aRBA.resultBody = aResultBody;
aRBA.baseShape = *aBoolObjIt;
aRBA.makeShape = *aBoolMSIt;
- aRBA.delTag = aModTag;
aResultBaseAlgoList.push_back(aRBA);
aResultShapesList.push_back((*aBoolMSIt)->shape());
}
// Collecting solids from compsolids which will not be modified in boolean operation.
ListOfShape aShapesToAdd;
- for(GeomAPI_ShapeExplorer
- anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
- GeomShapePtr aSolidInCompSolid = anExp.current();
+ for (GeomAPI_ShapeIterator aCompSolidIt(aCompSolid);
+ aCompSolidIt.more();
+ aCompSolidIt.next())
+ {
+ GeomShapePtr aSolidInCompSolid = aCompSolidIt.current();
ListOfShape::const_iterator aUsedShapesIt = aUsedShapes.cbegin();
for(; aUsedShapesIt != aUsedShapes.cend(); ++aUsedShapesIt) {
if(aSolidInCompSolid->isEqual(*aUsedShapesIt)) {
aSolidsToFuse.insert(aSolidsToFuse.end(), aUsedShapes.begin(), aUsedShapes.end());
// Collect solids from compsolid which will not be modified in boolean operation.
- for(GeomAPI_ShapeExplorer
- anExp(aCompSolid, GeomAPI_Shape::SOLID); anExp.more(); anExp.next()) {
- GeomShapePtr aSolidInCompSolid = anExp.current();
+ for (GeomAPI_ShapeIterator aCompSolidIt(aCompSolid);
+ aCompSolidIt.more();
+ aCompSolidIt.next())
+ {
+ GeomShapePtr aSolidInCompSolid = aCompSolidIt.current();
ListOfShape::iterator anIt = aUsedShapes.begin();
for(; anIt != aUsedShapes.end(); anIt++) {
if(aSolidInCompSolid->isEqual(*anIt)) {
void FeaturesPlugin_CompositeBoolean::storeModificationHistory(ResultBodyPtr theResultBody,
const GeomShapePtr theObject,
const ListOfShape& theTools,
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
- int& theTag)
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
{
- int aModTag = theTag;
- int anEdgesAndFacesTag = ++aModTag;
- int aDelTag = ++anEdgesAndFacesTag;
- theTag = aDelTag;
-
- const std::string aModName = "Modfied";
-
ListOfShape aTools = theTools;
aTools.push_back(theObject);
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMap = theMakeShape->mapOfSubShapes();
-
- int aTag;
- std::string aName;
for(ListOfShape::const_iterator anIt = aTools.begin(); anIt != aTools.end(); anIt++) {
- if((*anIt)->shapeType() == GeomAPI_Shape::EDGE) {
- aTag = anEdgesAndFacesTag;
- aName = aModName + "_Edge";
- }
- else if((*anIt)->shapeType() == GeomAPI_Shape::FACE) {
- aTag = anEdgesAndFacesTag;
- aName = aModName + "_Face";
- } else {
- aTag = aModTag;
- aName = aModName;
- }
- theResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), *anIt,
- (*anIt)->shapeType() == GeomAPI_Shape::EDGE ?
- GeomAPI_Shape::EDGE : GeomAPI_Shape::FACE, aTag, aName, *aMap.get(), false, false, true);
+ theResultBody->loadModifiedShapes(theMakeShape, *anIt,
+ (*anIt)->shapeType() == GeomAPI_Shape::EDGE ?
+ GeomAPI_Shape::EDGE :
+ GeomAPI_Shape::FACE);
}
}
++anIt)
{
ResultBaseAlgo& aRCA = *anIt;
- aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
+ aRCA.resultBody->loadDeletedShapes(aRCA.makeShape,
aRCA.baseShape,
GeomAPI_Shape::FACE,
- aRCA.delTag,
theResultShapesCompound);
for (ListOfShape::const_iterator anIter = theTools.begin(); anIter != theTools.end(); anIter++)
{
- aRCA.resultBody->loadDeletedShapes(aRCA.makeShape.get(),
+ aRCA.resultBody->loadDeletedShapes(aRCA.makeShape,
*anIter,
GeomAPI_Shape::FACE,
- aRCA.delTag,
theResultShapesCompound);
}
}
ResultBodyPtr resultBody;
GeomShapePtr baseShape;
std::shared_ptr<GeomAlgoAPI_MakeShape> makeShape;
- int delTag;
};
protected:
/// Stores generation history.
virtual void storeGenerationHistory(ResultBodyPtr theResultBody,
const GeomShapePtr theBaseShape,
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
- int& theTag) = 0;
+ const GeomMakeShapePtr theMakeShape) = 0;
/// Stores modification history.
void storeModificationHistory(ResultBodyPtr theResultBody,
const GeomShapePtr theObject,
const ListOfShape& theTools,
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
- int& theTag);
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
/// Stores deleted shapes.
void storeDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
#include <map>
#include <sstream>
-static void storeSubShape(ResultBodyPtr theResultBody,
+static void storeSubShape(const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
+ ResultBodyPtr theResultBody,
const GeomShapePtr theShape,
const GeomAPI_Shape::ShapeType theType,
- const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
- const std::string theName,
- int& theShapeIndex,
- int& theTag);
+ const std::string& theName);
//=================================================================================================
void FeaturesPlugin_CompositeSketch::initCompositeSketchAttribtues(const int theInitFlags)
std::shared_ptr<ModelAPI_Feature> FeaturesPlugin_CompositeSketch::subFeature(const int theIndex,
bool forTree)
{
+ FeaturePtr aSubFeature;
if(theIndex == 0) {
- return std::dynamic_pointer_cast<ModelAPI_Feature>(data()->reference(SKETCH_ID())->value());
+ aSubFeature =
+ std::dynamic_pointer_cast<ModelAPI_Feature>(data()->reference(SKETCH_ID())->value());
}
-
- return std::shared_ptr<ModelAPI_Feature>();
+ return aSubFeature;
}
//=================================================================================================
//=================================================================================================
bool FeaturesPlugin_CompositeSketch::isSub(ObjectPtr theObject) const
{
+ bool isSubFeature = false;
// Check is this feature of result
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
- if(!aFeature.get()) {
- return false;
+ if (aFeature.get()) {
+ ObjectPtr aSub = data()->reference(SKETCH_ID())->value();
+ isSubFeature = aSub == theObject;
}
-
- ObjectPtr aSub = data()->reference(SKETCH_ID())->value();
- return aSub == theObject;
+ return isSubFeature;
}
//=================================================================================================
}
}
-//=================================================================================================
-bool FeaturesPlugin_CompositeSketch::isMakeShapeValid(
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
-{
- // Check that algo is done.
- if(!theMakeShape->isDone()) {
- setError("Error: " + getKind() + " algorithm failed.");
- return false;
- }
-
- // Check if shape is not null.
- if(!theMakeShape->shape().get() || theMakeShape->shape()->isNull()) {
- setError("Error: Resulting shape is null.");
- return false;
- }
-
- // Check that resulting shape is valid.
- if(!theMakeShape->isValid()) {
- setError("Error: Resulting shape is not valid.");
- return false;
- }
-
- return true;
-}
-
//=================================================================================================
void FeaturesPlugin_CompositeSketch::storeResult(const GeomShapePtr theBaseShape,
const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
aResultBody->storeGenerated(theBaseShape, theMakeShape->shape());
// Store generated edges/faces.
- int aGenTag = 1;
- storeGenerationHistory(aResultBody, theBaseShape, theMakeShape, aGenTag);
+ storeGenerationHistory(aResultBody, theBaseShape, theMakeShape);
setResult(aResultBody, theIndex);
}
//=================================================================================================
void FeaturesPlugin_CompositeSketch::storeGenerationHistory(ResultBodyPtr theResultBody,
const GeomShapePtr theBaseShape,
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
- int& theTag)
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
{
GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType();
GeomAPI_Shape::ShapeType aShapeTypeToExplode = GeomAPI_Shape::SHAPE;
- std::string aGenName = "Generated_";
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = theMakeShape->mapOfSubShapes();
switch(aBaseShapeType) {
case GeomAPI_Shape::EDGE: {
aShapeTypeToExplode = GeomAPI_Shape::VERTEX;
break;
}
case GeomAPI_Shape::WIRE: {
- //std::shared_ptr<GeomAPI_Vertex> aV1, aV2;
- //GeomAlgoAPI_ShapeTools::findBounds(theBaseShape, aV1, aV2);
- //ListOfShape aV1History, aV2History;
- //theMakeShape->generated(aV1, aV1History);
- //theMakeShape->generated(aV2, aV2History);
- //if(!aV1History.empty()) {
- // theResultBody->generated(aV1, aV1History.front(), aGenName + "Edge_1", theTag++);
- //}
- //if(!aV2History.empty()) {
- // theResultBody->generated(aV2, aV2History.front(), aGenName + "Edge_2", theTag++);
- //}
aShapeTypeToExplode = GeomAPI_Shape::COMPOUND;
break;
}
}
}
+ int aLateralIndex = 1;
+ int aBaseEdgeIndex = 1;
+ int aVertexIndex = 1;
+ int aBaseVertexIndex = 1;
+
if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX ||
aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
- theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape,
- GeomAPI_Shape::VERTEX,
- theTag++, aGenName + "Edge",
- *aMapOfSubShapes.get());
+ theResultBody->loadGeneratedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::VERTEX);
}
if(aShapeTypeToExplode == GeomAPI_Shape::EDGE ||
aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
- theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(),
- theBaseShape, GeomAPI_Shape::EDGE,
- theTag++, aGenName + "Face",
- *aMapOfSubShapes.get());
- }
- // issue #2197: make naming of edges generated from vertices
- if (aShapeTypeToExplode == GeomAPI_Shape::EDGE) {
- GeomAPI_DataMapOfShapeShape aFacesFromFromEdges;
- GeomAPI_ShapeExplorer anEdgeExp(theBaseShape, GeomAPI_Shape::EDGE);
- for(; anEdgeExp.more(); anEdgeExp.next()) {
- ListOfShape aGenerated;
- theMakeShape->generated(anEdgeExp.current(), aGenerated);
- ListOfShape::iterator aGenIter = aGenerated.begin();
- for(; aGenIter != aGenerated.end(); aGenIter++) {
- GeomShapePtr aGen = *aGenIter;
- if (aGen.get() && !aGen->isNull()) {
- if ((*aGenIter)->shapeType() == GeomAPI_Shape::FACE) { // normal case
- aFacesFromFromEdges.bind(aGen, anEdgeExp.current());
- }
- }
- }
- }
-
- // closed revolution of 1-3 faces can not distinguish lateral and base edges
- if (aFacesFromFromEdges.size() <= 3) {
- bool isClosed = false; // lateral edges are closed (in full revolution)
- GeomAPI_DataMapOfShapeShape anEdgesFromVertices;
- GeomAPI_ShapeExplorer aVertExp(theBaseShape, GeomAPI_Shape::VERTEX);
- for(; aVertExp.more(); aVertExp.next()) {
- ListOfShape aGenerated;
- theMakeShape->generated(aVertExp.current(), aGenerated);
- ListOfShape::iterator aGenIter = aGenerated.begin();
- for(; aGenIter != aGenerated.end(); aGenIter++) {
- std::shared_ptr<GeomAPI_Shape> aGenerated = *aGenIter;
- if (anEdgesFromVertices.isBound(aGenerated)) // already here
- continue;
- std::ostringstream aStream;
- aStream<<"Lateral_"<<theTag++;
- theResultBody->generated(aGenerated, aStream.str(), theTag++);
-
- anEdgesFromVertices.bind(aGenerated, aVertExp.current());
- std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aGenerated));
- isClosed = isClosed || anEdge->isClosed();
- }
- }
- if (isClosed) {
- GeomAPI_ShapeExplorer anEdgesExp(theMakeShape->shape(), GeomAPI_Shape::EDGE);
- for(; anEdgesExp.more(); anEdgesExp.next()) {
- if (!anEdgesFromVertices.isBound(anEdgesExp.current())) {
- // found a base edge
- std::ostringstream aStream;
- aStream<<"Base_Edge_"<<theTag++;
- theResultBody->generated(anEdgesExp.current(), aStream.str(), theTag++);
- // only one orientation is needed
- anEdgesFromVertices.bind(anEdgesExp.current(), anEdgesExp.current());
- }
- }
- } else if (aFacesFromFromEdges.size() == 1) { // 2233: sphere created by the revolution:
- // vertices at degenerated edges will have the same name
- GeomAPI_DataMapOfShapeShape aVertices;
- GeomAPI_ShapeExplorer aVertExp(theMakeShape->shape(), GeomAPI_Shape::VERTEX);
- for(int anIndex = 1; aVertExp.more(); aVertExp.next()) {
- if (!aVertices.isBound(aVertExp.current())) {
- // found a base edge
- std::ostringstream aStream;
- aStream<<"Vertex_"<<theTag++;
- theResultBody->generated(aVertExp.current(), aStream.str(), theTag++);
- // only one orientation is needed
- aVertices.bind(aVertExp.current(), aVertExp.current());
- }
- }
- }
- } else { // issue #2197, test case 4 : edges that produce fully-revolved face,
- // but contain only 2 edges (on apex of revolution)
- GeomAPI_ShapeExplorer anEdgeExp(theBaseShape, GeomAPI_Shape::EDGE);
- for(; anEdgeExp.more(); anEdgeExp.next()) {
- ListOfShape aGenerated;
- theMakeShape->generated(anEdgeExp.current(), aGenerated);
- ListOfShape::iterator aGenIter = aGenerated.begin();
- for(; aGenIter != aGenerated.end(); aGenIter++) {
- GeomShapePtr aGen = (*aGenIter);
- if (aGen.get() && !aGen->isNull()) {
- GeomAPI_ShapeExplorer aFaceEdgeExp(aGen, GeomAPI_Shape::EDGE);
- int aNumEdges = 0;
- int aNumClosed = 0;
- GeomShapePtr aNotClosedEdge;
- GeomEdgePtr aDegenerateEdge;
- GeomAPI_DataMapOfShapeShape alreadyIterated;
- for(; aFaceEdgeExp.more(); aFaceEdgeExp.next()) {
- std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aFaceEdgeExp.current()));
- if (anEdge->isDegenerated()) {
- aDegenerateEdge = anEdge;
- continue;
- }
- if (alreadyIterated.isBound(anEdge))
- continue;
- alreadyIterated.bind(anEdge, anEdge);
- aNumEdges++;
- if (anEdge->isClosed()) {
- aNumClosed++;
- } else {
- aNotClosedEdge = anEdge;
- }
- }
- if (aNumEdges == 2 && aNumClosed == 1) {
- std::ostringstream aStream;
- aStream<<"Base_Edge_"<<theTag++;
- theResultBody->generated(aNotClosedEdge, aStream.str(), theTag++);
- if (aDegenerateEdge.get()) { // export vertex of the degenerated edge (apex) #2520
- GeomAPI_ShapeExplorer anEdgeExp(aDegenerateEdge, GeomAPI_Shape::VERTEX);
- if (anEdgeExp.more()) {
- std::ostringstream aStream;
- aStream << "Base_Vertex_" << theTag++;
- theResultBody->generated(anEdgeExp.current(), aStream.str(), theTag++);
- }
- }
- }
- }
- }
- }
- }
+ theResultBody->loadGeneratedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::EDGE);
}
-
+ std::list<std::shared_ptr<GeomAlgoAPI_MakeSweep> > aSweeps; // all sweeps collected
std::shared_ptr<GeomAlgoAPI_MakeSweep> aMakeSweep =
std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(theMakeShape);
if(aMakeSweep.get()) {
+ aSweeps.push_back(aMakeSweep);
+ } else {
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeList =
+ std::dynamic_pointer_cast<GeomAlgoAPI_MakeShapeList>(theMakeShape);
+ if (aMakeList.get()) {
+ ListOfMakeShape::const_iterator anIter = aMakeList->list().cbegin();
+ for(; anIter != aMakeList->list().cend(); anIter++) {
+ std::shared_ptr<GeomAlgoAPI_MakeSweep> aSweep =
+ std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(*anIter);
+ if (aSweep.get())
+ aSweeps.push_back(aSweep);
+ }
+ }
+ }
+ std::list<std::shared_ptr<GeomAlgoAPI_MakeSweep> >::iterator aSweep = aSweeps.begin();
+ for(; aSweep != aSweeps.end(); aSweep++) {
// Store from shapes.
- storeShapes(theResultBody, aBaseShapeType, aMapOfSubShapes,
- aMakeSweep->fromShapes(), "From_", theTag);
+ storeShapes(theMakeShape, theResultBody, aBaseShapeType, (*aSweep)->fromShapes(), "From_");
// Store to shapes.
- storeShapes(theResultBody, aBaseShapeType, aMapOfSubShapes,
- aMakeSweep->toShapes(), "To_", theTag);
+ storeShapes(theMakeShape, theResultBody, aBaseShapeType, (*aSweep)->toShapes(), "To_");
}
}
//=================================================================================================
-void FeaturesPlugin_CompositeSketch::storeShapes(ResultBodyPtr theResultBody,
- const GeomAPI_Shape::ShapeType theBaseShapeType,
- const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
- const ListOfShape& theShapes,
- const std::string theName,
- int& theTag)
+void FeaturesPlugin_CompositeSketch::storeShapes(
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
+ ResultBodyPtr theResultBody,
+ const GeomAPI_Shape::ShapeType theBaseShapeType,
+ const ListOfShape& theShapes,
+ const std::string theName)
{
GeomAPI_Shape::ShapeType aShapeTypeToExplore = GeomAPI_Shape::FACE;
std::string aShapeTypeStr = "Face";
}
// Store shapes.
- int aShapeIndex = 1;
- int aFaceIndex = 1;
for(ListOfShape::const_iterator anIt = theShapes.cbegin(); anIt != theShapes.cend(); ++anIt) {
GeomShapePtr aShape = *anIt;
if(aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) {
std::string aName = theName + (aShape->shapeType() == GeomAPI_Shape::EDGE ? "Edge" : "Face");
- storeSubShape(theResultBody,
- aShape,
- aShape->shapeType(),
- theMapOfSubShapes,
- aName,
- aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex,
- theTag);
+ storeSubShape(theMakeShape, theResultBody, aShape, aShape->shapeType(), aName);
} else {
std::string aName = theName + aShapeTypeStr;
- storeSubShape(theResultBody, aShape, aShapeTypeToExplore,
- theMapOfSubShapes, aName, aShapeIndex, theTag);
+ storeSubShape(theMakeShape, theResultBody, aShape, aShapeTypeToExplore, aName);
if (theBaseShapeType == GeomAPI_Shape::WIRE) { // issue 2289: special names also for vertices
aName = theName + "Vertex";
- storeSubShape(theResultBody, aShape, GeomAPI_Shape::VERTEX,
- theMapOfSubShapes, aName, aShapeIndex, theTag);
+ storeSubShape(theMakeShape, theResultBody, aShape, GeomAPI_Shape::VERTEX, aName);
}
}
}
}
-void storeSubShape(ResultBodyPtr theResultBody,
- const GeomShapePtr theShape,
- const GeomAPI_Shape::ShapeType theType,
- const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
- const std::string theName,
- int& theShapeIndex,
- int& theTag)
+void storeSubShape(
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
+ ResultBodyPtr theResultBody,
+ const GeomShapePtr theShape,
+ const GeomAPI_Shape::ShapeType theType,
+ const std::string& theName)
{
for(GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); anExp.next()) {
GeomShapePtr aSubShape = anExp.current();
- if(theMapOfSubShapes->isBound(aSubShape)) {
- aSubShape = theMapOfSubShapes->find(aSubShape);
+ if (!theResultBody->generated(aSubShape, theName)) {
+ // store from/to shapes as primitives and then store modification of them by the boolean
+ theResultBody->generated(aSubShape, theName, false);
+ theResultBody->loadModifiedShapes(theMakeShape, aSubShape, theType);
}
- std::ostringstream aStr;
- aStr << theName << "_" << theShapeIndex++;
- theResultBody->generated(aSubShape, aStr.str(), theTag++);
}
}
/// \param[in] theIsMakeShells if true make shells from faces with shared edges.
void getBaseShapes(ListOfShape& theBaseShapesList, const bool theIsMakeShells = true);
- /// Checks make shape algo.
- bool isMakeShapeValid(const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
-
/// Stores result of generation.
void storeResult(const GeomShapePtr theBaseShape,
const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
/// Stores generation history.
void storeGenerationHistory(ResultBodyPtr theResultBody,
const GeomShapePtr theBaseShape,
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
- int& theTag);
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
- /// Used to store from and to shapes.
- void storeShapes(ResultBodyPtr theResultBody,
+ /// Used to store from and to shapes: generated, or in common modified tag
+ void storeShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
+ ResultBodyPtr theResultBody,
const GeomAPI_Shape::ShapeType theBaseShapeType,
- const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
const ListOfShape& theShapes,
- const std::string theName,
- int& theTag);
+ const std::string theName);
};
#include <ModelAPI_Validator.h>
#include <GeomAlgoAPI_Prism.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_Dir.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
//=================================================================================================
FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion()
getBaseShapes(theBaseShapes);
//Getting direction.
- std::shared_ptr<GeomAPI_Dir> aDir;
- std::shared_ptr<GeomAPI_Edge> anEdge;
+ static const std::string aSelectionError = "Error: The direction shape selection is bad.";
AttributeSelectionPtr aSelection = selection(DIRECTION_OBJECT_ID());
- if(aSelection.get() && aSelection->value().get() && aSelection->value()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->value()));
- } else if(aSelection->context().get() &&
- aSelection->context()->shape().get() &&
- aSelection->context()->shape()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->context()->shape()));
+ GeomShapePtr aShape = aSelection->value();
+ if (!aShape.get()) {
+ if (aSelection->context().get()) {
+ aShape = aSelection->context()->shape();
+ }
+ }
+
+ GeomEdgePtr anEdge;
+ if (aShape.get()) {
+ if (aShape->isEdge())
+ {
+ anEdge = aShape->edge();
+ }
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ anEdge = anIt.current()->edge();
+ }
}
+
+ std::shared_ptr<GeomAPI_Dir> aDir;
if(anEdge.get()) {
if(anEdge->isLine()) {
aDir = anEdge->line()->direction();
if(!aToShape.get() && aSelection->context().get()) {
aToShape = aSelection->context()->shape();
}
+ if (aToShape.get() && aToShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aToShape);
+ aToShape = anIt.current();
+ }
}
aSelection = selection(FROM_OBJECT_ID());
if(aSelection.get()) {
if(!aFromShape.get() && aSelection->context().get()) {
aFromShape = aSelection->context()->shape();
}
+ if (aFromShape.get() && aFromShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aFromShape);
+ aFromShape = anIt.current();
+ }
}
}
// Generating result for each base shape.
+ std::string anError;
for(ListOfShape::const_iterator
anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) {
std::shared_ptr<GeomAPI_Shape> aBaseShape = *anIter;
std::shared_ptr<GeomAlgoAPI_Prism> aPrismAlgo(new GeomAlgoAPI_Prism(aBaseShape, aDir,
aToShape, aToSize,
aFromShape, aFromSize));
- if(!isMakeShapeValid(aPrismAlgo)) {
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPrismAlgo, getKind(), anError)) {
+ setError(anError);
return false;
}
//=================================================================================================
void FeaturesPlugin_ExtrusionBoolean::storeGenerationHistory(ResultBodyPtr theResultBody,
const GeomShapePtr theBaseShape,
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
- int& theTag)
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
{
- FeaturesPlugin_Extrusion::storeGenerationHistory(theResultBody, theBaseShape,
- theMakeShape, theTag);
+ FeaturesPlugin_Extrusion::storeGenerationHistory(theResultBody, theBaseShape, theMakeShape);
}
/// Stores generation history.
void storeGenerationHistory(ResultBodyPtr theResultBody,
const GeomShapePtr theBaseShape,
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
- int& theTag);
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
};
#endif
#include <GeomAlgoAPI_Fillet.h>
#include <GeomAlgoAPI_MakeShapeList.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_DataMapOfShapeMapOfShapes.h>
#include <GeomAPI_ShapeExplorer.h>
GeomAlgoAPI_MakeShapeList aMakeShapeList;
std::shared_ptr<GeomAlgoAPI_Fillet> aFilletBuilder;
int aResultIndex = 0;
+ std::string anError;
GeomAPI_DataMapOfShapeMapOfShapes::iterator anIt = aSolidsAndSubs.begin();
for (; anIt != aSolidsAndSubs.end(); ++anIt) {
aFilletBuilder.reset(new GeomAlgoAPI_Fillet(aSolid, aFilletEdges, aRadius1));
else
aFilletBuilder.reset(new GeomAlgoAPI_Fillet(aSolid, aFilletEdges, aRadius1, aRadius2));
- if (isFailed(aFilletBuilder))
+
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFilletBuilder, getKind(), anError)) {
+ setError(anError);
return;
+ }
GeomShapePtr aResult = unwrapCompound(aFilletBuilder->shape());
std::shared_ptr<ModelAPI_ResultBody> aResultBody =
document()->createBody(data(), aResultIndex);
- loadNamingDS(aResultBody, aSolid, aFilletEdgesAndVertices, aResult, aFilletBuilder);
+ loadNamingDS(aResultBody, aSolid, aResult, aFilletBuilder);
setResult(aResultBody, aResultIndex);
aResultIndex++;
}
removeResults(aResultIndex);
}
-bool FeaturesPlugin_Fillet::isFailed(
- const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm)
-{
- if (!theAlgorithm->isDone()) {
- static const std::string aFeatureError = "Error: fillet algorithm failed.";
- setError(aFeatureError);
- return true;
- }
- if (theAlgorithm->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape of fillet is Null.";
- setError(aShapeError);
- return true;
- }
- if (!theAlgorithm->isValid()) {
- std::string aFeatureError = "Error: Resulting shape of fillet is not valid.";
- setError(aFeatureError);
- return true;
- }
- return false;
-}
-
void FeaturesPlugin_Fillet::loadNamingDS(
std::shared_ptr<ModelAPI_ResultBody> theResultBody,
const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const ListOfShape& theFilletShapes,
const std::shared_ptr<GeomAPI_Shape> theResultShape,
const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape)
{
return;
}
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfShapes = theMakeShape->mapOfSubShapes();
-
- const int aDeletedTag = 1;
- const int aModifyTag = 2;
- const int aGeneratedTag = 3;
- /// sub solids will be placed at labels 4, 5, etc. if result is compound of solids
- const int aSubsolidsTag = 4;
-
- theResultBody->storeModified(theBaseShape, theResultShape, aSubsolidsTag);
+ theResultBody->storeModified(theBaseShape, theResultShape);
- const std::string aModFaceName = "Modified_Face";
const std::string aFilletFaceName = "Fillet_Face";
// Store modified faces
- theResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), theBaseShape,
- GeomAPI_Shape::FACE, aModifyTag, aModFaceName, *aMapOfShapes);
+ theResultBody->loadModifiedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE);
// Store new faces generated from edges and vertices
- theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape,
- GeomAPI_Shape::EDGE, aGeneratedTag, aFilletFaceName, *aMapOfShapes);
- theResultBody->loadAndOrientGeneratedShapes(theMakeShape.get(), theBaseShape,
- GeomAPI_Shape::VERTEX, aGeneratedTag, aFilletFaceName, *aMapOfShapes);
+ theResultBody->loadGeneratedShapes(theMakeShape,
+ theBaseShape,
+ GeomAPI_Shape::EDGE,
+ aFilletFaceName);
+ theResultBody->loadGeneratedShapes(theMakeShape,
+ theBaseShape,
+ GeomAPI_Shape::VERTEX,
+ aFilletFaceName);
// Deleted shapes
- theResultBody->loadDeletedShapes(theMakeShape.get(), theBaseShape,
- GeomAPI_Shape::EDGE, aDeletedTag);
- theResultBody->loadDeletedShapes(theMakeShape.get(), theBaseShape,
- GeomAPI_Shape::FACE, aDeletedTag);
+ theResultBody->loadDeletedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::EDGE);
+ theResultBody->loadDeletedShapes(theMakeShape, theBaseShape, GeomAPI_Shape::FACE);
}
FeaturesPlugin_Fillet();
private:
- /// Check algorithm is finished correctly and store error otherwise
- bool isFailed(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm);
-
/// Load Naming data structure of the feature to the document
void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const ListOfShape& theFilletShapes,
const std::shared_ptr<GeomAPI_Shape> theResultShape,
const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
};
#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAlgoAPI_UnifySameDomain.h>
std::shared_ptr<GeomAlgoAPI_UnifySameDomain> anAlgo(new GeomAlgoAPI_UnifySameDomain(aBaseShape));
// Check algo status
- if (!anAlgo->isDone()) {
- setError("Error: Fusion algorithm failed.");
- return;
- }
- if (anAlgo->shape()->isNull()) {
- setError("Error: Resulting shape is Null.");
- return;
- }
- if (!anAlgo->isValid()) {
- setError("Error: Resulting shape is not valid.");
+ std::string anError;
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
} else {
aResultBody->storeModified(aBaseShape, aResultShape);
- const int aModifyEdgeTag = 1;
- const int aModifyFaceTag = 2;
- const std::string aModEName = "Modified_Edge";
- const std::string aModFName = "Modified_Face";
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfShapes = anAlgo->mapOfSubShapes();
- aResultBody->loadAndOrientModifiedShapes(anAlgo.get(), aBaseShape, GeomAPI_Shape::EDGE,
- aModifyEdgeTag, aModEName, *aMapOfShapes.get(), true);
- aResultBody->loadAndOrientModifiedShapes(anAlgo.get(), aBaseShape, GeomAPI_Shape::FACE,
- aModifyFaceTag, aModFName, *aMapOfShapes.get(), true);
+ aResultBody->loadModifiedShapes(anAlgo, aBaseShape, GeomAPI_Shape::EDGE);
+ aResultBody->loadModifiedShapes(anAlgo, aBaseShape, GeomAPI_Shape::FACE);
}
setResult(aResultBody);
}
#include <ModelAPI_AttributeSelectionList.h>
#include <GeomAlgoAPI_Intersection.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_ShapeExplorer.h>
#include <sstream>
int aResultIndex = 0;
// Create result.
- GeomAlgoAPI_Intersection anIntersectionAlgo(anObjects);
+ GeomMakeShapePtr anIntersectionAlgo(new GeomAlgoAPI_Intersection(anObjects));
// Checking that the algorithm worked properly.
- if (!anIntersectionAlgo.isDone()) {
- static const std::string aFeatureError = "Error: Intersection algorithm failed.";
- setError(aFeatureError);
- return;
- }
- if (anIntersectionAlgo.shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- return;
- }
- if (!anIntersectionAlgo.isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ std::string anError;
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anIntersectionAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
}
//=================================================================================================
-void FeaturesPlugin_Intersection::loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+void FeaturesPlugin_Intersection::loadNamingDS(ResultBodyPtr theResultBody,
const ListOfShape& theObjects,
- GeomAlgoAPI_MakeShape& theMakeShape)
+ const GeomMakeShapePtr& theMakeShape)
{
- std::shared_ptr<GeomAPI_Shape> aResultShape = theMakeShape.shape();
+ std::shared_ptr<GeomAPI_Shape> aResultShape = theMakeShape->shape();
+
+ if(theObjects.front()->isEqual(aResultShape)) {
+ theResultBody->store(aResultShape, false);
+ return;
+ }
+
theResultBody->storeModified(theObjects.front(), aResultShape);
- GeomAPI_DataMapOfShapeShape aShapesMap; // Map to store {result_shape, original_shape}
- const int aShapeTypesNb = 2;
- const GeomAPI_Shape::ShapeType aShapeTypes[aShapeTypesNb] =
- {GeomAPI_Shape::VERTEX, GeomAPI_Shape::EDGE};
+ const int aShapeTypesNb = 3;
+ const GeomAPI_Shape::ShapeType aShapeTypes[aShapeTypesNb] = {GeomAPI_Shape::VERTEX,
+ GeomAPI_Shape::EDGE,
+ GeomAPI_Shape::FACE };
for (ListOfShape::const_iterator anIt = theObjects.cbegin(); anIt != theObjects.cend(); ++anIt) {
const GeomShapePtr aShape = *anIt;
for(int anIndex = 0; anIndex < aShapeTypesNb; ++anIndex) {
- for(GeomAPI_ShapeExplorer anOrigShapeExp(aShape, aShapeTypes[anIndex]);
- anOrigShapeExp.more();
- anOrigShapeExp.next()) {
- ListOfShape aHistory;
- const GeomShapePtr aSubShape = anOrigShapeExp.current();
- theMakeShape.modified(aSubShape, aHistory);
- for(ListOfShape::const_iterator aHistoryIt = aHistory.cbegin();
- aHistoryIt != aHistory.cend();
- ++aHistoryIt) {
- aShapesMap.bind(*aHistoryIt, aSubShape);
- }
- }
- }
- }
-
- int aModifiedVertexIndex(1),
- aGeneratedVertexIndex(1),
- aModifiedEdgeIndex(1),
- aGeneratedEdgeIndex(1);
- int aTag = 4;
- GeomAPI_DataMapOfShapeShape aStoredShapes;
- for(int anIndex = 0; anIndex < aShapeTypesNb; ++anIndex) {
- for(GeomAPI_ShapeExplorer aShapeExp(aResultShape, aShapeTypes[anIndex]);
- aShapeExp.more();
- aShapeExp.next()) {
- const GeomShapePtr aSubShape = aShapeExp.current();
- if(aStoredShapes.isBound(aSubShape)) {
- continue;
- }
- if(aShapesMap.isBound(aSubShape)) {
- theResultBody->modified(aShapesMap.find(aSubShape),
- aSubShape,
- std::string("Modified_")
- + (anIndex == 0 ? "Vertex_" : "Edge_")
- + std::to_string((long long)(anIndex == 0 ? aModifiedVertexIndex++
- : aModifiedEdgeIndex++)),
- aTag++);
- } else {
- theResultBody->generated(aSubShape,
- std::string("Generated_")
- + (anIndex == 0 ? "Vertex_" : "Edge_")
- + std::to_string((long long)(anIndex == 0 ? aGeneratedVertexIndex++
- : aGeneratedEdgeIndex++)),
- aTag++);
- }
- aStoredShapes.bind(aSubShape, aSubShape);
+ theResultBody->loadModifiedShapes(theMakeShape, aShape, aShapeTypes[anIndex]);
+ theResultBody->loadGeneratedShapes(theMakeShape, aShape, aShapeTypes[anIndex]);
}
}
}
/// Load Naming data structure of the feature to the document.
void loadNamingDS(std::shared_ptr<ModelAPI_ResultBody> theResultBody,
const ListOfShape& theObjects,
- GeomAlgoAPI_MakeShape& theMakeShape);
+ const std::shared_ptr<GeomAlgoAPI_MakeShape>& theMakeShape);
};
#endif
if ((aValues->size() == 0) || (aValues->value(0) <= Precision::Confusion()))
return AISObjectPtr();
+ if (!myScreenPlane) {
+ // initialize a default plane for dimension
+ GeomPointPtr anOrigin(new GeomAPI_Pnt(0., 0., 0.));
+ GeomDirPtr aNormal(new GeomAPI_Dir(0., 0., 1.));
+ myScreenPlane = GeomPlanePtr(new GeomAPI_Pln(anOrigin, aNormal));
+ }
+
AISObjectPtr anAIS;
std::string aKind = string(MEASURE_KIND())->value();
if (aKind == MEASURE_LENGTH())
AISObjectPtr FeaturesPlugin_Measurement::lengthDimension(AISObjectPtr thePrevious)
{
AISObjectPtr aAISObj;
- if (!myScreenPlane.get())
- return aAISObj;
AttributeSelectionPtr aSelectedFeature = selection(EDGE_FOR_LENGTH_ID());
AISObjectPtr FeaturesPlugin_Measurement::distanceDimension(AISObjectPtr thePrevious)
{
AISObjectPtr aAISObj;
- if (!myScreenPlane.get())
- return aAISObj;
AttributeSelectionPtr aFirstFeature = selection(DISTANCE_FROM_OBJECT_ID());
AttributeSelectionPtr aSecondFeature = selection(DISTANCE_TO_OBJECT_ID());
#include <GeomAlgoAPI_CompoundBuilder.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAlgoAPI_Translation.h>
#include <GeomAPI_ShapeExplorer.h>
#include <GeomAPI_Ax1.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_Trsf.h>
#include <ModelAPI_AttributeDouble.h>
data()->addAttribute(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID(),
ModelAPI_AttributeInteger::typeId());
- /*data()->addAttribute(FeaturesPlugin_MultiRotation::USE_RADIAL_DIR_ID(),
+#ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
+ data()->addAttribute(FeaturesPlugin_MultiRotation::USE_RADIAL_DIR_ID(),
ModelAPI_AttributeString::typeId());
data()->addAttribute(FeaturesPlugin_MultiRotation::STEP_RADIAL_ID(),
ModelAPI_AttributeDouble::typeId());
data()->addAttribute(FeaturesPlugin_MultiRotation::NB_COPIES_RADIAL_ID(),
- ModelAPI_AttributeInteger::typeId());*/
+ ModelAPI_AttributeInteger::typeId());
+#endif
}
//=================================================================================================
void FeaturesPlugin_MultiRotation::execute()
{
- /*std::string useRadialDir = string(FeaturesPlugin_MultiRotation::USE_RADIAL_DIR_ID())->value();
+#ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
+ std::string useRadialDir = string(FeaturesPlugin_MultiRotation::USE_RADIAL_DIR_ID())->value();
if (useRadialDir.empty()) {
performRotation1D();
} else {
performRotation2D();
- }*/
+ }
+#else
performRotation1D();
+#endif
}
//=================================================================================================
AttributeSelectionListPtr anObjectsSelList =
selectionList(FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID());
if (anObjectsSelList->size() == 0) {
+ setError("Error: empty selection list");
return;
}
for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) { // may be for not-activated parts
- eraseResults();
return;
}
anObjects.push_back(anObject);
}
//Getting axis.
- std::shared_ptr<GeomAPI_Ax1> anAxis;
- std::shared_ptr<GeomAPI_Edge> anEdge;
- std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
- selection(FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID());
- if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
- } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
- anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+ static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+ AttributeSelectionPtr anObjRef = selection(AXIS_ANGULAR_ID());
+ GeomShapePtr aShape = anObjRef->value();
+ if (!aShape.get()) {
+ if (anObjRef->context().get()) {
+ aShape = anObjRef->context()->shape();
+ }
}
- if(anEdge) {
- anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
- anEdge->line()->direction()));
+ if (!aShape.get()) {
+ setError(aSelectionError);
+ return;
}
+ GeomEdgePtr anEdge;
+ if (aShape->isEdge())
+ {
+ anEdge = aShape->edge();
+ }
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ anEdge = anIt.current()->edge();
+ }
+
+ if (!anEdge.get())
+ {
+ setError(aSelectionError);
+ return;
+ }
+
+ std::shared_ptr<GeomAPI_Ax1> anAxis(new GeomAPI_Ax1(anEdge->line()->location(),
+ anEdge->line()->direction()));
+
// Getting number of copies.
int nbCopies =
integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID())->value();
aResultIndex++;
}
} else {
+ std::string anError;
ListOfShape aListOfShape;
std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > aListOfRotationAlgo;
aRotationnAlgo->build();
// Checking that the algorithm worked properly.
- if (!aRotationnAlgo->isDone()) {
- static const std::string aFeatureError = "Error : Multitranslation algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if (aRotationnAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error : Resulting shape is null.";
- setError(aShapeError);
- break;
- }
- if (!aRotationnAlgo->isValid()) {
- static const std::string aFeatureError = "Error : Resulting shape in not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationnAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
aListOfShape.push_back(aRotationnAlgo->shape());
}
//=================================================================================================
+#ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
void FeaturesPlugin_MultiRotation::performRotation2D()
{
// Getting objects.
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) { // may be for not-activated parts
- eraseResults();
return;
}
anObjects.push_back(anObject);
std::shared_ptr<ModelAPI_ResultBody> theResultBody,
std::shared_ptr<GeomAPI_Shape> theBaseShape)
{
- int aTag = 1;
- int anIndex = 1;
- std::string aRotatedName;
-
for (std::list<std::shared_ptr<GeomAlgoAPI_Translation> >::const_iterator anIt =
theListOfTranslationAlgo.begin(); anIt != theListOfTranslationAlgo.cend(); ++anIt) {
- std::cout << "LOAD" << std::endl;
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = (*anIt)->mapOfSubShapes();
-
// naming of faces
- aRotatedName = "Rotated_Face_" + std::to_string((long long) anIndex);
- theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::FACE,
- aTag++, aRotatedName, *aSubShapes.get(),
- false, true);
+ theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::FACE, "Rotated_Face");
// naming of edges
- aRotatedName = "Rotated_Edge_" + std::to_string((long long) anIndex);
- theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::EDGE,
- aTag++, aRotatedName, *aSubShapes.get(),
- false, true);
+ theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::EDGE, "Rotated_Edge");
// naming of vertex
- aRotatedName = "Rotated_Vertex_" + std::to_string((long long) anIndex);
- theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::VERTEX,
- aTag++, aRotatedName, *aSubShapes.get(),
- false, true);
-
- ++anIndex;
+ theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::VERTEX, "Rotated_Vertex");
}
}
std::shared_ptr<ModelAPI_ResultBody> theResultBody,
std::shared_ptr<GeomAPI_Shape> theBaseShape, int nb)
{
- int aTag = 6*nb+1;
int anIndex = nb+1;
std::string aRotatedName;
for(; anExp.more(); anExp.next()) {
aRotatedName = "Rotated_Face_" + std::to_string((long long) anIndex);
aRotatedName = aRotatedName + "_" + std::to_string((long long) numFace);
- theResultBody->generated(anExp.current(), aRotatedName, aTag++);
+ theResultBody->generated(anExp.current(), aRotatedName);
++numFace;
}
++anIndex;
}
}
+#endif
//=================================================================================================
void FeaturesPlugin_MultiRotation::loadNamingDS(
std::shared_ptr<ModelAPI_ResultBody> theResultBody,
std::shared_ptr<GeomAPI_Shape> theBaseShape)
{
- int aTag = 1;
- int anIndex = 1;
- std::string aRotatedName;
-
for (std::list<std::shared_ptr<GeomAlgoAPI_Rotation> >::const_iterator anIt =
theListOfRotationAlgo.begin(); anIt != theListOfRotationAlgo.cend(); ++anIt) {
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = (*anIt)->mapOfSubShapes();
-
// naming of faces
- aRotatedName = "Rotated_Face_" + std::to_string((long long) anIndex);
- theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::FACE,
- aTag++, aRotatedName, *aSubShapes.get(),
- false, true);
+ theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::FACE, "Rotated_Face");
// naming of edges
- aRotatedName = "Rotated_Edge_" + std::to_string((long long) anIndex);
- theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::EDGE,
- aTag++, aRotatedName, *aSubShapes.get(),
- false, true);
+ theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::EDGE, "Rotated_Edge");
// naming of vertex
- aRotatedName = "Rotated_Vertex_" + std::to_string((long long) anIndex);
- theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::VERTEX,
- aTag++, aRotatedName, *aSubShapes.get(),
- false, true);
- ++anIndex;
+ theResultBody->loadModifiedShapes(*anIt, theBaseShape, GeomAPI_Shape::VERTEX, "Rotated_Vertex");
}
}
/// Perform the multi rotation in one direction.
void performRotation1D();
- /// Perform the multi totation in two directions.
+#ifdef FEATURE_MULTIROTATION_TWO_DIRECTIONS
+ /// Perform the multi rotation in two directions.
void performRotation2D();
void loadNamingDS2(std::list<std::shared_ptr<GeomAlgoAPI_Translation> > theListOfTranslationAlgo,
void loadNamingDS3(std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > theListOfRotationAlgo,
std::shared_ptr<ModelAPI_ResultBody> theResultBody,
std::shared_ptr<GeomAPI_Shape> theBaseShape, int nb);
+#endif
void loadNamingDS(std::list<std::shared_ptr<GeomAlgoAPI_Rotation> > theListOfRotationAlgo,
std::shared_ptr<ModelAPI_ResultBody> theResultBody,
#include <FeaturesPlugin_MultiTranslation.h>
#include <GeomAlgoAPI_CompoundBuilder.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_Ax1.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_Trsf.h>
#include <ModelAPI_AttributeDouble.h>
AttributeSelectionListPtr anObjectsSelList =
selectionList(FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID());
if (anObjectsSelList->size() == 0) {
+ setError("Error: empty selection list");
return;
}
for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) { // may be for not-activated parts
- eraseResults();
return;
}
anObjects.push_back(anObject);
}
//Getting axis.
- std::shared_ptr<GeomAPI_Ax1> anAxis;
- std::shared_ptr<GeomAPI_Edge> anEdge;
- std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
- selection(FeaturesPlugin_MultiTranslation::AXIS_FIRST_DIR_ID());
- if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
- } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
- anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+ static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+ AttributeSelectionPtr anObjRef = selection(AXIS_FIRST_DIR_ID());
+ GeomShapePtr aShape = anObjRef->value();
+ if (!aShape.get()) {
+ if (anObjRef->context().get()) {
+ aShape = anObjRef->context()->shape();
+ }
}
- if(anEdge) {
- anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
- anEdge->line()->direction()));
+ if (!aShape.get()) {
+ setError(aSelectionError);
+ return;
+ }
+
+ GeomEdgePtr anEdge;
+ if (aShape->isEdge())
+ {
+ anEdge = aShape->edge();
+ }
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ anEdge = anIt.current()->edge();
}
+ if (!anEdge.get())
+ {
+ setError(aSelectionError);
+ return;
+ }
+
+ std::shared_ptr<GeomAPI_Ax1> anAxis (new GeomAPI_Ax1(anEdge->line()->location(),
+ anEdge->line()->direction()));
+
// Getting step.
double aStep = real(FeaturesPlugin_MultiTranslation::STEP_FIRST_DIR_ID())->value();
aResultIndex++;
}
} else {
+ std::string anError;
ListOfShape aListOfShape;
std::list<std::shared_ptr<GeomAlgoAPI_Translation> > aListOfTranslationAlgo;
aTranslationAlgo->build();
// Checking that the algorithm worked properly.
- if (!aTranslationAlgo->isDone()) {
- static const std::string aFeatureError = "Error : Multitranslation algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if (aTranslationAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error : Resulting shape is null.";
- setError(aShapeError);
- break;
- }
- if (!aTranslationAlgo->isValid()) {
- static const std::string aFeatureError = "Error : Resulting shape in not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(
+ aTranslationAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
aListOfShape.push_back(aTranslationAlgo->shape());
AttributeSelectionListPtr anObjectsSelList =
selectionList(FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID());
if (anObjectsSelList->size() == 0) {
+ setError("Error: empty selection list");
return;
}
for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) { // may be for not-activated parts
- eraseResults();
return;
}
anObjects.push_back(anObject);
}
//Getting axis.
- std::shared_ptr<GeomAPI_Ax1> aFirstAxis;
- std::shared_ptr<GeomAPI_Edge> anEdge;
- std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
- selection(FeaturesPlugin_MultiTranslation::AXIS_FIRST_DIR_ID());
- if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
- } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
- anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+ static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+ AttributeSelectionPtr anObjRef = selection(AXIS_FIRST_DIR_ID());
+ GeomShapePtr aShape = anObjRef->value();
+ if (!aShape.get()) {
+ if (anObjRef->context().get()) {
+ aShape = anObjRef->context()->shape();
+ }
+ }
+ if (!aShape.get()) {
+ setError(aSelectionError);
+ return;
}
- if(anEdge) {
- aFirstAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
- anEdge->line()->direction()));
+
+ GeomEdgePtr anEdge;
+ if (aShape->isEdge())
+ {
+ anEdge = aShape->edge();
}
- std::shared_ptr<GeomAPI_Ax1> aSecondAxis;
- anObjRef = selection(FeaturesPlugin_MultiTranslation::AXIS_SECOND_DIR_ID());
- if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
- } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
- anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ anEdge = anIt.current()->edge();
}
- if(anEdge) {
- aSecondAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
- anEdge->line()->direction()));
+
+ if (!anEdge.get())
+ {
+ setError(aSelectionError);
+ return;
}
+ std::shared_ptr<GeomAPI_Ax1> aFirstAxis(new GeomAPI_Ax1(anEdge->line()->location(),
+ anEdge->line()->direction()));
+
+ //Getting axis.
+ anObjRef = selection(AXIS_SECOND_DIR_ID());
+ aShape = anObjRef->value();
+ if (!aShape.get()) {
+ if (anObjRef->context().get()) {
+ aShape = anObjRef->context()->shape();
+ }
+ }
+ if (!aShape.get()) {
+ setError(aSelectionError);
+ return;
+ }
+
+ if (aShape->isEdge())
+ {
+ anEdge = aShape->edge();
+ }
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ anEdge = anIt.current()->edge();
+ }
+
+ if (!anEdge.get())
+ {
+ setError(aSelectionError);
+ return;
+ }
+
+ std::shared_ptr<GeomAPI_Ax1> aSecondAxis(new GeomAPI_Ax1(anEdge->line()->location(),
+ anEdge->line()->direction()));
+
// Getting step.
double aFirstStep = real(FeaturesPlugin_MultiTranslation::STEP_FIRST_DIR_ID())->value();
double aSecondStep = real(FeaturesPlugin_MultiTranslation::STEP_SECOND_DIR_ID())->value();
}
}
} else {
+ std::string anError;
ListOfShape aListOfShape;
std::list<std::shared_ptr<GeomAlgoAPI_Translation> > aListOfTranslationAlgo;
aTranslationAlgo->build();
// Checking that the algorithm worked properly.
- if (!aTranslationAlgo->isDone()) {
- static const std::string aFeatureError = "Error : Multitranslation algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if (aTranslationAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error : Resulting shape is null.";
- setError(aShapeError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(
+ aTranslationAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
- if (!aTranslationAlgo->isValid()) {
- static const std::string aFeatureError = "Error : Resulting shape in not valid.";
- setError(aFeatureError);
- break;
- }
aListOfShape.push_back(aTranslationAlgo->shape());
aListOfTranslationAlgo.push_back(aTranslationAlgo);
}
std::shared_ptr<ModelAPI_ResultBody> theResultBody,
std::shared_ptr<GeomAPI_Shape> theBaseShape)
{
- int aTag = 1;
- int anIndex = 1;
- std::string aTranslatedName;
-
for (std::list<std::shared_ptr<GeomAlgoAPI_Translation> >::const_iterator anIt =
theListOfTranslationAlgo.begin(); anIt != theListOfTranslationAlgo.cend(); ++anIt) {
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = (*anIt)->mapOfSubShapes();
-
// naming of faces
- aTranslatedName = "Translated_Face_" + std::to_string((long long) anIndex);
- theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::FACE,
- aTag++, aTranslatedName, *aSubShapes.get(),
- false, true);
+ theResultBody->loadModifiedShapes(*anIt,
+ theBaseShape,
+ GeomAPI_Shape::FACE,
+ "Translated_Face");
// naming of edges
- aTranslatedName = "Translated_Edge_" + std::to_string((long long) anIndex);
- theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::EDGE,
- aTag++, aTranslatedName, *aSubShapes.get(),
- false, true);
+ theResultBody->loadModifiedShapes(*anIt,
+ theBaseShape,
+ GeomAPI_Shape::EDGE,
+ "Translated_Edge");
// naming of vertex
- aTranslatedName = "Translated_Vertex_" + std::to_string((long long) anIndex);
- theResultBody->loadAndOrientModifiedShapes((*anIt).get(), theBaseShape, GeomAPI_Shape::VERTEX,
- aTag++, aTranslatedName, *aSubShapes.get(),
- false, true);
-
- ++anIndex;
+ theResultBody->loadModifiedShapes(*anIt,
+ theBaseShape,
+ GeomAPI_Shape::VERTEX,
+ "Translated_Vertex");
}
}
#include <GeomAlgoAPI_MakeShapeList.h>
#include <GeomAlgoAPI_Partition.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_Face.h>
#include <GeomAPI_ShapeExplorer.h>
std::shared_ptr<GeomAlgoAPI_MakeShapeList>& theMakeShapeList,
std::string& theError);
-static bool isAlgoFailed(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
- std::string& theError);
-
//=================================================================================================
FeaturesPlugin_Partition::FeaturesPlugin_Partition()
new GeomAlgoAPI_Partition(aTargetObjects, aPlanes));
// Checking that the algorithm worked properly.
- if (isAlgoFailed(aPartitionAlgo, aError)) {
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPartitionAlgo, getKind(), aError)) {
setError(aError);
return;
}
aPartitionAlgo.reset(new GeomAlgoAPI_Partition(aTargetObjects, ListOfShape()));
// Checking that the algorithm worked properly.
- if (isAlgoFailed(aPartitionAlgo, aError)) {
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPartitionAlgo, getKind(), aError)) {
setError(aError);
return;
}
return;
}
- const int aDelTag = 1;
- /// sub solids will be placed at labels 3, 4, etc. if result is compound of solids
- const int aSubTag = 2;
- int aModTag = aSubTag + 10000;
- const std::string aModName = "Modified";
-
- aResultBody->storeModified(aBaseShape, theResultShape, aSubTag);
+ aResultBody->storeModified(aBaseShape, theResultShape);
std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = theMakeShape->mapOfSubShapes();
theObjects.insert(theObjects.end(), thePlanes.begin(), thePlanes.end());
- int anIndex = 1;
- for(ListOfShape::const_iterator anIt = theObjects.cbegin(); anIt != theObjects.cend(); ++anIt) {
+ for (ListOfShape::const_iterator anIt = theObjects.cbegin();
+ anIt != theObjects.cend();
+ ++anIt)
+ {
GeomShapePtr aShape = *anIt;
- std::string aModEdgeName = aModName + "_Edge_" + std::to_string((long long)anIndex);
- aResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), aShape, GeomAPI_Shape::EDGE,
- aModTag, aModEdgeName, *aMapOfSubShapes.get(), false, true, true);
- std::string aModFaceName = aModName + "_Face_" + std::to_string((long long)anIndex++);
- aResultBody->loadAndOrientModifiedShapes(theMakeShape.get(), aShape, GeomAPI_Shape::FACE,
- aModTag + 1, aModFaceName, *aMapOfSubShapes.get(), false, true, true);
- aResultBody->loadDeletedShapes(theMakeShape.get(), aShape, GeomAPI_Shape::FACE, aDelTag);
+ aResultBody->loadModifiedShapes(theMakeShape, aShape, GeomAPI_Shape::EDGE);
+ aResultBody->loadModifiedShapes(theMakeShape, aShape, GeomAPI_Shape::FACE);
+ aResultBody->loadDeletedShapes(theMakeShape, aShape, GeomAPI_Shape::FACE);
}
setResult(aResultBody, theIndex);
// cut from current list of solids
aCutAlgo.reset(
new GeomAlgoAPI_Boolean(aUIt->second, theTools, GeomAlgoAPI_Boolean::BOOL_CUT));
- if (isAlgoFailed(aCutAlgo, theError))
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCutAlgo, "", theError))
return false;
theMakeShapeList->appendAlgo(aCutAlgo);
return cutSubs(aFirstArgument, theObjects, aToolsForUsed, theMakeShapeList, theError)
&& cutSubs(aFirstArgument, theNotUsed, aToolsForUnused, theMakeShapeList, theError);
}
-
-bool isAlgoFailed(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo, std::string& theError)
-{
- if (!theAlgo->isDone()) {
- theError = "Error: Partition algorithm failed.";
- return true;
- }
- if (theAlgo->shape()->isNull()) {
- theError = "Error: Resulting shape is Null.";
- return true;
- }
- if (!theAlgo->isValid()) {
- theError = "Error: Resulting shape is not valid.";
- return true;
- }
-
- theError.clear();
- return false;
-}
#include <GeomAlgoAPI_CompoundBuilder.h>
#include <GeomAlgoAPI_Pipe.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <GeomAlgoAPI_Tools.h>
+
#include <GeomAPI_PlanarEdges.h>
#include <GeomAPI_ShapeExplorer.h>
static void storeSubShape(ResultBodyPtr theResultBody,
const GeomShapePtr theShape,
const GeomAPI_Shape::ShapeType theType,
- const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
const std::string theName,
- int& theShapeIndex,
- int& theTag);
+ int& theShapeIndex);
//==================================================================================================
FeaturesPlugin_Pipe::FeaturesPlugin_Pipe()
}
std::shared_ptr<GeomAPI_Shape> aPathShape =
std::dynamic_pointer_cast<GeomAPI_Shape>(aPathSelection->value());
- if(!aPathShape.get()) {
+ if(!aPathShape.get() && aPathSelection->context().get()) {
// Probaply it is a construction.
aPathShape = aPathSelection->context()->shape();
}
return;
}
aBiNormal = std::dynamic_pointer_cast<GeomAPI_Shape>(aBiNormalSelection->value());
- if(!aBiNormal.get()) {
+ if(!aBiNormal.get() && aBiNormalSelection->context().get()) {
// Probably it is a construction.
aBiNormal = aBiNormalSelection->context()->shape();
}
return;
}
std::shared_ptr<GeomAPI_Shape> aLocationShape = aLocationSelection->value();
- if(!aLocationShape.get()) {
+ if(!aLocationShape.get() && aLocationSelection->context().get()) {
// Probably it is a construction.
aLocationShape = aLocationSelection->context()->shape();
}
// Generating result for each object.
int aResultIndex = 0;
+ std::string anError;
if(aCreationMethod == CREATION_METHOD_SIMPLE() ||
aCreationMethod == CREATION_METHOD_BINORMAL()) {
for(ListOfShape::const_iterator
anIter = aBaseShapesList.cbegin(); anIter != aBaseShapesList.cend(); anIter++) {
std::shared_ptr<GeomAPI_Shape> aBaseShape = *anIter;
- GeomAlgoAPI_Pipe aPipeAlgo = aCreationMethod ==
- CREATION_METHOD_SIMPLE() ? GeomAlgoAPI_Pipe(aBaseShape, aPathShape) :
- GeomAlgoAPI_Pipe(aBaseShape, aPathShape, aBiNormal);
+ std::shared_ptr<GeomAlgoAPI_Pipe> aPipeAlgo(
+ aCreationMethod == CREATION_METHOD_SIMPLE() ? new GeomAlgoAPI_Pipe(aBaseShape,
+ aPathShape)
+ : new GeomAlgoAPI_Pipe(aBaseShape,
+ aPathShape,
+ aBiNormal));
- if(!aPipeAlgo.isDone()) {
- setError("Error: Pipe algorithm failed.");
- aResultIndex = 0;
- break;
- }
-
- // Check if shape is valid
- if(!aPipeAlgo.shape().get() || aPipeAlgo.shape()->isNull()) {
- setError("Error: Resulting shape is Null.");
- aResultIndex = 0;
- break;
- }
- if(!aPipeAlgo.isValid()) {
- setError("Error: Resulting shape is not valid.");
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPipeAlgo, getKind(), anError)) {
+ setError(anError);
aResultIndex = 0;
break;
}
storeResult(aBaseShape, aPipeAlgo, aResultIndex++);
}
} else if(aCreationMethod == CREATION_METHOD_LOCATIONS()) {
- GeomAlgoAPI_Pipe aPipeAlgo = GeomAlgoAPI_Pipe(aBaseShapesList, aLocations, aPathShape);
+ std::shared_ptr<GeomAlgoAPI_Pipe> aPipeAlgo(new GeomAlgoAPI_Pipe(aBaseShapesList,
+ aLocations,
+ aPathShape));
- if(!aPipeAlgo.isDone()) {
- setError("Error: Pipe algorithm failed.");
- removeResults(0);
- return;
- }
-
- // Check if shape is valid
- if(!aPipeAlgo.shape().get() || aPipeAlgo.shape()->isNull()) {
- setError("Error: Resulting shape is Null.");
- removeResults(0);
- return;
- }
- if(!aPipeAlgo.isValid()) {
- setError("Error: Resulting shape is not valid.");
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aPipeAlgo, getKind(), anError)) {
+ setError(anError);
removeResults(0);
return;
}
//==================================================================================================
void FeaturesPlugin_Pipe::storeResult(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- GeomAlgoAPI_Pipe& thePipeAlgo,
+ const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
const int theResultIndex)
{
// Create result body.
ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex);
// Store generated shape.
- aResultBody->storeGenerated(theBaseShape, thePipeAlgo.shape());
+ aResultBody->storeGenerated(theBaseShape, thePipeAlgo->shape());
// Store generated edges/faces.
GeomAPI_Shape::ShapeType aBaseShapeType = theBaseShape->shapeType();
GeomAPI_Shape::ShapeType aShapeTypeToExplode;
- int aGenTag = 1;
- std::string aGenName = "Generated_";
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = thePipeAlgo.mapOfSubShapes();
switch(aBaseShapeType) {
case GeomAPI_Shape::VERTEX: {
aShapeTypeToExplode = GeomAPI_Shape::VERTEX;
std::shared_ptr<GeomAPI_Vertex> aV1, aV2;
GeomAlgoAPI_ShapeTools::findBounds(theBaseShape, aV1, aV2);
ListOfShape aV1History, aV2History;
- thePipeAlgo.generated(aV1, aV1History);
- thePipeAlgo.generated(aV2, aV2History);
+ thePipeAlgo->generated(aV1, aV1History);
+ thePipeAlgo->generated(aV2, aV2History);
if(!aV1History.empty()) {
- aResultBody->generated(aV1, aV1History.front(), aGenName + "Edge_1", aGenTag++);
+ aResultBody->generated(aV1, aV1History.front());
}
if(!aV2History.empty()) {
- aResultBody->generated(aV2, aV2History.front(), aGenName + "Edge_2", aGenTag++);
+ aResultBody->generated(aV2, aV2History.front());
}
}
case GeomAPI_Shape::FACE:
if(aShapeTypeToExplode == GeomAPI_Shape::VERTEX ||
aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
- aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, theBaseShape, GeomAPI_Shape::VERTEX,
- aGenTag++, aGenName + "Edge", *aMapOfSubShapes.get());
+ aResultBody->loadGeneratedShapes(thePipeAlgo, theBaseShape, GeomAPI_Shape::VERTEX);
}
if(aShapeTypeToExplode == GeomAPI_Shape::EDGE ||
aShapeTypeToExplode == GeomAPI_Shape::COMPOUND) {
- aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, theBaseShape, GeomAPI_Shape::EDGE,
- aGenTag++, aGenName + "Face", *aMapOfSubShapes.get());
+ aResultBody->loadGeneratedShapes(thePipeAlgo, theBaseShape, GeomAPI_Shape::EDGE);
}
// Store from shapes.
- int aFromTag = aGenTag;
- storeShapes(aResultBody, aBaseShapeType, aMapOfSubShapes,
- thePipeAlgo.fromShapes(), "From_", aFromTag);
+ storeShapes(aResultBody, aBaseShapeType, thePipeAlgo->fromShapes(), "From_");
// Store to shapes.
- int aToTag = aFromTag;
- storeShapes(aResultBody, aBaseShapeType, aMapOfSubShapes, thePipeAlgo.toShapes(), "To_", aToTag);
+ storeShapes(aResultBody, aBaseShapeType, thePipeAlgo->toShapes(), "To_");
setResult(aResultBody, theResultIndex);
}
//==================================================================================================
void FeaturesPlugin_Pipe::storeResult(const ListOfShape& theBaseShapes,
- GeomAlgoAPI_Pipe& thePipeAlgo,
+ const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
const int theResultIndex)
{
// Create result body.
ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex);
// Store generated shape.
- aResultBody->storeGenerated(theBaseShapes.front(), thePipeAlgo.shape());
+ aResultBody->storeGenerated(theBaseShapes.front(), thePipeAlgo->shape());
// Store generated edges/faces.
- int aGenTag = 1;
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aMapOfSubShapes = thePipeAlgo.mapOfSubShapes();
-
- for(ListOfShape::const_iterator
- anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) {
+ for(ListOfShape::const_iterator anIter = theBaseShapes.cbegin();
+ anIter != theBaseShapes.cend();
+ ++anIter)
+ {
GeomShapePtr aBaseShape = *anIter;
GeomAPI_Shape::ShapeType aBaseShapeType = aBaseShape->shapeType();
GeomAPI_Shape::ShapeType aShapeTypeToExplode;
- std::string aGenName = "Generated_";
switch(aBaseShapeType) {
case GeomAPI_Shape::VERTEX: {
aShapeTypeToExplode = GeomAPI_Shape::VERTEX;
- aGenName += "Edge";
break;
}
case GeomAPI_Shape::EDGE:
std::shared_ptr<GeomAPI_Vertex> aV1, aV2;
GeomAlgoAPI_ShapeTools::findBounds(aBaseShape, aV1, aV2);
ListOfShape aV1History, aV2History;
- thePipeAlgo.generated(aV1, aV1History);
- thePipeAlgo.generated(aV2, aV2History);
- aResultBody->generated(aV1, aV1History.front(), aGenName + "Edge_1", aGenTag++);
- aResultBody->generated(aV2, aV2History.front(), aGenName + "Edge_2", aGenTag++);
+ thePipeAlgo->generated(aV1, aV1History);
+ thePipeAlgo->generated(aV2, aV2History);
+ aResultBody->generated(aV1, aV1History.front());
+ aResultBody->generated(aV2, aV2History.front());
}
case GeomAPI_Shape::FACE:
case GeomAPI_Shape::SHELL: {
aShapeTypeToExplode = GeomAPI_Shape::EDGE;
- aGenName += "Face";
break;
}
}
- aResultBody->loadAndOrientGeneratedShapes(&thePipeAlgo, aBaseShape, aShapeTypeToExplode,
- aGenTag++, aGenName, *aMapOfSubShapes.get());
+ aResultBody->loadGeneratedShapes(thePipeAlgo, aBaseShape, aShapeTypeToExplode);
}
// Store from shapes.
- int aFromTag = aGenTag;
- storeShapes(aResultBody, theBaseShapes.front()->shapeType(), aMapOfSubShapes,
- thePipeAlgo.fromShapes(), "From", aFromTag);
+ storeShapes(aResultBody, theBaseShapes.front()->shapeType(), thePipeAlgo->fromShapes(), "From_");
// Store to shapes.
- int aToTag = aFromTag;
- storeShapes(aResultBody, theBaseShapes.back()->shapeType(),
- aMapOfSubShapes, thePipeAlgo.toShapes(), "To", aToTag);
+ storeShapes(aResultBody, theBaseShapes.back()->shapeType(), thePipeAlgo->toShapes(), "To_");
setResult(aResultBody, theResultIndex);
//==================================================================================================
void FeaturesPlugin_Pipe::storeShapes(ResultBodyPtr theResultBody,
- const GeomAPI_Shape::ShapeType theBaseShapeType,
- const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
- const ListOfShape& theShapes,
- const std::string theName,
- int& theTag)
+ const GeomAPI_Shape::ShapeType theBaseShapeType,
+ const ListOfShape& theShapes,
+ const std::string theName)
{
GeomAPI_Shape::ShapeType aShapeTypeToExplore = GeomAPI_Shape::FACE;
std::string aShapeTypeStr = "Face";
if(aShapeTypeToExplore == GeomAPI_Shape::COMPOUND) {
std::string aName = theName + (aShape->shapeType() == GeomAPI_Shape::EDGE ? "Edge" : "Face");
- storeSubShape(theResultBody,
- aShape,
+ storeSubShape(theResultBody, aShape,
aShape->shapeType(),
- theMapOfSubShapes,
aName,
- aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex,
- theTag);
+ aShape->shapeType() == GeomAPI_Shape::EDGE ? aShapeIndex : aFaceIndex);
} else {
std::string aName = theName + aShapeTypeStr;
- storeSubShape(theResultBody, aShape, aShapeTypeToExplore,
- theMapOfSubShapes, aName, aShapeIndex, theTag);
+ storeSubShape(theResultBody, aShape, aShapeTypeToExplore, aName, aShapeIndex);
}
}
}
void storeSubShape(ResultBodyPtr theResultBody,
const GeomShapePtr theShape,
const GeomAPI_Shape::ShapeType theType,
- const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
const std::string theName,
- int& theShapeIndex,
- int& theTag)
+ int& theShapeIndex)
{
for(GeomAPI_ShapeExplorer anExp(theShape, theType); anExp.more(); anExp.next()) {
GeomShapePtr aSubShape = anExp.current();
- if(theMapOfSubShapes->isBound(aSubShape)) {
- aSubShape = theMapOfSubShapes->find(aSubShape);
- }
std::ostringstream aStr;
aStr << theName << "_" << theShapeIndex++;
- theResultBody->generated(aSubShape, aStr.str(), theTag++);
+ theResultBody->generated(aSubShape, aStr.str());
}
}
private:
void storeResult(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
- GeomAlgoAPI_Pipe& thePipeAlgo,
+ const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
const int theResultIndex = 0);
void storeResult(const ListOfShape& theBaseShapes,
- GeomAlgoAPI_Pipe& thePipeAlgo,
+ const std::shared_ptr<GeomAlgoAPI_Pipe> thePipeAlgo,
const int theResultIndex = 0);
void storeShapes(ResultBodyPtr theResultBody,
const GeomAPI_Shape::ShapeType theBaseShapeType,
- const std::shared_ptr<GeomAPI_DataMapOfShapeShape> theMapOfSubShapes,
const ListOfShape& theShapes,
- const std::string theName,
- int& theTag);
+ const std::string theName);
};
#endif
#include <GeomAPI_Edge.h>
#include <GeomAPI_Face.h>
#include <GeomAPI_Pln.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAlgoAPI_Placement.h>
#include <GeomAlgoAPI_Transform.h>
+#include <GeomAlgoAPI_Tools.h>
#include <FeaturesPlugin_Tools.h>
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) { // may be for not-activated parts
- eraseResults();
return;
}
anObjects.push_back(anObject);
// Verify planarity of faces and linearity of edges
std::shared_ptr<GeomAPI_Shape> aShapes[2] = {aStartShape, anEndShape};
for (int i = 0; i < 2; i++) {
- if (aShapes[i]->isFace()) {
- std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aShapes[i]));
- if (!aFace->isPlanar()) {
- static const std::string aPlanarityError = "Error: One of selected faces is not planar.";
- setError(aPlanarityError);
- return;
- }
- }
- else if (aShapes[i]->isEdge()) {
- std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShapes[i]));
- if (!anEdge->isLine()) {
- static const std::string aLinearityError = "Error: One of selected endges is not linear.";
- setError(aLinearityError);
- return;
- }
+ if (!isShapeValid(aShapes[i])) {
+ return;
}
}
// Applying transformation to each object.
int aResultIndex = 0;
+ std::string anError;
std::list<ResultPtr>::iterator aContext = aContextes.begin();
for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
anObjectsIt++, aContext++) {
setResult(aResultPart, aResultIndex);
} else {
std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
- GeomAlgoAPI_Transform aTransformAlgo(aBaseShape, aTrsf);
+ std::shared_ptr<GeomAlgoAPI_Transform> aTransformAlgo(new GeomAlgoAPI_Transform(aBaseShape,
+ aTrsf));
// Checking that the algorithm worked properly.
- if(!aTransformAlgo.isDone()) {
- static const std::string aFeatureError = "Error: Transform algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if(aTransformAlgo.shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- break;
- }
- if(!aTransformAlgo.isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTransformAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
//LoadNamingDS
- std::shared_ptr<ModelAPI_ResultBody> aResultBody =
- document()->createBody(data(), aResultIndex);
- loadNamingDS(aTransformAlgo, aResultBody, aBaseShape);
+ ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
+ aResultBody->storeModified(aBaseShape, aTransformAlgo->shape());
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aTransformAlgo, "Placed");
setResult(aResultBody, aResultIndex);
}
aResultIndex++;
removeResults(aResultIndex);
}
-//============================================================================
-void FeaturesPlugin_Placement::loadNamingDS(GeomAlgoAPI_Transform& theTransformAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBaseShape)
+//==================================================================================================
+bool FeaturesPlugin_Placement::isShapeValid(GeomShapePtr theShape)
{
- //load result
- theResultBody->storeModified(theBaseShape, theTransformAlgo.shape());
+ if (theShape->isCompound()) {
+ GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::SHAPE;
+ for (GeomAPI_ShapeIterator anIt(theShape); anIt.more(); anIt.next()) {
+ GeomShapePtr aCurrentShape = anIt.current();
+ if (aShapeType == GeomAPI_Shape::SHAPE) {
+ aShapeType = aCurrentShape->shapeType();
+ }
+ else if (aShapeType != aCurrentShape->shapeType()) {
+ static const std::string aLinearityError =
+ "Error: Selected compound contains shapes with different types.";
+ setError(aLinearityError);
+ return false;
+ }
- std::string aPlacedName = "Placed";
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theTransformAlgo.mapOfSubShapes();
+ if (!isShapeValid(aCurrentShape)) {
+ return false;
+ }
+ }
+ }
+ else if (theShape->isFace()) {
+ std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(theShape));
+ if (!aFace->isPlanar()) {
+ static const std::string aPlanarityError = "Error: One of selected faces is not planar.";
+ setError(aPlanarityError);
+ return false;
+ }
+ }
+ else if (theShape->isEdge()) {
+ std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(theShape));
+ if (!anEdge->isLine()) {
+ static const std::string aLinearityError = "Error: One of selected edges is not linear.";
+ setError(aLinearityError);
+ return false;
+ }
+ }
- FeaturesPlugin_Tools::storeModifiedShapes(theTransformAlgo, theResultBody,
- theBaseShape, 1, 2, 3, aPlacedName,
- *aSubShapes.get());
+ return true;
}
/// Use plugin manager for features creation
FeaturesPlugin_Placement();
private:
- /// Load Naming data structure of the feature to the document
- void loadNamingDS(GeomAlgoAPI_Transform& theTransformAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBaseShape);
+ /// Checks validity of passed shape.
+ bool isShapeValid(GeomShapePtr theShape);
};
#endif
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_Tools.h>
#include <GeomAlgoAPI_Copy.h>
+#include <GeomAlgoAPI_Tools.h>
FeaturesPlugin_Recover::FeaturesPlugin_Recover()
{
void FeaturesPlugin_Recover::execute()
{
+ std::string anError;
int aResultIndex = 0;
AttributeRefListPtr aRecovered = reflist(RECOVERED_ENTITIES());
for(int anIndex = aRecovered->size() - 1; anIndex >= 0; anIndex--) {
continue;
// Copy shape.
- GeomAlgoAPI_Copy aCopyAlgo(aShape);
+ std::shared_ptr<GeomAlgoAPI_Copy> aCopyAlgo(new GeomAlgoAPI_Copy(aShape));
// Check that algo is done.
- if(!aCopyAlgo.isDone()) {
- setError("Error: recover algorithm failed.");
- return;
- }
- // Check if shape is not null.
- if(!aCopyAlgo.shape().get() || aCopyAlgo.shape()->isNull()) {
- setError("Error: resulting shape is null.");
- return;
- }
- // Check that resulting shape is valid.
- if(!aCopyAlgo.isValid()) {
- setError("Error: resulting shape is not valid.");
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aCopyAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
// Store result.
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- aResultBody->store(aCopyAlgo.shape());//, aCopyAlgo.shape());
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = aCopyAlgo.mapOfSubShapes();
- // like in import: forget any history
- int aTag(1);
- std::string aNameMS = "Shape";
- aResultBody->loadFirstLevel(aCopyAlgo.shape(), aNameMS, aTag);
+ aResultBody->store(aCopyAlgo->shape());//, aCopyAlgo.shape());
+
+ aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::VERTEX);
+ aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::EDGE);
+ aResultBody->loadModifiedShapes(aCopyAlgo, aShape, GeomAPI_Shape::FACE);
setResult(aResultBody, aResultIndex);
++aResultIndex;
aResultShape = anAttrSelectionInList->value();
}
// deleted and copied must be jointed to one list which keeps all the history
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
// find all removed shapes
std::shared_ptr<GeomAlgoAPI_MakeShapeCustom> aDeletedSubs(new GeomAlgoAPI_MakeShapeCustom);
}
}
}
- aMakeShapeList.appendAlgo(aDeletedSubs);
+ aMakeShapeList->appendAlgo(aDeletedSubs);
std::shared_ptr<GeomAlgoAPI_Copy> aCopy(new GeomAlgoAPI_Copy(aResultShape));
aResultShape = aCopy->shape();
- aMakeShapeList.appendAlgo(aCopy);
+ aMakeShapeList->appendAlgo(aCopy);
if (aResultShape->shapeType() == GeomAPI_Shape::COMPOUND) {
aResultShape = GeomAlgoAPI_ShapeTools::groupSharedTopology(aResultShape);
// Store result.
ResultBodyPtr aResultBody = document()->createBody(data());
- aResultBody->storeModified(aBaseShape, aResultShape, 1);
- std::set<GeomAPI_Shape::ShapeType>::iterator aTypeIter = aTypes.begin();
- for(; aTypeIter != aTypes.end(); aTypeIter++)
- aResultBody->loadDeletedShapes(&aMakeShapeList, aBaseShape, *aTypeIter, 1);
- aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, aBaseShape, GeomAPI_Shape::FACE,
- 2, "Modified_Face", *aMakeShapeList.mapOfSubShapes().get(), true, false, true);
- aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, aBaseShape, GeomAPI_Shape::EDGE,
- 3, "Modified_Edge", *aMakeShapeList.mapOfSubShapes().get(), false, false, true);
- aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, aBaseShape, GeomAPI_Shape::VERTEX,
- 4, "Modified_Vertex", *aMakeShapeList.mapOfSubShapes().get());
+ aResultBody->storeModified(aBaseShape, aResultShape);
+ for (std::set<GeomAPI_Shape::ShapeType>::iterator aTypeIter = aTypes.begin();
+ aTypeIter != aTypes.end();
+ ++aTypeIter)
+ {
+ aResultBody->loadDeletedShapes(aMakeShapeList, aBaseShape, *aTypeIter);
+ }
+
+ aResultBody->loadModifiedShapes(aMakeShapeList,
+ aBaseShape,
+ GeomAPI_Shape::FACE);
+ aResultBody->loadModifiedShapes(aMakeShapeList,
+ aBaseShape,
+ GeomAPI_Shape::EDGE);
+ aResultBody->loadModifiedShapes(aMakeShapeList,
+ aBaseShape,
+ GeomAPI_Shape::VERTEX);
setResult(aResultBody);
}
#include <ModelAPI_Validator.h>
#include <GeomAlgoAPI_Revolution.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
//=================================================================================================
FeaturesPlugin_Revolution::FeaturesPlugin_Revolution()
// Getting base shapes.
getBaseShapes(theBaseShapes);
- //Getting axis.
- std::shared_ptr<GeomAPI_Ax1> anAxis;
- std::shared_ptr<GeomAPI_Edge> anEdge;
+ // Getting axis.
+ static const std::string aSelectionError = "Error: The axis shape selection is bad.";
AttributeSelectionPtr aSelection = selection(AXIS_OBJECT_ID());
- if(aSelection.get() && aSelection->value().get() && aSelection->value()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->value()));
- } else if(aSelection->context().get() &&
- aSelection->context()->shape().get() &&
- aSelection->context()->shape()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->context()->shape()));
+ GeomShapePtr aShape = aSelection->value();
+ if (!aShape.get()) {
+ if (aSelection->context().get()) {
+ aShape = aSelection->context()->shape();
+ }
+ }
+ if (!aShape.get()) {
+ setError(aSelectionError);
+ return false;
+ }
+
+ GeomEdgePtr anEdge;
+ if (aShape->isEdge())
+ {
+ anEdge = aShape->edge();
+ }
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ anEdge = anIt.current()->edge();
}
+ else
+ {
+ setError(aSelectionError);
+ return false;
+ }
+
+ std::shared_ptr<GeomAPI_Ax1> anAxis;
if(anEdge.get()) {
if(anEdge->isLine()) {
anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
if(!aToShape.get() && aSelection->context().get()) {
aToShape = aSelection->context()->shape();
}
+ if (aToShape.get() && aToShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aToShape);
+ aToShape = anIt.current();
+ }
}
aSelection = selection(FROM_OBJECT_ID());
if(aSelection.get()) {
if(!aFromShape.get() && aSelection->context().get()) {
aFromShape = aSelection->context()->shape();
}
+ if (aFromShape.get() && aFromShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aFromShape);
+ aFromShape = anIt.current();
+ }
}
}
// Generating result for each base shape.
+ std::string anError;
for(ListOfShape::const_iterator
anIter = theBaseShapes.cbegin(); anIter != theBaseShapes.cend(); anIter++) {
GeomShapePtr aBaseShape = *anIter;
aBaseShape, anAxis,
aToShape, aToAngle,
aFromShape, aFromAngle));
- if(!isMakeShapeValid(aRevolAlgo)) {
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRevolAlgo, getKind(), anError)) {
+ setError(anError);
return false;
}
//=================================================================================================
void FeaturesPlugin_RevolutionBoolean::storeGenerationHistory(ResultBodyPtr theResultBody,
const GeomShapePtr theBaseShape,
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
- int& theTag)
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
{
- FeaturesPlugin_Revolution::storeGenerationHistory(theResultBody, theBaseShape,
- theMakeShape, theTag);
+ FeaturesPlugin_Revolution::storeGenerationHistory(theResultBody, theBaseShape, theMakeShape);
}
/// Stores generation history.
void storeGenerationHistory(ResultBodyPtr theResultBody,
const GeomShapePtr theBaseShape,
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
- int& theTag);
+ const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
};
#endif
#include <ModelAPI_ResultPart.h>
#include <GeomAlgoAPI_PointBuilder.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_Trsf.h>
#include <FeaturesPlugin_Tools.h>
}
//Getting axis.
- std::shared_ptr<GeomAPI_Ax1> anAxis;
- std::shared_ptr<GeomAPI_Edge> anEdge;
- std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
- selection(FeaturesPlugin_Rotation::AXIS_OBJECT_ID());
- if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
- } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
- anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+ static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+ AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID());
+ GeomShapePtr aShape = anObjRef->value();
+ if (!aShape.get()) {
+ if (anObjRef->context().get()) {
+ aShape = anObjRef->context()->shape();
+ }
+ }
+ if (!aShape.get()) {
+ setError(aSelectionError);
+ return;
+ }
+
+ GeomEdgePtr anEdge;
+ if (aShape->isEdge())
+ {
+ anEdge = aShape->edge();
+ }
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ anEdge = anIt.current()->edge();
}
- if(anEdge) {
- anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
- anEdge->line()->direction()));
+
+ if (!anEdge.get())
+ {
+ setError(aSelectionError);
+ return;
}
+ std::shared_ptr<GeomAPI_Ax1> anAxis (new GeomAPI_Ax1(anEdge->line()->location(),
+ anEdge->line()->direction()));
+
// Getting angle.
double anAngle = real(FeaturesPlugin_Rotation::ANGLE_ID())->value();
// Rotating each object.
+ std::string anError;
int aResultIndex = 0;
std::list<ResultPtr>::iterator aContext = aContextes.begin();
for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
aResultPart->setTrsf(*aContext, aTrsf);
setResult(aResultPart, aResultIndex);
} else {
- GeomAlgoAPI_Rotation aRotationAlgo(aBaseShape, anAxis, anAngle);
+ std::shared_ptr<GeomAlgoAPI_Rotation> aRotationAlgo(new GeomAlgoAPI_Rotation(aBaseShape,
+ anAxis,
+ anAngle));
- if (!aRotationAlgo.check()) {
- setError(aRotationAlgo.getError());
+ if (!aRotationAlgo->check()) {
+ setError(aRotationAlgo->getError());
return;
}
- aRotationAlgo.build();
+ aRotationAlgo->build();
// Checking that the algorithm worked properly.
- if(!aRotationAlgo.isDone()) {
- static const std::string aFeatureError = "Error: Rotation algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if(aRotationAlgo.shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- break;
- }
- if(!aRotationAlgo.isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- loadNamingDS(aRotationAlgo, aResultBody, aBaseShape);
+ aResultBody->storeModified(aBaseShape, aRotationAlgo->shape());
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aRotationAlgo, "Rotated");
setResult(aResultBody, aResultIndex);
}
aResultIndex++;
selection(FeaturesPlugin_Rotation::START_POINT_ID());
std::shared_ptr<ModelAPI_AttributeSelection> anEndPointRef =
selection(FeaturesPlugin_Rotation::END_POINT_ID());
- if ((aCenterRef.get() != NULL) && (aStartPointRef.get() != NULL)
- && (anEndPointRef.get() != NULL)) {
+ if ((aCenterRef.get() != NULL) &&
+ (aStartPointRef.get() != NULL) &&
+ (anEndPointRef.get() != NULL)) {
GeomShapePtr aCenterShape = aCenterRef->value();
- if (!aCenterShape.get())
+ if (!aCenterShape.get() && aCenterRef->context().get())
aCenterShape = aCenterRef->context()->shape();
GeomShapePtr aStartShape = aStartPointRef->value();
- if (!aStartShape.get())
+ if (!aStartShape.get() && aStartPointRef->context().get())
aStartShape = aStartPointRef->context()->shape();
- GeomShapePtr anEndShape = anEndPointRef->value();
- if (!anEndShape.get())
+ GeomShapePtr anEndShape = anEndPointRef->value();
+ if (!anEndShape.get() && anEndPointRef->context().get())
anEndShape = anEndPointRef->context()->shape();
if (aStartShape && anEndShape && aCenterShape) {
aCenterPoint = GeomAlgoAPI_PointBuilder::point(aCenterShape);
}
// Rotating each object.
+ std::string anError;
int aResultIndex = 0;
std::list<ResultPtr>::iterator aContext = aContextes.begin();
for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
aResultPart->setTrsf(*aContext, aTrsf);
setResult(aResultPart, aResultIndex);
} else {
- GeomAlgoAPI_Rotation aRotationAlgo(aBaseShape, aCenterPoint, aStartPoint, anEndPoint);
+ std::shared_ptr<GeomAlgoAPI_Rotation> aRotationAlgo(new GeomAlgoAPI_Rotation(aBaseShape,
+ aCenterPoint,
+ aStartPoint,
+ anEndPoint));
- if (!aRotationAlgo.check()) {
- setError(aRotationAlgo.getError());
+ if (!aRotationAlgo->check()) {
+ setError(aRotationAlgo->getError());
return;
}
- aRotationAlgo.build();
+ aRotationAlgo->build();
// Checking that the algorithm worked properly.
- if(!aRotationAlgo.isDone()) {
- static const std::string aFeatureError = "Error: Rotation algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if(aRotationAlgo.shape()->isNull()) {
- static const std::string aShapeError = "Error : Resulting shape is Null.";
- setError(aShapeError);
- break;
- }
- if(!aRotationAlgo.isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aRotationAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- loadNamingDS(aRotationAlgo, aResultBody, aBaseShape);
+ aResultBody->storeModified(aBaseShape, aRotationAlgo->shape());
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aRotationAlgo, "Rotated");
setResult(aResultBody, aResultIndex);
}
aResultIndex++;
}
}
-
-//=================================================================================================
-void FeaturesPlugin_Rotation::loadNamingDS(GeomAlgoAPI_Rotation& theRotaionAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBaseShape)
-{
- // Store result.
- theResultBody->storeModified(theBaseShape, theRotaionAlgo.shape());
-
- std::string aRotatedName = "Rotated";
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theRotaionAlgo.mapOfSubShapes();
-
- FeaturesPlugin_Tools::storeModifiedShapes(theRotaionAlgo, theResultBody,
- theBaseShape, 1, 2, 3, aRotatedName,
- *aSubShapes.get());
-}
///Perform the rotation using a center and two points.
void performTranslationByThreePoints();
-
- void loadNamingDS(GeomAlgoAPI_Rotation& theRotaionAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBaseShape);
};
#endif
#include <FeaturesPlugin_Scale.h>
#include <GeomAlgoAPI_PointBuilder.h>
+#include <GeomAlgoAPI_Tools.h>
#include <ModelAPI_AttributeDouble.h>
#include <ModelAPI_AttributeSelectionList.h>
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) { // may be for not-activated parts
- eraseResults();
return;
}
anObjects.push_back(anObject);
double aScaleFactor = real(FeaturesPlugin_Scale::SCALE_FACTOR_ID())->value();
// Moving each object.
+ std::string anError;
int aResultIndex = 0;
std::list<ResultPtr>::iterator aContext = aContextes.begin();
for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
anObjectsIt++, aContext++) {
std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
- GeomAlgoAPI_Scale aScaleAlgo(aBaseShape, aCenterPoint, aScaleFactor);
+ std::shared_ptr<GeomAlgoAPI_Scale> aScaleAlgo(
+ new GeomAlgoAPI_Scale(aBaseShape, aCenterPoint, aScaleFactor));
- if (!aScaleAlgo.check()) {
- setError(aScaleAlgo.getError());
+ if (!aScaleAlgo->check()) {
+ setError(aScaleAlgo->getError());
return;
}
- aScaleAlgo.build();
+ aScaleAlgo->build();
// Checking that the algorithm worked properly.
- if(!aScaleAlgo.isDone()) {
- static const std::string aFeatureError = "Error: Symmetry algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if(aScaleAlgo.shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- break;
- }
- if(!aScaleAlgo.isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aScaleAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- loadNamingDS(aScaleAlgo, aResultBody, aBaseShape);
+ aResultBody->storeModified(aBaseShape, aScaleAlgo->shape());
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aScaleAlgo, "Scaled");
setResult(aResultBody, aResultIndex);
aResultIndex++;
}
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) { // may be for not-activated parts
- eraseResults();
return;
}
anObjects.push_back(anObject);
double aScaleFactorZ = real(FeaturesPlugin_Scale::SCALE_FACTOR_Z_ID())->value();
// Moving each object.
+ std::string anError;
int aResultIndex = 0;
std::list<ResultPtr>::iterator aContext = aContextes.begin();
for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
anObjectsIt++, aContext++) {
std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
- GeomAlgoAPI_Scale aScaleAlgo(aBaseShape, aCenterPoint,
- aScaleFactorX, aScaleFactorY, aScaleFactorZ);
-
- if (!aScaleAlgo.check()) {
- setError(aScaleAlgo.getError());
+ std::shared_ptr<GeomAlgoAPI_Scale> aScaleAlgo(new GeomAlgoAPI_Scale(aBaseShape,
+ aCenterPoint,
+ aScaleFactorX,
+ aScaleFactorY,
+ aScaleFactorZ));
+
+ if (!aScaleAlgo->check()) {
+ setError(aScaleAlgo->getError());
return;
}
- aScaleAlgo.build();
+ aScaleAlgo->build();
// Checking that the algorithm worked properly.
- if(!aScaleAlgo.isDone()) {
- static const std::string aFeatureError = "Error: Symmetry algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if(aScaleAlgo.shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- break;
- }
- if(!aScaleAlgo.isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aScaleAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- loadNamingDS(aScaleAlgo, aResultBody, aBaseShape);
+ aResultBody->storeModified(aBaseShape, aScaleAlgo->shape());
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, aBaseShape, aScaleAlgo, "Scaled");
setResult(aResultBody, aResultIndex);
aResultIndex++;
}
// Remove the rest results if there were produced in the previous pass.
removeResults(aResultIndex);
}
-
-//=================================================================================================
-void FeaturesPlugin_Scale::loadNamingDS(GeomAlgoAPI_Scale& theScaleAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBaseShape)
-{
- // Store and name the result.
- theResultBody->storeModified(theBaseShape, theScaleAlgo.shape());
-
- // Name the faces
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theScaleAlgo.mapOfSubShapes();
- std::string aScaledName = "Scaled";
- FeaturesPlugin_Tools::storeModifiedShapes(theScaleAlgo, theResultBody,
- theBaseShape, 1, 2, 3, aScaledName,
- *aSubShapes.get());
-}
/// Perform symmetry using a central point and three dimensions
void performScaleByDimensions();
-
- /// Perform the naming
- void loadNamingDS(GeomAlgoAPI_Scale& theScaleAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBaseShape);
};
#endif // FEATURESPLUGIN_SCALE_H_
\ No newline at end of file
#include <GeomAlgoAPI_FaceBuilder.h>
#include <GeomAlgoAPI_Copy.h>
#include <GeomAlgoAPI_MakeShapeList.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Face.h>
#include <GeomAPI_Lin.h>
#include <GeomAPI_Pln.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_Trsf.h>
#include <ModelAPI_AttributeBoolean.h>
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if (!anObject.get()) { // may be for not-activated parts
- eraseResults();
return false;
}
theSourceShapes.push_back(anObject);
}
// Moving each object.
+ std::string anError;
int aResultIndex = 0;
std::list<ResultPtr>::iterator aContext = aContextes.begin();
for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
aSymmetryAlgo->build();
// Checking that the algorithm worked properly.
- if(!aSymmetryAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Symmetry algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if(aSymmetryAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- break;
- }
- if(!aSymmetryAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSymmetryAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
return;
//Getting axis.
- std::shared_ptr<GeomAPI_Ax1> anAxis;
- std::shared_ptr<GeomAPI_Edge> anEdge;
- std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
- selection(FeaturesPlugin_Symmetry::AXIS_OBJECT_ID());
- if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
- } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
- anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+ static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+ AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID());
+ GeomShapePtr aShape = anObjRef->value();
+ if (!aShape.get()) {
+ if (anObjRef->context().get()) {
+ aShape = anObjRef->context()->shape();
+ }
+ }
+ if (!aShape.get()) {
+ setError(aSelectionError);
+ return;
+ }
+
+ GeomEdgePtr anEdge;
+ if (aShape->isEdge())
+ {
+ anEdge = aShape->edge();
}
- if(anEdge) {
- anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
- anEdge->line()->direction()));
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ anEdge = anIt.current()->edge();
}
+ if (!anEdge.get())
+ {
+ setError(aSelectionError);
+ return;
+ }
+
+ std::shared_ptr<GeomAPI_Ax1> anAxis (new GeomAPI_Ax1(anEdge->line()->location(),
+ anEdge->line()->direction()));
+
+
// Moving each object.
+ std::string anError;
int aResultIndex = 0;
std::list<ResultPtr>::iterator aContext = aContextes.begin();
for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
aSymmetryAlgo->build();
// Checking that the algorithm worked properly.
- if(!aSymmetryAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Symmetry algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if(aSymmetryAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- break;
- }
- if(!aSymmetryAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSymmetryAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
if (!collectSourceObjects(anObjects, aContextes))
return;
- //Getting axis.
- std::shared_ptr<GeomAPI_Ax2> aPlane;
- std::shared_ptr<GeomAPI_Pln> aPln;
- std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
- selection(FeaturesPlugin_Symmetry::PLANE_OBJECT_ID());
- if (anObjRef && anObjRef->value() && anObjRef->value()->isFace()) {
- aPln = std::shared_ptr<GeomAPI_Face>(new GeomAPI_Face(anObjRef->value()))->getPlane();
+ //Getting plane.
+ static const std::string aSelectionError = "Error: The plane shape selection is bad.";
+ AttributeSelectionPtr anObjRef = selection(PLANE_OBJECT_ID());
+ GeomShapePtr aShape = anObjRef->value();
+ if (!aShape.get()) {
+ if (anObjRef->context().get()) {
+ aShape = anObjRef->context()->shape();
+ }
+ }
+ if (!aShape.get()) {
+ setError(aSelectionError);
+ return;
}
- else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
- anObjRef->context()->shape() && anObjRef->context()->shape()->isFace()) {
- aPln =
- std::shared_ptr<GeomAPI_Face>(new GeomAPI_Face(anObjRef->context()->shape()))->getPlane();
+
+ GeomFacePtr aFace;
+ if (aShape->isFace())
+ {
+ aFace = aShape->face();
}
- if (aPln) {
- aPlane = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aPln->location(),
- aPln->direction()));
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ aFace = anIt.current()->face();
}
+ if (!aFace.get())
+ {
+ setError(aSelectionError);
+ return;
+ }
+
+ std::shared_ptr<GeomAPI_Ax2> aPlane(new GeomAPI_Ax2(aFace->getPlane()->location(),
+ aFace->getPlane()->direction()));
+
+
// Moving each object.
+ std::string anError;
int aResultIndex = 0;
std::list<ResultPtr>::iterator aContext = aContextes.begin();
for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
aSymmetryAlgo->build();
// Checking that the algorithm worked properly.
- if(!aSymmetryAlgo->isDone()) {
- static const std::string aFeatureError = "Error: Symmetry algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if(aSymmetryAlgo->shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- break;
- }
- if(!aSymmetryAlgo->isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aSymmetryAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
std::shared_ptr<GeomAlgoAPI_Symmetry>& theSymmetryAlgo,
std::shared_ptr<GeomAPI_Shape> theBaseShape, int theResultIndex)
{
- GeomAlgoAPI_MakeShapeList anAlgoList;
- anAlgoList.appendAlgo(theSymmetryAlgo);
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> anAlgoList(new GeomAlgoAPI_MakeShapeList());
+ anAlgoList->appendAlgo(theSymmetryAlgo);
// Compose source shape and the result of symmetry.
GeomShapePtr aCompound;
if (boolean(KEEP_ORIGINAL_RESULT())->value()) {
// add a copy of a base shape otherwise selection of this base shape is bad (2592)
std::shared_ptr<GeomAlgoAPI_Copy> aCopyAlgo(new GeomAlgoAPI_Copy(theBaseShape));
aShapes.push_back(aCopyAlgo->shape());
- anAlgoList.appendAlgo(aCopyAlgo);
+ anAlgoList->appendAlgo(aCopyAlgo);
aShapes.push_back(theSymmetryAlgo->shape());
aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
// Store and name the result.
ResultBodyPtr aResultBody = document()->createBody(data(), theResultIndex);
aResultBody->storeModified(theBaseShape, aCompound);
- loadNamingDS(anAlgoList, aResultBody, theBaseShape);
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody, theBaseShape, anAlgoList, "Symmetried");
setResult(aResultBody, theResultIndex);
}
aResultPart->setTrsf(theOriginal, theTrsf);
setResult(aResultPart, theResultIndex);
}
-
-//=================================================================================================
-void FeaturesPlugin_Symmetry::loadNamingDS(GeomAlgoAPI_MakeShapeList& theAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBaseShape)
-{
- // Name the faces
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theAlgo.mapOfSubShapes();
- std::string aReflectedName = "Symmetried";
- FeaturesPlugin_Tools::storeModifiedShapes(theAlgo, theResultBody,
- theBaseShape, 1, 2, 3, aReflectedName,
- *aSubShapes.get());
-}
/// Perform symmetry with respect to a plane.
void performSymmetryByPlane();
- /// Perform the naming
- void loadNamingDS(GeomAlgoAPI_MakeShapeList& theSymmetryAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBaseShape);
-
/// Create new result on given shapes and the index of result
void buildResult(std::shared_ptr<GeomAlgoAPI_Symmetry>& theSymmetryAlgo,
std::shared_ptr<GeomAPI_Shape> theBaseShape,
#include <GeomAPI_ShapeIterator.h>
-void FeaturesPlugin_Tools::storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const int theFaceTag,
- const int theEdgeTag,
- const int theVertexTag,
- const std::string theName,
- GeomAPI_DataMapOfShapeShape& theSubShapes)
+//==================================================================================================
+void FeaturesPlugin_Tools::loadModifiedShapes(ResultBodyPtr theResultBody,
+ const GeomShapePtr theBaseShape,
+ const ListOfShape& theTools,
+ const GeomMakeShapePtr& theMakeShape,
+ const GeomShapePtr theResultShape)
+{
+ if (theBaseShape->isEqual(theResultShape)) {
+ theResultBody->store(theResultShape, false);
+ return;
+ }
+
+ theResultBody->storeModified(theBaseShape, theResultShape);
+
+ ListOfShape aShapes = theTools;
+ aShapes.push_front(theBaseShape);
+
+ for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); ++anIter)
+ {
+ theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::VERTEX);
+ theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::EDGE);
+ theResultBody->loadModifiedShapes(theMakeShape, *anIter, GeomAPI_Shape::FACE);
+ }
+}
+
+//==================================================================================================
+void FeaturesPlugin_Tools::loadModifiedShapes(ResultBodyPtr theResultBody,
+ const GeomShapePtr theBaseShape,
+ const GeomMakeShapePtr& theMakeShape,
+ const std::string theName)
{
switch(theBaseShape->shapeType()) {
case GeomAPI_Shape::COMPOUND: {
for(GeomAPI_ShapeIterator anIt(theBaseShape); anIt.more(); anIt.next())
{
- storeModifiedShapes(theAlgo,
- theResultBody,
- anIt.current(),
- theFaceTag,
- theEdgeTag,
- theVertexTag,
- theName,
- theSubShapes);
+ loadModifiedShapes(theResultBody,
+ anIt.current(),
+ theMakeShape,
+ theName);
}
break;
}
case GeomAPI_Shape::COMPSOLID:
case GeomAPI_Shape::SOLID:
case GeomAPI_Shape::SHELL: {
- theResultBody->loadAndOrientModifiedShapes(&theAlgo,
- theBaseShape, GeomAPI_Shape::FACE,
- theFaceTag, theName + "_Face", theSubShapes, false, true);
+ theResultBody->loadModifiedShapes(theMakeShape,
+ theBaseShape,
+ GeomAPI_Shape::FACE,
+ theName);
}
case GeomAPI_Shape::FACE:
case GeomAPI_Shape::WIRE: {
- theResultBody->loadAndOrientModifiedShapes(&theAlgo,
- theBaseShape, GeomAPI_Shape::EDGE,
- theEdgeTag, theName + "_Edge", theSubShapes, false, true);
+ theResultBody->loadModifiedShapes(theMakeShape,
+ theBaseShape,
+ GeomAPI_Shape::EDGE,
+ theName);
}
case GeomAPI_Shape::EDGE: {
- theResultBody->loadAndOrientModifiedShapes(&theAlgo,
- theBaseShape, GeomAPI_Shape::VERTEX,
- theVertexTag, theName + "_Vertex", theSubShapes, false, true);
+ theResultBody->loadModifiedShapes(theMakeShape,
+ theBaseShape,
+ GeomAPI_Shape::VERTEX,
+ theName);
}
}
}
+
+//==================================================================================================
+void FeaturesPlugin_Tools::loadDeletedShapes(ResultBodyPtr theResultBody,
+ const GeomShapePtr theBaseShape,
+ const ListOfShape& theTools,
+ const GeomMakeShapePtr& theMakeShape,
+ const GeomShapePtr theResultShapesCompound)
+{
+ ListOfShape aShapes = theTools;
+ aShapes.push_front(theBaseShape);
+
+ for (ListOfShape::const_iterator anIter = aShapes.begin(); anIter != aShapes.end(); anIter++)
+ {
+ theResultBody->loadDeletedShapes(theMakeShape,
+ *anIter,
+ GeomAPI_Shape::VERTEX,
+ theResultShapesCompound);
+ theResultBody->loadDeletedShapes(theMakeShape,
+ *anIter,
+ GeomAPI_Shape::EDGE,
+ theResultShapesCompound);
+ theResultBody->loadDeletedShapes(theMakeShape,
+ *anIter,
+ GeomAPI_Shape::FACE,
+ theResultShapesCompound);
+ }
+}
+
+//==================================================================================================
+void FeaturesPlugin_Tools::loadDeletedShapes(
+ std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
+ const ListOfShape& theTools,
+ const GeomShapePtr theResultShapesCompound)
+{
+ for (std::vector<ResultBaseAlgo>::iterator anIt = theResultBaseAlgoList.begin();
+ anIt != theResultBaseAlgoList.end();
+ ++anIt)
+ {
+ ResultBaseAlgo& aRCA = *anIt;
+ loadDeletedShapes(aRCA.resultBody,
+ aRCA.baseShape,
+ theTools,
+ aRCA.makeShape,
+ theResultShapesCompound);
+ }
+}
#ifndef FeaturesPlugin_Tools_H_
#define FeaturesPlugin_Tools_H_
-#include <GeomAlgoAPI_Translation.h>
+#include <GeomAlgoAPI_MakeShape.h>
+#include <ModelAPI_ResultBody.h>
-class ModelAPI_ResultBody;
+#include <vector>
class FeaturesPlugin_Tools {
public:
- static void storeModifiedShapes(GeomAlgoAPI_MakeShape& theAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBaseShape,
- const int theFaceTag,
- const int theEdgeTag,
- const int theVertexTag,
- const std::string theName,
- GeomAPI_DataMapOfShapeShape& theSubShapes);
+ struct ResultBaseAlgo {
+ ResultBodyPtr resultBody;
+ GeomShapePtr baseShape;
+ GeomMakeShapePtr makeShape;
+ };
+
+public:
+ static void loadModifiedShapes(ResultBodyPtr theResultBody,
+ const GeomShapePtr theBaseShape,
+ const ListOfShape& theTools,
+ const GeomMakeShapePtr& theMakeShape,
+ const GeomShapePtr theResultShape);
+
+ static void loadModifiedShapes(ResultBodyPtr theResultBody,
+ const GeomShapePtr theBaseShape,
+ const GeomMakeShapePtr& theMakeShape,
+ const std::string theName);
+
+ /// Stores deleted shapes.
+ static void loadDeletedShapes(ResultBodyPtr theResultBody,
+ const GeomShapePtr theBaseShape,
+ const ListOfShape& theTools,
+ const GeomMakeShapePtr& theMakeShape,
+ const GeomShapePtr theResultShapesCompound);
+
+ /// Stores deleted shapes.
+ static void loadDeletedShapes(std::vector<ResultBaseAlgo>& theResultBaseAlgoList,
+ const ListOfShape& theTools,
+ const GeomShapePtr theResultShapesCompound);
};
#endif /* FeaturesPlugin_Tools_H_ */
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_Trsf.h>
#include <GeomAlgoAPI_PointBuilder.h>
+#include <GeomAlgoAPI_Tools.h>
#include <FeaturesPlugin_Tools.h>
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) { // may be for not-activated parts
- eraseResults();
return;
}
anObjects.push_back(anObject);
}
//Getting axis.
- std::shared_ptr<GeomAPI_Ax1> anAxis;
- std::shared_ptr<GeomAPI_Edge> anEdge;
- std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
- selection(FeaturesPlugin_Translation::AXIS_OBJECT_ID());
- if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
- } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
- anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
+ static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+ AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID());
+ GeomShapePtr aShape = anObjRef->value();
+ if (!aShape.get()) {
+ if (anObjRef->context().get()) {
+ aShape = anObjRef->context()->shape();
+ }
+ }
+ if (!aShape.get()) {
+ setError(aSelectionError);
+ return;
}
- if(anEdge) {
- anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
- anEdge->line()->direction()));
+
+ GeomEdgePtr anEdge;
+ if (aShape->isEdge())
+ {
+ anEdge = aShape->edge();
+ }
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ anEdge = anIt.current()->edge();
+ }
+
+ if (!anEdge.get())
+ {
+ setError(aSelectionError);
+ return;
}
+ std::shared_ptr<GeomAPI_Ax1> anAxis(new GeomAPI_Ax1(anEdge->line()->location(),
+ anEdge->line()->direction()));
+
+
// Getting distance.
double aDistance = real(FeaturesPlugin_Translation::DISTANCE_ID())->value();
// Moving each object.
+ std::string anError;
int aResultIndex = 0;
std::list<ResultPtr>::iterator aContext = aContextes.begin();
for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
aResultPart->setTrsf(*aContext, aTrsf);
setResult(aResultPart, aResultIndex);
} else {
- GeomAlgoAPI_Translation aTranslationAlgo(aBaseShape, anAxis, aDistance);
+ std::shared_ptr<GeomAlgoAPI_Translation> aTranslationAlgo(
+ new GeomAlgoAPI_Translation(aBaseShape, anAxis, aDistance));
- if (!aTranslationAlgo.check()) {
- setError(aTranslationAlgo.getError());
+ if (!aTranslationAlgo->check()) {
+ setError(aTranslationAlgo->getError());
return;
}
- aTranslationAlgo.build();
+ aTranslationAlgo->build();
// Checking that the algorithm worked properly.
- if(!aTranslationAlgo.isDone()) {
- static const std::string aFeatureError = "Error: Translation algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if(aTranslationAlgo.shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- break;
- }
- if(!aTranslationAlgo.isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTranslationAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- loadNamingDS(aTranslationAlgo, aResultBody, aBaseShape);
+ aResultBody->storeModified(aBaseShape, aTranslationAlgo->shape());
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ aBaseShape,
+ aTranslationAlgo,
+ "Translated");
setResult(aResultBody, aResultIndex);
}
aResultIndex++;
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) { // may be for not-activated parts
- eraseResults();
return;
}
anObjects.push_back(anObject);
double aDZ = real(FeaturesPlugin_Translation::DZ_ID())->value();
// Moving each object.
+ std::string anError;
int aResultIndex = 0;
std::list<ResultPtr>::iterator aContext = aContextes.begin();
for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
aResultPart->setTrsf(*aContext, aTrsf);
setResult(aResultPart, aResultIndex);
} else {
- GeomAlgoAPI_Translation aTranslationAlgo(aBaseShape, aDX, aDY, aDZ);
+ std::shared_ptr<GeomAlgoAPI_Translation> aTranslationAlgo(
+ new GeomAlgoAPI_Translation(aBaseShape, aDX, aDY, aDZ));
- if (!aTranslationAlgo.check()) {
- setError(aTranslationAlgo.getError());
+ if (!aTranslationAlgo->check()) {
+ setError(aTranslationAlgo->getError());
return;
}
- aTranslationAlgo.build();
+ aTranslationAlgo->build();
// Checking that the algorithm worked properly.
- if(!aTranslationAlgo.isDone()) {
- static const std::string aFeatureError = "Error: Translation algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if(aTranslationAlgo.shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- break;
- }
- if(!aTranslationAlgo.isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTranslationAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- loadNamingDS(aTranslationAlgo, aResultBody, aBaseShape);
+ aResultBody->storeModified(aBaseShape, aTranslationAlgo->shape());
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ aBaseShape,
+ aTranslationAlgo,
+ "Translated");
setResult(aResultBody, aResultIndex);
}
aResultIndex++;
anObjectsSelList->value(anObjectsIndex);
std::shared_ptr<GeomAPI_Shape> anObject = anObjectAttr->value();
if(!anObject.get()) { // may be for not-activated parts
- eraseResults();
return;
}
anObjects.push_back(anObject);
}
// Moving each object.
+ std::string anError;
int aResultIndex = 0;
std::list<ResultPtr>::iterator aContext = aContextes.begin();
for(ListOfShape::iterator anObjectsIt = anObjects.begin(); anObjectsIt != anObjects.end();
aResultPart->setTrsf(*aContext, aTrsf);
setResult(aResultPart, aResultIndex);
} else {
- GeomAlgoAPI_Translation aTranslationAlgo(aBaseShape, aFirstPoint, aSecondPoint);
+ std::shared_ptr<GeomAlgoAPI_Translation> aTranslationAlgo(
+ new GeomAlgoAPI_Translation(aBaseShape, aFirstPoint, aSecondPoint));
- if (!aTranslationAlgo.check()) {
- setError(aTranslationAlgo.getError());
+ if (!aTranslationAlgo->check()) {
+ setError(aTranslationAlgo->getError());
return;
}
- aTranslationAlgo.build();
+ aTranslationAlgo->build();
// Checking that the algorithm worked properly.
- if(!aTranslationAlgo.isDone()) {
- static const std::string aFeatureError = "Error: Translation algorithm failed.";
- setError(aFeatureError);
- break;
- }
- if(aTranslationAlgo.shape()->isNull()) {
- static const std::string aShapeError = "Error: Resulting shape is Null.";
- setError(aShapeError);
- break;
- }
- if(!aTranslationAlgo.isValid()) {
- std::string aFeatureError = "Error: Resulting shape is not valid.";
- setError(aFeatureError);
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aTranslationAlgo, getKind(), anError)) {
+ setError(anError);
break;
}
ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
- loadNamingDS(aTranslationAlgo, aResultBody, aBaseShape);
+ aResultBody->storeModified(aBaseShape, aTranslationAlgo->shape());
+ FeaturesPlugin_Tools::loadModifiedShapes(aResultBody,
+ aBaseShape,
+ aTranslationAlgo,
+ "Translated");
setResult(aResultBody, aResultIndex);
}
aResultIndex++;
// Remove the rest results if there were produced in the previous pass.
removeResults(aResultIndex);
}
-
-//=================================================================================================
-void FeaturesPlugin_Translation::loadNamingDS(GeomAlgoAPI_Translation& theTranslationAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBaseShape)
-{
- // Store result.
- theResultBody->storeModified(theBaseShape, theTranslationAlgo.shape());
-
- std::string aTranslatedName = "Translated";
- std::shared_ptr<GeomAPI_DataMapOfShapeShape> aSubShapes = theTranslationAlgo.mapOfSubShapes();
-
- FeaturesPlugin_Tools::storeModifiedShapes(theTranslationAlgo, theResultBody,
- theBaseShape, 1, 2, 3, aTranslatedName,
- *aSubShapes.get());
-}
///Perform the translation usind two points
void performTranslationByTwoPoints();
-
- void loadNamingDS(GeomAlgoAPI_Translation& theTranslationAlgo,
- std::shared_ptr<ModelAPI_ResultBody> theResultBody,
- std::shared_ptr<GeomAPI_Shape> theBaseShape);
};
#endif
#include <GeomAlgoAPI_Boolean.h>
#include <GeomAlgoAPI_MakeShapeList.h>
#include <GeomAlgoAPI_PaveFiller.h>
+#include <GeomAlgoAPI_Tools.h>
#include <GeomAlgoAPI_UnifySameDomain.h>
#include <GeomAPI_ShapeExplorer.h>
}
// Fuse objects.
+ std::string anError;
std::shared_ptr<GeomAlgoAPI_MakeShape> anAlgo;
ListOfShape aTools;
if (anObjects.front()->shapeType() == GeomAPI_Shape::SOLID) {
}
// Checking that the algorithm worked properly.
- GeomAlgoAPI_MakeShapeList aMakeShapeList;
+ std::shared_ptr<GeomAlgoAPI_MakeShapeList> aMakeShapeList(new GeomAlgoAPI_MakeShapeList());
GeomAPI_DataMapOfShapeShape aMapOfShapes;
- if(!anAlgo->isDone()) {
- setError("Error: Boolean algorithm failed.");
- return;
- }
- if(anAlgo->shape()->isNull()) {
- setError("Error: Resulting shape is Null.");
- return;
- }
- if(!anAlgo->isValid()) {
- setError("Error: Resulting shape is not valid.");
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(anAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
GeomShapePtr aShape = anAlgo->shape();
- aMakeShapeList.appendAlgo(anAlgo);
+ aMakeShapeList->appendAlgo(anAlgo);
aMapOfShapes.merge(anAlgo->mapOfSubShapes());
// Store original shapes for naming.
aShapesToAdd.push_back(aShape);
std::shared_ptr<GeomAlgoAPI_PaveFiller> aFillerAlgo(
new GeomAlgoAPI_PaveFiller(aShapesToAdd, true));
- if(!aFillerAlgo->isDone()) {
- setError("Error: PaveFiller algorithm failed.");
- return;
- }
- if(aFillerAlgo->shape()->isNull()) {
- setError("Error: Resulting shape is Null.");
- return;
- }
- if(!aFillerAlgo->isValid()) {
- setError("Error: Resulting shape is not valid.");
+ if (GeomAlgoAPI_Tools::AlgoError::isAlgorithmFailed(aFillerAlgo, getKind(), anError)) {
+ setError(anError);
return;
}
aShape = aFillerAlgo->shape();
- aMakeShapeList.appendAlgo(aFillerAlgo);
+ aMakeShapeList->appendAlgo(aFillerAlgo);
aMapOfShapes.merge(aFillerAlgo->mapOfSubShapes());
}
// workaround: make copy to name edges correctly
// Store result and naming.
- const int aModifyEdgeTag = 1;
- const int aModifyFaceTag = 2;
- const int aDeletedTag = 3;
- /// sub solids will be placed at labels 4, 5 etc. if result is compound of solids
- const int aSubsolidsTag = 4;
- const std::string aModEName = "Modified_Edge";
- const std::string aModFName = "Modified_Face";
std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data());
- aResultBody->storeModified(anObjects.front(), aShape, aSubsolidsTag);
+ aResultBody->storeModified(anObjects.front(), aShape);
for(ListOfShape::const_iterator anIter = anObjects.begin(); anIter != anObjects.end(); ++anIter) {
- aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::EDGE,
- aModifyEdgeTag, aModEName, aMapOfShapes,
- false, true, true);
- aResultBody->loadAndOrientModifiedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::FACE,
- aModifyFaceTag, aModFName, aMapOfShapes,
- false, true, true);
+ aResultBody->loadModifiedShapes(aMakeShapeList, *anIter, GeomAPI_Shape::EDGE);
+ aResultBody->loadModifiedShapes(aMakeShapeList, *anIter, GeomAPI_Shape::FACE);
//aResultBody->loadDeletedShapes(&aMakeShapeList, *anIter, GeomAPI_Shape::FACE, aDeletedTag);
}
if (aContext.get())
aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext);
if(aConstruction.get()) {
- // Construciotn selected. Check that is is not infinite.
+ // Construction selected. Check that it is not infinite.
if(aConstruction->isInfinite()) {
theError = "Error: Infinite constructions is not allowed as base.";
return false;
return true;
}
}
-
return false;
}
if(aContext.get()) {
aDirShape = aContext->shape();
}
+
+ if (aDirShape.get() && aDirShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aDirShape);
+ aDirShape = anIt.current();
+ }
}
}
- if(!aDirShape.get()) {
+ if(!aDirShape.get() || aDirShape->isNull() ||
+ aDirShape->shapeType() != GeomAPI_Shape::EDGE) {
// Check that dir can be empty.
if(!isShapesCanBeEmpty(aCheckAttribute, theError)) {
theError = "Error: Base objects list contains vertex or edge, so attribute \"%1\" "
return false;
}
- int anObjectsNb = 0, aToolsNb = 0;
- //int anOperationType = 0;
+ int anObjectsToolsNb[2] = { 0, 0 };
std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
bool isAllInSameCompSolid = true;
ResultBodyPtr aCompSolid;
- AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt);
- if (anAttrSelList)
- {
- anObjectsNb = anAttrSelList->size();
- for (int anIndex = 0; anIndex < anObjectsNb; ++anIndex)
- {
- AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
- ResultPtr aContext = anAttr->context();
- ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
- if (aResCompSolidPtr.get())
- {
- if (aCompSolid.get())
- {
- isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
- }
- else
- {
- aCompSolid = aResCompSolidPtr;
- }
- }
- else
- {
- isAllInSameCompSolid = false;
- break;
- }
- }
- }
- anIt++;
-
-
- anAttrSelList = theFeature->selectionList(*anIt);
- if (anAttrSelList)
- {
- aToolsNb = anAttrSelList->size();
- if (isAllInSameCompSolid)
+ for (int* anArgNbIt = anObjectsToolsNb; anIt != aLast; ++anIt, ++anArgNbIt) {
+ AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt);
+ if (anAttrSelList)
{
- for (int anIndex = 0; anIndex < aToolsNb; ++anIndex)
- {
- AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
- ResultPtr aContext = anAttr->context();
- ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
- if (aResCompSolidPtr.get())
+ *anArgNbIt = anAttrSelList->size();
+ if (isAllInSameCompSolid) {
+ for (int anIndex = 0; anIndex < *anArgNbIt; ++anIndex)
{
- if (aCompSolid.get())
+ AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
+ ResultPtr aContext = anAttr->context();
+ ResultBodyPtr aResCompSolidPtr = ModelAPI_Tools::bodyOwner(aContext);
+ if (aResCompSolidPtr.get())
{
- isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
+ if (aCompSolid.get())
+ {
+ isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
+ }
+ else
+ {
+ aCompSolid = aResCompSolidPtr;
+ }
}
else
{
- aCompSolid = aResCompSolidPtr;
+ isAllInSameCompSolid = false;
+ break;
}
}
- else
- {
- isAllInSameCompSolid = false;
- break;
- }
}
}
}
- anIt++;
std::shared_ptr<FeaturesPlugin_Boolean> aFeature =
std::dynamic_pointer_cast<FeaturesPlugin_Boolean>(theFeature);
if (anOperationType == FeaturesPlugin_Boolean::BOOL_FUSE)
{
// Fuse operation
- if (anObjectsNb + aToolsNb < 2)
+ if (anObjectsToolsNb[0] + anObjectsToolsNb[1] < 2)
{
theError = "Not enough arguments for Fuse operation.";
return false;
}
else
{
- if (anObjectsNb < 1)
+ if (anObjectsToolsNb[0] < 1) // check number of objects
{
theError = "Objects not selected.";
return false;
}
- if (aToolsNb < 1)
+ if (anObjectsToolsNb[1] < 1) // check number of tools
{
theError = "Tools not selected.";
return false;
##
# -*- coding: utf-8 -*-
-from SketchAPI import *
from salome.shaper import model
SketchLine_1 = SketchProjection_1.createdFeature()
SketchLine_1.setName("SketchLine_5")
SketchLine_1.result().setName("SketchLine_5")
-SketchLine_2 = Sketch_1.addLine(0.008, 0.0005000000000000006, 0.0075, -1.258295422426014e-035)
+SketchLine_2 = Sketch_1.addLine(0.008, 0.0005000000000000006, 0.0075, -1.258295422426014e-35)
SketchLine_2.setName("SketchLine_9")
SketchLine_2.result().setName("SketchLine_9")
SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "OX"), False)
SketchLine_3.result().setName("SketchLine_10")
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.result())
SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_12")
-SketchLine_4 = Sketch_1.addLine(0.0075, -1.258295422426014e-035, 0.005, 0)
+SketchLine_4 = Sketch_1.addLine(0.0075, -1.258295422426014e-35, 0.005, 0)
SketchLine_4.setName("SketchLine_11")
SketchLine_4.result().setName("SketchLine_11")
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_4.startPoint())
SketchConstraintVertical_1.setName("SketchConstraintVertical_3")
SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_6.result())
SketchConstraintHorizontal_1.setName("SketchConstraintHorizontal_3")
-SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_2.result(), 45)
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_2.result(), 45.00000000000001)
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_5.result(), 0.02)
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_6.result(), 0.005)
SketchConstraintLength_2.setName("SketchConstraintLength_4")
SketchLine_11.result().setName("SketchLine_16")
SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_17")
-SketchLine_12 = Sketch_1.addLine(0.008999999999999999, 0.042, -5.446629538236431e-036, 0.042)
+SketchLine_12 = Sketch_1.addLine(0.008999999999999999, 0.042, -5.446629538236431e-36, 0.042)
SketchLine_12.setName("SketchLine_17")
SketchLine_12.result().setName("SketchLine_17")
SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_18")
SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_1.result())
SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19")
-SketchLine_13 = Sketch_1.addLine(-5.446629538236431e-036, 0.042, 0, 0.02)
+SketchLine_13 = Sketch_1.addLine(-5.446629538236431e-36, 0.042, 0, 0.02)
SketchLine_13.setName("SketchLine_18")
SketchLine_13.result().setName("SketchLine_18")
SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
model.do()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_9r-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_7f-SketchLine_8f-SketchArc_1_2r-SketchLine_14f-SketchArc_2_2r-SketchLine_15f-SketchLine_16f-SketchLine_17f-SketchLine_18f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_7f-SketchLine_8f-SketchArc_1_2r-SketchLine_14f-SketchArc_2_2r-SketchLine_15f-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_9r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
-SketchLine_14 = Sketch_2.addLine(-5.446629538236431e-036, 0.042, 5.172728347136208e-022, 0.03963932022500211)
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Sketch_1/Vertex-SketchLine_18s-SketchLine_17e"), False)
+SketchLine_14 = Sketch_2.addLine(-5.446629538236431e-36, 0.042, 5.172728347136208e-22, 0.03963932022500211)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_17_EndVertex"), False)
SketchPoint_1 = SketchProjection_3.createdFeature()
SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchPoint_1.result())
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_18"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/Sketch_1/SketchLine_18"), False)
SketchLine_15 = SketchProjection_4.createdFeature()
SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_15.result())
-SketchArc_3 = Sketch_2.addArc(0.02, 0.062, 5.172728347136208e-022, 0.03963932022500211, 0.02, 0.032, False)
+SketchArc_3 = Sketch_2.addArc(0.02, 0.062, 5.172728347136208e-22, 0.03963932022500211, 0.02, 0.032, False)
SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchArc_3.startPoint())
SketchLine_16 = Sketch_2.addLine(0.02, 0.032, 0.02, 0.042)
SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_16.startPoint())
SketchLine_18 = SketchProjection_5.createdFeature()
SketchConstraintDistance_7 = Sketch_2.setDistance(SketchLine_18.result(), SketchArc_3.center(), 0.062, True)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchArc_1_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 0.008999999999999999, 0.008999999999999999)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 0.008999999999999999, 0.008999999999999999)
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
-Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_13"))
+Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_7"))
RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 10, 28, [model.selection("SOLID", "Fuse_1_1")])
Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
SketchLine_19 = Sketch_3.addLine(0.029, 0.042, 0.029, 0.03267384683690003)
SketchLine_21 = Sketch_3.addLine(0.008999999999999999, 0.042, 0.029, 0.042)
SketchLine_21.setName("SketchLine_9")
SketchLine_21.result().setName("SketchLine_9")
-SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False)
+SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), False)
SketchLine_22 = SketchProjection_6.createdFeature()
SketchLine_22.setName("SketchLine_10")
SketchLine_22.result().setName("SketchLine_10")
SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_11")
SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_21.result())
SketchConstraintAngle_2 = Sketch_3.setAngle(SketchLine_20.result(), SketchLine_21.result(), 25)
-SketchProjection_7 = Sketch_3.addProjection(model.selection("VERTEX", "PartSet/Sketch_1/Vertex-SketchLine_17s-SketchLine_16e"), False)
+SketchProjection_7 = Sketch_3.addProjection(model.selection("VERTEX", "PartSet/Sketch_1/SketchLine_16_EndVertex"), False)
+SketchPoint_2 = SketchProjection_7.createdFeature()
SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_21.result(), 0.02)
RevolutionCut_1.setNestedSketch(Sketch_3)
+model.do()
model.end()
# check that result was created
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
-# Create document
model.begin()
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
-
-# Create base and path for pipe
Point_2 = model.addPoint(Part_1_doc, 5, 20, 0)
Point_3 = model.addPoint(Part_1_doc, 0, 40, 30)
Point_4 = model.addPoint(Part_1_doc, 10, 50, 70)
SketchConstraintRigid_1 = Sketch_1.setFixed(SketchArc_1.startPoint())
SketchConstraintRigid_2 = Sketch_1.setFixed(SketchLine_2.endPoint())
model.do()
-Wire_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2")]
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchArc_2_2"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchArc_1_2")]
Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchLine_4 = Sketch_2.addLine(9.525599451781, 2.539525405208, -21.231656152164, 2.539525405208)
SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_6.result())
SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_7.result())
model.do()
-
-# Create pipe on the entire path (big pipe)
Pipe_1 = model.addPipe(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("WIRE", "Wire_1_1"))
-
-# Create pipe on the fisrt segment of the path (small pipe)
-Pipe_2 = model.addPipe(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2"))
-
-# Cut big pipe from the small pipe
+Pipe_2 = model.addPipe(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_1/SketchArc_2_2"))
Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Pipe_2_1")], [model.selection("SOLID", "Pipe_1_1")])
model.do()
+model.end()
# Check that the small pipe is a part of the big one
assert(len(Cut_1.results()) == 0)
-
-model.end()
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_6.result(), "Lgx")
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "Ray")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchArc_1_2f-SketchLine_4r-SketchLine_6r")], model.selection(), 0, "Lgy")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_4r-SketchArc_1_2f-SketchLine_3r-SketchLine_1r")], model.selection(), 0, "Lgy")
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"))
SketchLine_7 = Sketch_2.addLine(0, -75, 0, 0)
-SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_1e"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False)
SketchPoint_2 = SketchProjection_4.createdFeature()
SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchPoint_2.result())
-SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), False)
SketchPoint_3 = SketchProjection_5.createdFeature()
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchPoint_3.result())
SketchLine_8 = Sketch_2.addLine(0, 0, 60, 0)
SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
-SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"), False)
SketchPoint_4 = SketchProjection_6.createdFeature()
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchPoint_4.result())
SketchLine_9 = Sketch_2.addLine(60, 0, 59.99999999999999, -62.5)
SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
-SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"), False)
SketchLine_10 = SketchProjection_7.createdFeature()
SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.result())
SketchLine_11 = Sketch_2.addLine(0, -75, 47.49999999999999, -75)
SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_11.startPoint())
-SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1"), False)
+SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False)
SketchLine_12 = SketchProjection_8.createdFeature()
SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.result())
SketchArc_2 = Sketch_2.addArc(47.49999999999999, -62.5, 59.99999999999999, -62.5, 47.49999999999999, -75, True)
SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_11.result())
SketchConstraintTangent_4 = Sketch_2.setTangent(SketchLine_9.result(), SketchArc_2.results()[1])
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_11f-SketchArc_2_2f")], model.selection(), 0, "Lgx")
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchArc_2_2f-SketchLine_9r-SketchLine_8r-SketchLine_7r")], model.selection(), 0, "Lgx")
Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
+model.do()
model.end()
assert(len(Common_1.results()) == 1)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchCircle_2 = Sketch_2.addCircle(-111.0503834053735, -148.4878232655183, 89.21253106334201)
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], model.selection(), 10, 0)
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2_2"), model.selection("SOLID", "Extrusion_1_2_1")], [model.selection("SOLID", "Extrusion_1_1")])
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2_2"), model.selection("SOLID", "Extrusion_1_2_1")], [model.selection("SOLID", "Extrusion_1_1")])
+model.do()
model.end()
assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
-from ModelAPI import *
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchPoint_11.setName("SketchPoint_13")
SketchPoint_11.result().setName("SketchPoint_13")
SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_11.coordinates(), SketchLine_5.result())
-SketchPoint_12 = Sketch_1.addPoint(-584.124830393487, -180.9380775505472)
+SketchPoint_12 = Sketch_1.addPoint(-584.1248303934869, -180.9380775505472)
SketchPoint_12.setName("SketchPoint_14")
SketchPoint_12.result().setName("SketchPoint_14")
SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchPoint_12.coordinates(), SketchLine_5.result())
model.do()
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_6s-SketchLine_5e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_7"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_11"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_10"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_8"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_9"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2s-SketchLine_1e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_13"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_6e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_14"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_6"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_4"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_5")])
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2"), model.selection("VERTEX", "Vertex_1_3"), model.selection("VERTEX", "Vertex_1_4"), model.selection("VERTEX", "Vertex_1_5"), model.selection("VERTEX", "Vertex_1_6"), model.selection("VERTEX", "Vertex_1_7"), model.selection("VERTEX", "Vertex_1_8"), model.selection("VERTEX", "Vertex_1_9"), model.selection("VERTEX", "Vertex_1_10"), model.selection("VERTEX", "Vertex_1_11"), model.selection("VERTEX", "Vertex_1_12"), model.selection("VERTEX", "Vertex_1_13"), model.selection("VERTEX", "Vertex_1_14"), model.selection("VERTEX", "Vertex_1_15"), model.selection("VERTEX", "Vertex_1_16"), model.selection("VERTEX", "Vertex_1_17"), model.selection("VERTEX", "Vertex_1_18")], model.selection("EDGE", "PartSet/OZ"), 100, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_1_12/To_Vertex_1"), model.selection("VERTEX", "Extrusion_1_13/To_Vertex_1"), model.selection("VERTEX", "Extrusion_1_3/To_Vertex_1"))
+Vertex_1_objects = [model.selection("VERTEX", "Sketch_1/SketchLine_5_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchPoint_7"), model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchPoint_11"), model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchPoint_10"), model.selection("VERTEX", "Sketch_1/SketchPoint_8"), model.selection("VERTEX", "Sketch_1/SketchPoint_9"), model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchPoint_13"), model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), model.selection("VERTEX", "Sketch_1/SketchPoint_14"), model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_1/SketchPoint_6"), model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_4"), model.selection("VERTEX", "Sketch_1/SketchPoint_5")]
+Vertex_1 = model.addVertex(Part_1_doc, Vertex_1_objects)
+Extrusion_1_objects = [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2"), model.selection("VERTEX", "Vertex_1_3"), model.selection("VERTEX", "Vertex_1_4"), model.selection("VERTEX", "Vertex_1_5"), model.selection("VERTEX", "Vertex_1_6"), model.selection("VERTEX", "Vertex_1_7"), model.selection("VERTEX", "Vertex_1_8"), model.selection("VERTEX", "Vertex_1_9"), model.selection("VERTEX", "Vertex_1_10"), model.selection("VERTEX", "Vertex_1_11"), model.selection("VERTEX", "Vertex_1_12"), model.selection("VERTEX", "Vertex_1_13"), model.selection("VERTEX", "Vertex_1_14"), model.selection("VERTEX", "Vertex_1_15"), model.selection("VERTEX", "Vertex_1_16"), model.selection("VERTEX", "Vertex_1_17"), model.selection("VERTEX", "Vertex_1_18")]
+Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OZ"), 100, 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_1_12/To_Vertex"), model.selection("VERTEX", "Extrusion_1_13/To_Vertex"), model.selection("VERTEX", "Extrusion_1_3/To_Vertex"))
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_7 = Sketch_2.addLine(-717.0963364993213, -45.06817090071282, -717.0963364993213, -180.9380775505473)
-SketchPoint_13 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_12/To_Vertex_1"))
+SketchPoint_13 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_12/To_Vertex"))
SketchPoint_13.setName("SketchPoint_15")
SketchPoint_13.result().setName("SketchPoint_15")
SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchPoint_13.result())
-SketchPoint_14 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_1/To_Vertex_1"))
+SketchPoint_14 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_1/To_Vertex"))
SketchPoint_14.setName("SketchPoint_16")
SketchPoint_14.result().setName("SketchPoint_16")
SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchPoint_14.result())
SketchLine_8 = Sketch_2.addLine(-717.0963364993213, -180.9380775505473, -102.0809741405142, -180.9380775505473)
SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
-SketchPoint_15 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_3/To_Vertex_1"))
+SketchPoint_15 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_3/To_Vertex"))
SketchPoint_15.setName("SketchPoint_17")
SketchPoint_15.result().setName("SketchPoint_17")
SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchPoint_15.result())
SketchLine_9 = Sketch_2.addLine(-102.0809741405142, -180.9380775505473, -102.0809741405142, 193.0685819822336)
SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
-SketchPoint_16 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_10/To_Vertex_1"))
+SketchPoint_16 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_10/To_Vertex"))
SketchPoint_16.setName("SketchPoint_18")
SketchPoint_16.result().setName("SketchPoint_18")
SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchPoint_16.result())
SketchLine_10 = Sketch_2.addLine(-102.0809741405142, 193.0685819822336, -254.8675173043772, 193.0685819822336)
SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
-SketchPoint_17 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_5/To_Vertex_1"))
+SketchPoint_17 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_5/To_Vertex"))
SketchPoint_17.setName("SketchPoint_19")
SketchPoint_17.result().setName("SketchPoint_19")
SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchPoint_17.result())
SketchLine_11 = Sketch_2.addLine(-254.8675173043772, 193.0685819822336, -254.8675173043772, -45.06817090071281)
SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
-SketchPoint_18 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_9/To_Vertex_1"))
+SketchPoint_18 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_9/To_Vertex"))
SketchPoint_18.setName("SketchPoint_20")
SketchPoint_18.result().setName("SketchPoint_20")
SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchPoint_18.result())
SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_12.endPoint())
SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchPoint_13.coordinates(), SketchLine_12.endPoint())
-SketchLine_13 = Sketch_2.addLine(-599.2405881202537, -45.06817090071282, -584.124830393487, -180.9380775505472)
+SketchLine_13 = Sketch_2.addLine(-599.2405881202537, -45.06817090071282, -584.1248303934869, -180.9380775505472)
SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_13.startPoint(), SketchLine_12.result())
-SketchPoint_19 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_13/To_Vertex_1"))
+SketchPoint_19 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_13/To_Vertex"))
SketchPoint_19.setName("SketchPoint_21")
SketchPoint_19.result().setName("SketchPoint_21")
SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchPoint_19.result())
SketchLine_14 = Sketch_2.addLine(-356.1736770691994, -45.06817090071282, -342.6051560379917, -180.9380775505472)
-SketchPoint_20 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_15/To_Vertex_1"))
+SketchPoint_20 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_15/To_Vertex"))
SketchPoint_20.setName("SketchPoint_22")
SketchPoint_20.result().setName("SketchPoint_22")
SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchPoint_20.result())
-SketchPoint_21 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_11/To_Vertex_1"))
+SketchPoint_21 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_11/To_Vertex"))
SketchPoint_21.setName("SketchPoint_23")
SketchPoint_21.result().setName("SketchPoint_23")
SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchPoint_21.result())
SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchLine_12.startPoint(), SketchLine_15.startPoint())
SketchConstraintCoincidence_39 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_9.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_7f-SketchLine_8f-SketchLine_12f-SketchLine_13r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_8f-SketchLine_12f-SketchLine_13f-SketchLine_14r")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_8f-SketchLine_9f-SketchLine_12f-SketchLine_14f-SketchLine_15r")])
-Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_15f")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1"), model.selection("EDGE", "Extrusion_1_2"), model.selection("EDGE", "Extrusion_1_3"), model.selection("EDGE", "Extrusion_1_4"), model.selection("EDGE", "Extrusion_1_5"), model.selection("EDGE", "Extrusion_1_6"), model.selection("EDGE", "Extrusion_1_7"), model.selection("EDGE", "Extrusion_1_8"), model.selection("EDGE", "Extrusion_1_9"), model.selection("EDGE", "Extrusion_1_10"), model.selection("EDGE", "Extrusion_1_11"), model.selection("EDGE", "Extrusion_1_12"), model.selection("EDGE", "Extrusion_1_13"), model.selection("EDGE", "Extrusion_1_14"), model.selection("EDGE", "Extrusion_1_15"), model.selection("EDGE", "Extrusion_1_16"), model.selection("EDGE", "Extrusion_1_17"), model.selection("EDGE", "Extrusion_1_18"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_4_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_7r-SketchLine_8f-SketchLine_13r-SketchLine_12f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_8f-SketchLine_14r-SketchLine_12f-SketchLine_13f_wire")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_8f-SketchLine_9f-SketchLine_15r-SketchLine_12f-SketchLine_14f_wire")])
+Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_15f_wire")])
+Partition_1_objects = [model.selection("EDGE", "Extrusion_1_1"), model.selection("EDGE", "Extrusion_1_2"), model.selection("EDGE", "Extrusion_1_3"), model.selection("EDGE", "Extrusion_1_4"), model.selection("EDGE", "Extrusion_1_5"), model.selection("EDGE", "Extrusion_1_6"), model.selection("EDGE", "Extrusion_1_7"), model.selection("EDGE", "Extrusion_1_8"), model.selection("EDGE", "Extrusion_1_9"), model.selection("EDGE", "Extrusion_1_10"), model.selection("EDGE", "Extrusion_1_11"), model.selection("EDGE", "Extrusion_1_12"), model.selection("EDGE", "Extrusion_1_13"), model.selection("EDGE", "Extrusion_1_14"), model.selection("EDGE", "Extrusion_1_15"), model.selection("EDGE", "Extrusion_1_16"), model.selection("EDGE", "Extrusion_1_17"), model.selection("EDGE", "Extrusion_1_18"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_4_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+model.do()
model.end()
+
+from ModelAPI import *
+
PartitionFeature = Partition_1.feature()
assert(len(PartitionFeature.results()) == 1)
PartitionResult = modelAPI_ResultBody(PartitionFeature.firstResult())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Part_1_doc = Part_1.document()
model.addParameter(Part_1_doc, "a", "100")
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/Plane_4"))
-SketchLine_1 = Sketch_1.addLine(-5.023684372475525, -46.5755143466786, -14.75825153820805, -43.01597925234075)
+SketchLine_1 = Sketch_1.addLine(-5.024014514861164, -46.57477619916804, -15.03025649976126, -42.91660461599292)
SketchLine_1.setName("SketchLine_9")
SketchLine_1.result().setName("SketchLine_9")
-SketchLine_2 = Sketch_1.addLine(-33.96152175760117, -20.26294727816075, -38.72043789437247, 5.632510332222703)
+SketchLine_2 = Sketch_1.addLine(-34.15308715195452, -20.5925185611531, -39.51293324824182, 6.356619200673476)
SketchLine_2.setName("SketchLine_10")
SketchLine_2.result().setName("SketchLine_10")
-SketchLine_3 = Sketch_1.addLine(-5.023684372475525, -46.5755143466786, -30.86227207373359, -37.12739424591874)
+SketchLine_3 = Sketch_1.addLine(-5.024014514861164, -46.57477619916804, -30.86442523156243, -37.12780736470863)
SketchLine_3.setName("SketchLine_1")
SketchLine_3.result().setName("SketchLine_1")
SketchLine_3.setAuxiliary(True)
-SketchLine_4 = Sketch_1.addLine(-30.86227207373359, -37.12739424591874, -38.72043789437247, 5.632510332222703)
+SketchLine_4 = Sketch_1.addLine(-30.86442523156243, -37.12780736470863, -39.51293324824182, 6.356619200673476)
SketchLine_4.setName("SketchLine_2")
SketchLine_4.result().setName("SketchLine_2")
SketchLine_4.setAuxiliary(True)
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
-SketchLine_5 = Sketch_1.addLine(-20.37351638704503, 39.82660556161157, 5.515492360623621, 50.89855436380311)
+SketchLine_5 = Sketch_1.addLine(-21.88471935002519, 39.79243387785534, 5.516674902531107, 51.5099134867221)
SketchLine_5.setName("SketchLine_4")
SketchLine_5.result().setName("SketchLine_4")
-SketchLine_6 = Sketch_1.addLine(5.515492360623621, 50.89855436380311, 32.11790618078412, 35.7788047045564)
+SketchLine_6 = Sketch_1.addLine(5.516674902531107, 51.5099134867221, 32.11790618078412, 35.7788047045564)
SketchLine_6.setName("SketchLine_5")
SketchLine_6.result().setName("SketchLine_5")
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
SketchLine_7.result().setName("SketchLine_6")
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5")
-SketchLine_8 = Sketch_1.addLine(51.23593736581751, -10.42185420425237, 33.52439630860805, -30.08966199583723)
+SketchLine_8 = Sketch_1.addLine(51.23593736581751, -10.42185420425237, 33.52471395405271, -30.09043472300023)
SketchLine_8.setName("SketchLine_7")
SketchLine_8.result().setName("SketchLine_7")
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6")
-SketchLine_9 = Sketch_1.addLine(33.52439630860805, -30.08966199583723, -5.023684372475525, -46.5755143466786)
+SketchLine_9 = Sketch_1.addLine(33.52471395405271, -30.09043472300023, -5.024014514861164, -46.57477619916804)
SketchLine_9.setName("SketchLine_8")
SketchLine_9.result().setName("SketchLine_8")
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7")
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchLine_9.endPoint())
SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8")
-SketchArc_1 = Sketch_1.addArc(-4.455634849643539, -14.84052735945157, -33.96152175760117, -20.26294727816075, -14.75825153820805, -43.01597925234075, False)
+SketchArc_1 = Sketch_1.addArc(-4.72938863253667, -14.74051331180418, -34.15308715195452, -20.5925185611531, -15.03025649976126, -42.91660461599292, False)
SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_9")
SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint())
SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_4.result())
SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_14")
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 30)
-SketchArc_2 = Sketch_1.addArc(-8.152231059872202, 11.25015706261054, -38.72043789437247, 5.632510332222703, -20.37351638704503, 39.82660556161157, True)
+SketchArc_2 = Sketch_1.addArc(-10.08923472882396, 12.20862445002239, -39.51293324824182, 6.356619200673476, -21.88471935002519, 39.79243387785534, True)
SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 30)
SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_2.endPoint())
SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_15")
SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchPoint_7.coordinates())
SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_34")
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_10r-SketchLine_4r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchArc_1_2f-SketchArc_2_2f-SketchArc_4_2r-SketchArc_3_2r")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_12"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchArc_2_2f-SketchLine_10r-SketchArc_1_2f-SketchLine_9r-SketchArc_3_2r-SketchArc_4_2r")], model.selection("EDGE", "Sketch_2/SketchLine_12"), 360, 0)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "PartSet/Plane_4"), model.selection("SOLID", "Revolution_1_1")])
Recover_1 = model.addRecover(Part_1_doc, Partition_1, [Revolution_1.result()])
Plane_5 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/Axis_4"), model.selection("VERTEX", "PartSet/Point_2"), True)
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchArc_2_2"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Recover_1_1"), model.selection("FACE", "Face_1_1")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_2_1"), model.selection("VERTEX", "Intersection_1_1/Generated_Vertex_2"), model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_6_1"), model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_4_1"), model.selection("VERTEX", "Intersection_1_1/Generated_Vertex_3"), model.selection("VERTEX", "Intersection_1_1/Generated_Vertex_1"), model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_1_1"), model.selection("VERTEX", "Intersection_1_1/Generated_Vertex_4"), model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_3_1"), model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_7_1"), model.selection("VERTEX", "Intersection_1_1/Modified_Vertex_5_1")])
-Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Intersection_1_1_7"), model.selection("EDGE", "Intersection_1_1_6"), model.selection("EDGE", "Intersection_1_1_3"), model.selection("EDGE", "Intersection_1_1_11"), model.selection("EDGE", "Intersection_1_1_5"), model.selection("EDGE", "Intersection_1_1_1"), model.selection("EDGE", "Intersection_1_1_4"), model.selection("EDGE", "Intersection_1_1_2"), model.selection("EDGE", "Intersection_1_1_10"), model.selection("EDGE", "Intersection_1_1_9"), model.selection("EDGE", "Intersection_1_1_8")])
+Group_1_objects = [model.selection("VERTEX", "[Intersection_1_1_3/Intersection_1_1_3&Face_1_1/Edge_3][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_1/Intersection_1_1_1][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_9/Intersection_1_1_9&Face_1_1/Edge_7][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_7/Intersection_1_1_7&Face_1_1/Edge_5][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_4/Intersection_1_1_4][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_1/Intersection_1_1_1][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_2/Intersection_1_1_2&Face_1_1/Edge_2][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_4/Intersection_1_1_4][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_6/Intersection_1_1_6&Face_1_1/Edge_4][weak_name_2]"), model.selection("VERTEX", "[Intersection_1_1_10/Intersection_1_1_10&Face_1_1/Edge_8][weak_name_1]"), model.selection("VERTEX", "[Intersection_1_1_8/Intersection_1_1_8&Face_1_1/Edge_6][weak_name_1]")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+Group_2_objects = [model.selection("EDGE", "Intersection_1_1_7"), model.selection("EDGE", "Intersection_1_1_6"), model.selection("EDGE", "Intersection_1_1_3"), model.selection("EDGE", "Intersection_1_1_11"), model.selection("EDGE", "Intersection_1_1_5"), model.selection("EDGE", "Intersection_1_1_1"), model.selection("EDGE", "Intersection_1_1_4"), model.selection("EDGE", "Intersection_1_1_2"), model.selection("EDGE", "Intersection_1_1_10"), model.selection("EDGE", "Intersection_1_1_9"), model.selection("EDGE", "Intersection_1_1_8")]
+Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
+model.do()
model.end()
aGroupFeature = Group_1.feature()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 100, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 100, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
SketchLine_5 = Sketch_2.addLine(99.48542024013722, 69.46826758147516, -34.30531732418524, 69.46826758147516)
SketchLine_6 = Sketch_2.addLine(-34.30531732418524, 69.46826758147516, -34.30531732418524, -62.60720411663805)
SketchLine_7 = Sketch_2.addLine(-34.30531732418524, -62.60720411663805, 99.48542024013722, -62.60720411663805)
SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 10, 110)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 10, 110)
Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
Rotation_1 = model.addRotation(Part_1_doc, [model.selection("COMPOUND", "Intersection_1_1")], model.selection("EDGE", "PartSet/OZ"), 45)
+model.do()
model.end()
assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.startPoint())
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_5.endPoint())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_5r")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_5r")], model.selection(), 100, 0)
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f")], model.selection(), 100, 0)
Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OX"), 50)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Translation_1_1"), model.selection("SOLID", "Extrusion_2_1")])
Translation_2 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1")], model.selection("EDGE", "PartSet/OZ"), 50)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Translation_2_1/Translated_Face_24"), model.selection("FACE", "Translation_2_1/Translated_Face_13"), model.selection("FACE", "Translation_2_1/Translated_Face_16"), model.selection("FACE", "Translation_2_1/Translated_Face_12"), model.selection("FACE", "Translation_2_1/Translated_Face_9"), model.selection("FACE", "Translation_2_1/Translated_Face_10"), model.selection("FACE", "Translation_2_1/Translated_Face_11"), model.selection("FACE", "Translation_2_1/Translated_Face_25"), model.selection("FACE", "Translation_2_1/Translated_Face_20"), model.selection("FACE", "Translation_2_1/Translated_Face_19"), model.selection("FACE", "Translation_2_1/Translated_Face_18"), model.selection("FACE", "Translation_2_1/Translated_Face_27"), model.selection("FACE", "Translation_2_1/Translated_Face_17"), model.selection("FACE", "Translation_2_1/Translated_Face_31"), model.selection("FACE", "Translation_2_1/Translated_Face_32"), model.selection("FACE", "Translation_2_1/Translated_Face_30"), model.selection("FACE", "Translation_2_1/Translated_Face_28"), model.selection("FACE", "Translation_2_1/Translated_Face_29"), model.selection("FACE", "Translation_2_1/Translated_Face_8"), model.selection("FACE", "Translation_2_1/Translated_Face_22"), model.selection("FACE", "Translation_2_1/Translated_Face_7"), model.selection("FACE", "Translation_2_1/Translated_Face_6"), model.selection("FACE", "Translation_2_1/Translated_Face_5"), model.selection("FACE", "Translation_2_1/Translated_Face_3"), model.selection("FACE", "Translation_2_1/Translated_Face_1"), model.selection("FACE", "Translation_2_1/Translated_Face_2"), model.selection("FACE", "Translation_2_1/Translated_Face_21"), model.selection("FACE", "Translation_2_1/Translated_Face_4"), model.selection("FACE", "Translation_2_1/Translated_Face_25"), model.selection("FACE", "Translation_2_1/Translated_Face_27"), model.selection("FACE", "Translation_2_1/Translated_Face_21"), model.selection("FACE", "Translation_2_1/Translated_Face_22"), model.selection("FACE", "Translation_2_1/Translated_Face_26"), model.selection("FACE", "Translation_2_1/Translated_Face_23"), model.selection("FACE", "Translation_2_1/Translated_Face_30"), model.selection("FACE", "Translation_2_1/Translated_Face_23"), model.selection("FACE", "Translation_2_1/Translated_Face_14"), model.selection("FACE", "Translation_2_1/Translated_Face_15")])
-#Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Translation_2_1_6/Translated_Face_1"), model.selection("FACE", "Translation_2_1_5/Translated_Face_1"), model.selection("FACE", "Translation_2_1_5/Translated_Face_4"), model.selection("FACE", "Translation_2_1_4/Translated_Face_4"), model.selection("FACE", "Translation_2_1_5/Translated_Face_3"), model.selection("FACE", "Translation_2_1_5/Translated_Face_2"), model.selection("FACE", "Translation_2_1_5/Translated_Face_5"), model.selection("FACE", "Translation_2_1_7/Translated_Face_5"), model.selection("FACE", "Translation_2_1_6/Translated_Face_5"), model.selection("FACE", "Translation_2_1_4/Translated_Face_1"), model.selection("FACE", "Translation_2_1_2/Translated_Face_2"), model.selection("FACE", "Translation_2_1_5/Translated_Face_5"), model.selection("FACE", "Translation_2_1_2/Translated_Face_1"), model.selection("FACE", "Translation_2_1_4/Translated_Face_5"), model.selection("FACE", "Translation_2_1_2/Translated_Face_3"), model.selection("FACE", "Translation_2_1_3/Translated_Face_5"), model.selection("FACE", "Translation_2_1_1/Translated_Face_3"), model.selection("FACE", "Translation_2_1_4/Translated_Face_2"), model.selection("FACE", "Translation_2_1_2/Translated_Face_3"), model.selection("FACE", "Translation_2_1_1/Translated_Face_4"), model.selection("FACE", "Translation_2_1_1/Translated_Face_1"), model.selection("FACE", "Translation_2_1_1/Translated_Face_2"), model.selection("FACE", "Translation_2_1_3/Translated_Face_4"), model.selection("FACE", "Translation_2_1_4/Translated_Face_3"), model.selection("FACE", "Translation_2_1_3/Translated_Face_5"), model.selection("FACE", "Translation_2_1_3/Translated_Face_2"), model.selection("FACE", "Translation_2_1_3/Translated_Face_3"), model.selection("FACE", "Translation_2_1_3/Translated_Face_1"), model.selection("FACE", "Translation_2_1_7/Translated_Face_3"), model.selection("FACE", "Translation_2_1_7/Translated_Face_5"), model.selection("FACE", "Translation_2_1_7/Translated_Face_4"), model.selection("FACE", "Translation_2_1_7/Translated_Face_1"), model.selection("FACE", "Translation_2_1_7/Translated_Face_2"), model.selection("FACE", "Translation_2_1_6/Translated_Face_4"), model.selection("FACE", "Translation_2_1_4/Translated_Face_5"), model.selection("FACE", "Translation_2_1_6/Translated_Face_5"), model.selection("FACE", "Translation_2_1_6/Translated_Face_2"), model.selection("FACE", "Translation_2_1_6/Translated_Face_3")])
-
+Group_1_objects = [model.selection("FACE", "Translation_2_1_3/MF:Translated&Sketch_1/SketchLine_4"), model.selection("FACE", "Translation_2_1_4/MF:Translated&Extrusion_1_1/To_Face"), model.selection("FACE", "Translation_2_1_4/MF:Translated&Extrusion_1_1/From_Face"), model.selection("FACE", "Translation_2_1_5/MF:Translated&Extrusion_2_1/From_Face"), model.selection("FACE", "Translation_2_1_5/MF:Translated&Extrusion_2_1/To_Face"), model.selection("FACE", "Translation_2_1_5/MF:Translated&Sketch_1/SketchLine_4"), model.selection("FACE", "Translation_2_1_5/MF:Translated&Sketch_1/SketchLine_5"), model.selection("FACE", "Translation_2_1_2/MF:Translated&Extrusion_2_1/To_Face&Extrusion_1_1/To_Face"), model.selection("FACE", "Translation_2_1_3/MF:Translated&Sketch_1/SketchLine_1"), model.selection("FACE", "Translation_2_1_3/MF:Translated&Extrusion_1_1/From_Face"), model.selection("FACE", "Translation_2_1_3/MF:Translated&Extrusion_1_1/To_Face"), model.selection("FACE", "Translation_2_1_5/MF:Translated&Sketch_1/SketchLine_1"), model.selection("FACE", "Translation_2_1_3/MF:Translated&Sketch_1/SketchLine_5"), model.selection("FACE", "Translation_2_1_1/MF:Translated&Extrusion_1_1/From_Face"), model.selection("FACE", "Translation_2_1_1/MF:Translated&Sketch_1/SketchLine_1"), model.selection("FACE", "Translation_2_1_1/MF:Translated&Sketch_1/SketchLine_2"), model.selection("FACE", "(Translation_2_1_2/MF:Translated&Sketch_1/SketchLine_1)(Translation_2_1_2/MF:Translated&Extrusion_2_1/From_Face&Extrusion_1_1/From_Face)(Translation_2_1_2/MF:Translated&Extrusion_2_1/To_Face&Extrusion_1_1/To_Face)(Translation_2_1_2/MF:Translated&Sketch_1/SketchLine_2)"), model.selection("FACE", "Translation_2_1_1/MF:Translated&Extrusion_1_1/To_Face"), model.selection("FACE", "Translation_2_1_6/MF:Translated&Sketch_1/SketchLine_3"), model.selection("FACE", "Translation_2_1_4/MF:Translated&Sketch_1/SketchLine_3"), model.selection("FACE", "Translation_2_1_6/MF:Translated&Extrusion_2_1/From_Face"), model.selection("FACE", "Translation_2_1_6/MF:Translated&Extrusion_2_1/To_Face"), model.selection("FACE", "Translation_2_1_6/MF:Translated&Sketch_1/SketchLine_5"), model.selection("FACE", "Translation_2_1_7/MF:Translated&Extrusion_2_1/From_Face"), model.selection("FACE", "Translation_2_1_7/MF:Translated&Extrusion_2_1/To_Face"), model.selection("FACE", "Translation_2_1_7/MF:Translated&Sketch_1/SketchLine_4"), model.selection("FACE", "Translation_2_1_6/MF:Translated&Sketch_1/SketchLine_2"), model.selection("FACE", "Translation_2_1_7/MF:Translated&Sketch_1/SketchLine_3"), model.selection("FACE", "Translation_2_1_2/MF:Translated&Extrusion_2_1/To_Face&Extrusion_1_1/To_Face"), model.selection("FACE", "Translation_2_1_5/MF:Translated&Sketch_1/SketchLine_1"), model.selection("FACE", "Translation_2_1_6/MF:Translated&Sketch_1/SketchLine_2"), model.selection("FACE", "Translation_2_1_4/MF:Translated&Sketch_1/SketchLine_3"), model.selection("FACE", "Translation_2_1_2/MF:Translated&Extrusion_2_1/From_Face&Extrusion_1_1/From_Face"), model.selection("FACE", "Translation_2_1_7/MF:Translated&Sketch_1/SketchLine_5"), model.selection("FACE", "Translation_2_1_1/MF:Translated&Sketch_1/SketchLine_2"), model.selection("FACE", "Translation_2_1_7/MF:Translated&Sketch_1/SketchLine_5"), model.selection("FACE", "Translation_2_1_4/MF:Translated&Sketch_1/SketchLine_2"), model.selection("FACE", "Translation_2_1_4/MF:Translated&Sketch_1/SketchLine_5")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+model.do()
model.end()
groupFeature = Group_1.feature()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
model.do()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_3")])
+Wire_1_objects = [model.selection("EDGE", "PartSet/Sketch_1/SketchLine_1"), model.selection("EDGE", "PartSet/Sketch_1/SketchLine_2"), model.selection("EDGE", "PartSet/Sketch_1/SketchLine_3")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 100, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1")])
+Group_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_3")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
model.do()
model.end()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
SketchLine_6 = Sketch_1.addLine(-18.08302242613596, -398.3514326277755, -18.08302242613596, -98.35143262777552)
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
-SketchArc_1 = Sketch_1.addArc(0, -7.626897158721915e-023, -85.62958302127123, 51.64856737222455, -18.08302242613596, -98.35143262777552, False)
+SketchArc_1 = Sketch_1.addArc(0, -7.626897158721915e-23, -85.62958302127123, 51.64856737222455, -18.08302242613596, -98.35143262777552, False)
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchArc_1.endPoint())
SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.startPoint())
SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_2.result())
SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_5.result(), SketchLine_4.result(), 139.9999999999999)
SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), 124.9999999999987)
SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_6.result(), 300)
-SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.startPoint(), SketchLine_2.result(), 350)
-SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_5.result(), 300)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.startPoint(), SketchLine_2.result(), 350, False)
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchLine_5.result(), 300, False)
SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin"))
SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.center(), SketchPoint_1.coordinates())
SketchCircle_1 = Sketch_1.addCircle(623.3624504738834, 247.4315530304268, 75)
SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_8.startPoint())
SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_7.result(), SketchLine_8.result())
SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchCircle_2.results()[1])
-SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_2.center(), SketchLine_6.endPoint(), 325)
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_2.center(), SketchLine_6.endPoint(), 325, False)
SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchCircle_1.results()[1])
-SketchConstraintDistance_4 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.endPoint(), 325)
+SketchConstraintDistance_4 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.endPoint(), 325, False)
model.do()
Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_8f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchLine_7r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Lateral_2"), model.selection("EDGE", "Revolution_1_1/Lateral_4"), model.selection("EDGE", "Revolution_1_1/Base_Edge_6"), model.selection("EDGE", "Revolution_1_1/Base_Edge_8"), model.selection("EDGE", "Revolution_2_1/Base_Edge_8"), model.selection("EDGE", "Revolution_2_1/Lateral_2"), model.selection("EDGE", "Revolution_2_1/Lateral_4"), model.selection("EDGE", "Revolution_2_1/Base_Edge_10"), model.selection("EDGE", "Revolution_2_1/Base_Edge_12"), model.selection("EDGE", "Revolution_2_1/Lateral_6")])
+Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchLine_7r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Group_1_objects = [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][weak_name_2]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][weak_name_1]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][weak_name_3]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8][weak_name_3]"), model.selection("EDGE", "[Revolution_2_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][weak_name_3]"), model.selection("EDGE", "[Revolution_2_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Revolution_2_1/Generated_Face&Sketch_1/SketchLine_7]"), model.selection("EDGE", "[Revolution_2_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][Revolution_2_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2]"), model.selection("EDGE", "[Revolution_2_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][weak_name_3]"), model.selection("EDGE", "[Revolution_2_1/Generated_Face&Sketch_1/SketchLine_7][weak_name_3]"), model.selection("EDGE", "[Revolution_2_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Revolution_2_1/Generated_Face&Sketch_1/SketchLine_7]")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+model.do()
model.end()
# check that resulting group selection is valid
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
SketchCircle_1 = Sketch_1.addCircle(-79.57211859899775, 93.0358363165245, 69.46562387481423)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
SketchCircle_2 = Sketch_2.addCircle(-111.8968837135755, 98.96901887198163, 6.57145775571253)
SketchCircle_3 = Sketch_2.addCircle(-41.97827733564338, 89.35676702647821, 6.102067916018811)
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")], model.selection(), 10, 0)
-Boolean_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_2_2/To_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_2/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Smash_1_1_1/Modified_Face_1"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Extrusion_2_1/To_Face_1")])
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")], model.selection(), 10, 0)
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
+Group_1_objects = [model.selection("FACE", "Extrusion_2_2/To_Face"), model.selection("FACE", "Extrusion_2_2/From_Face"), model.selection("FACE", "Extrusion_2_2/Generated_Face&Sketch_2/SketchCircle_3_2"), model.selection("FACE", "Extrusion_2_1/From_Face"), model.selection("FACE", "(Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2)(Extrusion_2_1/From_Face)(Extrusion_2_2/From_Face)"), model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2"), model.selection("FACE", "Extrusion_2_2/From_Face"), model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchCircle_2_2"), model.selection("FACE", "Extrusion_2_1/From_Face"), model.selection("FACE", "Extrusion_2_1/To_Face")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
model.do()
model.end()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
-SketchCircle_1 = Sketch_1.addCircle(-150, 79, -50, 79)
-SketchCircle_2 = Sketch_1.addCircle(-155, 278, -10, 278)
+SketchCircle_1 = Sketch_1.addCircle(-155, 278, 145)
+SketchCircle_2 = Sketch_1.addCircle(-150, 79, 100)
+model.do()
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_2_2f-SketchCircle_2_2f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Group_1_objects = [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][weak_name_1]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][weak_name_1]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1][weak_name_1]")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+Group_2_objects = [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_2][Revolution_1_1/Generated_Face&Sketch_1/SketchCircle_2_2&weak_name_1]")]
+Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_2_2f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Base_Edge_8"), model.selection("EDGE", "Revolution_1_1/Base_Edge_10"), model.selection("EDGE", "Revolution_1_1/Base_Edge_12")])
-Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Lateral_2"), model.selection("EDGE", "Revolution_1_1/Lateral_4"), model.selection("EDGE", "Revolution_1_1/Lateral_6")])
model.end()
# check that resulting group selection is valid
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
SketchCircle_1 = Sketch_1.addCircle(-150, 80, 100)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Base_Edge_4")])
-Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Lateral_2")])
-Group_3 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Revolution_1_1/Lateral_2&Revolution_1_1/Base_Edge_4")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Face_1_1/Edge_1][weak_name_1]")])
+Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Face_1_1/Edge_1][weak_name_2]")])
+Group_3 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Face_1_1/Edge_1]")])
+model.do()
model.end()
# check that resulting group selection is valid
##
# revolution of 3-edges contour (4th is used as axis of rotation) is checking for naming of edges
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), 360, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Lateral_4"), model.selection("EDGE", "Revolution_1_1/Base_Edge_10"), model.selection("EDGE", "Revolution_1_1/Lateral_6"), model.selection("EDGE", "Revolution_1_1/Base_Edge_12"), model.selection("EDGE", "Revolution_1_1/Base_Edge_14")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection("EDGE", "Sketch_1/SketchLine_4"), 360, 0)
+Group_1_objects = [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][weak_name_3]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3])"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][weak_name_3]")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+model.do()
model.end()
# check that resulting group selection is valid
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_5.endPoint())
SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7")
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5r-SketchLine_6r")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), 360, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4&Revolution_1_1/Generated_Face_3"), model.selection("EDGE", "Revolution_1_1/Generated_Face_3&Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "Revolution_1_1/Base_Edge_6"), model.selection("EDGE", "Revolution_1_1/Base_Edge_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Revolution_1_1/Generated_Face_3")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_6r-SketchLine_5r-SketchLine_3f-SketchLine_4f")], model.selection("EDGE", "Sketch_1/SketchLine_4"), 360, 0)
+Group_1_objects = [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][weak_name_3]"), model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][weak_name_3]"), model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5])"), model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_6][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_5][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3])")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+model.do()
model.end()
# check that resulting group selection is valid
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result())
SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 50, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1"), 25, True)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 50, 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face"), 25, True)
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_5 = Sketch_2.addLine(84.67753244325934, -72.65003691291119, -28.95543815719345, -72.65003691291119)
SketchLine_6 = Sketch_2.addLine(-28.95543815719345, -72.65003691291119, -28.95543815719345, 10.01640181835304)
SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_7.result())
SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_8.result())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_6"), model.selection("EDGE", "Sketch_2/SketchLine_8"), model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_7")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")])
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "Face_1_1")])
Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchConstraintParallel_4 = Sketch_3.setParallel(SketchLine_10.result(), SketchLine_12.result())
SketchConstraintPerpendicular_2 = Sketch_3.setPerpendicular(SketchLine_9.result(), SketchLine_12.result())
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_9r-SketchLine_10r-SketchLine_11r-SketchLine_12r")], model.selection(), 50, 0)
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r")], model.selection(), 50, 0)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPSOLID", "Partition_1_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
model.do()
model.end()
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 1, False)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Plane_1")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Partition_1_1_2/Modified_Edge_1_1")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Partition_1_1_2/Modified_Edge&Face_1_1/Edge_4")])
+model.do()
model.end()
# check that resulting group selection is valid
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_13.result())
SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_14.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_5f-SketchLine_6f-SketchLine_7f"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"), model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f")], model.selection(), 10, 0)
+Extrusion_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_2f-SketchLine_5f-SketchLine_6f-SketchLine_7f"), model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r"), model.selection("FACE", "Sketch_1/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f")]
+Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 10, 0)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")])
model.do()
model.end()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
-# check that revolution that produces a sphere has correctly named 2 vertices with different names
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.endPoint())
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), 360, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Revolution_1_1/Vertex_6"), model.selection("VERTEX", "Revolution_1_1/Vertex_8")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f")], model.selection("EDGE", "Sketch_1/SketchLine_2"), 360, 0)
+Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2][weak_name_1]"), model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2][weak_name_2]")])
+model.do()
model.end()
# check that resulting group selection is valid and names are different
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result())
SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result())
-SketchArc_1 = Sketch_1.addArc(4.151438510550382e-034, -3.089278765476956e-034, 81.26217508737108, 0, 0, 81.26217508737108, False)
+SketchArc_1 = Sketch_1.addArc(4.151438510550382e-34, -3.089278765476956e-34, 81.26217508737108, 0, 0, 81.26217508737108, False)
SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_1.center())
SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_1.startPoint())
SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint())
SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_1.endPoint())
SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result())
-SketchArc_2 = Sketch_1.addArc(4.151438510550382e-034, -3.089278765476956e-034, 76.26217508737108, 0, 0, 76.26217508737108, False)
+SketchArc_2 = Sketch_1.addArc(4.151438510550382e-34, -3.089278765476956e-34, 76.26217508737108, 0, 0, 76.26217508737108, False)
SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_2.center())
SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_23")
SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_9.result(), SketchArc_2.startPoint())
SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_24")
SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_10.result(), SketchArc_2.endPoint())
SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_25")
-SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchArc_2.endPoint(), 5)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchArc_2.endPoint(), 5, False)
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "2*length_assemblage")
SketchConstraintLength_1.setName("SketchConstraintLength_2")
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_6.result(), "length_assemblage")
SketchCircle_11 = Sketch_2.addCircle(66.22695092615982, 10.77677442495125, 4.536925074373645)
SketchCircle_12 = Sketch_2.addCircle(50.98852111849166, 6.165144351577979, 3.547307159201085)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_9f-SketchLine_10r-SketchArc_1_2f-SketchArc_2_2r")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2")])
-Face_4 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("FACE", "Face_4_1")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_12")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_9f-SketchArc_1_2f-SketchLine_10r-SketchArc_2_2r_wire")])
+Face_3_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2")]
+Face_3 = model.addFace(Part_1_doc, Face_3_objects)
+Face_4_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")]
+Face_4 = model.addFace(Part_1_doc, Face_4_objects)
+Partition_1_objects = [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("FACE", "Face_4_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+Group_1_objects = [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_12")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
Group_1.result().setName("eau")
Group_1.result().setColor(0, 170, 255)
Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Face_4_1")])
Group_2.result().setName("acier")
Group_2.result().setColor(170, 85, 0)
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/XOY"))
+Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchLine_11 = Sketch_3.addLine(40, 0, 30, 0)
-SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "Partition_1_1_1/Modified_Edge_14_15&Partition_1_1_1/Modified_Edge_14_16"))
+SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "[Partition_1_1_1/Modified_Edge&Face_4_1/Edge_7&Face_1_1/Edge_7][Partition_1_1_1/Modified_Edge&Face_4_1/Edge_6&Face_1_1/Edge_6]"))
SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_19")
SketchLine_12 = Sketch_3.addLine(30, 0, 30, 10)
SketchLine_13 = Sketch_3.addLine(30, 10, 40, 10)
SketchLine_14 = Sketch_3.addLine(40, 10, 40, 0)
SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_20")
SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_21")
SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_22")
SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26")
SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_11.result())
SketchConstraintEqual_5 = Sketch_3.setEqual(SketchLine_13.result(), SketchLine_14.result())
SketchConstraintEqual_5.setName("SketchConstraintEqual_1")
model.do()
-Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")])
-MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_9"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
-Recover_1 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Sketch_3/Vertex-SketchPoint_1-SketchLine_12s-SketchLine_11e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_6s-SketchLine_5e"))
-MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
-Recover_2 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Sketch_3/Vertex-SketchPoint_1-SketchLine_12s-SketchLine_11e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"))
-MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4)
-Recover_3 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_9s-SketchLine_7e"), model.selection("VERTEX", "LinearCopy_3_1/Translated_Edge_1_4&LinearCopy_3_1/Translated_Edge_1_1"))
-MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 3)
-Recover_4 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_9s-SketchLine_7e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_10s"))
-MultiTranslation_5 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_4_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 2)
-Partition_2 = model.addPartition(Part_1_doc, [model.selection("COMPOUND", "Partition_1_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_2_1"), model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "LinearCopy_4_1"), model.selection("COMPOUND", "LinearCopy_5_1")])
+Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r_wire")])
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/SketchLine_9"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
+Recover_1 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Sketch_3/SketchLine_11_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_5_EndVertex"))
+LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
+Recover_2 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Sketch_3/SketchLine_11_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"))
+LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4)
+Recover_3 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_1]e[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_4]e"))
+LinearCopy_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 3)
+Recover_4 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"))
+LinearCopy_5 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_4_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 2)
+Partition_2_objects = [model.selection("COMPOUND", "Partition_1_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_2_1"), model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "LinearCopy_4_1"), model.selection("COMPOUND", "LinearCopy_5_1")]
+Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects)
+model.do()
model.end()
# check that partition constructed correctly
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint())
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.endPoint())
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f")], model.selection("EDGE", "Sketch_1/SketchLine_2"), 360, 0)
Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], model.selection("EDGE", "PartSet/OY"), 150)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Translation_1_1/Translated_Vertex_1"), model.selection("VERTEX", "Translation_1_1/Translated_Vertex_2")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Translation_1_1/MF:Translated&Sketch_1/SketchArc_1_2][weak_name_1]"), model.selection("VERTEX", "[Translation_1_1/MF:Translated&Sketch_1/SketchArc_1_2][weak_name_2]")])
+model.do()
model.end()
# check that resulting group selection is valid, names exist and different
SketchCircle_1 = Sketch_1.addCircle(-13.45056286489504, 169.4770920976776, 150.6703210346195)
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_2"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_2"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_2"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_2"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_10&Extrusion_1_1/To_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_10&Extrusion_1_1/From_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_10"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&Extrusion_1_1/Generated_Face_10"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&Extrusion_1_1/To_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&Extrusion_1_1/From_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_9"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/From_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/To_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_7"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/Generated_Face_6"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/From_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/To_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_11&Extrusion_1_1/Generated_Face_5"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_11&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_11&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_11&Extrusion_1_1/Generated_Face_10"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_10&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_10&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/Generated_Face_6"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_10&Extrusion_1_1/Generated_Face_9"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&Extrusion_1_1/Generated_Face_8"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/Generated_Face_7")])
+Group_1_objects = [model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1_2/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1]"), model.selection("EDGE", "[Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_4/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1_4/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_4/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_4/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1][Extrusion_1_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1][Extrusion_1_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1][Extrusion_1_1_1/Generated_Face&Sketch_1/SketchArc_1_2]")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+model.do()
model.end()
# check that resulting group selection is valid
SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.results()[1], SketchArc_4.endPoint())
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/Generated_Face_19"), model.selection("FACE", "Extrusion_1_1/Generated_Face_18"), model.selection("FACE", "Extrusion_1_1/Generated_Face_16"), model.selection("FACE", "Extrusion_1_1/Generated_Face_15"), model.selection("FACE", "Extrusion_1_1/Generated_Face_15"), model.selection("FACE", "Extrusion_1_1/Generated_Face_5"), model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("FACE", "Extrusion_1_1/From_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("FACE", "Extrusion_1_1/To_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_19"), model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("FACE", "Extrusion_1_1/From_Face_4"), model.selection("FACE", "Extrusion_1_1/To_Face_4"), model.selection("FACE", "Extrusion_1_1/Generated_Face_8"), model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_9"), model.selection("FACE", "Extrusion_1_1/From_Face_6"), model.selection("FACE", "Extrusion_1_1/Generated_Face_13"), model.selection("FACE", "Extrusion_1_1/To_Face_6"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_12"), model.selection("FACE", "Extrusion_1_1/To_Face_5"), model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), model.selection("FACE", "Extrusion_1_1/From_Face_5"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_8"), model.selection("FACE", "Extrusion_1_1/Generated_Face_9"), model.selection("FACE", "Extrusion_1_1/Generated_Face_13"), model.selection("FACE", "Extrusion_1_1/Generated_Face_7"), model.selection("FACE", "Extrusion_1_1/Generated_Face_14"), model.selection("FACE", "Extrusion_1_1/Generated_Face_12"), model.selection("FACE", "Extrusion_1_1/Generated_Face_18"), model.selection("FACE", "Extrusion_1_1/From_Face_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face_11"), model.selection("FACE", "Extrusion_1_1/Generated_Face_6"), model.selection("FACE", "Extrusion_1_1/To_Face_2"), model.selection("FACE", "Extrusion_1_1/Generated_Face_10"), model.selection("FACE", "Extrusion_1_1/Generated_Face_6"), model.selection("FACE", "Extrusion_1_1/To_Face_7"), model.selection("FACE", "Extrusion_1_1/From_Face_7"), model.selection("FACE", "Extrusion_1_1/Generated_Face_17"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/To_Face_1")])
+Group_1_objects = [model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_1"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_3_2"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_3/From_Face"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1_3/To_Face"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_1&weak_name_2"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_4/From_Face"), model.selection("FACE", "Extrusion_1_1_4/To_Face"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchLine_2"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2"), model.selection("FACE", "Extrusion_1_1_6/From_Face"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchArc_3_2"), model.selection("FACE", "Extrusion_1_1_6/To_Face"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_5/To_Face"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_2_2&weak_name_1"), model.selection("FACE", "Extrusion_1_1_5/From_Face"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Extrusion_1_1_2/Generated_Face&Sketch_1/SketchCircle_1_2"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchArc_3_2"), model.selection("FACE", "Extrusion_1_1_4/Generated_Face&Sketch_1/SketchArc_4_2"), model.selection("FACE", "Extrusion_1_1_5/Generated_Face&Sketch_1/SketchArc_4_2"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_2"), model.selection("FACE", "Extrusion_1_1_2/From_Face"), model.selection("FACE", "Extrusion_1_1_1/Generated_Face&Sketch_1/SketchLine_4"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_2_2&weak_name_2"), model.selection("FACE", "Extrusion_1_1_2/To_Face"), model.selection("FACE", "Extrusion_1_1_7/Generated_Face&Sketch_1/SketchCircle_2_2"), model.selection("FACE", "Extrusion_1_1_6/Generated_Face&Sketch_1/SketchArc_2_2&weak_name_2"), model.selection("FACE", "Extrusion_1_1_7/To_Face"), model.selection("FACE", "Extrusion_1_1_7/From_Face"), model.selection("FACE", "Extrusion_1_1_3/Generated_Face&Sketch_1/SketchCircle_1_2&weak_name_1"), model.selection("FACE", "Extrusion_1_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1_1/To_Face")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
+model.do()
model.end()
# check that resulting group selection is valid
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchCircle_1 = Sketch_1.addCircle(0, 0, 24.97092001270093)
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.center())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_1")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")])
Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_2_1")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")], model.selection(), 50, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/YOZ"))
+Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
SketchLine_5 = Sketch_2.addLine(49.62901186301215, 25.3130971701971, 39.15939470736273, 25.3130971701971)
SketchLine_6 = Sketch_2.addLine(39.15939470736273, 25.3130971701971, 39.15939470736273, 38.96586914453801)
SketchLine_7 = Sketch_2.addLine(39.15939470736273, 38.96586914453801, 49.62901186301215, 38.96586914453801)
SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")], model.selection(), 50, 50, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r")], model.selection(), 50, 50, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
model.do()
model.end()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_3.result())
SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_4.result())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_5")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 10, 0)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result())
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 100, 100)
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_3")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "Face_1_1")])
model.do()
model.end()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_12.endPoint(), 8.1, False)
SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_12.result(), 45)
model.do()
-Edge_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")]
+Edge_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")]
Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
Face_1_objects = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4")]
Face_1 = model.addFace(Part_1_doc, Face_1_objects)
-Edge_2_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_16"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_15"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_13"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_14"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_9")]
+Edge_2_objects = [model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_16"), model.selection("EDGE", "Sketch_1/SketchCircle_3_2"), model.selection("EDGE", "Sketch_1/SketchLine_15"), model.selection("EDGE", "Sketch_1/SketchCircle_2_2"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_13"), model.selection("EDGE", "Sketch_1/SketchLine_14"), model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_9")]
Edge_2 = model.addEdge(Part_1_doc, Edge_2_objects)
Partition_1_objects = [model.selection("FACE", "Face_1_1"), model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2"), model.selection("EDGE", "Edge_2_3"), model.selection("EDGE", "Edge_2_4"), model.selection("EDGE", "Edge_2_5"), model.selection("EDGE", "Edge_2_6"), model.selection("EDGE", "Edge_2_7"), model.selection("EDGE", "Edge_2_8"), model.selection("EDGE", "Edge_2_9"), model.selection("EDGE", "Edge_2_10"), model.selection("EDGE", "Edge_2_11")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
from salome.shaper import model
SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_3.result(), 1.5)
SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_8.result(), 4)
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_7r-SketchLine_8f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_1"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Revolution_1_1/Generated_Face_1__cc"), False)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"))
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]__cc"), False)
SketchPoint_1 = SketchProjection_3.createdFeature()
SketchCircle_1 = Sketch_2.addCircle(0, 0, 4.75)
SketchCircle_1.setAuxiliary(True)
SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center())
SketchCircle_3 = Sketch_2.addCircle(-4.113620667974014, 2.375000000003604, 1.1)
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_3.center())
-SketchCircle_4 = Sketch_2.addCircle(4.163806340121522e-012, -4.75000000000001, 1.1)
+SketchCircle_4 = Sketch_2.addCircle(4.163806340121522e-12, -4.75000000000001, 1.1)
SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_4.center())
SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_2.results()[1], SketchCircle_3.results()[1])
SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_3.results()[1], SketchCircle_4.results()[1])
SketchLine_10.setAuxiliary(True)
SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchLine_10.startPoint())
SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_10.endPoint())
-SketchLine_11 = Sketch_2.addLine(4.163806340121522e-012, -4.75000000000001, 0, 0)
+SketchLine_11 = Sketch_2.addLine(4.163806340121522e-12, -4.75000000000001, 0, 0)
SketchLine_11.setAuxiliary(True)
SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchCircle_4.center(), SketchLine_11.startPoint())
SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_11.endPoint())
SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_2.results()[1], 1.1)
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
SketchLine_12 = SketchProjection_4.createdFeature()
SketchConstraintAngle_1 = Sketch_2.setAngleBackward(SketchLine_9.result(), SketchLine_12.result(), 30.00000000000006)
SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_9.result(), SketchLine_10.result(), 119.9999999999498)
SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_19).startPoint(), SketchCircle_17.center(), 5.2, True)
model.do()
ExtrusionCut_1_objects_1 = [model.selection("FACE", "Sketch_2/Face-SketchCircle_9_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_10_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_7_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_17_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_16_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")]
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
-ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_11_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_12_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_6_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_8_2f")]
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
+ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Face-SketchCircle_11_2f-SketchCircle_9_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_12_2f-SketchCircle_10_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_6_2f-SketchCircle_5_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_8_2f-SketchCircle_7_2r_wire")]
ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_1_1")])
Axis_4 = model.addAxis(Part_1_doc, 0, -1, -10)
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f")], model.selection("EDGE", "Axis_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-ExtrusionCut_3.result().setDeflection(1e-005)
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f")], model.selection("EDGE", "Axis_1"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+ExtrusionCut_3.result().setDeflection(1e-05)
Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
SketchLine_21 = Sketch_3.addLine(3.5, 2.508501119175777, 3.5, 4.934853156880259)
SketchLine_22 = Sketch_3.addLine(3.5, 4.934853156880259, 6.2, 4.934853156880259)
SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
SketchLine_23 = Sketch_3.addLine(6.2, 4.934853156880259, 6.2, 3.008501119175777)
SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
-SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), False)
+SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_3"), False)
SketchLine_24 = SketchProjection_6.createdFeature()
SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_24.result())
SketchLine_25 = Sketch_3.addLine(6.2, 3.008501119175777, 3.5, 2.508501119175777)
SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_25.startPoint())
SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_25.endPoint())
-SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), False)
+SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_5"), False)
SketchLine_26 = SketchProjection_7.createdFeature()
SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_26.result())
SketchConstraintCoincidence_55 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_26.result())
SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_22.result())
SketchConstraintCoincidence_56 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_24.result())
-SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False)
+SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), False)
SketchLine_27 = SketchProjection_8.createdFeature()
SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_25.result(), SketchLine_27.result())
-SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False)
+SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), False)
SketchLine_28 = SketchProjection_9.createdFeature()
SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_21.startPoint(), SketchLine_28.result(), 0.5, True)
model.do()
Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_13_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_14_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_13_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_14_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0)
Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_3_1")], [model.selection("SOLID", "Common_1_1"), model.selection("SOLID", "Common_1_2")])
-# skip 3 vertices, limitation
-Group_1_objects = [model.selection("VERTEX", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Cut_1_1/Modified_Face_1"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5095"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("VERTEX", "ExtrusionCut_3_1/Lateral_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5108"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5082"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5069"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5043"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5024"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5006"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5015"), model.selection("VERTEX", "Extrusion_1_1/Lateral_4"), model.selection("VERTEX", "Extrusion_1_2/Lateral_4"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5033"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5031"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5022"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5013"), model.selection("VERTEX", "Common_1_2/Modified_Face_2&Common_1_2/Modified_Face_1"), model.selection("VERTEX", "Common_1_1/Modified_Face_2&Common_1_1/Modified_Face_1")]
-Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
-# skip 3 edges, limitation
-Group_2_objects = [model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5011"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "Common_1_2/Modified_Face_2&Common_1_2/Modified_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&Common_1_2/Modified_Face_2"), model.selection("EDGE", "Common_1_2/Modified_Edge_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_9&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5002"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Common_1_1/Modified_Edge_1"), model.selection("EDGE", "Common_1_1/Modified_Face_2&Common_1_1/Modified_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&Common_1_1/Modified_Face_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5029"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5020")]
-Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
-Group_3_objects = [model.selection("FACE", "ExtrusionCut_2_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_8"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_3"), model.selection("FACE", "Common_1_2/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_9"), model.selection("FACE", "Common_1_1/Modified_Face_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Cut_1_1/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_2"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_7"), model.selection("FACE", "Common_1_1/Modified_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_4"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Common_1_2/Modified_Face_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_8")]
-Group_3 = model.addGroup(Part_1_doc, Group_3_objects)
+model.do()
+model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
model.end()
assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f")], model.selection(), 100, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection(), 100, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"))
SketchCircle_1 = Sketch_2.addCircle(-10.74792845018279, -51.46099937127247, 20.55678647017868)
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/OX"), model.selection("FACE", "PartSet/YOZ"), 0, model.selection(), 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection("EDGE", "PartSet/OX"), model.selection("FACE", "PartSet/YOZ"), 0, model.selection(), 0)
model.do()
model.end()
-# -*- coding: utf-8 -*-
-
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from GeomAPI import *
from SketchAPI import *
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
-
model.addParameter(Part_1_doc, "R", "58")
model.addParameter(Part_1_doc, "cote_cube", "R/2")
model.addParameter(Part_1_doc, "theta", "54")
model.addParameter(Part_1_doc, "haut_ext_tuyau", "5")
model.addParameter(Part_1_doc, "haut_int_tuyau", "14")
Param_Diam = model.addParameter(Part_1_doc, "diam_tuyau", "10")
-
Revolution_1 = model.addRevolution(Part_1_doc, [], model.selection("EDGE", "PartSet/OZ"), 90, 0)
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), "R")
Revolution_1.setNestedSketch(Sketch_1)
-
Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 0, "cote_cube")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_2"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3"))
SketchLine_4 = Sketch_2.addLine(29, 0, 0, 0)
SketchLine_5 = Sketch_2.addLine(0, 0, 0, 29)
SketchLine_6 = Sketch_2.addLine(0, 29, 29, 29)
SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_7.result())
SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_6.result(), "cote_cube")
SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_6.result(), SketchLine_7.result())
-SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Revolution_1_1/To_Face_1"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][Revolution_1_1/To_Face]"), False)
SketchLine_8 = SketchProjection_3.createdFeature()
SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_8.result())
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Revolution_1_1/From_Face_1"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][Revolution_1_1/From_Face]"), False)
SketchLine_9 = SketchProjection_4.createdFeature()
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_9.result())
Extrusion_1.setNestedSketch(Sketch_2)
-
Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
-
Point_2 = model.addPoint(Part_1_doc, "x", "y", "-z")
-Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Fill_1_1_2/Modified_Face_3&Fill_1_1_2/Modified_Face_2&Fill_1_1_2/Modified_Face_1"))
+Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "[Fill_1_1_2/Modified_Face&Sketch_2/SketchLine_5&Revolution_1_1/To_Face][Fill_1_1_2/Modified_Face&Sketch_2/SketchLine_4&Revolution_1_1/From_Face][Fill_1_1_2/Modified_Face&Extrusion_1_1/To_Face&Sketch_1/SketchLine_3]"))
Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Point_1"), True)
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), "haut_ext_tuyau", True)
Plane_5.result().setName("Plane_2 arrivee tuyau")
-Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), 45)
-Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1"), 45)
-Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_4"), "90+45")
-
+Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/From_Face]"), 45)
+Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/From_Face]"), 45)
+Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7]"), "90+45")
Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_1_1_1")], [model.selection("FACE", "Plane_5")])
Fill_3 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_2_1_2")], [model.selection("FACE", "Plane_3")])
Fill_4 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_3_1_2")], [model.selection("FACE", "Plane_4")])
Fill_4.result().subResult(2).setColor(51, 51, 102)
Fill_4.result().subResult(3).setColor(102, 204, 102)
Fill_4.result().subResult(4).setColor(204, 204, 0)
-
Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Fill_4_1_4"), model.selection("SOLID", "Fill_4_1_2")])
-
Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("FACE", "Plane_2 arrivee tuyau"))
-
Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2 arrivee tuyau"))
SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Point_2"), False)
SketchPoint_2 = SketchProjection_5.createdFeature()
SketchConstraintEqual_4 = Sketch_3.setEqual(SketchLine_17.result(), SketchLine_16.result())
SketchConstraintLength_3 = Sketch_3.setLength(SketchLine_10.result(), "diam_tuyau")
model.do()
-
-Extrusion_2_objects = [model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_11f-SketchLine_14r-SketchLine_16r"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_10f-SketchLine_14f-SketchLine_17r"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_13f-SketchLine_15r-SketchLine_17f"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_12f-SketchLine_15f-SketchLine_16f")]
+Extrusion_2_objects = [model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_14r-SketchLine_11f-SketchLine_16r"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchCircle_1_2f-SketchLine_17r-SketchLine_10f-SketchLine_14f"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_15r-SketchLine_13f-SketchLine_17f"), model.selection("FACE", "Sketch_3/Face-SketchCircle_1_2f-SketchLine_16f-SketchLine_12f-SketchLine_15f")]
Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection(), 10, 0)
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_13r")], model.selection(), "haut_int_tuyau", 0)
-
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_3"))
-SketchProjection_6 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), False)
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_10r")], model.selection(), "haut_int_tuyau", 0)
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1_3/To_Face"))
+SketchProjection_6 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/To_Face]"), False)
SketchPoint_3 = SketchProjection_6.createdFeature()
-SketchProjection_7 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), False)
+SketchProjection_7 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_1][Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_2/To_Face]"), False)
SketchPoint_4 = SketchProjection_7.createdFeature()
SketchArc_2 = Sketch_4.addArc(0, 0, -7.071067811865476, -7.071067811865472, 7.071067811865476, 7.071067811865472, True)
SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchPoint_3.result(), SketchArc_2.startPoint())
SketchLine_18 = Sketch_4.addLine(7.071067811865476, 7.071067811865472, -7.071067811865476, -7.071067811865472)
SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchArc_2.endPoint(), SketchLine_18.startPoint())
SketchConstraintCoincidence_29 = Sketch_4.setCoincident(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_18.endPoint())
-SketchProjection_8 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/To_Face_1"), False)
+SketchProjection_8 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_14][Extrusion_2_1_1/To_Face]"), False)
SketchPoint_5 = SketchProjection_8.createdFeature()
SketchConstraintCoincidence_30 = Sketch_4.setCoincident(SketchArc_2.endPoint(), SketchAPI_Point(SketchPoint_5).coordinates())
model.do()
-
-Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchArc_2_2f-SketchLine_18r")], model.selection("EDGE", "Sketch_4/Edge-SketchLine_18"), 0, 180)
-
+Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchArc_2_2f-SketchLine_18r")], model.selection("EDGE", "Sketch_4/SketchLine_18"), 0, 180)
Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
Cut_1.result().setName("demi-sphere")
-
-Plane_9 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_10&Extrusion_2_1/Generated_Face_1&Extrusion_2_1/From_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_10&Extrusion_2_1/Generated_Face_1&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_10&Extrusion_2_1/To_Face_4"))
-Plane_10 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_12&Extrusion_2_1/Generated_Face_11&Extrusion_2_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/From_Face_1"))
-Plane_11 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/From_Face_3"))
-Plane_12 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_1&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/From_Face_4"))
-
+Plane_9 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_11][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_16][Extrusion_2_1_1/From_Face]"), model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_11][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_16][Extrusion_2_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_16][Extrusion_2_1_1/To_Face]"))
+Plane_10 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_14][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_11][Extrusion_2_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_14][Extrusion_2_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_1/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_1/Generated_Face&Sketch_3/SketchLine_14][Extrusion_2_1_1/From_Face]"))
+Plane_11 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_1][Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_2/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_10][Extrusion_2_1_2/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_2/Generated_Face&Sketch_3/SketchCircle_1_2&weak_name_1][Extrusion_2_1_2/Generated_Face&Sketch_3/SketchLine_17][Extrusion_2_1_2/From_Face]"))
+Plane_12 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_13][Extrusion_2_1_3/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1_3/Generated_Face&Sketch_3/SketchCircle_1_2][Extrusion_2_1_3/Generated_Face&Sketch_3/SketchLine_15][Extrusion_2_1_3/From_Face]"))
Recover_1 = model.addRecover(Part_1_doc, Cut_1, [Extrusion_3.result()])
-
-Plane_13 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape4"), model.selection("EDGE", "Recover_1_1/Shape4&Recover_1_1/Shape6"), "90+45")
-Plane_14 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape1"), model.selection("EDGE", "Recover_1_1/Shape1&Recover_1_1/Shape6"), "90+45")
-Plane_15 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape2"), model.selection("EDGE", "Recover_1_1/Shape2&Recover_1_1/Shape6"), "90+45")
-Plane_16 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape6"), model.selection("EDGE", "Recover_1_1/Shape3&Recover_1_1/Shape6"), 45)
-
+Plane_13 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Modified_Face&Sketch_3/SketchLine_10"), model.selection("EDGE", "[Recover_1_1/Modified_Face&Sketch_3/SketchLine_10][Recover_1_1/Modified_Face&Extrusion_3_1/To_Face]"), "90+45")
+Plane_14 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Modified_Face&Sketch_3/SketchLine_13"), model.selection("EDGE", "[Recover_1_1/Modified_Face&Sketch_3/SketchLine_13][Recover_1_1/Modified_Face&Extrusion_3_1/To_Face]"), "90+45")
+Plane_15 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Modified_Face&Sketch_3/SketchLine_12"), model.selection("EDGE", "[Recover_1_1/Modified_Face&Sketch_3/SketchLine_12][Recover_1_1/Modified_Face&Extrusion_3_1/To_Face]"), "90+45")
+Plane_16 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Modified_Face&Extrusion_3_1/To_Face"), model.selection("EDGE", "[Recover_1_1/Modified_Face&Sketch_3/SketchLine_11][Recover_1_1/Modified_Face&Extrusion_3_1/To_Face]"), 45)
Fill_5_objects_2 = [model.selection("FACE", "Plane_6"), model.selection("FACE", "Plane_7"), model.selection("FACE", "Plane_8"), model.selection("FACE", "Plane_9"), model.selection("FACE", "Plane_10"), model.selection("FACE", "Plane_11"), model.selection("FACE", "Plane_12"), model.selection("FACE", "Plane_13")]
Fill_5 = model.addFill(Part_1_doc, [model.selection("SOLID", "demi-sphere")], Fill_5_objects_2)
-
+Fill_5.result().subResult(0).setName("Fill_5_1_1")
+Fill_5.result().subResult(1).setName("Fill_5_1_2")
+Fill_5.result().subResult(2).setName("Fill_5_1_3")
+Fill_5.result().subResult(3).setName("Fill_5_1_4")
+Fill_5.result().subResult(4).setName("Fill_5_1_5")
+Fill_5.result().subResult(5).setName("Fill_5_1_6")
+Fill_5.result().subResult(6).setName("Fill_5_1_7")
+Fill_5.result().subResult(7).setName("Fill_5_1_8")
+Fill_5.result().subResult(8).setName("Fill_5_1_9")
+Fill_5.result().subResult(9).setName("Fill_5_1_10")
+Fill_5.result().subResult(10).setName("Fill_5_1_11")
+Fill_5.result().subResult(11).setName("Fill_5_1_12")
+Fill_5.result().subResult(12).setName("Fill_5_1_13")
+Fill_5.result().subResult(13).setName("Fill_5_1_14")
+Fill_5.result().subResult(14).setName("Fill_5_1_15")
+Fill_5.result().subResult(15).setName("Fill_5_1_16")
Union_2_objects = [model.selection("SOLID", "Fill_5_1_14"), model.selection("SOLID", "Fill_5_1_15"), model.selection("SOLID", "Fill_5_1_16")]
Union_2 = model.addUnion(Part_1_doc, Union_2_objects)
-Union_3_objects = [model.selection("SOLID", "Fill_5_1_8/Fill_5_1_8"), model.selection("SOLID", "Fill_5_1_4/Fill_5_1_4"), model.selection("SOLID", "Fill_5_1_9/Fill_5_1_9"), model.selection("SOLID", "Fill_5_1_11/Fill_5_1_11")]
+Union_2.result().subResult(0).setName("Union_2_1_1")
+Union_2.result().subResult(1).setName("Union_2_1_2")
+Union_2.result().subResult(2).setName("Union_2_1_3")
+Union_2.result().subResult(3).setName("Union_2_1_4")
+Union_2.result().subResult(4).setName("Union_2_1_5")
+Union_2.result().subResult(5).setName("Union_2_1_6")
+Union_2.result().subResult(6).setName("Union_2_1_7")
+Union_2.result().subResult(7).setName("Union_2_1_8")
+Union_2.result().subResult(8).setName("Union_2_1_9")
+Union_2.result().subResult(9).setName("Union_2_1_10")
+Union_2.result().subResult(10).setName("Union_2_1_11")
+Union_2.result().subResult(11).setName("Union_2_1_12")
+Union_2.result().subResult(12).setName("Union_2_1_13")
+Union_2.result().subResult(13).setName("Union_2_1_14")
+Union_3_objects = [model.selection("SOLID", "Union_2_1_8"), model.selection("SOLID", "Union_2_1_4"), model.selection("SOLID", "Union_2_1_9"), model.selection("SOLID", "Union_2_1_11")]
Union_3 = model.addUnion(Part_1_doc, Union_3_objects)
-Union_4_objects = [model.selection("SOLID", "Fill_5_1_6/Fill_5_1_6"), model.selection("SOLID", "Fill_5_1_10/Fill_5_1_10"), model.selection("SOLID", "Fill_5_1_13/Fill_5_1_13")]
+Union_3.result().subResult(0).setName("Union_3_1_1")
+Union_3.result().subResult(1).setName("Union_3_1_2")
+Union_3.result().subResult(2).setName("Union_3_1_3")
+Union_3.result().subResult(3).setName("Union_3_1_4")
+Union_3.result().subResult(4).setName("Union_3_1_5")
+Union_3.result().subResult(5).setName("Union_3_1_6")
+Union_3.result().subResult(6).setName("Union_3_1_7")
+Union_3.result().subResult(7).setName("Union_3_1_8")
+Union_3.result().subResult(8).setName("Union_3_1_9")
+Union_3.result().subResult(9).setName("Union_3_1_10")
+Union_3.result().subResult(10).setName("Union_3_1_11")
+Union_4_objects = [model.selection("SOLID", "Union_3_1_5"), model.selection("SOLID", "Union_3_1_7"), model.selection("SOLID", "Union_3_1_9")]
Union_4 = model.addUnion(Part_1_doc, Union_4_objects)
-Union_5_objects = [model.selection("SOLID", "Fill_5_1_2/Fill_5_1_2"), model.selection("SOLID", "Fill_5_1_1/Fill_5_1_1"), model.selection("SOLID", "Fill_5_1_3/Fill_5_1_3")]
+Union_4.result().subResult(0).setName("Union_4_1_1")
+Union_4.result().subResult(1).setName("Union_4_1_2")
+Union_4.result().subResult(2).setName("Union_4_1_3")
+Union_4.result().subResult(3).setName("Union_4_1_4")
+Union_4.result().subResult(4).setName("Union_4_1_5")
+Union_4.result().subResult(5).setName("Union_4_1_6")
+Union_4.result().subResult(6).setName("Union_4_1_7")
+Union_4.result().subResult(7).setName("Union_4_1_8")
+Union_4.result().subResult(8).setName("Union_4_1_9")
+Union_5_objects = [model.selection("SOLID", "Union_4_1_2"), model.selection("SOLID", "Union_4_1_1"), model.selection("SOLID", "Union_4_1_3")]
Union_5 = model.addUnion(Part_1_doc, Union_5_objects)
-Union_6_objects = [model.selection("SOLID", "Fill_5_1_5/Fill_5_1_5"), model.selection("SOLID", "Fill_5_1_7/Fill_5_1_7"), model.selection("SOLID", "Fill_5_1_12/Fill_5_1_12")]
+Union_5.result().subResult(0).setName("Union_5_1_1")
+Union_5.result().subResult(1).setName("Union_5_1_2")
+Union_5.result().subResult(2).setName("Union_5_1_3")
+Union_5.result().subResult(3).setName("Union_5_1_4")
+Union_5.result().subResult(4).setName("Union_5_1_5")
+Union_5.result().subResult(5).setName("Union_5_1_6")
+Union_5.result().subResult(6).setName("Union_5_1_7")
+Union_6_objects = [model.selection("SOLID", "Union_5_1_1"), model.selection("SOLID", "Union_5_1_2"), model.selection("SOLID", "Union_5_1_3")]
Union_6 = model.addUnion(Part_1_doc, Union_6_objects)
Union_6.result().setColor(0, 0, 204)
+Union_6.result().subResult(0).setName("Union_6_1_1")
Union_6.result().subResult(0).setColor(204, 102, 102)
+Union_6.result().subResult(1).setName("Union_6_1_2")
Union_6.result().subResult(1).setColor(127, 254, 127)
+Union_6.result().subResult(2).setName("Union_6_1_3")
Union_6.result().subResult(2).setColor(102, 51, 102)
+Union_6.result().subResult(3).setName("Union_6_1_4")
Union_6.result().subResult(3).setColor(76, 76, 153)
+Union_6.result().subResult(4).setName("Union_6_1_5")
Union_6.result().subResult(4).setColor(0, 0, 254)
-
Partition_1_objects = [model.selection("SOLID", "Recover_1_1"), model.selection("COMPSOLID", "Union_1_1"), model.selection("COMPSOLID", "Extrusion_2_1"), model.selection("COMPSOLID", "demi-sphere")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
Partition_1.result().setColor(102, 0, 0)
Partition_1.result().subResult(16).setColor(153, 153, 0)
Partition_1.result().subResult(17).setColor(153, 153, 0)
Partition_1.result().subResult(18).setColor(204, 0, 204)
-
Folder_1 = model.addFolder(Part_1_doc, Revolution_1, Union_1)
Folder_2 = model.addFolder(Part_1_doc, Point_3, Union_6)
model.do()
model.end()
+# too long
#assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
SketchLine_5 = Sketch_2.addLine(0, 0, -37.87650574447493, 64.03712943185892)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchProjection_1-SketchPoint_1-SketchLine_2s-SketchLine_1e"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False)
SketchPoint_2 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchPoint_2.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")], model.selection("EDGE", "Sketch_2/SketchLine_5"), 100, 0)
model.do()
model.end()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result())
SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result())
-SketchArc_1 = Sketch_1.addArc(4.151438510550382e-034, -3.089278765476956e-034, 81.26217508737108, 0, 0, 81.26217508737108, False)
+SketchArc_1 = Sketch_1.addArc(4.151438510550382e-34, -3.089278765476956e-34, 81.26217508737108, 0, 0, 81.26217508737108, False)
SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_1.center())
SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_1.startPoint())
SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint())
SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_1.endPoint())
SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result())
-SketchArc_2 = Sketch_1.addArc(4.151438510550382e-034, -3.089278765476956e-034, 76.26217508737108, 0, 0, 76.26217508737108, False)
+SketchArc_2 = Sketch_1.addArc(4.151438510550382e-34, -3.089278765476956e-34, 76.26217508737108, 0, 0, 76.26217508737108, False)
SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_2.center())
SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_23")
SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_9.result(), SketchArc_2.startPoint())
SketchConstraintEqual_4 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_1.result())
SketchConstraintEqual_4.setName("SketchConstraintEqual_5")
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")])
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchLine_11 = Sketch_2.addLine(40, 0, 30, 0)
SketchLine_12 = Sketch_2.addLine(30, 0, 30, 10)
SketchLine_13 = Sketch_2.addLine(30, 10, 40, 10)
SketchLine_14 = Sketch_2.addLine(40, 10, 40, 0)
SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_19")
SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_20")
SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_21")
SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_26")
SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_11.result())
model.do()
Sketch_2.setName("Sketch_3")
Sketch_2.result().setName("Sketch_3")
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r_wire")])
Face_2.setName("Face_5")
Face_2.result().setName("Face_5_1")
-LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_9"), 10, 2)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/SketchLine_9"), 10, 2)
LinearCopy_1.result().setName("LinearCopy")
-LinearCopy_1.result().subResult(0).setName("LinearCopy_1_1_1")
-LinearCopy_1.result().subResult(1).setName("LinearCopy_1_1_2")
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("COMPOUND", "LinearCopy")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("COMPOUND", "LinearCopy")])
+model.do()
model.end()
from GeomAPI import GeomAPI_Shape
-model.testNbResults(Boolean_1, 1)
-model.testNbSubResults(Boolean_1, [3])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.SOLID, [0])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.FACE, [3])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [20])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [40])
+model.testNbResults(Fill_1, 1)
+model.testNbSubResults(Fill_1, [3])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.EDGE, [20])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.VERTEX, [40])
assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchCircle_11 = Sketch_2.addCircle(66.22695092615982, 10.77677442495125, 4.536925074373645)
SketchCircle_12 = Sketch_2.addCircle(50.98852111849166, 6.165144351577979, 3.547307159201085)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_9f-SketchLine_10r-SketchArc_1_2f-SketchArc_2_2r")])
-Face_3_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2")]
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_9f-SketchArc_1_2f-SketchLine_10r-SketchArc_2_2r_wire")])
+Face_3_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2")]
Face_3 = model.addFace(Part_1_doc, Face_3_objects)
-Face_4_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")]
+Face_4_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")]
Face_4 = model.addFace(Part_1_doc, Face_4_objects)
Group_1_objects = [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_12")]
Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
Group_2.result().setColor(170, 85, 0)
Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchLine_11 = Sketch_3.addLine(40, 0, 30, 0)
-SketchProjection_1 = Sketch_3.addProjection(model.selection("VERTEX", "Face_4_1/Edge_6&Face_4_1/Edge_7"), False)
+SketchProjection_1 = Sketch_3.addProjection(model.selection("VERTEX", "[Face_4_1/Edge_6][Face_4_1/Edge_7]"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_19")
SketchLine_12 = Sketch_3.addLine(30, 0, 30, 10)
SketchLine_13 = Sketch_3.addLine(30, 10, 40, 10)
SketchLine_14 = Sketch_3.addLine(40, 10, 40, 0)
SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_20")
SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_21")
SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_22")
SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26")
SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_11.result())
SketchConstraintEqual_5 = Sketch_3.setEqual(SketchLine_13.result(), SketchLine_14.result())
SketchConstraintEqual_5.setName("SketchConstraintEqual_1")
model.do()
-Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")])
-LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_9"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
+Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r_wire")])
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/SketchLine_9"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
Recover_1 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Sketch_3/Vertex-SketchProjection_1-SketchPoint_1-SketchLine_12s-SketchLine_11e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_6s-SketchLine_5e"))
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Sketch_3/SketchLine_11_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_5_EndVertex"))
LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
Recover_2 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Sketch_3/Vertex-SketchProjection_1-SketchPoint_1-SketchLine_12s-SketchLine_11e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"))
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Sketch_3/SketchLine_11_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"))
LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4)
Recover_3 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_9s-SketchLine_7e"), model.selection("VERTEX", "LinearCopy_3_1/Translated_Edge_1_4&LinearCopy_3_1/Translated_Edge_1_1"))
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_1]e[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_4]e"))
LinearCopy_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 3)
Recover_4 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_9s-SketchLine_7e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_10s"))
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"))
LinearCopy_5 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_4_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 2)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
-Boolean_1_objects_2 = [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("FACE", "Face_4_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_2_1"), model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "LinearCopy_4_1"), model.selection("COMPOUND", "LinearCopy_5_1")]
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Partition_1_1")], Boolean_1_objects_2)
+Fill_1_objects_2 = [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("FACE", "Face_4_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_2_1"), model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "LinearCopy_4_1"), model.selection("COMPOUND", "LinearCopy_5_1")]
+Fill_1 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Partition_1_1")], Fill_1_objects_2)
model.do()
model.end()
from GeomAPI import GeomAPI_Shape
-model.testNbResults(Boolean_1, 1)
-model.testNbSubResults(Boolean_1, [60])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.SOLID, [0])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.FACE, [60])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [273])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [546])
+model.testNbResults(Fill_1, 1)
+model.testNbSubResults(Fill_1, [60])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.FACE, [60])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.EDGE, [273])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.VERTEX, [546])
assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchCircle_11 = Sketch_2.addCircle(66.22695092615982, 10.77677442495125, 4.536925074373645)
SketchCircle_12 = Sketch_2.addCircle(50.98852111849166, 6.165144351577979, 3.547307159201085)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_9f-SketchLine_10r-SketchArc_1_2f-SketchArc_2_2r")])
-Face_3_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2")]
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_9f-SketchArc_1_2f-SketchLine_10r-SketchArc_2_2r_wire")])
+Face_3_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2")]
Face_3 = model.addFace(Part_1_doc, Face_3_objects)
-Face_4_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")]
+Face_4_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")]
Face_4 = model.addFace(Part_1_doc, Face_4_objects)
Group_1_objects = [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_12")]
Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
Group_2.result().setColor(170, 85, 0)
Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchLine_11 = Sketch_3.addLine(40, 0, 30, 0)
-SketchProjection_1 = Sketch_3.addProjection(model.selection("VERTEX", "Face_4_1/Edge_6&Face_4_1/Edge_7"), False)
+SketchProjection_1 = Sketch_3.addProjection(model.selection("VERTEX", "[Face_4_1/Edge_6][Face_4_1/Edge_7]"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_19")
SketchLine_12 = Sketch_3.addLine(30, 0, 30, 10)
SketchLine_13 = Sketch_3.addLine(30, 10, 40, 10)
SketchLine_14 = Sketch_3.addLine(40, 10, 40, 0)
SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_20")
SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_21")
SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_22")
SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26")
SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_11.result())
SketchConstraintEqual_5 = Sketch_3.setEqual(SketchLine_13.result(), SketchLine_14.result())
SketchConstraintEqual_5.setName("SketchConstraintEqual_1")
model.do()
-Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")])
-LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_9"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
+Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r_wire")])
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "Sketch_1/SketchLine_9"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
Recover_1 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Sketch_3/Vertex-SketchProjection_1-SketchPoint_1-SketchLine_12s-SketchLine_11e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_6s-SketchLine_5e"))
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Sketch_3/SketchLine_11_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_5_EndVertex"))
LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4, model.selection("EDGE", "PartSet/OY"), "length_assemblage", 2)
Recover_2 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Sketch_3/Vertex-SketchProjection_1-SketchPoint_1-SketchLine_12s-SketchLine_11e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"))
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Sketch_3/SketchLine_11_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"))
LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 4)
Recover_3 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_9s-SketchLine_7e"), model.selection("VERTEX", "LinearCopy_3_1/Translated_Edge_1_4&LinearCopy_3_1/Translated_Edge_1_1"))
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_1]e[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_4]e"))
LinearCopy_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 3)
Recover_4 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
-Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_9s-SketchLine_7e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_10s"))
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Sketch_1/SketchLine_7_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"))
LinearCopy_5 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_4_1")], model.selection("EDGE", "PartSet/OX"), "length_assemblage", 2)
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
-Boolean_1_objects_2 = [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("FACE", "Face_4_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_2_1"), model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "LinearCopy_4_1"), model.selection("COMPOUND", "LinearCopy_5_1")]
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], Boolean_1_objects_2)
+Fill_1_objects_2 = [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("FACE", "Face_4_1"), model.selection("COMPOUND", "LinearCopy_1_1"), model.selection("COMPOUND", "LinearCopy_2_1"), model.selection("COMPOUND", "LinearCopy_3_1"), model.selection("COMPOUND", "LinearCopy_4_1"), model.selection("COMPOUND", "LinearCopy_5_1")]
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], Fill_1_objects_2)
model.do()
model.end()
from GeomAPI import GeomAPI_Shape
-model.testNbResults(Boolean_1, 1)
-model.testNbSubResults(Boolean_1, [0])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.SOLID, [0])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.FACE, [60])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [273])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [546])
+model.testNbResults(Fill_1, 1)
+model.testNbSubResults(Fill_1, [0])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.FACE, [60])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.EDGE, [273])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.VERTEX, [546])
assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Part_1_doc = Part_1.document()
Ellipsoid_1 = model.addEllipsoid(Part_1_doc, 10, 20, 40)
Torus_1 = model.addTorus(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 15, 3)
-LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Ellipsoid_1_1")], model.selection("EDGE", "Ellipsoid_1_1/Face_1"), 10, 2)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Ellipsoid_1_1")], model.selection("EDGE", "[Ellipsoid_1_1/Face_1][weak_name_3]"), 10, 2)
+model.do()
model.end()
# check that for the linear copy direction the elliptical edge is invalid
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
SketchLine_2 = Sketch_1.addLine(-153.5, 27.7, -153.5, 16.19999999999975)
SketchLine_3 = Sketch_1.addLine(-151.5000000000398, -24.69999999999951, 151.5000000000377, -24.69999999999977)
SketchLine_4 = Sketch_1.addLine(153.5000000000001, -22.70000000003736, 153.5, -15.80000000000003)
-SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 307)
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 11.50000000000025)
SketchPoint_1 = Sketch_1.addPoint(0, 27.7)
-SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result())
-SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5")
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result())
+SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_5")
SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
SketchLine_5 = SketchProjection_1.createdFeature()
-SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_5.result())
-SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6")
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_5.result())
+SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_6")
SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_1.result(), SketchPoint_1.coordinates())
SketchPoint_2 = Sketch_1.addPoint(153.5, 0)
-SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_4.result())
-SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7")
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_4.result())
+SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_7")
SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
SketchLine_6 = SketchProjection_2.createdFeature()
-SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_6.result())
-SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8")
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchLine_6.result())
+SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_8")
SketchLine_7 = Sketch_1.addLine(-108.1499999999999, 23.04999999999991, -109.8500000000001, 23.04999999999991)
SketchLine_8 = Sketch_1.addLine(-109.8500000000001, 19.75000000000008, -108.1499999999999, 19.75000000000008)
SketchLine_8.setName("SketchLine_9")
SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_7.result())
SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_8.result())
SketchArc_1 = Sketch_1.addArc(-109.8500000000001, 21.39999999999999, -109.8500000000001, 19.75000000000008, -109.8500000000001, 23.04999999999991, True)
-SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchArc_1.startPoint())
-SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_9")
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_9")
SketchArc_2 = Sketch_1.addArc(-108.1499999999999, 21.39999999999999, -108.1499999999999, 19.75000000000008, -108.1499999999999, 23.04999999999991, False)
-SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchArc_2.startPoint())
-SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_10")
-SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_7.startPoint())
-SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_11")
-SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.endPoint())
-SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_12")
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchArc_2.startPoint())
+SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_10")
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_11")
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.endPoint())
+SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12")
SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_7.result())
SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_8.result(), SketchArc_2.results()[1])
SketchConstraintTangent_3 = Sketch_1.setTangent(SketchLine_8.result(), SketchArc_1.results()[1])
SketchLine_9.setName("SketchLine_10")
SketchLine_9.result().setName("SketchLine_10")
SketchLine_9.setAuxiliary(True)
-SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchArc_1.results()[1])
-SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_13")
-SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_2.results()[1])
-SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_14")
-SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_9.result())
-SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_15")
-SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_9.result())
-SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_16")
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchArc_1.results()[1])
+SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_13")
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_2.results()[1])
+SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_14")
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_9.result())
+SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_15")
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_9.result())
+SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_16")
SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_9.result(), 5)
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.startPoint(), SketchLine_7.result(), 3.3, True)
SketchPoint_3 = Sketch_1.addPoint(0, 21.40000000000294)
-SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_5.result())
-SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_17")
-SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_9.result())
-SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_18")
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_5.result())
+SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_17")
+SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_3.coordinates(), SketchLine_9.result())
+SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_18")
SketchPoint_4 = Sketch_1.addPoint(-109, 21.4)
-SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_9.result())
-SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_19")
+SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchPoint_4.coordinates(), SketchLine_9.result())
+SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_19")
SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchPoint_4.coordinates(), SketchLine_9.result())
SketchConstraintMiddle_2.setName("SketchConstraintMiddle_3")
SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchPoint_4.coordinates(), SketchPoint_3.coordinates(), 109)
SketchArc_4.results()[1].setName("SketchArc_5_2")
SketchConstraintDistance_2 = Sketch_1.setDistance(SketchPoint_4.coordinates(), SketchLine_6.result(), 21.4, True)
SketchPoint_5 = Sketch_1.addPoint(0, -21)
-SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_5.result())
-SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_20")
+SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchPoint_5.coordinates(), SketchLine_5.result())
+SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_20")
SketchConstraintDistance_3 = Sketch_1.setDistance(SketchPoint_5.coordinates(), SketchLine_6.result(), 21, True)
SketchMultiTranslation_2_objects = [SketchArc_1.results()[1], SketchLine_7.result(), SketchLine_8.result(), SketchArc_2.results()[1], SketchLine_10.result(), SketchArc_5.results()[1], SketchLine_12.result(), SketchArc_3.results()[1], SketchArc_4.results()[1], SketchLine_13.result(), SketchLine_11.result(), SketchArc_6.results()[1]]
SketchMultiTranslation_2 = Sketch_1.addTranslation(SketchMultiTranslation_2_objects, SketchPoint_3.coordinates(), SketchPoint_5.coordinates(), 2)
SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_21.result(), 8)
SketchArc_13 = Sketch_1.addArc(-146.43, 15.7, -145.43, 15.69999999999999, -146.43, 14.7, False)
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_13.results()[1], 1)
-SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchArc_13.startPoint())
-SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_31")
-SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_13.endPoint(), SketchLine_21.startPoint())
-SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_29")
-SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_13.center(), SketchLine_20.result())
-SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_30")
-SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_13.center(), SketchLine_21.result())
-SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_32")
+SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_20.endPoint(), SketchArc_13.startPoint())
+SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_31")
+SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_13.endPoint(), SketchLine_21.startPoint())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_29")
+SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_13.center(), SketchLine_20.result())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_30")
+SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_13.center(), SketchLine_21.result())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_32")
SketchArc_14 = Sketch_1.addArc(-146.43, 5.699999999999998, -146.43, 6.699999999999998, -145.43, 5.7, False)
SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_13.results()[1], SketchArc_14.results()[1])
-SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_14.startPoint(), SketchLine_21.endPoint())
-SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_35")
-SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_22.startPoint())
-SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_34")
-SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_14.center(), SketchLine_22.result())
-SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_33")
-SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_14.center(), SketchLine_21.result())
-SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_36")
+SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchArc_14.startPoint(), SketchLine_21.endPoint())
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_35")
+SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_22.startPoint())
+SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_34")
+SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_14.center(), SketchLine_22.result())
+SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_33")
+SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchArc_14.center(), SketchLine_21.result())
+SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_36")
SketchArc_15 = Sketch_1.addArc(-107.43, 15.69999999999999, -107.43, 14.69999999999999, -108.43, 15.69999999999999, False)
SketchConstraintEqual_2 = Sketch_1.setEqual(SketchArc_15.results()[1], SketchArc_13.results()[1])
-SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchLine_20.startPoint())
-SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_39")
-SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_15.startPoint(), SketchLine_23.endPoint())
-SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_37")
-SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_15.center(), SketchLine_20.result())
-SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_38")
-SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_15.center(), SketchLine_23.result())
-SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_40")
+SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchLine_20.startPoint())
+SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_39")
+SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_15.startPoint(), SketchLine_23.endPoint())
+SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_37")
+SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_15.center(), SketchLine_20.result())
+SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_38")
+SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_15.center(), SketchLine_23.result())
+SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_40")
SketchArc_16 = Sketch_1.addArc(-107.43, 5.7, -108.43, 5.7, -107.43, 6.7, False)
SketchConstraintEqual_3 = Sketch_1.setEqual(SketchArc_15.results()[1], SketchArc_16.results()[1])
-SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_16.startPoint(), SketchLine_22.endPoint())
-SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_43")
-SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_16.endPoint(), SketchLine_23.startPoint())
-SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_42")
-SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_16.center(), SketchLine_22.result())
-SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_41")
-SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchArc_16.center(), SketchLine_23.result())
-SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_44")
+SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_16.startPoint(), SketchLine_22.endPoint())
+SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_43")
+SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_16.endPoint(), SketchLine_23.startPoint())
+SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_42")
+SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_16.center(), SketchLine_22.result())
+SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_41")
+SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchArc_16.center(), SketchLine_23.result())
+SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_44")
SketchConstraintDistance_4 = Sketch_1.setDistance(SketchArc_15.center(), SketchLine_5.result(), 107.43, True)
SketchConstraintDistance_5 = Sketch_1.setDistance(SketchArc_16.center(), SketchLine_6.result(), 5.7, True)
SketchPoint_6 = Sketch_1.addPoint(-95.65000000000001, 15.7)
-SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_20.result())
-SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_45")
+SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchPoint_6.coordinates(), SketchLine_20.result())
+SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_45")
SketchConstraintDistance_6 = Sketch_1.setDistance(SketchArc_15.center(), SketchPoint_6.coordinates(), "5.89*2", True)
SketchMultiTranslation_3_objects = [SketchLine_23.result(), SketchArc_13.results()[1], SketchLine_21.result(), SketchArc_14.results()[1], SketchArc_16.results()[1], SketchLine_22.result(), SketchLine_20.result(), SketchArc_15.results()[1]]
SketchMultiTranslation_3 = Sketch_1.addTranslation(SketchMultiTranslation_3_objects, SketchArc_13.center(), SketchPoint_6.coordinates(), 6)
SketchLine_24.setName("SketchLine_25")
SketchLine_24.result().setName("SketchLine_25")
SketchPoint_7 = Sketch_1.addPoint(-107.43, -5.3)
-SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchPoint_7.coordinates(), SketchLine_23.result())
-SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_46")
+SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchPoint_7.coordinates(), SketchLine_23.result())
+SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_46")
SketchConstraintDistance_7 = Sketch_1.setDistance(SketchPoint_7.coordinates(), SketchLine_6.result(), 5.3, True)
SketchMultiTranslation_4_objects = [SketchLine_20.result(), SketchArc_21.results()[1], SketchLine_22.result(), SketchArc_16.results()[1], SketchLine_41.result(), SketchLine_37.result(), SketchLine_38.result(), SketchArc_33.results()[1], SketchLine_43.result(), SketchLine_24.result(), SketchLine_42.result(), SketchArc_13.results()[1], SketchArc_31.results()[1], SketchLine_36.result(), SketchLine_28.result(), SketchArc_19.results()[1], SketchLine_21.result(), SketchArc_36.results()[1], SketchArc_14.results()[1], SketchArc_24.results()[1], SketchLine_31.result(), SketchArc_32.results()[1], SketchArc_20.results()[1], SketchLine_27.result(), SketchLine_34.result(), SketchArc_30.results()[1], SketchLine_39.result(), SketchArc_25.results()[1], SketchArc_34.results()[1], SketchArc_18.results()[1], SketchLine_40.result(), SketchLine_35.result(), SketchArc_35.results()[1], SketchArc_28.results()[1], SketchLine_32.result(), SketchArc_22.results()[1], SketchArc_26.results()[1], SketchLine_26.result(), SketchLine_30.result(), SketchArc_15.results()[1], SketchLine_33.result(), SketchLine_29.result(), SketchLine_23.result(), SketchLine_25.result(), SketchArc_29.results()[1], SketchArc_23.results()[1], SketchArc_27.results()[1], SketchArc_17.results()[1]]
SketchMultiTranslation_4 = Sketch_1.addTranslation(SketchMultiTranslation_4_objects, SketchArc_15.center(), SketchPoint_7.coordinates(), 2)
SketchConstraintHorizontal_8 = Sketch_1.setHorizontal(SketchLine_70.result())
SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_69.result())
SketchArc_61 = Sketch_1.addArc(-152.2999999999999, 14.70000000000002, -150.7999999999999, 14.70000000000003, -152.2999999999999, 16.20000000000002, False)
-SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_61.startPoint(), SketchLine_69.startPoint())
-SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_47")
-SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_61.endPoint(), SketchLine_68.endPoint())
-SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_50")
+SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchArc_61.startPoint(), SketchLine_69.startPoint())
+SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_47")
+SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_61.endPoint(), SketchLine_68.endPoint())
+SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_50")
SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_61.results()[1], SketchLine_69.result())
SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_61.results()[1], SketchLine_68.result())
SketchArc_62 = Sketch_1.addArc(-152.2999999999999, 9.699999999999999, -152.2999999999999, 8.199999999999999, -150.7999999999999, 9.699999999999999, False)
-SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchArc_62.startPoint(), SketchLine_70.startPoint())
-SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_48")
-SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchArc_62.endPoint(), SketchLine_69.endPoint())
-SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_51")
+SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_62.startPoint(), SketchLine_70.startPoint())
+SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_48")
+SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchArc_62.endPoint(), SketchLine_69.endPoint())
+SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_51")
SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_62.results()[1], SketchLine_69.result())
SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_62.results()[1], SketchLine_70.result())
SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_70.startPoint(), SketchLine_68.result(), 8, True)
SketchConstraintEqual_4 = Sketch_1.setEqual(SketchArc_61.results()[1], SketchArc_62.results()[1])
SketchConstraintDistance_10 = Sketch_1.setDistance(SketchLine_70.endPoint(), SketchLine_6.result(), 8.199999999999999, True)
SketchPoint_8 = Sketch_1.addPoint(-153.5, -7.799999999999999)
-SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchPoint_8.coordinates(), SketchLine_2.result())
-SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_53")
+SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchPoint_8.coordinates(), SketchLine_2.result())
+SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_53")
SketchConstraintDistance_11 = Sketch_1.setDistance(SketchPoint_8.coordinates(), SketchLine_6.result(), 7.8, True)
SketchMultiTranslation_5_objects = [SketchLine_68.result(), SketchArc_61.results()[1], SketchLine_69.result(), SketchArc_62.results()[1], SketchLine_70.result()]
SketchMultiTranslation_5 = Sketch_1.addTranslation(SketchMultiTranslation_5_objects, SketchLine_68.startPoint(), SketchPoint_8.coordinates(), 2)
SketchLine_80.setName("SketchLine_81")
SketchLine_80.result().setName("SketchLine_81")
SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_2.result(), SketchLine_80.result())
-SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_70.endPoint(), SketchLine_80.startPoint())
-SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_54")
-SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_68.startPoint(), SketchLine_2.endPoint())
-SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_55")
+SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchLine_70.endPoint(), SketchLine_80.startPoint())
+SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_54")
+SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_68.startPoint(), SketchLine_2.endPoint())
+SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_55")
SketchLine_81 = Sketch_1.addLine(-153.4999999999999, -15.79999999999969, -153.5, -22.70000000003739)
SketchLine_81.setName("SketchLine_82")
SketchLine_81.result().setName("SketchLine_82")
SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_80.result(), SketchLine_81.result())
-SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_81.startPoint(), SketchLine_73.result())
-SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_49")
-SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_80.endPoint(), SketchPoint_8.result())
-SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_52")
+SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_81.startPoint(), SketchLine_73.result())
+SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_49")
+SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_80.endPoint(), SketchPoint_8.result())
+SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_52")
SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_80.result())
SketchLine_82 = Sketch_1.addLine(153.5, 16.19999999999975, 153.5, 27.7)
SketchLine_82.setName("SketchLine_83")
SketchLine_82.result().setName("SketchLine_83")
-SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_82.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_82.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_56")
SketchConstraintCollinear_3 = Sketch_1.setCollinear(SketchLine_4.result(), SketchLine_82.result())
SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchLine_82.startPoint(), SketchLine_74.result())
SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_56")
SketchLine_84 = Sketch_1.addLine(-153.5, -22.70000000003739, -151.5000000000398, -24.69999999999951)
SketchLine_84.setName("SketchLine_85")
SketchLine_84.result().setName("SketchLine_85")
-SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_84.result(), SketchLine_3.result(), 45)
+SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_84.result(), SketchLine_3.result(), 45.0000000000272)
SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_84.startPoint(), SketchLine_81.endPoint())
SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_62")
SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_84.endPoint(), SketchLine_3.startPoint())
SketchConstraintCoincidence_53 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_85.result())
SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_63")
model.do()
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4e-SketchLine_80e"))
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"))
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_83e"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), False)
SketchPoint_9 = SketchProjection_3.createdFeature()
SketchArc_69 = Sketch_2.addArc(27.70000001097709, 0.85, 27.7, 0, 28.55000001097708, 0.85, False)
SketchConstraintCoincidence_54 = Sketch_2.setCoincident(SketchPoint_9.result(), SketchArc_69.startPoint())
SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_64")
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_83"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_83"), False)
SketchLine_86 = SketchProjection_4.createdFeature()
SketchLine_86.setName("SketchLine_87")
SketchLine_86.result().setName("SketchLine_87")
SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_88.result())
SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_88.result(), 10)
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchArc_69_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_89")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchArc_69_2"), model.selection("EDGE", "Sketch_2/SketchLine_89")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2")], model.selection("EDGE", "PartSet/OX"), 0, 307)
-Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3e-SketchLine_86e"))
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"))
Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2"))
-SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3e-SketchLine_86e"), False)
+SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"), False)
SketchPoint_10 = SketchProjection_5.createdFeature()
-SketchArc_70 = Sketch_3.addArc(-24.69999999999951, 1.85, -24.69999999999928, -3.648414406296559e-014, -26.54999999999951, 1.85, True)
+SketchArc_70 = Sketch_3.addArc(-24.69999999999951, 1.85, -24.69999999999928, -3.648414406296559e-14, -26.54999999999951, 1.85, True)
SketchConstraintCoincidence_58 = Sketch_3.setCoincident(SketchPoint_10.result(), SketchArc_70.startPoint())
SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_68")
SketchLine_89 = Sketch_3.addLine(-26.54999999999951, 1.85, -24.69999999999951, 1.85)
SketchConstraintRadius_4 = Sketch_3.setRadius(SketchArc_70.results()[1], "rext_2-ep/2")
SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_91.result(), 10)
model.do()
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_92"), model.selection("EDGE", "Sketch_3/Edge-SketchArc_70_2")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_92"), model.selection("EDGE", "Sketch_3/SketchArc_70_2")])
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2")], model.selection("EDGE", "PartSet/OX"), 0, 299)
Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Extrusion_2_2"), model.selection("FACE", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OX"), -2)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_7r-SketchLine_9r-SketchArc_1_2r-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11r-SketchLine_12r-SketchArc_4_2r-SketchArc_5_2r-SketchLine_13r-SketchLine_14r-SketchArc_6_2r-SketchArc_7_2r-SketchLine_15r-SketchLine_16r-SketchArc_8_2r-SketchLine_17r-SketchArc_9_2r-SketchLine_18r-SketchArc_10_2r-SketchArc_11_2r-SketchLine_19r-SketchLine_20r-SketchArc_12_2r-SketchLine_21r-SketchLine_22r-SketchLine_23r-SketchLine_24r-SketchArc_13_2r-SketchArc_14_2r-SketchArc_15_2r-SketchArc_16_2r-SketchLine_25r-SketchArc_17_2r-SketchLine_26r-SketchArc_18_2r-SketchArc_19_2r-SketchLine_27r-SketchLine_28r-SketchArc_20_2r-SketchLine_29r-SketchLine_30r-SketchLine_31r-SketchLine_32r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_23_2r-SketchArc_24_2r-SketchLine_33r-SketchLine_34r-SketchLine_35r-SketchLine_36r-SketchArc_25_2r-SketchArc_26_2r-SketchArc_27_2r-SketchArc_28_2r-SketchArc_29_2r-SketchArc_30_2r-SketchArc_31_2r-SketchArc_32_2r-SketchLine_37r-SketchLine_38r-SketchLine_39r-SketchLine_40r-SketchLine_41r-SketchLine_42r-SketchLine_43r-SketchLine_44r-SketchArc_33_2r-SketchArc_34_2r-SketchArc_35_2r-SketchArc_36_2r-SketchLine_45r-SketchArc_37_2r-SketchLine_46r-SketchArc_38_2r-SketchLine_47r-SketchLine_48r-SketchLine_49r-SketchArc_39_2r-SketchLine_50r-SketchLine_51r-SketchLine_52r-SketchArc_40_2r-SketchArc_41_2r-SketchLine_53r-SketchLine_54r-SketchArc_42_2r-SketchLine_55r-SketchArc_43_2r-SketchArc_44_2r-SketchArc_45_2r-SketchLine_56r-SketchArc_46_2r-SketchArc_47_2r-SketchLine_57r-SketchLine_58r-SketchArc_48_2r-SketchLine_59r-SketchArc_49_2r-SketchArc_50_2r-SketchArc_51_2r-SketchLine_60r-SketchLine_61r-SketchArc_52_2r-SketchArc_53_2r-SketchLine_62r-SketchArc_54_2r-SketchArc_55_2r-SketchLine_63r-SketchLine_64r-SketchArc_56_2r-SketchLine_65r-SketchLine_66r-SketchLine_67r-SketchLine_68r-SketchArc_57_2r-SketchArc_58_2r-SketchArc_59_2r-SketchArc_60_2r-SketchLine_69f-SketchLine_70f-SketchLine_71f-SketchArc_61_2r-SketchArc_62_2r-SketchLine_72f-SketchArc_63_2r-SketchLine_73f-SketchArc_64_2r-SketchLine_74f-SketchLine_75r-SketchArc_65_2r-SketchLine_76r-SketchArc_66_2r-SketchLine_77r-SketchLine_78r-SketchArc_67_2r-SketchLine_79r-SketchArc_68_2r-SketchLine_80r-SketchLine_81f-SketchLine_82f-SketchLine_83f-SketchLine_84f-SketchLine_85f-SketchLine_86r")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_69f-SketchArc_61_2r-SketchLine_70f-SketchArc_62_2r-SketchLine_71f-SketchLine_81f-SketchLine_72f-SketchArc_63_2r-SketchLine_73f-SketchArc_64_2r-SketchLine_74f-SketchLine_82f-SketchLine_85f-SketchLine_3f-SketchLine_86r-SketchLine_4f-SketchLine_80r-SketchArc_68_2r-SketchLine_79r-SketchArc_67_2r-SketchLine_78r-SketchLine_84f-SketchLine_77r-SketchArc_66_2r-SketchLine_76r-SketchArc_65_2r-SketchLine_75r-SketchLine_83f-SketchLine_15r-SketchArc_8_2r-SketchLine_16r-SketchArc_7_2r-SketchArc_2_2r-SketchLine_9r-SketchArc_1_2r-SketchLine_7r-SketchLine_11r-SketchArc_4_2r-SketchLine_12r-SketchArc_3_2r-SketchArc_32_2r-SketchLine_40r-SketchArc_28_2r-SketchLine_36r-SketchArc_24_2r-SketchLine_44r-SketchArc_36_2r-SketchLine_32r-SketchLine_50r-SketchArc_43_2r-SketchLine_54r-SketchArc_41_2r-SketchLine_49r-SketchArc_55_2r-SketchLine_65r-SketchArc_37_2r-SketchLine_13r-SketchArc_6_2r-SketchLine_14r-SketchArc_5_2r-SketchArc_9_2r-SketchLine_18r-SketchArc_10_2r-SketchLine_17r-SketchLine_20r-SketchArc_12_2r-SketchLine_19r-SketchArc_11_2r-SketchArc_29_2r-SketchLine_37r-SketchArc_25_2r-SketchLine_33r-SketchArc_21_2r-SketchLine_41r-SketchArc_33_2r-SketchLine_29r-SketchArc_30_2r-SketchLine_38r-SketchArc_26_2r-SketchLine_34r-SketchArc_22_2r-SketchLine_42r-SketchArc_34_2r-SketchLine_30r-SketchLine_68r-SketchArc_53_2r-SketchLine_61r-SketchArc_58_2r-SketchLine_64r-SketchArc_51_2r-SketchLine_60r-SketchArc_39_2r-SketchArc_50_2r-SketchLine_63r-SketchArc_57_2r-SketchLine_53r-SketchArc_45_2r-SketchLine_56r-SketchArc_42_2r-SketchLine_47r-SketchArc_49_2r-SketchLine_62r-SketchArc_47_2r-SketchLine_52r-SketchArc_52_2r-SketchLine_57r-SketchArc_48_2r-SketchLine_48r-SketchArc_31_2r-SketchLine_39r-SketchArc_27_2r-SketchLine_35r-SketchArc_23_2r-SketchLine_43r-SketchArc_35_2r-SketchLine_31r-SketchArc_59_2r-SketchLine_58r-SketchArc_54_2r-SketchLine_66r-SketchArc_60_2r-SketchLine_59r-SketchArc_46_2r-SketchLine_51r-SketchArc_19_2r-SketchLine_27r-SketchArc_18_2r-SketchLine_26r-SketchArc_17_2r-SketchLine_28r-SketchArc_20_2r-SketchLine_25r-SketchArc_56_2r-SketchLine_67r-SketchArc_38_2r-SketchLine_46r-SketchArc_44_2r-SketchLine_55r-SketchArc_40_2r-SketchLine_45r-SketchArc_15_2r-SketchLine_24r-SketchArc_16_2r-SketchLine_23r-SketchArc_14_2r-SketchLine_22r-SketchArc_13_2r-SketchLine_21r")])
Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Translation_1_2"))
SketchCircle_1 = Sketch_4.addCircle(96.50000000003769, 5.5, 1.65)
-SketchProjection_6 = Sketch_4.addProjection(model.selection("EDGE", "Translation_1_2/Translated_Edge_1"), False)
+SketchProjection_6 = Sketch_4.addProjection(model.selection("EDGE", "Translation_1_2/ME:Translated&Extrusion_2_1/To_Edge"), False)
SketchLine_92 = SketchProjection_6.createdFeature()
SketchLine_92.setName("SketchLine_93")
SketchLine_92.result().setName("SketchLine_93")
SketchConstraintDistance_14 = Sketch_4.setDistance(SketchCircle_1.center(), SketchLine_92.result(), 53, True)
-SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "Extrusion_1_2/To_Edge_1"), False)
+SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "Extrusion_1_2/To_Edge"), False)
SketchLine_93 = SketchProjection_7.createdFeature()
SketchLine_93.setName("SketchLine_94")
SketchLine_93.result().setName("SketchLine_94")
SketchMultiTranslation_6 = Sketch_4.addTranslation([SketchCircle_1.results()[1]], SketchLine_95.endPoint(), SketchLine_95.startPoint(), 4)
[SketchCircle_2, SketchCircle_3, SketchCircle_4] = SketchMultiTranslation_6.translated()
model.do()
-Face_2_objects = [model.selection("EDGE", "Sketch_4/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_4/Edge-SketchCircle_3_2"), model.selection("WIRE", "Sketch_4/Wire-SketchCircle_2_2f"), model.selection("EDGE", "Sketch_4/Edge-SketchCircle_1_2")]
+Face_2_objects = [model.selection("EDGE", "Sketch_4/SketchCircle_4_2"), model.selection("EDGE", "Sketch_4/SketchCircle_3_2"), model.selection("WIRE", "[Sketch_4/SketchCircle_2_2]"), model.selection("EDGE", "Sketch_4/SketchCircle_1_2")]
Face_2 = model.addFace(Part_1_doc, Face_2_objects)
Partition_1_objects = [model.selection("FACE", "Extrusion_1_1"), model.selection("FACE", "Extrusion_1_2"), model.selection("FACE", "Translation_1_1"), model.selection("FACE", "Translation_1_2"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_2_2"), model.selection("FACE", "Face_2_3"), model.selection("FACE", "Face_2_4")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
-Remove_SubShapes_1_objects_2 = [model.selection("FACE", "Face_2_1/Face_2_1"), model.selection("FACE", "Face_2_2/Face_2_2"), model.selection("FACE", "Face_2_3/Face_2_3"), model.selection("FACE", "Face_2_4/Face_2_4")]
+Remove_SubShapes_1_objects_2 = [model.selection("FACE", "Partition_1_1_5"), model.selection("FACE", "Partition_1_1_6"), model.selection("FACE", "Partition_1_1_7"), model.selection("FACE", "Partition_1_1_8")]
Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "Partition_1_1"))
Remove_SubShapes_1.setSubShapesToRemove(Remove_SubShapes_1_objects_2)
model.do()
SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.result())
SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_17")
model.do()
-Edge_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_9")]
+Edge_1_objects = [model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_9")]
Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
Revolution_1_objects = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4"), model.selection("EDGE", "Edge_1_5"), model.selection("EDGE", "Edge_1_6"), model.selection("EDGE", "Edge_1_7")]
Revolution_1 = model.addRevolution(Part_1_doc, Revolution_1_objects, model.selection("EDGE", "PartSet/OZ"), 360, 0)
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2e"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"), False)
SketchPoint_1 = SketchProjection_3.createdFeature()
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
SketchLine_9 = SketchProjection_4.createdFeature()
SketchLine_9.setName("SketchLine_11")
SketchLine_9.result().setName("SketchLine_11")
SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_13.endPoint())
SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_22")
SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_12.result())
-SketchPoint_2 = Sketch_2.addPoint(-5.903605550615992e-026, -5)
-SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_12.result())
-SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_24")
+SketchPoint_2 = Sketch_2.addPoint(-5.903605550615992e-26, -5)
+SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_12.result())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_24")
SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchPoint_2.coordinates(), SketchLine_12.result())
-SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
-SketchLine_15 = SketchProjection_6.createdFeature()
-SketchLine_15.setName("SketchLine_16")
-SketchLine_15.result().setName("SketchLine_16")
-SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_15.result())
-SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_25")
+SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_14 = SketchProjection_5.createdFeature()
+SketchLine_14.setName("SketchLine_16")
+SketchLine_14.result().setName("SketchLine_16")
+SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_14.result())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_25")
SketchConstraintDistance_2 = Sketch_2.setDistance(SketchLine_11.endPoint(), SketchLine_10.result(), 2, True)
SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_10.result(), 3)
SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint(SketchAPI_Line(SketchLine_9).endPoint(), SketchLine_10.result())
SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_12.result(), 2)
model.do()
-Edge_2_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchLine_12"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_13"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_14"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_10")]
+Edge_2_objects = [model.selection("EDGE", "Sketch_2/SketchLine_12"), model.selection("EDGE", "Sketch_2/SketchLine_13"), model.selection("EDGE", "Sketch_2/SketchLine_14"), model.selection("EDGE", "Sketch_2/SketchLine_10")]
Edge_2 = model.addEdge(Part_1_doc, Edge_2_objects)
Extrusion_1_objects = [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2"), model.selection("EDGE", "Edge_2_3"), model.selection("EDGE", "Edge_2_4")]
Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection("EDGE", "PartSet/OY"), 3, 3)
Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_6"))
-SketchLine_16 = Sketch_3.addLine(-15, 0, -10, 2.951677693621839e-024)
-SketchLine_16.setName("SketchLine_17")
-SketchLine_16.result().setName("SketchLine_17")
-SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Revolution_1_6/Generated_Edge_1"), False)
-SketchCircle_1 = SketchProjection_7.createdFeature()
-SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_16.startPoint(), SketchCircle_1.results()[1])
-SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26")
-SketchLine_17 = Sketch_3.addLine(-10, 2.951677693621839e-024, -10, -3)
-SketchLine_17.setName("SketchLine_18")
-SketchLine_17.result().setName("SketchLine_18")
+SketchLine_15 = Sketch_3.addLine(-15, 0, -10, 2.951677693621839e-24)
+SketchLine_15.setName("SketchLine_17")
+SketchLine_15.result().setName("SketchLine_17")
+SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Revolution_1_6/Generated_Edge&Sketch_1/SketchLine_2_StartVertex"), False)
+SketchCircle_1 = SketchProjection_6.createdFeature()
+SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_15.startPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_26")
+SketchLine_16 = Sketch_3.addLine(-10, 2.951677693621839e-24, -10, -3)
+SketchLine_16.setName("SketchLine_18")
+SketchLine_16.result().setName("SketchLine_18")
+SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
+SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_27")
+SketchLine_17 = Sketch_3.addLine(-10, -3, -14.69693845669907, -3)
+SketchLine_17.setName("SketchLine_19")
+SketchLine_17.result().setName("SketchLine_19")
SketchConstraintCoincidence_24 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_17.startPoint())
-SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_27")
-SketchLine_18 = Sketch_3.addLine(-10, -3, -14.69693845669907, -3)
-SketchLine_18.setName("SketchLine_19")
-SketchLine_18.result().setName("SketchLine_19")
-SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint())
-SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_28")
-SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_18.endPoint(), SketchCircle_1.results()[1])
-SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_29")
-SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_17.result())
-SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_16.result(), SketchAPI_Circle(SketchCircle_1).center())
-SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_30")
-SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_16.result(), SketchLine_18.result())
-SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_16.result(), 5)
-SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_17.result(), 3)
-SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_16.result(), [SketchLine_17.result(), SketchLine_18.result()])
-[SketchLine_19, SketchLine_20] = SketchConstraintMirror_1.mirrored()
-SketchLine_20.setName("SketchLine_21")
-SketchLine_20.result().setName("SketchLine_21")
-SketchLine_19.setName("SketchLine_20")
-SketchLine_19.result().setName("SketchLine_20")
-SketchLine_21 = Sketch_3.addLine(-1.5, -2, 2, -2)
-SketchLine_21.setName("SketchLine_22")
-SketchLine_21.result().setName("SketchLine_22")
-SketchLine_22 = Sketch_3.addLine(2, -2, 2, 2)
-SketchLine_22.setName("SketchLine_23")
-SketchLine_22.result().setName("SketchLine_23")
+SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_28")
+SketchConstraintCoincidence_25 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_29")
+SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_16.result())
+SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_15.result(), SketchAPI_Circle(SketchCircle_1).center())
+SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_30")
+SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_15.result(), SketchLine_17.result())
+SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_15.result(), 5)
+SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_16.result(), 3)
+SketchConstraintMirror_1 = Sketch_3.addMirror(SketchLine_15.result(), [SketchLine_16.result(), SketchLine_17.result()])
+[SketchLine_18, SketchLine_19] = SketchConstraintMirror_1.mirrored()
+SketchLine_19.setName("SketchLine_21")
+SketchLine_19.result().setName("SketchLine_21")
+SketchLine_18.setName("SketchLine_20")
+SketchLine_18.result().setName("SketchLine_20")
+SketchLine_20 = Sketch_3.addLine(-1.5, -2, 2, -2)
+SketchLine_20.setName("SketchLine_22")
+SketchLine_20.result().setName("SketchLine_22")
+SketchLine_21 = Sketch_3.addLine(2, -2, 2, 2)
+SketchLine_21.setName("SketchLine_23")
+SketchLine_21.result().setName("SketchLine_23")
+SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
+SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_31")
+SketchLine_22 = Sketch_3.addLine(2, 2, -1.5, 2)
+SketchLine_22.setName("SketchLine_24")
+SketchLine_22.result().setName("SketchLine_24")
SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
-SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_31")
-SketchLine_23 = Sketch_3.addLine(2, 2, -1.5, 2)
-SketchLine_23.setName("SketchLine_24")
-SketchLine_23.result().setName("SketchLine_24")
-SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
-SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_32")
-SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False)
-SketchLine_24 = SketchProjection_8.createdFeature()
-SketchLine_24.setName("SketchLine_25")
-SketchLine_24.result().setName("SketchLine_25")
-SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchLine_16.startPoint(), SketchLine_24.result())
-SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_33")
-SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_23.result())
-SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_21.result())
-SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_22.result())
+SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_32")
+SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_23 = SketchProjection_7.createdFeature()
+SketchLine_23.setName("SketchLine_25")
+SketchLine_23.result().setName("SketchLine_25")
+SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_15.startPoint(), SketchLine_23.result())
+SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_33")
+SketchConstraintHorizontal_3 = Sketch_3.setHorizontal(SketchLine_22.result())
+SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_20.result())
+SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_21.result())
SketchArc_2 = Sketch_3.addArc(0, 0, -1.5, -2, -1.5, 2, True)
-SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchArc_2.center())
-SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_34")
-SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchArc_2.startPoint(), SketchLine_21.startPoint())
-SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_35")
-SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchArc_2.endPoint(), SketchLine_23.endPoint())
-SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_36")
+SketchConstraintCoincidence_30 = Sketch_3.setCoincident(SketchAPI_Circle(SketchCircle_1).center(), SketchArc_2.center())
+SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_34")
+SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchArc_2.startPoint(), SketchLine_20.startPoint())
+SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_35")
+SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchArc_2.endPoint(), SketchLine_22.endPoint())
+SketchConstraintCoincidence_32.setName("SketchConstraintCoincidence_36")
SketchPoint_3 = Sketch_3.addPoint(2, 0)
-SketchConstraintCoincidence_34 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_22.result())
-SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_37")
-SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_24.result())
-SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_38")
-SketchConstraintMiddle_3 = Sketch_3.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_22.result())
-SketchLine_25 = Sketch_3.addLine(-1.5, -2, -1.5, 2)
-SketchLine_25.setName("SketchLine_26")
-SketchLine_25.result().setName("SketchLine_26")
-SketchLine_25.setAuxiliary(True)
-SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_25.startPoint())
-SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_39")
-SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_25.endPoint())
-SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_40")
-SketchProjection_9 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_12s-SketchLine_10e"), False)
-SketchPoint_4 = SketchProjection_9.createdFeature()
-SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_25.result())
-SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_41")
-SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_25.result(), 4)
-SketchProjection_10 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_10s-SketchLine_14e"), False)
-SketchPoint_5 = SketchProjection_10.createdFeature()
-SketchConstraintDistance_3 = Sketch_3.setDistance(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_22.result(), 0.5, True)
-SketchLine_26 = Sketch_3.addLine(-7.5, -7.382311001750988e-022, -7.5, -3)
-SketchLine_26.setName("SketchLine_27")
-SketchLine_26.result().setName("SketchLine_27")
-SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_26.result())
-SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_26.startPoint(), SketchLine_16.result())
-SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_42")
-SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchLine_18.result())
-SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_43")
-SketchLine_27 = Sketch_3.addLine(-7.5, -7.382311001750988e-022, -2.500000000000019, -5.187200122832181e-016)
-SketchLine_27.setName("SketchLine_28")
-SketchLine_27.result().setName("SketchLine_28")
-SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_26.startPoint(), SketchLine_27.startPoint())
-SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_44")
-SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchArc_2.results()[1])
-SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_45")
-SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_27.result())
-SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_17.startPoint(), SketchLine_26.result(), 2.5, True)
-SketchLine_28 = Sketch_3.addLine(2, 0, 11, 0)
-SketchLine_28.setName("SketchLine_29")
-SketchLine_28.result().setName("SketchLine_29")
-SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_28.startPoint())
-SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_46")
-SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_24.result())
-SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_47")
-SketchLine_29 = Sketch_3.addLine(15, 0, 14, 0)
-SketchLine_29.setName("SketchLine_30")
-SketchLine_29.result().setName("SketchLine_30")
-SketchProjection_11 = Sketch_3.addProjection(model.selection("VERTEX", "Revolution_1_6/Generated_Edge_1"), False)
-SketchPoint_6 = SketchProjection_11.createdFeature()
-SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_29.startPoint(), SketchPoint_6.result())
-SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_48")
-SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchLine_29.endPoint(), SketchLine_24.result())
-SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_49")
-SketchConstraintDistance_5 = Sketch_3.setDistance(SketchLine_28.endPoint(), SketchLine_29.endPoint(), 3, True)
-SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_29.result(), 1)
-SketchLine_30 = Sketch_3.addLine(11, 0, 11, -2.000000000000004)
-SketchLine_30.setName("SketchLine_31")
-SketchLine_30.result().setName("SketchLine_31")
-SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_30.startPoint())
-SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_50")
-SketchLine_31 = Sketch_3.addLine(9.500000000000002, 2.627360613063856e-019, 9.5, -2.000000000000004)
-SketchLine_31.setName("SketchLine_32")
-SketchLine_31.result().setName("SketchLine_32")
-SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchLine_31.startPoint(), SketchLine_28.result())
-SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_51")
-SketchLine_32 = Sketch_3.addLine(8, -1.882265929199326e-020, 8, -2.000000000000004)
-SketchLine_32.setName("SketchLine_33")
-SketchLine_32.result().setName("SketchLine_33")
-SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_32.startPoint(), SketchLine_28.result())
-SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_52")
-SketchLine_33 = Sketch_3.addLine(5, -3.396138881322731e-022, 5, -2.000000000000004)
-SketchLine_33.setName("SketchLine_34")
-SketchLine_33.result().setName("SketchLine_34")
-SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_33.startPoint(), SketchLine_28.result())
-SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_53")
-SketchLine_34 = Sketch_3.addLine(5, -2.000000000000004, 11, -2.000000000000004)
-SketchLine_34.setName("SketchLine_35")
-SketchLine_34.result().setName("SketchLine_35")
-SketchLine_34.setAuxiliary(True)
-SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_33.endPoint(), SketchLine_34.startPoint())
-SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_54")
-SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_34.endPoint())
-SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_55")
-SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_33.result())
-SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_32.result())
-SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_31.result())
-#SketchConstraintVertical_9 = Sketch_3.setVertical(SketchLine_30.result())
-SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_34.result())
-SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_34.result())
-SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_56")
-SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_31.endPoint(), SketchLine_34.result())
-SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_57")
-SketchConstraintDistance_6 = Sketch_3.setDistance(SketchLine_21.endPoint(), SketchLine_33.result(), 3, True)
-SketchConstraintDistance_7 = Sketch_3.setDistance(SketchLine_33.endPoint(), SketchLine_32.result(), 3, True)
-SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_32.endPoint(), SketchLine_31.result(), 1.5, True)
-SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_31.endPoint(), SketchLine_30.result(), 1.5, True)
-SketchConstraintCoincidence_55 = Sketch_3.setCoincident(SketchLine_33.endPoint(), SketchLine_21.result())
-SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_58")
-SketchConstraintMirror_2_objects = [SketchLine_33.result(), SketchLine_32.result(), SketchLine_31.result(), SketchLine_30.result()]
-SketchConstraintMirror_2 = Sketch_3.addMirror(SketchLine_24.result(), SketchConstraintMirror_2_objects)
-[SketchLine_35, SketchLine_36, SketchLine_37, SketchLine_38] = SketchConstraintMirror_2.mirrored()
-SketchLine_38.setName("SketchLine_39")
-SketchLine_38.result().setName("SketchLine_39")
-SketchLine_37.setName("SketchLine_38")
-SketchLine_37.result().setName("SketchLine_38")
-SketchLine_36.setName("SketchLine_37")
-SketchLine_36.result().setName("SketchLine_37")
-SketchLine_35.setName("SketchLine_36")
-SketchLine_35.result().setName("SketchLine_36")
+SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_21.result())
+SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_37")
+SketchConstraintCoincidence_34 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_23.result())
+SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_38")
+SketchConstraintMiddle_3 = Sketch_3.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_21.result())
+SketchLine_24 = Sketch_3.addLine(-1.5, -2, -1.5, 2)
+SketchLine_24.setName("SketchLine_26")
+SketchLine_24.result().setName("SketchLine_26")
+SketchLine_24.setAuxiliary(True)
+SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_24.startPoint())
+SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_39")
+SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_24.endPoint())
+SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_40")
+SketchProjection_8 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_10_EndVertex"), False)
+SketchPoint_4 = SketchProjection_8.createdFeature()
+SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_24.result())
+SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_41")
+SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_24.result(), 4)
+SketchProjection_9 = Sketch_3.addProjection(model.selection("VERTEX", "Sketch_2/SketchLine_10_StartVertex"), False)
+SketchPoint_5 = SketchProjection_9.createdFeature()
+SketchConstraintDistance_3 = Sketch_3.setDistance(SketchAPI_Point(SketchPoint_5).coordinates(), SketchLine_21.result(), 0.5, True)
+SketchLine_25 = Sketch_3.addLine(-7.5, -7.382311001750988e-22, -7.5, -3)
+SketchLine_25.setName("SketchLine_27")
+SketchLine_25.result().setName("SketchLine_27")
+SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_25.result())
+SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchLine_15.result())
+SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_42")
+SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_25.endPoint(), SketchLine_17.result())
+SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_43")
+SketchLine_26 = Sketch_3.addLine(-7.5, -7.382311001750988e-22, -2.500000000000019, -5.187200122832181e-16)
+SketchLine_26.setName("SketchLine_28")
+SketchLine_26.result().setName("SketchLine_28")
+SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchLine_26.startPoint())
+SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_44")
+SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_26.endPoint(), SketchArc_2.results()[1])
+SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_45")
+SketchConstraintHorizontal_5 = Sketch_3.setHorizontal(SketchLine_26.result())
+SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_16.startPoint(), SketchLine_25.result(), 2.5, True)
+SketchLine_27 = Sketch_3.addLine(2, 0, 11, 0)
+SketchLine_27.setName("SketchLine_29")
+SketchLine_27.result().setName("SketchLine_29")
+SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchPoint_3.coordinates(), SketchLine_27.startPoint())
+SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_46")
+SketchConstraintCoincidence_43 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchLine_23.result())
+SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_47")
+SketchLine_28 = Sketch_3.addLine(15, 0, 14, 0)
+SketchLine_28.setName("SketchLine_30")
+SketchLine_28.result().setName("SketchLine_30")
+SketchProjection_10 = Sketch_3.addProjection(model.selection("VERTEX", "[Revolution_1_6/Revolution_1_6&Sketch_1/SketchLine_2]"), False)
+SketchPoint_6 = SketchProjection_10.createdFeature()
+SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_28.startPoint(), SketchPoint_6.result())
+SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_48")
+SketchConstraintCoincidence_45 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_23.result())
+SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_49")
+SketchConstraintDistance_5 = Sketch_3.setDistance(SketchLine_27.endPoint(), SketchLine_28.endPoint(), 3, True)
+SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_28.result(), 1)
+SketchLine_29 = Sketch_3.addLine(11, 0, 11, -2.000000000000004)
+SketchLine_29.setName("SketchLine_31")
+SketchLine_29.result().setName("SketchLine_31")
+SketchConstraintCoincidence_46 = Sketch_3.setCoincident(SketchLine_27.endPoint(), SketchLine_29.startPoint())
+SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_50")
+SketchLine_30 = Sketch_3.addLine(9.500000000000002, 2.627360613063856e-19, 9.5, -2.000000000000004)
+SketchLine_30.setName("SketchLine_32")
+SketchLine_30.result().setName("SketchLine_32")
+SketchConstraintCoincidence_47 = Sketch_3.setCoincident(SketchLine_30.startPoint(), SketchLine_27.result())
+SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_51")
+SketchLine_31 = Sketch_3.addLine(8, -1.882265929199326e-20, 8, -2.000000000000004)
+SketchLine_31.setName("SketchLine_33")
+SketchLine_31.result().setName("SketchLine_33")
+SketchConstraintCoincidence_48 = Sketch_3.setCoincident(SketchLine_31.startPoint(), SketchLine_27.result())
+SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_52")
+SketchLine_32 = Sketch_3.addLine(5, -3.396138881322731e-22, 5, -2.000000000000004)
+SketchLine_32.setName("SketchLine_34")
+SketchLine_32.result().setName("SketchLine_34")
+SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_32.startPoint(), SketchLine_27.result())
+SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_53")
+SketchLine_33 = Sketch_3.addLine(5, -2.000000000000004, 11, -2.000000000000004)
+SketchLine_33.setName("SketchLine_35")
+SketchLine_33.result().setName("SketchLine_35")
+SketchLine_33.setAuxiliary(True)
+SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint())
+SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_54")
+SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_29.endPoint(), SketchLine_33.endPoint())
+SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_55")
+SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_32.result())
+SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_31.result())
+SketchConstraintVertical_8 = Sketch_3.setVertical(SketchLine_30.result())
+SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_33.result())
+SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_31.endPoint(), SketchLine_33.result())
+SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_56")
+SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_30.endPoint(), SketchLine_33.result())
+SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_57")
+SketchConstraintDistance_6 = Sketch_3.setDistance(SketchLine_20.endPoint(), SketchLine_32.result(), 3, True)
+SketchConstraintDistance_7 = Sketch_3.setDistance(SketchLine_32.endPoint(), SketchLine_31.result(), 3, True)
+SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_31.endPoint(), SketchLine_30.result(), 1.5, True)
+SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_30.endPoint(), SketchLine_29.result(), 1.5, True)
+SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_32.endPoint(), SketchLine_20.result())
+SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_58")
+SketchConstraintMirror_2_objects = [SketchLine_32.result(), SketchLine_31.result(), SketchLine_30.result(), SketchLine_29.result()]
+SketchConstraintMirror_2 = Sketch_3.addMirror(SketchLine_23.result(), SketchConstraintMirror_2_objects)
+[SketchLine_34, SketchLine_35, SketchLine_36, SketchLine_37] = SketchConstraintMirror_2.mirrored()
+SketchLine_37.setName("SketchLine_39")
+SketchLine_37.result().setName("SketchLine_39")
+SketchLine_36.setName("SketchLine_38")
+SketchLine_36.result().setName("SketchLine_38")
+SketchLine_35.setName("SketchLine_37")
+SketchLine_35.result().setName("SketchLine_37")
+SketchLine_34.setName("SketchLine_36")
+SketchLine_34.result().setName("SketchLine_36")
+model.do()
+model.do()
model.end()
assert(model.checkPythonDump())
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(7.823413936076148e-032, 6, 18, 6)
+SketchLine_1 = Sketch_1.addLine(7.823413936076148e-32, 6, 18, 6)
SketchLine_2 = Sketch_1.addLine(18, 6, 18, 10)
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
SketchLine_3 = Sketch_1.addLine(18, 10, 63, 10)
SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
SketchLine_9 = Sketch_1.addLine(70, 6.999999999999999, 38, 6.999999999999999)
SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
-SketchLine_10 = Sketch_1.addLine(38, 6.999999999999999, 34, 1.232595164407831e-032)
+SketchLine_10 = Sketch_1.addLine(38, 6.999999999999999, 34, 1.232595164407831e-32)
SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
-SketchLine_11 = Sketch_1.addLine(34, 1.232595164407831e-032, 7.823413936076148e-032, 1.232595164407831e-032)
+SketchLine_11 = Sketch_1.addLine(34, 1.232595164407831e-32, 7.823413936076148e-32, 1.232595164407831e-32)
SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
-SketchLine_12 = Sketch_1.addLine(7.823413936076148e-032, 1.232595164407831e-032, 7.823413936076148e-032, 6)
+SketchLine_12 = Sketch_1.addLine(7.823413936076148e-32, 1.232595164407831e-32, 7.823413936076148e-32, 6)
SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_12.endPoint())
SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_11.result())
SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_13.result())
SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_8.result())
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10r-SketchLine_11r-SketchLine_12r")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_13"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "Sketch_1/SketchLine_13"), 360, 0)
model.do()
# check that naming of the revolution is correct
model.testHaveNamingSubshapes(Revolution_1, model, Part_1_doc)
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
import math
SketchArc_1 = Sketch_1.addArc(-47.73523320343703, -72.31551328948351, 43.26553250145439, -30.85636904935887, -50.76060275488791, 27.63871192924931, False)
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "R")
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")])
model.do()
radius = model.measureRadius(Part_1_doc, model.selection("EDGE", "Edge_1_1"))
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
from salome.shaper import model
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_1).coordinates())
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 2)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0)
-Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], model.selection("VERTEX", "Sketch_1/Edge-SketchCircle_1_2__cc"), True)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], model.selection("VERTEX", "Sketch_1/SketchCircle_1_2__cc"), True)
LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("COMPOUND", "all-in-Symmetry_1")], model.selection("EDGE", "PartSet/OY"), 5, 3)
AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-LinearCopy_1")], model.selection("EDGE", "PartSet/OZ"), 45, 8)
+model.do()
model.end()
from GeomAPI import GeomAPI_Shape
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
-Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom"), True)
+Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), True)
Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1_1")], model.selection("EDGE", "PartSet/OX"), True)
+model.do()
model.end()
# check python dump failed before the bug fix: selection in symmetry 2 changed to the whole symmetry 1 compound
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_4.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_2/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
Smash_1 = model.addSmash(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Face_1_2")])
model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc)
model.do()
--- /dev/null
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("EDGE", "PartSet/OX"), 5)
+Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OZ"), True)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Symmetry_1_1_2"), model.selection("SOLID", "Symmetry_1_1_1")])
+model.do()
+model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Common_1, 1)
+model.testNbSubResults(Common_1, [0])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [8])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [16])
+model.testResultsVolumes(Common_1, [461.055845803990962394891539589])
+
+assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
from salome.shaper import model
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchLine_3 = Sketch_2.addLine(31.90519577166173, 58.11303515552675, 60.012153951459, 58.11303515552675)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
SketchLine_4 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchLine_4.result())
SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_4).endPoint(), SketchLine_3.endPoint())
SketchLine_5 = Sketch_2.addLine(60.012153951459, 58.11303515552675, 60.012153951459, 33.0446670492211)
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_5.startPoint())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
SketchLine_6 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_5")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_5")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2")], [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2")])
model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_5.endPoint())
model.do()
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e"))
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"))
Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_6 = Sketch_3.addLine(18.78449167586506, 11.40320166178118, 18.60732592394469, -15.47067574876233)
SketchLine_7 = Sketch_3.addLine(18.60732592394469, -15.47067574876233, 57.06415928764967, -9.455161348995592)
SketchConstraintCoincidence_7 = Sketch_3.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
SketchConstraintCoincidence_8 = Sketch_3.setCoincident(SketchLine_6.startPoint(), SketchLine_9.endPoint())
model.do()
-Pipe_1 = model.addPipe(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r"), model.selection("FACE", "Sketch_3/Face-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e")])
+Pipe_1 = model.addPipe(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r"), model.selection("FACE", "Sketch_3/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f")], model.selection("EDGE", "Sketch_1/SketchLine_1"), [model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex")])
model.do()
model.end()
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+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(30.99434204882063, 26.80840312072785, -30.86519895695055, 26.80840312072785)
+SketchLine_2 = Sketch_1.addLine(-30.86519895695055, 26.80840312072785, -30.86519895695055, -19.3714637805129)
+SketchLine_3 = Sketch_1.addLine(-30.86519895695055, -19.3714637805129, 30.99434204882063, -19.3714637805129)
+SketchLine_4 = Sketch_1.addLine(30.99434204882063, -19.3714637805129, 30.99434204882063, 26.80840312072785)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchArc_1 = Sketch_1.addArc(-7.617093567666898, 26.80840312072785, -19.24336125977736, 26.80840312072785, 4.009174124443563, 26.80840312072785, False)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.center())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.endPoint())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0)
+model.do()
+model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc)
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from GeomAPI import GeomAPI_Pnt
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "angle", "27.5")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_1.addLine(0, 4, 6.2, 4)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_2 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
+SketchLine_3 = Sketch_1.addLine(6.2, 4, 6.2, 2.5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(6.2, 2.5, 3.5, 2)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchLine_5 = Sketch_1.addLine(3.5, 2, 3.5, 0)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_6 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
+SketchLine_7 = Sketch_1.addLine(3.5, 0, 0, 0)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_7.endPoint())
+SketchLine_8 = Sketch_1.addLine(0, 4, 0, 0)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchLine_8.endPoint())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_3.result())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), 3.5)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 6.2)
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 1.5)
+SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 4)
+SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_5.result(), 2)
+model.do()
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", GeomAPI_Pnt(3.1, 0, 2))], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", GeomAPI_Pnt(0, 0, 4)))
+SketchCircle_1 = Sketch_2.addCircle(4.027018127601872, 2.325000000002457, 1.1)
+SketchCircle_2 = Sketch_2.addCircle(-4.027018127597639, 2.325000000000002, 1.1)
+SketchCircle_3 = Sketch_2.addCircle(7.188370358619843e-12, -4.650000000090492, 1.1)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", GeomAPI_Pnt(0, 0, 4)), False)
+SketchPoint_1 = SketchProjection_3.createdFeature()
+SketchCircle_4 = Sketch_2.addCircle(0, 0, 4.65)
+SketchCircle_4.setAuxiliary(True)
+SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_4.center())
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_9 = SketchProjection_4.createdFeature()
+SketchLine_10 = Sketch_2.addLine(0, 0, 4.027018127601872, 2.325000000002457)
+SketchLine_10.setAuxiliary(True)
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_10.endPoint())
+SketchLine_11 = Sketch_2.addLine(0, 0, -4.027018127597639, 2.325000000000002)
+SketchLine_11.setAuxiliary(True)
+SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_11.endPoint())
+SketchLine_12 = Sketch_2.addLine(0, 0, 7.188370358619843e-12, -4.650000000090492)
+SketchLine_12.setAuxiliary(True)
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchLine_12.endPoint())
+SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchCircle_4.results()[1])
+SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchCircle_4.results()[1])
+SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchCircle_4.results()[1])
+SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_4.results()[1], 4.65)
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], 1.1)
+SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_1.results()[1], SketchCircle_2.results()[1])
+SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_2.results()[1], SketchCircle_3.results()[1])
+SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", GeomAPI_Pnt(3.1, 0, 4)), False)
+SketchLine_13 = SketchProjection_5.createdFeature()
+SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_13.result(), SketchLine_10.result(), 30)
+SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_10.result(), SketchLine_11.result(), 120)
+SketchConstraintAngle_3 = Sketch_2.setAngle(SketchLine_11.result(), SketchLine_12.result(), 120)
+SketchCircle_5 = Sketch_2.addCircle(4.645574230355638, 0.2028301512488116, 0.8)
+SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchCircle_4.results()[1], SketchCircle_5.center())
+SketchCircle_6 = Sketch_2.addCircle(4.645574230355638, 0.2028301512488116, 0.65)
+SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchCircle_6.center())
+SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_6.results()[1], 0.65)
+SketchConstraintRadius_4 = Sketch_2.setRadius(SketchCircle_5.results()[1], 0.8)
+SketchLine_14 = Sketch_2.addLine(0, 0, 4.645574230355638, 0.2028301512488116)
+SketchLine_14.setAuxiliary(True)
+SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_14.startPoint())
+SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchCircle_5.center(), SketchLine_14.endPoint())
+SketchConstraintAngle_4 = Sketch_2.setAngle(SketchLine_14.result(), SketchLine_10.result(), "angle")
+SketchCircle_7 = Sketch_2.addCircle(2.498443178812738, 3.921770223029927, 0.65)
+SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchCircle_4.results()[1], SketchCircle_7.center())
+SketchCircle_8 = Sketch_2.addCircle(2.498443178812738, 3.921770223029927, 0.8)
+SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchCircle_4.results()[1], SketchCircle_8.center())
+SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchCircle_8.center())
+SketchConstraintEqual_3 = Sketch_2.setEqual(SketchCircle_6.results()[1], SketchCircle_7.results()[1])
+SketchConstraintEqual_4 = Sketch_2.setEqual(SketchCircle_8.results()[1], SketchCircle_5.results()[1])
+SketchLine_15 = Sketch_2.addLine(0, 0, 2.498443178812738, 3.921770223029927)
+SketchLine_15.setAuxiliary(True)
+SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_15.startPoint())
+SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchCircle_7.center(), SketchLine_15.endPoint())
+SketchConstraintAngle_5 = Sketch_2.setAngle(SketchLine_10.result(), SketchLine_15.result(), "angle")
+SketchMultiRotation_1 = Sketch_2.addRotation([SketchCircle_8.results()[1], SketchCircle_5.results()[1]], SketchCircle_4.center(), 360, 3, True)
+[SketchCircle_9, SketchCircle_10, SketchCircle_11, SketchCircle_12] = SketchMultiRotation_1.rotated()
+SketchCircle_12.setName("SketchCircle_13")
+SketchCircle_12.result().setName("SketchCircle_13")
+SketchCircle_12.results()[1].setName("SketchCircle_13_2")
+SketchCircle_11.setName("SketchCircle_12")
+SketchCircle_11.result().setName("SketchCircle_12")
+SketchCircle_11.results()[1].setName("SketchCircle_12_2")
+SketchMultiRotation_2 = Sketch_2.addRotation([SketchCircle_6.results()[1], SketchCircle_7.results()[1]], SketchAPI_Line(SketchLine_9).startPoint(), 120, 2)
+[SketchCircle_13, SketchCircle_14] = SketchMultiRotation_2.rotated()
+SketchCircle_14.setName("SketchCircle_17")
+SketchCircle_14.result().setName("SketchCircle_17")
+SketchCircle_14.results()[1].setName("SketchCircle_17_2")
+SketchCircle_13.setName("SketchCircle_14")
+SketchCircle_13.result().setName("SketchCircle_14")
+SketchCircle_13.results()[1].setName("SketchCircle_14_2")
+SketchCircle_15 = Sketch_2.addCircle(0, 5, 0.45)
+SketchCircle_15.setName("SketchCircle_15")
+SketchCircle_15.result().setName("SketchCircle_15")
+SketchCircle_15.results()[1].setName("SketchCircle_15_2")
+SketchLine_16 = Sketch_2.addLine(0, 0, 0, 5)
+SketchLine_16.setAuxiliary(True)
+SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_16.startPoint())
+SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchCircle_15.center(), SketchLine_16.endPoint())
+SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_16.result(), 5)
+SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_17 = SketchProjection_6.createdFeature()
+SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchCircle_15.center(), SketchLine_17.result())
+SketchConstraintRadius_5 = Sketch_2.setRadius(SketchCircle_15.results()[1], 0.45)
+SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", GeomAPI_Pnt(-6.2, 7.59281015471359e-16, 4)), False)
+SketchCircle_16 = SketchProjection_7.createdFeature()
+SketchCircle_16.setName("SketchCircle_16")
+SketchCircle_16.result().setName("SketchCircle_16")
+SketchCircle_16.results()[1].setName("SketchCircle_16_2")
+SketchCircle_17 = Sketch_2.addCircle(4.259590630302756, -2.982597469025441, 0.5)
+SketchCircle_17.setName("SketchCircle_18")
+SketchCircle_17.result().setName("SketchCircle_18")
+SketchCircle_17.results()[1].setName("SketchCircle_18_2")
+SketchCircle_18 = Sketch_2.addCircle(3.276608177155966, -2.294305745404186, 0.3)
+SketchCircle_18.setName("SketchCircle_19")
+SketchCircle_18.result().setName("SketchCircle_19")
+SketchCircle_18.results()[1].setName("SketchCircle_19_2")
+SketchLine_18 = Sketch_2.addLine(0, 0, 4.259590630302756, -2.982597469025441)
+SketchLine_18.setAuxiliary(True)
+SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_18.startPoint())
+SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchCircle_17.center(), SketchLine_18.endPoint())
+SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchCircle_18.center(), SketchLine_18.result())
+SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", GeomAPI_Pnt(3.1, 0, 4)), False)
+SketchLine_19 = SketchProjection_8.createdFeature()
+SketchConstraintAngle_6 = Sketch_2.setAngleBackward(SketchLine_19.result(), SketchLine_18.result(), 35)
+SketchConstraintRadius_6 = Sketch_2.setRadius(SketchCircle_17.results()[1], 0.5)
+SketchConstraintRadius_7 = Sketch_2.setRadius(SketchCircle_18.results()[1], 0.3)
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchCircle_4.center(), SketchCircle_18.center(), 4, True)
+SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_4.center(), SketchLine_18.endPoint(), 5.2, True)
+model.do()
+ExtrusionCut_1_objects_1 = [model.selection("WIRE", GeomAPI_Pnt(2.927018127601872, 2.325000000002457, 4)), model.selection("WIRE", GeomAPI_Pnt(1.848443178812738, 3.921770223029927, 4)), model.selection("WIRE", GeomAPI_Pnt(3.995574230355639, 0.2028301512488117, 4)), model.selection("WIRE_2", GeomAPI_Pnt(-3.148443178812729, 3.921770223029919, 4)), model.selection("WIRE", GeomAPI_Pnt(-5.127018127597639, 2.325000000000002, 4)), model.selection("WIRE_2", GeomAPI_Pnt(-5.29557423035565, 0.2028301512488154, 4)), model.selection("FACE", GeomAPI_Pnt(7.188472039842964e-12, -4.650000000090492, 4)), model.selection("FACE", GeomAPI_Pnt(4.259590630302756, -2.982597469025441, 4)), model.selection("FACE", GeomAPI_Pnt(3.276608177155966, -2.294305745404186, 4))]
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", GeomAPI_Pnt(0, 0, 0)), 0, model.selection(), 0, [model.selection("SOLID", GeomAPI_Pnt(-7.561538823095622e-16, 6.008767139946657e-17, 2.62684985301323))])
+ExtrusionCut_2_objects_1 = [model.selection("WIRE", GeomAPI_Pnt(-5.44557423035565, 0.2028301512488154, 4)), model.selection("WIRE", GeomAPI_Pnt(-3.298443178812729, 3.921770223029919, 4)), model.selection("WIRE", GeomAPI_Pnt(1.698443178812738, 3.921770223029927, 4)), model.selection("WIRE", GeomAPI_Pnt(3.845574230355639, 0.2028301512488117, 4))]
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 0.75, [model.selection("SOLID", GeomAPI_Pnt(0.06663461012735418, 0.05143712897449785, 2.675990079155852))])
+Axis_4 = model.addAxis(Part_1_doc, 0, -1, -10)
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", GeomAPI_Pnt(-0.45, 5, 4))], model.selection("EDGE", GeomAPI_Pnt(0, -0.5, -5)), 10, 10, [model.selection("SOLID", GeomAPI_Pnt(0.06614791498027658, 0.06612435067467369, 2.67762623401837))])
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", GeomAPI_Pnt(-2.14713105154291, -4.124600374278729, 4)), model.selection("FACE", GeomAPI_Pnt(2.14713105154291, -4.124600374278742, 4))], model.selection(), model.selection("FACE", GeomAPI_Pnt(0, 0, 0)), 0, model.selection(), 0)
+Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
+SketchLine_20 = Sketch_3.addLine(3.5, 2.508501119175777, 3.5, 4)
+SketchLine_21 = Sketch_3.addLine(3.5, 4, 6.2, 4)
+SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
+SketchLine_22 = Sketch_3.addLine(6.2, 4, 6.2, 3.008501119175777)
+SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
+SketchLine_23 = Sketch_3.addLine(6.2, 3.008501119175777, 3.5, 2.508501119175777)
+SketchConstraintCoincidence_37 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
+SketchConstraintCoincidence_38 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_20.startPoint())
+SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_20.result())
+SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE_9", GeomAPI_Pnt(3.5, 0, 1)), False)
+SketchLine_24 = SketchProjection_9.createdFeature()
+SketchConstraintCoincidence_39 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_24.result())
+SketchProjection_10 = Sketch_3.addProjection(model.selection("EDGE_3", GeomAPI_Pnt(4.85, 0, 2.25)), False)
+SketchLine_25 = SketchProjection_10.createdFeature()
+SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_23.result(), SketchLine_25.result())
+SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_22.result())
+SketchProjection_11 = Sketch_3.addProjection(model.selection("EDGE_9", GeomAPI_Pnt(6.2, 0, 3.25)), False)
+SketchLine_26 = SketchProjection_11.createdFeature()
+SketchConstraintCoincidence_40 = Sketch_3.setCoincident(SketchLine_23.startPoint(), SketchLine_26.result())
+SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_21.result())
+SketchConstraintDistance_3 = Sketch_3.setDistance(SketchLine_20.startPoint(), SketchLine_25.result(), 0.5, True)
+SketchProjection_12 = Sketch_3.addProjection(model.selection("EDGE_5", GeomAPI_Pnt(3.1, 0, 4)), False)
+SketchLine_27 = SketchProjection_12.createdFeature()
+SketchConstraintCoincidence_41 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_27.result())
+model.do()
+Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", GeomAPI_Pnt(4.850000000000001, 0, 3.254250559587889))], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", GeomAPI_Pnt(-2.14713105154291, -4.124600374278729, 2)), model.selection("SOLID", GeomAPI_Pnt(2.14713105154291, -4.124600374278742, 2))], [model.selection("SOLID", GeomAPI_Pnt(-1.278142456973851e-15, 2.734224632526547e-16, 3.386836255166113))])
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", GeomAPI_Pnt(0.06552679693747457, 0.1115566065149892, 2.681859907222054))], [model.selection("SOLID", GeomAPI_Pnt(-2.134018078943279, -4.099410579753945, 3.358593616213623)), model.selection("SOLID", GeomAPI_Pnt(2.134018071503405, -4.099410583757958, 3.358593616233432))])
+model.do()
+model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+model.addParameter(partSet, "hh", "20")
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-14.44396674123619, 36.663, -34.44396674123619, 36.663)
+SketchLine_2 = Sketch_1.addLine(-34.44396674123619, 36.663, -34.44396674123619, 14.29964516129033)
+SketchLine_3 = Sketch_1.addLine(-34.44396674123619, 14.29964516129033, -14.44396674123619, 14.29964516129033)
+SketchLine_4 = Sketch_1.addLine(-14.44396674123619, 14.29964516129033, -14.44396674123619, 36.663)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchLine_5 = Sketch_1.addLine(34.94274193548387, 39.45841935483872, 18.60029032258063, 39.45841935483872)
+SketchLine_6 = Sketch_1.addLine(18.60029032258063, 39.45841935483872, 18.60029032258063, 13.00945161290323)
+SketchLine_7 = Sketch_1.addLine(18.60029032258063, 13.00945161290323, 34.94274193548387, 13.00945161290323)
+SketchLine_8 = Sketch_1.addLine(34.94274193548387, 13.00945161290323, 34.94274193548387, 39.45841935483872)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_6.result())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result())
+SketchLine_9 = Sketch_1.addLine(-7.633645161290328, -5.05325806451613, -33.00745161290323, -5.05325806451613)
+SketchLine_10 = Sketch_1.addLine(-33.00745161290323, -5.05325806451613, -33.00745161290323, -31.71725806451613)
+SketchLine_11 = Sketch_1.addLine(-33.00745161290323, -31.71725806451613, -7.633645161290328, -31.71725806451613)
+SketchLine_12 = Sketch_1.addLine(-7.633645161290328, -31.71725806451613, -7.633645161290328, -5.05325806451613)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_10.result())
+SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_11.result())
+SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_12.result())
+SketchLine_13 = Sketch_1.addLine(36.44796774193549, -7.848677419354839, 19.46041935483872, -7.848677419354839)
+SketchLine_14 = Sketch_1.addLine(19.46041935483872, -7.848677419354839, 19.46041935483872, -34.29764516129033)
+SketchLine_15 = Sketch_1.addLine(19.46041935483872, -34.29764516129033, 36.44796774193549, -34.29764516129033)
+SketchLine_16 = Sketch_1.addLine(36.44796774193549, -34.29764516129033, 36.44796774193549, -7.848677419354839)
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
+SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint())
+SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
+SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_13.result())
+SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_14.result())
+SketchConstraintHorizontal_8 = Sketch_1.setHorizontal(SketchLine_15.result())
+SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_16.result())
+SketchCircle_1 = Sketch_1.addCircle(-24.6211935483871, 23.331, 4.515677419354841)
+SketchCircle_2 = Sketch_1.addCircle(27.20158064516131, 20.96564516129033, 4.091267733479863)
+SketchCircle_3 = Sketch_1.addCircle(-16.23493548387097, -18.60029032258065, 7.50151366286372)
+SketchCircle_4 = Sketch_1.addCircle(27.84667741935485, -22.90093548387097, 5.414373911476542)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "hh")
+model.do()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "hh", "15")
+model.addParameter(Part_1_doc, "hh_1", "26")
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchCircle_1_2r")], model.selection(), "hh", 0)
+Extrusion_2_objects = [model.selection("WIRE", "PartSet/Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchCircle_1_2r_wire"), model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchCircle_2_2r"), model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16f-SketchCircle_4_2r"), model.selection("FACE", "PartSet/Sketch_1/Face-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f-SketchCircle_3_2r")]
+Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection(), 10, "hh_1")
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_4"), model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OX"), 40)
+Fuse_1_objects_1 = [model.selection("SOLID", "Translation_1_2"), model.selection("SOLID", "Translation_1_1"), model.selection("SOLID", "Extrusion_2_1")]
+Fuse_1 = model.addFuse(Part_1_doc, Fuse_1_objects_1)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_2_3")], model.selection("EDGE", "PartSet/OX"), 30)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_2_2"), model.selection("SOLID", "Translation_2_1")])
+model.do()
+model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
+model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OY"), 20, 3)
+ExtrusionCut_1_objects_2 = [model.selection("SOLID", "LinearCopy_1_1_2"), model.selection("SOLID", "LinearCopy_1_1_1"), model.selection("SOLID", "LinearCopy_1_1_3")]
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, ExtrusionCut_1_objects_2)
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "LinearCopy_1_1_2/MF:Translated_Face&Box_1_1/Top"))
+SketchCircle_1 = Sketch_1.addCircle(4.871972805908816, 24.69028692663239, 2.754280056405151)
+SketchCircle_2 = Sketch_1.addCircle(4.956613458332676, 4.459837610261877, 1.82794741094275)
+SketchCircle_3 = Sketch_1.addCircle(4.842959508111481, 44.32940059836771, 3.136980464700132)
+ExtrusionCut_1.setNestedSketch(Sketch_1)
+model.do()
+model.testHaveNamingSubshapes(ExtrusionCut_1, model, Part_1_doc)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(ExtrusionCut_1, 1)
+model.testNbSubResults(ExtrusionCut_1, [3])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.FACE, [21])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.EDGE, [90])
+model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [180])
+model.testResultsVolumes(ExtrusionCut_1, [2347.550996571865198347950354218])
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+model.addParameter(partSet, "hh", "20")
+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(-17.23654191510748, 16.36770059625795, -4.760492650097712, 19.4251823602345)
+SketchLine_2 = Sketch_1.addLine(20, 2.414080216212369e-15, 20, -31)
+SketchLine_3 = Sketch_1.addLine(2.928932188134523, -38.07106781186548, -8.677669529663685, -26.46446609406726)
+SketchLine_4 = Sketch_1.addLine(-12.21320343559642, -25, -20.00000000000047, -25)
+SketchArc_1 = Sketch_1.addArc(10, -31, 20, -31, 2.928932188134523, -38.07106781186548, True)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2")
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_2.result(), SketchArc_1.results()[1])
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3")
+SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_3.result(), SketchArc_1.results()[1])
+SketchArc_2 = Sketch_1.addArc(-12.21320343559642, -30, -8.677669529663685, -26.46446609406726, -12.21320343559642, -25, False)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_3.endPoint())
+SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4")
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5")
+SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result())
+SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_3.result())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchArc_3 = Sketch_1.addArc(5.671735138196638e-24, 3.298692290329323e-23, -4.760492650097712, 19.4251823602345, 20, 2.414080216212369e-15, True)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_3.startPoint())
+SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6")
+SketchConstraintTangent_5 = Sketch_1.setTangent(SketchLine_1.result(), SketchArc_3.results()[1])
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7")
+SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_2.result())
+SketchArc_4 = Sketch_1.addArc(-12, -5, -22.35294117647118, -24.41176470588231, -17.23654191510748, 16.36770059625795, True)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_9")
+SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_1.result())
+SketchConstraintTangent_7.setName("SketchConstraintTangent_8")
+SketchCircle_1 = Sketch_1.addCircle(-22, -5, 7.5)
+SketchCircle_2 = Sketch_1.addCircle(5.671735138196638e-24, 3.298692290329323e-23, 10)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_3.center(), SketchCircle_2.center())
+SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_10")
+SketchCircle_3 = Sketch_1.addCircle(7, -25, 7.5)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 10)
+SketchConstraintRadius_1.setName("SketchConstraintRadius_2")
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_4.result(), SketchLine_3.result(), 134.9999999999999)
+SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 5)
+SketchConstraintRadius_2.setName("SketchConstraintRadius_3")
+SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_4.results()[1], 22)
+SketchConstraintRadius_3.setName("SketchConstraintRadius_4")
+SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_3.results()[1], 20)
+SketchConstraintRadius_4.setName("SketchConstraintRadius_5")
+SketchPoint_1 = Sketch_1.addPoint(-20.00000000000047, -25)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchLine_4.endPoint())
+SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_12")
+SketchArc_5 = Sketch_1.addArc(-20.00000000000047, -20, -20.00000000000047, -25, -22.35294117647118, -24.41176470588231, True)
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchArc_5.startPoint())
+SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11")
+SketchConstraintTangent_8 = Sketch_1.setTangent(SketchLine_4.result(), SketchArc_5.results()[1])
+SketchConstraintTangent_8.setName("SketchConstraintTangent_9")
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchArc_5.endPoint())
+SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_13")
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_4.center(), SketchCircle_2.center(), 12)
+SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchCircle_1.center(), SketchArc_3.center(), 22)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchArc_3.center(), SketchArc_4.center(), 5)
+SketchLine_5 = Sketch_1.addLine(-22, -5, -12, -5)
+SketchLine_5.setAuxiliary(True)
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_14")
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_5.endPoint())
+SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_15")
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintRadius_5 = Sketch_1.setRadius(SketchCircle_1.results()[1], 7.5)
+SketchConstraintRadius_5.setName("SketchConstraintRadius_6")
+SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchCircle_2.center(), SketchCircle_3.center(), 7)
+SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchCircle_2.center(), SketchCircle_3.center(), 25)
+SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance(SketchArc_3.center(), SketchArc_1.center(), 31)
+SketchConstraintRadius_6 = Sketch_1.setRadius(SketchCircle_3.results()[1], 7.5)
+SketchConstraintRadius_6.setName("SketchConstraintRadius_7")
+SketchConstraintRadius_7 = Sketch_1.setRadius(SketchCircle_2.results()[1], 10)
+SketchConstraintRadius_7.setName("SketchConstraintRadius_8")
+SketchConstraintRadius_8 = Sketch_1.setRadius(SketchArc_5.results()[1], 5)
+SketchConstraintRadius_8.setName("SketchConstraintRadius_9")
+SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchArc_5.results()[1])
+SketchConstraintTangent_9.setName("SketchConstraintTangent_10")
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_2 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.center(), SketchAPI_Point(SketchPoint_2).coordinates())
+SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_16")
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_4.result(), 20, True)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_4_2f-SketchArc_5_2f-SketchLine_4r-SketchArc_2_2r-SketchLine_3r-SketchArc_1_2f-SketchLine_2r-SketchArc_3_2f-SketchLine_1r-SketchCircle_1_2r-SketchCircle_2_2r-SketchCircle_3_2r")], model.selection(), 6.5, 0)
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 100, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"))
+SketchLine_6 = Sketch_2.addLine(12.25, 6.5, -12.25, 6.5)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False)
+SketchLine_7 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.result())
+SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_17")
+SketchLine_8 = Sketch_2.addLine(-12.25, 6.5, -12.25, 4.5)
+SketchLine_9 = Sketch_2.addLine(-12.25, 4.5, 12.25, 4.5)
+SketchLine_10 = Sketch_2.addLine(12.25, 4.5, 12.25, 6.5)
+SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_18")
+SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_19")
+SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_20")
+SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_21")
+SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_6.result())
+SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_8.result())
+SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_10.result())
+SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_9.result(), 24.5)
+SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_8.result(), 2)
+SketchPoint_3 = Sketch_2.addPoint(2.442490654175344e-15, 6.499999999999999)
+SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_6.result())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_22")
+SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchPoint_3.coordinates(), SketchLine_6.result())
+SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2]"), False)
+SketchLine_11 = SketchProjection_3.createdFeature()
+SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_11.result())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_23")
+ExtrusionCut_1.setNestedSketch(Sketch_2)
+model.do()
+model.testHaveNamingSubshapes(ExtrusionCut_1, model, Part_1_doc)
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+model.addParameter(partSet, "hh", "20")
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_1.addLine(0, -3.45, 0, -6.45)
+SketchLine_2 = Sketch_1.addLine(0, -6.45, 7.781999999999999, -6.45)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(7.781999999999999, -6.45, 7.781999999999999, -3.45)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(7.781999999999999, -3.45, 6.537999941088452, -3.45)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchLine_5 = Sketch_1.addLine(6.537999941088452, -3.45, 6.537999999999999, -2.4)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchLine_6 = Sketch_1.addLine(6.537999999999999, -2.4, 6.375999999999999, -2.25)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchLine_7 = Sketch_1.addLine(6.375999999999999, -2.25, 6.375999999999999, 9.025)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchLine_8 = Sketch_1.addLine(6.375999999999999, 9.025, 6.537999999999998, 9.186999999999999)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchLine_9 = Sketch_1.addLine(6.537999999999998, 9.186999999999999, 6.537999999999998, 10.256)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchLine_10 = Sketch_1.addLine(6.537999999999998, 10.256, 6.187999999999998, 10.256)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchLine_11 = Sketch_1.addLine(6.187999999999998, 10.256, 4.9175, 10.94235984621995)
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_12 = SketchProjection_1.createdFeature()
+SketchArc_1 = Sketch_1.addArc(0, 2.425, 0, 12.26, 4.9175, 10.94235984621995, True)
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_12.result(), SketchArc_1.center())
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_12.result(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchArc_1.endPoint())
+SketchLine_13 = Sketch_1.addLine(0, 12.26, 0, 12.096)
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_13.startPoint())
+SketchLine_14 = Sketch_1.addLine(0, -3.45, 6.187999958006518, -3.45)
+SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_14.startPoint())
+SketchLine_15 = Sketch_1.addLine(6.187999958006518, -3.45, 6.188, 9.025)
+SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint())
+SketchLine_16 = Sketch_1.addLine(6.188, 9.025, 6.082, 9.532)
+SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_14.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_4.result())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_2.result())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_10.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_9.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_7.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_15.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_3.result())
+SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_5.result())
+SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_14.result())
+SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_12.result())
+SketchConstraintVertical_6 = Sketch_1.setVertical(SketchLine_1.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_14.endPoint(), SketchLine_5.result(), 0.35, True)
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_15.result(), 0.188, True)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 3)
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_17 = SketchProjection_2.createdFeature()
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_17.result(), 3.45, True)
+SketchConstraintDistance_4 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.result(), 6.188, True)
+SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_17.result(), 9.025, True)
+SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchLine_12.result())
+SketchLine_18 = Sketch_1.addLine(6.188, 9.025, 6.375999999999999, 9.025)
+SketchLine_18.setAuxiliary(True)
+SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchLine_15.endPoint(), SketchLine_18.startPoint())
+SketchConstraintCoincidence_22 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_18.endPoint())
+SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_18.result())
+SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_17.result(), 10.256, True)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_10.result(), 0.35)
+SketchConstraintAngle_1 = Sketch_1.setAngleComplementary(SketchLine_18.result(), SketchLine_8.result(), 45)
+SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_8.endPoint(), SketchLine_17.result(), 9.186999999999999, True)
+SketchConstraintDistance_8 = Sketch_1.setDistance(SketchLine_16.endPoint(), SketchLine_15.result(), 0.106, True)
+SketchConstraintDistance_9 = Sketch_1.setDistance(SketchLine_16.endPoint(), SketchLine_17.result(), 9.532, True)
+SketchArc_2 = Sketch_1.addArc(4.793786120242238, 9.263, 6.082, 9.532, 5.676067550792405, 10.23944020672409, False)
+SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchArc_2.startPoint())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_2.results()[1], 1.316)
+SketchConstraintDistance_10 = Sketch_1.setDistance(SketchArc_2.center(), SketchLine_17.result(), 9.263, True)
+SketchLine_19 = Sketch_1.addLine(4.793786120242238, 9.263, 6.082, 9.532)
+SketchLine_19.setAuxiliary(True)
+SketchConstraintCoincidence_24 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_19.startPoint())
+SketchConstraintCoincidence_25 = Sketch_1.setCoincident(SketchLine_16.endPoint(), SketchLine_19.endPoint())
+SketchLine_20 = Sketch_1.addLine(4.793786120242238, 9.263, 5.676067550792405, 10.23944020672409)
+SketchLine_20.setAuxiliary(True)
+SketchConstraintCoincidence_26 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_20.startPoint())
+SketchConstraintCoincidence_27 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_20.endPoint())
+SketchLine_21 = Sketch_1.addLine(4.793786120242238, 9.263, 4.79378612024245, 10.72808112087842)
+SketchLine_21.setAuxiliary(True)
+SketchConstraintCoincidence_28 = Sketch_1.setCoincident(SketchArc_2.center(), SketchLine_21.startPoint())
+SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_21.result())
+SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_20.result(), SketchLine_21.result(), 42.09999999999906)
+SketchLine_22 = Sketch_1.addLine(5.676067550792282, 10.23944020672395, 5.404900443923878, 10.43809443685872)
+SketchConstraintCoincidence_29 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_22.startPoint())
+SketchLine_23 = Sketch_1.addLine(5.404900443923878, 10.43809443685872, 5.12663857042824, 10.62933672216996)
+SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
+SketchLine_24 = Sketch_1.addLine(5.12663857042824, 10.62933672216996, 4.835500000000001, 10.80033167999931)
+SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_23.endPoint(), SketchLine_24.startPoint())
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_13.result(), "0.082*2")
+SketchArc_3 = Sketch_1.addArc(0, 2.425, 0, 12.096, 4.835500000000001, 10.80033167999931, True)
+SketchConstraintCoincidence_32 = Sketch_1.setCoincident(SketchArc_1.center(), SketchArc_3.center())
+SketchConstraintCoincidence_33 = Sketch_1.setCoincident(SketchLine_13.endPoint(), SketchArc_3.startPoint())
+SketchConstraintCoincidence_34 = Sketch_1.setCoincident(SketchLine_24.endPoint(), SketchArc_3.endPoint())
+SketchConstraintDistance_11 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_17.result(), 2.425, True)
+SketchLine_25 = Sketch_1.addLine(0, 2.425, 4.9175, 10.94235984621995)
+SketchLine_25.setName("SketchLine_26")
+SketchLine_25.result().setName("SketchLine_26")
+SketchLine_25.setAuxiliary(True)
+SketchConstraintCoincidence_35 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_25.startPoint())
+SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_37")
+SketchConstraintCoincidence_36 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchLine_11.result())
+SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_38")
+SketchConstraintCoincidence_37 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_25.result())
+SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_39")
+SketchLine_26 = Sketch_1.addLine(0, 2.425, 5.220090907696442, 10.77889172431985)
+SketchLine_26.setName("SketchLine_27")
+SketchLine_26.result().setName("SketchLine_27")
+SketchLine_26.setAuxiliary(True)
+SketchConstraintCoincidence_38 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_26.startPoint())
+SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_40")
+SketchConstraintCoincidence_39 = Sketch_1.setCoincident(SketchLine_26.endPoint(), SketchLine_11.result())
+SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_41")
+SketchConstraintCoincidence_40 = Sketch_1.setCoincident(SketchLine_24.startPoint(), SketchLine_26.result())
+SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_42")
+SketchLine_27 = Sketch_1.addLine(0, 2.425, 5.524022094217663, 10.61469954608912)
+SketchLine_27.setName("SketchLine_28")
+SketchLine_27.result().setName("SketchLine_28")
+SketchLine_27.setAuxiliary(True)
+SketchConstraintCoincidence_41 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_27.startPoint())
+SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_43")
+SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchLine_27.endPoint(), SketchLine_11.result())
+SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_44")
+SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchLine_27.result(), SketchLine_23.startPoint())
+SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_45")
+SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_25.endPoint(), SketchArc_1.endPoint())
+SketchConstraintCoincidence_44.setName("SketchConstraintCoincidence_46")
+SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_25.result(), SketchLine_12.result(), 30.00000000000003)
+SketchConstraintAngle_4 = Sketch_1.setAngle(SketchLine_26.result(), SketchLine_12.result(), 32.00000000000001)
+SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_27.result(), SketchLine_12.result(), 33.99999999999999)
+SketchConstraintDistance_12 = Sketch_1.setDistance(SketchLine_23.endPoint(), SketchLine_11.result(), "0.088*2", True)
+SketchConstraintDistance_13 = Sketch_1.setDistance(SketchLine_22.endPoint(), SketchLine_11.result(), "0.106*2", True)
+SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_1.results()[1], 9.835000000000001)
+SketchLine_28 = Sketch_1.addLine(7.031999999999999, -4.05, 5.531999999999999, -4.05)
+SketchLine_28.setName("SketchLine_29")
+SketchLine_28.result().setName("SketchLine_29")
+SketchLine_29 = Sketch_1.addLine(5.531999999999999, -4.05, 5.531999999999999, -5.85)
+SketchLine_29.setName("SketchLine_30")
+SketchLine_29.result().setName("SketchLine_30")
+SketchLine_30 = Sketch_1.addLine(5.531999999999999, -5.85, 7.031999999999999, -5.85)
+SketchLine_30.setName("SketchLine_31")
+SketchLine_30.result().setName("SketchLine_31")
+SketchLine_31 = Sketch_1.addLine(7.031999999999999, -5.85, 7.031999999999999, -4.05)
+SketchLine_31.setName("SketchLine_32")
+SketchLine_31.result().setName("SketchLine_32")
+SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchLine_28.startPoint())
+SketchConstraintCoincidence_45.setName("SketchConstraintCoincidence_47")
+SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint())
+SketchConstraintCoincidence_46.setName("SketchConstraintCoincidence_48")
+SketchConstraintCoincidence_47 = Sketch_1.setCoincident(SketchLine_29.endPoint(), SketchLine_30.startPoint())
+SketchConstraintCoincidence_47.setName("SketchConstraintCoincidence_49")
+SketchConstraintCoincidence_48 = Sketch_1.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint())
+SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_50")
+SketchConstraintHorizontal_6 = Sketch_1.setHorizontal(SketchLine_28.result())
+SketchConstraintVertical_8 = Sketch_1.setVertical(SketchLine_29.result())
+SketchConstraintHorizontal_7 = Sketch_1.setHorizontal(SketchLine_30.result())
+SketchConstraintVertical_9 = Sketch_1.setVertical(SketchLine_31.result())
+SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_30.result(), 1.5)
+SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_29.result(), 1.8)
+SketchConstraintDistance_14 = Sketch_1.setDistance(SketchLine_29.startPoint(), SketchLine_14.result(), 0.6, True)
+SketchLine_32 = Sketch_1.addLine(6.281999999999999, 9.025000000000009, 6.281999999999999, -4.049999999999998)
+SketchLine_32.setName("SketchLine_33")
+SketchLine_32.result().setName("SketchLine_33")
+SketchLine_32.setAuxiliary(True)
+SketchConstraintCoincidence_49 = Sketch_1.setCoincident(SketchLine_32.startPoint(), SketchLine_18.result())
+SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_51")
+SketchConstraintCoincidence_50 = Sketch_1.setCoincident(SketchLine_32.endPoint(), SketchLine_28.result())
+SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_52")
+SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_32.result())
+SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchLine_32.endPoint(), SketchLine_28.result())
+SketchConstraintMiddle_2 = Sketch_1.setMiddlePoint(SketchLine_32.startPoint(), SketchLine_18.result())
+SketchConstraintDistance_15 = Sketch_1.setDistance(SketchLine_32.endPoint(), SketchLine_3.result(), 1.5, True)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_6.endPoint(), SketchLine_5.endPoint(), 0.15)
+SketchConstraintDistance_16 = Sketch_1.setDistance(SketchLine_6.endPoint(), SketchLine_17.result(), 2.25, True)
+SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_21.result(), SketchLine_21.endPoint())
+SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_53")
+SketchConstraintCoincidence_52 = Sketch_1.setCoincident(SketchLine_25.result(), SketchLine_21.endPoint())
+SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_54")
+model.do()
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchArc_1_2f-SketchLine_13f-SketchArc_3_2r-SketchLine_24r-SketchLine_23r-SketchLine_22r-SketchArc_2_2r-SketchLine_16r-SketchLine_15r-SketchLine_14r-SketchLine_32r-SketchLine_31r-SketchLine_30r-SketchLine_29r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_33 = Sketch_2.addLine(0, 2.425, 3.282538500974061, 11.74164236673401)
+SketchLine_33.setName("SketchLine_34")
+SketchLine_33.result().setName("SketchLine_34")
+SketchLine_33.setAuxiliary(True)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_28_StartVertex"), False)
+SketchPoint_1 = SketchProjection_3.createdFeature()
+SketchConstraintCoincidence_53 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchPoint_1.result())
+SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_55")
+SketchPoint_2 = Sketch_2.addPoint(3.241, 11.6237460014939)
+SketchConstraintCoincidence_54 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_33.result())
+SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_56")
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_34 = SketchProjection_4.createdFeature()
+SketchLine_34.setName("SketchLine_36")
+SketchLine_34.result().setName("SketchLine_36")
+SketchConstraintDistance_17 = Sketch_2.setDistance(SketchPoint_2.coordinates(), SketchLine_34.result(), 3.241, True)
+SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_13"), False)
+SketchLine_35 = SketchProjection_5.createdFeature()
+SketchLine_35.setName("SketchLine_37")
+SketchLine_35.result().setName("SketchLine_37")
+SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_28"), False)
+SketchLine_36 = SketchProjection_6.createdFeature()
+SketchLine_36.setName("SketchLine_38")
+SketchLine_36.result().setName("SketchLine_38")
+SketchArc_4 = Sketch_2.addArc(0, 2.425, 0, 12.178, 5.453808387550194, 10.51060344512932, True)
+SketchArc_4.setAuxiliary(True)
+SketchConstraintCoincidence_55 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchArc_4.center())
+SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_58")
+SketchConstraintCoincidence_56 = Sketch_2.setCoincident(SketchLine_35.result(), SketchArc_4.startPoint())
+SketchConstraintCoincidence_56.setName("SketchConstraintCoincidence_59")
+SketchConstraintCoincidence_57 = Sketch_2.setCoincident(SketchLine_36.result(), SketchArc_4.endPoint())
+SketchConstraintCoincidence_57.setName("SketchConstraintCoincidence_60")
+SketchConstraintMiddle_3 = Sketch_2.setMiddlePoint(SketchLine_35.result(), SketchArc_4.startPoint())
+SketchConstraintCoincidence_58 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchArc_4.results()[1])
+SketchConstraintCoincidence_58.setName("SketchConstraintCoincidence_61")
+SketchArc_5 = Sketch_2.addArc(0, 2.425, 3.28253850097406, 11.74164236673401, 4.139817701932777, 11.39365616437401, True)
+SketchConstraintCoincidence_59 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchArc_5.center())
+SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_62")
+SketchConstraintCoincidence_60 = Sketch_2.setCoincident(SketchLine_33.result(), SketchArc_5.startPoint())
+SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_63")
+SketchLine_37 = Sketch_2.addLine(4.139817701932777, 11.39365616437401, 4.459277785066624, 11.1909606795611)
+SketchLine_37.setName("SketchLine_39")
+SketchLine_37.result().setName("SketchLine_39")
+SketchConstraintCoincidence_61 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_37.startPoint())
+SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_64")
+SketchProjection_7 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_1_2"), False)
+SketchArc_6 = SketchProjection_7.createdFeature()
+SketchConstraintCoincidence_62 = Sketch_2.setCoincident(SketchLine_37.endPoint(), SketchArc_6.results()[1])
+SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_65")
+SketchLine_38 = Sketch_2.addLine(4.459277785066624, 11.1909606795611, 4.390495384356073, 11.041947909785)
+SketchLine_38.setName("SketchLine_40")
+SketchLine_38.result().setName("SketchLine_40")
+SketchConstraintCoincidence_63 = Sketch_2.setCoincident(SketchLine_37.endPoint(), SketchLine_38.startPoint())
+SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_66")
+SketchProjection_8 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchArc_3_2"), False)
+SketchArc_7 = SketchProjection_8.createdFeature()
+SketchConstraintCoincidence_64 = Sketch_2.setCoincident(SketchLine_38.endPoint(), SketchArc_7.results()[1])
+SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_67")
+SketchLine_39 = Sketch_2.addLine(4.390495384356073, 11.041947909785, 4.035044020470619, 11.16667053559354)
+SketchLine_39.setName("SketchLine_41")
+SketchLine_39.result().setName("SketchLine_41")
+SketchConstraintCoincidence_65 = Sketch_2.setCoincident(SketchLine_38.endPoint(), SketchLine_39.startPoint())
+SketchConstraintCoincidence_65.setName("SketchConstraintCoincidence_68")
+SketchArc_8 = Sketch_2.addArc(0, 2.425, 3.199461499025941, 11.5058496362538, 4.035044020470619, 11.16667053559354, True)
+SketchConstraintCoincidence_66 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchArc_8.center())
+SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_69")
+SketchConstraintCoincidence_67 = Sketch_2.setCoincident(SketchLine_33.result(), SketchArc_8.startPoint())
+SketchConstraintCoincidence_67.setName("SketchConstraintCoincidence_70")
+SketchConstraintCoincidence_68 = Sketch_2.setCoincident(SketchArc_8.endPoint(), SketchLine_39.endPoint())
+SketchConstraintCoincidence_68.setName("SketchConstraintCoincidence_71")
+SketchLine_40 = Sketch_2.addLine(0, 2.425, 4.139817701932777, 11.39365616437401)
+SketchLine_40.setName("SketchLine_42")
+SketchLine_40.result().setName("SketchLine_42")
+SketchLine_40.setAuxiliary(True)
+SketchConstraintCoincidence_69 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchLine_40.startPoint())
+SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_72")
+SketchConstraintCoincidence_70 = Sketch_2.setCoincident(SketchArc_5.endPoint(), SketchLine_40.endPoint())
+SketchConstraintCoincidence_70.setName("SketchConstraintCoincidence_73")
+SketchConstraintCoincidence_71 = Sketch_2.setCoincident(SketchArc_8.endPoint(), SketchLine_40.result())
+SketchConstraintCoincidence_71.setName("SketchConstraintCoincidence_74")
+SketchConstraintParallel_1 = Sketch_2.setParallel(SketchLine_38.result(), SketchLine_40.result())
+SketchLine_41 = Sketch_2.addLine(0, 2.425, 3.9115060144283, 11.49555702253678)
+SketchLine_41.setName("SketchLine_43")
+SketchLine_41.result().setName("SketchLine_43")
+SketchLine_41.setAuxiliary(True)
+SketchConstraintCoincidence_72 = Sketch_2.setCoincident(SketchLine_33.startPoint(), SketchLine_41.startPoint())
+SketchConstraintCoincidence_72.setName("SketchConstraintCoincidence_75")
+SketchConstraintCoincidence_73 = Sketch_2.setCoincident(SketchLine_41.endPoint(), SketchArc_5.results()[1])
+SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_76")
+SketchPoint_3 = Sketch_2.addPoint(3.812510620258724, 11.26599240868436)
+SketchConstraintCoincidence_74 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_41.result())
+SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_77")
+SketchConstraintCoincidence_75 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchArc_8.results()[1])
+SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_78")
+SketchLine_42 = Sketch_2.addLine(3.812510620258724, 11.26599240868436, 3.9115060144283, 11.49555702253678)
+SketchLine_42.setName("SketchLine_44")
+SketchLine_42.result().setName("SketchLine_44")
+SketchConstraintCoincidence_76 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_42.startPoint())
+SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_79")
+SketchConstraintCoincidence_77 = Sketch_2.setCoincident(SketchLine_41.endPoint(), SketchLine_42.endPoint())
+SketchConstraintCoincidence_77.setName("SketchConstraintCoincidence_80")
+SketchPoint_4 = Sketch_2.addPoint(3.862008317343517, 11.38077471561057)
+SketchConstraintCoincidence_78 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchLine_42.result())
+SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_81")
+SketchConstraintMiddle_4 = Sketch_2.setMiddlePoint(SketchPoint_4.coordinates(), SketchLine_42.result())
+SketchConstraintCoincidence_79 = Sketch_2.setCoincident(SketchPoint_4.coordinates(), SketchArc_4.results()[1])
+SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_82")
+SketchConstraintDistance_18 = Sketch_2.setDistance(SketchLine_42.endPoint(), SketchLine_40.result(), 0.25, True)
+SketchConstraintDistance_19 = Sketch_2.setDistance(SketchArc_5.endPoint(), SketchLine_38.result(), 0.375, True)
+SketchConstraintDistance_20 = Sketch_2.setDistance(SketchArc_5.startPoint(), SketchLine_42.result(), "1.35/2", True)
+SketchConstraintDistance_21 = Sketch_2.setDistance(SketchArc_8.startPoint(), SketchArc_5.startPoint(), 0.25, True)
+SketchConstraintCoincidence_80 = Sketch_2.setCoincident(SketchLine_33.endPoint(), SketchArc_5.startPoint())
+SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_83")
+SketchLine_43 = Sketch_2.addLine(3.199461499025942, 11.5058496362538, 3.28253850097406, 11.74164236673401)
+SketchLine_43.setName("SketchLine_45")
+SketchLine_43.result().setName("SketchLine_45")
+SketchConstraintCoincidence_81 = Sketch_2.setCoincident(SketchArc_8.startPoint(), SketchLine_43.startPoint())
+SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_84")
+SketchConstraintCoincidence_82 = Sketch_2.setCoincident(SketchLine_33.endPoint(), SketchLine_43.endPoint())
+SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_85")
+model.do()
+Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_5_2f-SketchLine_45r-SketchArc_8_2r-SketchLine_44f")], model.selection("EDGE", "Sketch_2/SketchLine_34"), 360, 0)
+Revolution_2.result().setName("Cut_tool")
+Revolution_3 = model.addRevolution(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchArc_5_2f-SketchLine_44r-SketchArc_8_2r-SketchLine_41r-SketchLine_40r-SketchLine_39r_wire")], model.selection("EDGE", "Sketch_2/SketchLine_34"), 360, 0)
+Revolution_3.result().setName("Fuse_tool")
+Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Cut_tool"), model.selection("SOLID", "Fuse_tool")], model.selection("EDGE", "PartSet/OZ"), True)
+Symmetry_1.result().subResult(0).setName("Symmetry_1_1_1")
+Symmetry_1.result().subResult(1).setName("Symmetry_1_1_2")
+Symmetry_1.results()[1].subResult(0).setName("Symmetry_1_2_1")
+Symmetry_1.results()[1].subResult(1).setName("Symmetry_1_2_2")
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("COMPOUND", "Cut_tool")])
+Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cut_1_1"), model.selection("COMPOUND", "Fuse_tool")], True)
+model.do()
+model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "a", "10")
+model.addParameter(Part_1_doc, "b", "8")
+model.addParameter(Part_1_doc, "c", "2*a")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-48.37423594569039, -43.07420401522882, -48.37423594569039, -8.074204015228814)
+SketchLine_2 = Sketch_1.addLine(-40.38893648559045, -0.07421752185518632, -2.793802518897851e-22, 0)
+SketchLine_3 = Sketch_1.addLine(-2.793802518897851e-22, 0, 37.58770483143633, -13.68080573302675)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2")
+SketchLine_4 = Sketch_1.addLine(37.58770483143633, -13.68080573302675, 19.91003530177265, -31.35847526269043)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3")
+SketchLine_5 = Sketch_1.addLine(-8.374235945690391, -43.07420401522882, -48.37423594569039, -43.07420401522882)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint())
+SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_5")
+SketchArc_1 = Sketch_1.addArc(-40.37423594569039, -8.074204015228817, -40.38893648559045, -0.07421752185518632, -48.37423594569039, -8.074204015228814, False)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_6")
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint())
+SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_7")
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_1.result())
+SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result())
+SketchArc_2 = Sketch_1.addArc(-8.374235945690213, -3.074204015227884, -8.374235945690391, -43.07420401522882, 19.91003530177265, -31.35847526269043, False)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_8")
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_4.endPoint())
+SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_9")
+SketchConstraintTangent_3 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_4.result())
+SketchConstraintTangent_4 = Sketch_1.setTangent(SketchArc_2.results()[1], SketchLine_5.result())
+SketchLine_6 = Sketch_1.addLine(-2.793802518897851e-22, 0, 0, 35)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_10")
+SketchLine_7 = Sketch_1.addLine(30.00000000001173, 65.00000000001097, 42.00000000001173, 65.00000000001097)
+SketchLine_8 = Sketch_1.addLine(65.00000000000007, 42, 65.00000000000007, 30)
+SketchLine_9 = Sketch_1.addLine(35.00000000000009, 0, -2.793802518897851e-22, 0)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_9.endPoint())
+SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_14")
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_8.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result())
+SketchArc_3 = Sketch_1.addArc(30.00000000000873, 35.00000000000306, 30.00000000001173, 65.00000000001097, 0, 35, False)
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_15")
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_6.endPoint())
+SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_16")
+SketchConstraintTangent_5 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_6.result())
+SketchConstraintTangent_6 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchLine_7.result())
+SketchArc_4 = Sketch_1.addArc(42.00000000000008, 41.99999999999999, 65.00000000000007, 42, 42.00000000001173, 65.00000000001097, False)
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_17")
+SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_7.endPoint())
+SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_18")
+SketchConstraintTangent_7 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_7.result())
+SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_8.result())
+SketchArc_5 = Sketch_1.addArc(35.00000000000006, 30.00000000000001, 35.00000000000009, 0, 65.00000000000007, 30, False)
+SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_5.startPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_19")
+SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_8.endPoint())
+SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_20")
+SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_8.result())
+SketchConstraintTangent_10 = Sketch_1.setTangent(SketchArc_5.results()[1], SketchLine_9.result())
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_21")
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_1.result())
+SketchConstraintAngle_1 = Sketch_1.setAngleBackward(SketchLine_4.result(), SketchLine_3.result(), 65.00000000000011)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), "2*c")
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), 25)
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_5.result(), "4*a")
+SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_1.result(), 35)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 8)
+SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_3.result(), SketchLine_9.result(), 20.00000000000001)
+SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 40)
+SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_6.result(), 35)
+SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_7.result(), 12)
+SketchConstraintLength_7 = Sketch_1.setLength(SketchLine_8.result(), 12)
+SketchConstraintRadius_3 = Sketch_1.setRadius(SketchArc_3.results()[1], 30)
+SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_5.results()[1], 30)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_1")], model.selection(), 10, 0)
+model.do()
+model.testHaveNamingSubshapes(Extrusion_1, model, Part_1_doc)
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+model.addParameter(partSet, "b", "80")
+model.addParameter(partSet, "a", "100")
+model.addParameter(partSet, "c", "b-a")
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-60, -20, -60.00000000000001, 80)
+SketchLine_2 = Sketch_1.addLine(-60.00000000000001, 80, 0, 0)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(0, 0, 0, -100)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(0, -100, -60, -20)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_3.result())
+SketchConstraintEqual_2 = Sketch_1.setEqual(SketchLine_4.result(), SketchLine_3.result())
+SketchConstraintEqual_3 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_3.startPoint(), "a", True)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.endPoint(), SketchLine_2.endPoint(), 60)
+SketchConstraintMirror_1_objects = [SketchLine_4.result(), SketchLine_1.result(), SketchLine_2.result()]
+SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_3.result(), SketchConstraintMirror_1_objects)
+[SketchLine_5, SketchLine_6, SketchLine_7] = SketchConstraintMirror_1.mirrored()
+SketchMultiTranslation_1_objects = [SketchLine_1.result(), SketchLine_4.result(), SketchLine_3.result(), SketchLine_5.result(), SketchLine_6.result()]
+SketchMultiTranslation_1 = Sketch_1.addTranslation(SketchMultiTranslation_1_objects, SketchLine_2.endPoint(), SketchLine_4.startPoint(), 4)
+[SketchLine_8, SketchLine_9, SketchLine_10, SketchLine_11, SketchLine_12, SketchLine_13, SketchLine_14, SketchLine_15, SketchLine_16, SketchLine_5, SketchLine_17, SketchLine_18, SketchLine_19, SketchLine_6, SketchLine_20, SketchLine_21, SketchLine_22] = SketchMultiTranslation_1.translated()
+model.do()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Extrusion_1_objects = [model.selection("FACE", (-30, -10, 0)), model.selection("FACE", (30, -110, 0)), model.selection("FACE", (-30, -210, 0)), model.selection("FACE", (30, -310, 0))]
+Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), "c", 0)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", (30, -310, -9.999999999999998))], model.selection("EDGE", (-30, -360, 0)), "-c")
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", (-30.00000000000001, -10, -10))], model.selection("FACE", (5, 10, 5)), model.selection("FACE", (-30, 40, -10)), True, True)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", (-30.00000000000001, -210, -10)), model.selection("SOLID", (18, -293.9999999999999, -9.999999999999998))])
+model.do()
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_WEAK))
+model.end()
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "B", "46")
+model.addParameter(Part_1_doc, "B1", "36")
+model.addParameter(Part_1_doc, "B2", "25.5")
+model.addParameter(Part_1_doc, "B3", "10")
+model.addParameter(Part_1_doc, "D", "4.2")
+model.addParameter(Part_1_doc, "D1", "4")
+model.addParameter(Part_1_doc, "D2", "0")
+model.addParameter(Part_1_doc, "H", "95")
+model.addParameter(Part_1_doc, "H1", "86")
+model.addParameter(Part_1_doc, "H2", "4.7")
+model.addParameter(Part_1_doc, "H4", "86")
+model.addParameter(Part_1_doc, "H5", "71")
+model.addParameter(Part_1_doc, "H6", "40")
+model.addParameter(Part_1_doc, "H7", "26.75")
+model.addParameter(Part_1_doc, "H8", "51.5")
+model.addParameter(Part_1_doc, "H9", "15")
+model.addParameter(Part_1_doc, "H10", "1.5")
+model.addParameter(Part_1_doc, "L1", "23")
+model.addParameter(Part_1_doc, "L2", "30")
+model.addParameter(Part_1_doc, "L3", "4")
+model.addParameter(Part_1_doc, "L4", "2.3")
+model.addParameter(Part_1_doc, "L5", "6.5")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_1.addLine(29.99999999999995, 0, -16.00000000000005, 0)
+SketchLine_2 = Sketch_1.addLine(-16.00000000000005, 0, -16.00000000000005, 4.7)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(-16.00000000000005, 4.7, 1.946471204593173e-17, 4.7)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(1.946471204593173e-17, 4.7, 4.235164736271502e-22, 95)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchLine_5 = Sketch_1.addLine(4.235164736271502e-22, 95, 7, 95)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchLine_6 = Sketch_1.addLine(7, 95, 7, 80)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchLine_7 = Sketch_1.addLine(7, 80, 9, 80)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchLine_8 = Sketch_1.addLine(9, 80, 9, 8.999999999999996)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchLine_9 = Sketch_1.addLine(9, 8.999999999999996, 17, 9.000000000000002)
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchLine_10 = Sketch_1.addLine(17, 9.000000000000002, 17, 4.7)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchLine_11 = Sketch_1.addLine(17, 4.7, 30, 4.7)
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchLine_12 = Sketch_1.addLine(30, 4.7, 29.99999999999995, 0)
+SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_12.endPoint())
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_13 = SketchProjection_1.createdFeature()
+SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_13.result(), SketchLine_1.result())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
+SketchLine_14 = SketchProjection_2.createdFeature()
+SketchConstraintCollinear_2 = Sketch_1.setCollinear(SketchLine_4.result(), SketchLine_14.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_6.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_8.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_10.result())
+SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_12.result())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_9.result())
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_11.result())
+SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_5.result())
+SketchConstraintHorizontal_5 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), "H2")
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), "B")
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_3.endPoint(), SketchLine_1.startPoint(), "L2")
+SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_5.endPoint(), SketchLine_11.endPoint(), "L1")
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_7.result(), 2)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_6.startPoint(), SketchLine_1.startPoint(), "H")
+SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchLine_8.startPoint(), SketchLine_9.endPoint(), "H5")
+SketchConstraintDistanceVertical_3 = Sketch_1.setVerticalDistance(SketchLine_6.startPoint(), SketchLine_9.endPoint(), "H1")
+SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_12.result(), "H2")
+SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_11.result(), "L5*2")
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), "B/2", "B/2")
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, "L5", [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8"))
+SketchLine_15 = Sketch_2.addLine(-8.985867605559861e-16, 8.999999999999996, 1.535230276239474e-15, 80)
+SketchLine_15.setAuxiliary(True)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]"), False)
+SketchLine_16 = SketchProjection_3.createdFeature()
+SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchLine_16.result(), SketchLine_15.endPoint())
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8]"), False)
+SketchLine_17 = SketchProjection_4.createdFeature()
+SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint(SketchLine_15.startPoint(), SketchLine_17.result())
+SketchLine_18 = Sketch_2.addLine(-4.999999999999998, 13.00000000000012, -4.999999999999999, 94.99999999999999)
+SketchLine_19 = Sketch_2.addLine(-4.999999999999999, 94.99999999999999, -13.00000000000988, 95.00000000000222)
+SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint())
+SketchLine_20 = Sketch_2.addLine(-13.00000000000988, 95.00000000000222, -13, 78.5)
+SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_19.endPoint(), SketchLine_20.startPoint())
+SketchLine_21 = Sketch_2.addLine(-13, 78.5, -23.00000000000001, 78.5)
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
+SketchLine_22 = Sketch_2.addLine(-23.00000000000001, 78.5, -23.00000000000001, 72.5)
+SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
+SketchLine_23 = Sketch_2.addLine(-23.00000000000001, 72.5, -15, 72.5)
+SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
+SketchLine_24 = Sketch_2.addLine(-13, 70.5, -13, 23)
+SketchLine_25 = Sketch_2.addLine(-15, 21, -22.99999999999999, 21)
+SketchLine_26 = Sketch_2.addLine(-22.99999999999999, 21, -22.99999999999999, 15)
+SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchLine_26.startPoint())
+SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_20")
+SketchLine_27 = Sketch_2.addLine(-22.99999999999999, 15, -13, 15)
+SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchLine_26.endPoint(), SketchLine_27.startPoint())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_21")
+SketchLine_28 = Sketch_2.addLine(-13, 15, -13.00000000000024, 13.00000000000012)
+SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_22")
+SketchArc_1 = Sketch_2.addArc(-9.000000000000117, 13.00000000000012, -4.999999999999998, 13.00000000000012, -13.00000000000024, 13.00000000000012, True)
+SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_18.startPoint(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_23")
+SketchConstraintTangent_1 = Sketch_2.setTangent(SketchLine_18.result(), SketchArc_1.results()[1])
+SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_28.endPoint(), SketchArc_1.endPoint())
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_24")
+SketchConstraintTangent_2 = Sketch_2.setTangent(SketchLine_28.result(), SketchArc_1.results()[1])
+SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_18.result())
+SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_28.result())
+SketchConstraintCollinear_3 = Sketch_2.setCollinear(SketchLine_28.result(), SketchLine_24.result())
+SketchConstraintCollinear_4 = Sketch_2.setCollinear(SketchLine_20.result(), SketchLine_24.result())
+SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_27.result())
+SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_25.result())
+SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_23.result())
+SketchConstraintHorizontal_9 = Sketch_2.setHorizontal(SketchLine_21.result())
+SketchProjection_5 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/To_Face]"), False)
+SketchLine_29 = SketchProjection_5.createdFeature()
+SketchConstraintCollinear_5 = Sketch_2.setCollinear(SketchLine_22.result(), SketchLine_29.result())
+SketchConstraintCollinear_5.setName("SketchConstraintCollinear_7")
+SketchConstraintCollinear_6 = Sketch_2.setCollinear(SketchLine_26.result(), SketchLine_29.result())
+SketchConstraintCollinear_6.setName("SketchConstraintCollinear_8")
+SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_1.results()[1], SketchLine_17.result())
+SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_22.result(), 6)
+SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_26.result(), 6)
+SketchConstraintDistanceHorizontal_3 = Sketch_2.setHorizontalDistance(SketchLine_18.endPoint(), SketchLine_15.endPoint(), "B3/2")
+SketchConstraintLength_8 = Sketch_2.setLength(SketchLine_19.result(), 8)
+SketchConstraintLength_8.setName("SketchConstraintLength_9")
+SketchArc_2 = Sketch_2.addArc(-15, 70.5, -13, 70.5, -15, 72.5, False)
+SketchPoint_1 = Sketch_2.addPoint(-13, 72.5)
+SketchPoint_1.setAuxiliary(True)
+SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchLine_23.result())
+SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_25")
+SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchPoint_1.coordinates(), SketchLine_24.result())
+SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_26")
+SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_24.startPoint())
+SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_27")
+SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_23.endPoint())
+SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_28")
+SketchConstraintTangent_4 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_23.result())
+SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_24.result())
+SketchArc_3 = Sketch_2.addArc(-15, 23, -15, 21, -13, 23, False)
+SketchPoint_2 = Sketch_2.addPoint(-13, 21)
+SketchPoint_2.setAuxiliary(True)
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchPoint_2.coordinates(), "H8", False)
+SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_25.result())
+SketchConstraintCoincidence_27.setName("SketchConstraintCoincidence_29")
+SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchPoint_2.coordinates(), SketchLine_24.result())
+SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_30")
+SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchArc_3.startPoint(), SketchLine_25.startPoint())
+SketchConstraintCoincidence_29.setName("SketchConstraintCoincidence_31")
+SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_24.endPoint())
+SketchConstraintCoincidence_30.setName("SketchConstraintCoincidence_32")
+SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_25.result())
+SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_24.result())
+SketchConstraintRadius_1 = Sketch_2.setRadius(SketchArc_3.results()[1], 2)
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_2.results()[1], 2)
+SketchLine_30 = Sketch_2.addLine(13.00000000000001, 78.49999999999866, 23, 78.49999999999866)
+SketchLine_30.setName("SketchLine_32")
+SketchLine_30.result().setName("SketchLine_32")
+SketchLine_31 = Sketch_2.addLine(23, 78.49999999999866, 23, 72.49999999999866)
+SketchLine_31.setName("SketchLine_33")
+SketchLine_31.result().setName("SketchLine_33")
+SketchLine_32 = Sketch_2.addLine(23, 72.49999999999866, 14.99999999999993, 72.5)
+SketchLine_32.setName("SketchLine_34")
+SketchLine_32.result().setName("SketchLine_34")
+SketchArc_4 = Sketch_2.addArc(14.99999999999997, 70.5, 12.99999999999997, 70.50000000000004, 14.99999999999993, 72.5, True)
+SketchLine_33 = Sketch_2.addLine(12.99999999999997, 70.50000000000004, 12.99999999999995, 22.99999999999997)
+SketchLine_33.setName("SketchLine_35")
+SketchLine_33.result().setName("SketchLine_35")
+SketchArc_5 = Sketch_2.addArc(14.99999999999996, 23.00000000000001, 14.99999999999992, 21, 12.99999999999995, 22.99999999999997, True)
+SketchLine_34 = Sketch_2.addLine(14.99999999999992, 21, 23, 20.99999999999866)
+SketchLine_34.setName("SketchLine_36")
+SketchLine_34.result().setName("SketchLine_36")
+SketchLine_35 = Sketch_2.addLine(23, 20.99999999999866, 23, 14.99999999999866)
+SketchLine_35.setName("SketchLine_37")
+SketchLine_35.result().setName("SketchLine_37")
+SketchLine_36 = Sketch_2.addLine(23, 14.99999999999866, 13.00000000000001, 14.99999999999866)
+SketchLine_36.setName("SketchLine_38")
+SketchLine_36.result().setName("SketchLine_38")
+SketchLine_37 = Sketch_2.addLine(13.00000000000001, 14.99999999999866, 13.00000000000024, 13.00000000000011)
+SketchLine_37.setName("SketchLine_39")
+SketchLine_37.result().setName("SketchLine_39")
+SketchArc_6 = Sketch_2.addArc(9.000000000000117, 13.00000000000012, 4.999999999999996, 13.00000000000012, 13.00000000000024, 13.00000000000011, False)
+SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"), True)
+SketchLine_38 = SketchProjection_6.createdFeature()
+SketchLine_38.setName("SketchLine_41")
+SketchLine_38.result().setName("SketchLine_41")
+SketchConstraintCollinear_7 = Sketch_2.setCollinear(SketchLine_19.result(), SketchLine_38.result())
+SketchConstraintCollinear_7.setName("SketchConstraintCollinear_9")
+SketchConstraintDistanceVertical_4 = Sketch_2.setVerticalDistance(SketchAPI_Line(SketchLine_29).startPoint(), SketchLine_22.startPoint(), "H10")
+SketchConstraintMirror_1_objects = [SketchLine_18.result(), SketchLine_20.result(), SketchLine_19.result()]
+SketchConstraintMirror_1 = Sketch_2.addMirror(SketchLine_15.result(), SketchConstraintMirror_1_objects)
+[SketchLine_39, SketchLine_40, SketchLine_41] = SketchConstraintMirror_1.mirrored()
+SketchLine_41.setName("SketchLine_43")
+SketchLine_41.result().setName("SketchLine_43")
+SketchLine_40.setName("SketchLine_42")
+SketchLine_40.result().setName("SketchLine_42")
+SketchLine_39.setName("SketchLine_40")
+SketchLine_39.result().setName("SketchLine_40")
+ExtrusionCut_1.setNestedSketch(Sketch_2)
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 20, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_8&weak_name_1"))
+SketchCircle_1 = Sketch_3.addCircle(-19.86097902097902, 65.28094405594405, 2.5)
+SketchCircle_2 = Sketch_3.addCircle(-18.51902097902098, 27.57192307692308, 2)
+SketchCircle_3 = Sketch_3.addCircle(-19.0558041958042, 85.54451048951049, 3)
+SketchConstraintRadius_3 = Sketch_3.setRadius(SketchCircle_2.results()[1], 2)
+SketchConstraintRadius_4 = Sketch_3.setRadius(SketchCircle_1.results()[1], 2.5)
+SketchConstraintRadius_5 = Sketch_3.setRadius(SketchCircle_3.results()[1], 3)
+ExtrusionCut_2.setNestedSketch(Sketch_3)
+model.end()
+
+# check that radius constraint is valid
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(SketchConstraintRadius_3.feature()))
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.addParameter(Part_1_doc, "r", "20")
+model.addParameter(Part_1_doc, "l", "40")
+model.addParameter(Part_1_doc, "r2", "3")
+model.addParameter(Part_1_doc, "a", "10")
+model.addParameter(Part_1_doc, "h", "5")
+model.addParameter(Part_1_doc, "n", "2")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_1 = SketchProjection_2.createdFeature()
+SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_2 = SketchProjection_3.createdFeature()
+SketchArc_1 = Sketch_1.addArc(0, 0, 20, 0, 0, 20, False)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint())
+SketchArc_2 = Sketch_1.addArc(0, 0, 60, 0, 0, 60, False)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchAPI_Line(SketchLine_2).startPoint(), SketchArc_2.center())
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.result(), SketchArc_2.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_2.endPoint())
+SketchLine_3 = Sketch_1.addLine(0, 20, 0, 60)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_3.endPoint())
+SketchLine_4 = Sketch_1.addLine(20, 0, 60, 0)
+SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchArc_2.startPoint(), SketchLine_4.endPoint())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_4.result(), "l")
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "r")
+model.do()
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", (30, 30, 0))])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE_2", (30, 30, 0)))
+SketchCircle_1 = Sketch_2.addCircle(24.6201938253052, 4.341204441673258, 3)
+SketchLine_5 = Sketch_2.addLine(24.6201938253052, 4.341204441673258, 54.16442641567144, 9.550649771681169)
+SketchLine_5.setAuxiliary(True)
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_5.startPoint())
+SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], "r2")
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_6 = SketchProjection_4.createdFeature()
+SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", (20, 0, 0)), False)
+SketchPoint_2 = SketchProjection_5.createdFeature()
+SketchMultiTranslation_1 = Sketch_2.addTranslation([SketchCircle_1.results()[1]], SketchCircle_1.center(), SketchLine_5.endPoint(), "n")
+[SketchCircle_2] = SketchMultiTranslation_1.translated()
+SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_5.result(), "(l-2*h)/(n-1)")
+SketchLine_7 = Sketch_2.addLine(0, 0, 24.6201938253052, 4.341204441673258)
+SketchLine_7.setAuxiliary(True)
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_6).startPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchLine_7.endPoint())
+SketchConstraintCollinear_1 = Sketch_2.setCollinear(SketchLine_5.result(), SketchLine_7.result())
+SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_6.result(), SketchLine_7.result(), "a")
+SketchPoint_3 = Sketch_2.addPoint(19.69615506024416, 3.472963553338606)
+SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchLine_7.result())
+SketchProjection_6 = Sketch_2.addProjection(model.selection("EDGE", (14.14213562373095, 14.14213562373095, 0)), False)
+SketchArc_3 = SketchProjection_6.createdFeature()
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchArc_3.results()[1])
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchPoint_3.coordinates(), SketchLine_7.endPoint(), "h", True)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "all-in-Sketch_2")], model.selection(), 10, 0)
+AngularCopy_1 = model.addMultiRotation(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], model.selection("EDGE", "PartSet/OZ"), "(90-2*a)/(n-1)", "n")
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", (30, 30, 0))], [model.selection("COMPOUND", (29.25281542867235, 29.25281542867235, 5))])
+model.end()
+
+assert(model.checkPythonDump())
+++ /dev/null
-## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-##
-## This library is free software; you can redistribute it and/or
-## modify it under the terms of the GNU Lesser General Public
-## License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-##
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public
-## License along with this library; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-##
-## See http:##www.salome-platform.org/ or
-## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-##
-
-"""
- TestBoolean.py
- Unit test of FeaturesPlugin_Boolean class
-
- class FeaturesPlugin_Boolean
- static const std::string MY_ID("Boolean");
- static const std::string MY_OBJECT_ID("main_object");
- static const std::string MY_TOOL_ID("tool_object");
- static const std::string MY_TYPE_ID("bool_type");
-
- data()->addAttribute(FeaturesPlugin_Boolean::OBJECT_ID(), ModelAPI_AttributeReference::typeId());
- data()->addAttribute(FeaturesPlugin_Boolean::TOOL_ID(), ModelAPI_AttributeReference::typeId());
- data()->addAttribute(FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeInteger::typeId());
-"""
-#=========================================================================
-# Initialization of the test
-#=========================================================================
-from ModelAPI import *
-from GeomDataAPI import *
-from GeomAlgoAPI import *
-from GeomAPI import *
-
-__updated__ = "2014-12-16"
-
-aSession = ModelAPI_Session.get()
-# Create a part for extrusions & boolean
-aSession.startOperation()
-aPartFeature = aSession.moduleDocument().addFeature("Part")
-aSession.finishOperation()
-aPart = aSession.activeDocument()
-#=========================================================================
-# Create a sketch with circle to extrude
-#=========================================================================
-aSession.startOperation()
-aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin"))
-origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX"))
-dirx.setValue(1, 0, 0)
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
-norm.setValue(0, 0, 1)
-aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
-anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
-aCircleRadius = aSketchCircle.real("circle_radius")
-anCircleCentr.setValue(10., 10.)
-aCircleRadius.setValue(50.)
-aSession.finishOperation()
-#=========================================================================
-# Create a sketch with triangle to extrude
-#=========================================================================
-aSession.startOperation()
-aTriangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
-origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin"))
-origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX"))
-dirx.setValue(1, 0, 0)
-norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm"))
-norm.setValue(0, 0, 1)
-aSketchLineA = aTriangleSketchFeature.addFeature("SketchLine")
-aSketchLineB = aTriangleSketchFeature.addFeature("SketchLine")
-aSketchLineC = aTriangleSketchFeature.addFeature("SketchLine")
-aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint"))
-aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint"))
-aLineBStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint"))
-aLineBEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint"))
-aLineCStartPoint = geomDataAPI_Point2D(aSketchLineC.attribute("StartPoint"))
-aLineCEndPoint = geomDataAPI_Point2D(aSketchLineC.attribute("EndPoint"))
-aLineAStartPoint.setValue(25., 25.)
-aLineAEndPoint.setValue(100., 25.)
-aLineBStartPoint.setValue(100., 25.)
-aLineBEndPoint.setValue(60., 75.)
-aLineCStartPoint.setValue(60., 75.)
-aLineCEndPoint.setValue(25., 25.)
-aSession.finishOperation()
-#=========================================================================
-# Make extrusion on circle (cylinder) and triangle (prism)
-#=========================================================================
-# Build shape from sketcher results
-aSession.startOperation()
-extrudedObjects = []
-for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]:
- # Build sketch faces
- aSketchResult = eachSketchFeature.firstResult()
- aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
- origin = geomDataAPI_Point(eachSketchFeature.attribute("Origin")).pnt()
- dirX = geomDataAPI_Dir(eachSketchFeature.attribute("DirX")).dir()
- norm = geomDataAPI_Dir(eachSketchFeature.attribute("Norm")).dir()
- aSketchFaces = ShapeList()
- GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
- # Create extrusion on them
- anExtrusionFt = aPart.addFeature("Extrusion")
- anExtrusionFt.selectionList("base").append(
- aSketchResult, aSketchFaces[0])
- anExtrusionFt.string("CreationMethod").setValue("BySizes")
- anExtrusionFt.real("from_size").setValue(0)
- anExtrusionFt.real("to_size").setValue(50)
- anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
- anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
- anExtrusionFt.execute()
- extrudedObjects.append(modelAPI_ResultBody(anExtrusionFt.firstResult()))
-aSession.finishOperation()
-#=========================================================================
-# Create a pacman as boolean cut of the prism from the cylinder
-#=========================================================================
-aSession.startOperation()
-aBooleanFt = aPart.addFeature("Cut")
-aBooleanFt.selectionList("main_objects").append(extrudedObjects[0], extrudedObjects[0].shape())
-aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], extrudedObjects[1].shape())
-aBooleanFt.execute()
-aSession.finishOperation()
-
-assert (len(aBooleanFt.results()) > 0)
-aBooleanResult = modelAPI_ResultBody(aBooleanFt.firstResult())
-assert (aBooleanResult is not None)
-#=========================================================================
-# End of test
-#=========================================================================
-
-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"))
-SketchCircle_1 = Sketch_1.addCircle(-353.344768439108, 0.857632933105, 175.14200032067)
-model.do()
-Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchCircle_2 = Sketch_2.addCircle(-126.929674099485, -2.572898799314, 176.971885556791)
-model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 10, 0)
-Boolean_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")])
-model.end()
-assert(len(Boolean_1.results()) > 0)
-
-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"))
-SketchCircle_1 = Sketch_1.addCircle(-353.344768439108, 0.857632933105, 175.14200032067)
-model.do()
-Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchCircle_2 = Sketch_2.addCircle(-126.929674099485, -2.572898799314, 176.971885556791)
-model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), 10, 0)
-Boolean_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")])
-model.end()
-assert(len(Boolean_1.results()) > 0)
-
-assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+ TestBoolean.py
+ Unit test of FeaturesPlugin_Boolean class
+
+ class FeaturesPlugin_Boolean
+ static const std::string MY_ID("Boolean");
+ static const std::string MY_OBJECT_ID("main_object");
+ static const std::string MY_TOOL_ID("tool_object");
+ static const std::string MY_TYPE_ID("bool_type");
+
+ data()->addAttribute(FeaturesPlugin_Boolean::OBJECT_ID(), ModelAPI_AttributeReference::typeId());
+ data()->addAttribute(FeaturesPlugin_Boolean::TOOL_ID(), ModelAPI_AttributeReference::typeId());
+ data()->addAttribute(FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeInteger::typeId());
+"""
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+
+__updated__ = "2014-12-16"
+
+aSession = ModelAPI_Session.get()
+# Create a part for extrusions & boolean
+aSession.startOperation()
+aPartFeature = aSession.moduleDocument().addFeature("Part")
+aSession.finishOperation()
+aPart = aSession.activeDocument()
+#=========================================================================
+# Create a sketch with circle to extrude
+#=========================================================================
+aSession.startOperation()
+aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
+anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
+aCircleRadius = aSketchCircle.real("circle_radius")
+anCircleCentr.setValue(10., 10.)
+aCircleRadius.setValue(50.)
+aSession.finishOperation()
+#=========================================================================
+# Create a sketch with triangle to extrude
+#=========================================================================
+aSession.startOperation()
+aTriangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aSketchLineA = aTriangleSketchFeature.addFeature("SketchLine")
+aSketchLineB = aTriangleSketchFeature.addFeature("SketchLine")
+aSketchLineC = aTriangleSketchFeature.addFeature("SketchLine")
+aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint"))
+aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint"))
+aLineBStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint"))
+aLineBEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint"))
+aLineCStartPoint = geomDataAPI_Point2D(aSketchLineC.attribute("StartPoint"))
+aLineCEndPoint = geomDataAPI_Point2D(aSketchLineC.attribute("EndPoint"))
+aLineAStartPoint.setValue(25., 25.)
+aLineAEndPoint.setValue(100., 25.)
+aLineBStartPoint.setValue(100., 25.)
+aLineBEndPoint.setValue(60., 75.)
+aLineCStartPoint.setValue(60., 75.)
+aLineCEndPoint.setValue(25., 25.)
+aSession.finishOperation()
+#=========================================================================
+# Make extrusion on circle (cylinder) and triangle (prism)
+#=========================================================================
+# Build shape from sketcher results
+aSession.startOperation()
+extrudedObjects = []
+for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]:
+ # Build sketch faces
+ aSketchResult = modelAPI_ResultConstruction(eachSketchFeature.firstResult())
+ # Create extrusion on them
+ anExtrusionFt = aPart.addFeature("Extrusion")
+ anExtrusionFt.selectionList("base").append(
+ aSketchResult, aSketchResult.face(0))
+ anExtrusionFt.string("CreationMethod").setValue("BySizes")
+ anExtrusionFt.real("from_size").setValue(0)
+ anExtrusionFt.real("to_size").setValue(50)
+ anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
+ anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+ anExtrusionFt.execute()
+ extrudedObjects.append(modelAPI_ResultBody(anExtrusionFt.firstResult()))
+aSession.finishOperation()
+#=========================================================================
+# Create a pacman as boolean cut of the prism from the cylinder
+#=========================================================================
+aSession.startOperation()
+aBooleanFt = aPart.addFeature("Cut")
+aBooleanFt.selectionList("main_objects").append(extrudedObjects[0], extrudedObjects[0].shape())
+aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], extrudedObjects[1].shape())
+aBooleanFt.execute()
+aSession.finishOperation()
+
+assert (len(aBooleanFt.results()) > 0)
+aBooleanResult = modelAPI_ResultBody(aBooleanFt.firstResult())
+assert (aBooleanResult is not None)
+#=========================================================================
+# End of test
+#=========================================================================
+
+from salome.shaper import model
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+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"))
+SketchCircle_1 = Sketch_1.addCircle(-353.344768439108, 0.857632933105, 175.14200032067)
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_2 = Sketch_2.addCircle(-126.929674099485, -2.572898799314, 176.971885556791)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")], model.selection(), 10, 0)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")])
+model.do()
+model.end()
+assert(len(Common_1.results()) > 0)
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+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"))
+SketchCircle_1 = Sketch_1.addCircle(-353.344768439108, 0.857632933105, 175.14200032067)
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_2 = Sketch_2.addCircle(-126.929674099485, -2.572898799314, 176.971885556791)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")], model.selection(), 10, 0)
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")])
+model.do()
+model.end()
+assert(len(Smash_1.results()) > 0)
+
+assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_14.result())
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12f-SketchLine_13f-SketchLine_14f")])
Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("COMPOUND", "Compound_1_1")])
model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10)
Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")])
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_13f-SketchLine_14f-SketchLine_15f"), model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_15r")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_15f-SketchLine_13f-SketchLine_14f"), model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12f-SketchLine_13f-SketchLine_15r")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("COMPOUND", "Compound_1_1")])
model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_9.result())
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")])
model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result())
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchLine_6 = Sketch_2.addLine(26.29086071781277, 6.827405438264643, 9.220324256871813, 6.827405438264643)
-SketchLine_7 = Sketch_2.addLine(9.220324256871813, 6.827405438264643, 9.220324256871813, -3.640935176083419)
-SketchLine_8 = Sketch_2.addLine(9.220324256871813, -3.640935176083419, 26.29086071781277, -3.640935176083419)
+SketchLine_6 = Sketch_2.addLine(26.29086071781277, 6.827405438264643, 9.220324256871812, 6.827405438264643)
+SketchLine_7 = Sketch_2.addLine(9.220324256871812, 6.827405438264643, 9.220324256871812, -3.640935176083419)
+SketchLine_8 = Sketch_2.addLine(9.220324256871812, -3.640935176083419, 26.29086071781277, -3.640935176083419)
SketchLine_9 = Sketch_2.addLine(26.29086071781277, -3.640935176083419, 26.29086071781277, 6.827405438264643)
SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_6.startPoint())
SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_8.result())
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10)
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_10r"), model.selection("FACE", "Sketch_2/Face-SketchLine_6f-SketchLine_8f-SketchLine_9f-SketchLine_10f")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_10r"), model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_10f-SketchLine_8f-SketchLine_9f")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("COMPSOLID", "Extrusion_1_1")])
model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.startPoint(), SketchLine_3.result())
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_3.result())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_3")])
Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_2_2")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_2_1")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchLine_1.result())
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.endPoint())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_1")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2")])
model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
model.do()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Box_1_1")])
+assert(Common_1.feature().error() != "")
+Part_1_doc.removeFeature(Common_1.feature())
+
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [])
+assert(Common_1.feature().error() != "")
+Part_1_doc.removeFeature(Common_1.feature())
+
+model.end()
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+Common_1 = Part_1_doc.addFeature("Common")
+Common_1.execute()
+assert(Common_1.error() != "")
+aSession.finishOperation()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_8 = Sketch_2.setHorizontal(SketchLine_15.result())
SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_16.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f"), model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_10f-SketchLine_11f-SketchLine_12f"), model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16f")])
Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_1_2")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_2_2")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_2/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f-SketchLine_8f")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_1_2")])
model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
model.do()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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(32.87583448774056, -21.97399556638079, -28.86536213173501, -21.97399556638079)
+SketchLine_2 = Sketch_1.addLine(-28.86536213173501, -21.97399556638079, -28.86536213173501, 32.11012709159006)
+SketchLine_3 = Sketch_1.addLine(-28.86536213173501, 32.11012709159006, 32.87583448774056, 32.11012709159006)
+SketchLine_4 = Sketch_1.addLine(32.87583448774056, 32.11012709159006, 32.87583448774056, -21.97399556638079)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")])
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 0, False)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_1")])
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Common_1, 0)
+
+assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_20.startPoint(), SketchLine_17.result())
SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_19.result())
model.do()
-Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_9r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_9f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_10f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_7f-SketchLine_8f-SketchLine_10r")]
+Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_9r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_9f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_10f"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_10r-SketchLine_7f-SketchLine_8f")]
Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
-Shell_2_objects = [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchLine_14f-SketchLine_15f"), model.selection("FACE", "Sketch_2/Face-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_15r"), model.selection("FACE", "Sketch_2/Face-SketchLine_16f-SketchLine_17f-SketchLine_19f-SketchLine_20f"), model.selection("FACE", "Sketch_2/Face-SketchLine_17f-SketchLine_18f-SketchLine_19f-SketchLine_20r")]
+Shell_2_objects = [model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12f-SketchLine_15f-SketchLine_14f"), model.selection("FACE", "Sketch_2/Face-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_15r"), model.selection("FACE", "Sketch_2/Face-SketchLine_16f-SketchLine_17f-SketchLine_20f-SketchLine_19f"), model.selection("FACE", "Sketch_2/Face-SketchLine_17f-SketchLine_18f-SketchLine_19f-SketchLine_20r")]
Shell_2 = model.addShell(Part_1_doc, Shell_2_objects)
Compound_1 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_1_2")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_2_2")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchLine_7.result())
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_9.result())
model.do()
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f")])
-Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10f"), model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7r-SketchLine_9r-SketchLine_10r")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_5f-SketchLine_3f-SketchLine_4f")])
+Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_10f-SketchLine_9r-SketchLine_8r-SketchLine_7r"), model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_10r-SketchLine_7r-SketchLine_6r")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_2_1")])
model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_11.result())
SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9f-SketchLine_10f-SketchLine_11f-SketchLine_12f")])
-Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_10f-SketchLine_11f-SketchLine_12f")])
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("COMPOUND", "Compound_1_1")])
model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_15.endPoint())
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 10)
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_10r-SketchLine_14r-SketchLine_15f"), model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_15r")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_14r-SketchLine_15f-SketchLine_10r-SketchLine_9r"), model.selection("FACE", "Sketch_2/Face-SketchLine_15r-SketchLine_13r-SketchLine_12r-SketchLine_11r")])
Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("COMPOUND", "Compound_1_1")])
model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchCircle_1 = Sketch_1.addCircle(-19.01903137581643, 2.528314065029049, 44.55011038017909)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")])
Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10)
Common_1 = model.addCommon(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Sphere_1_1")])
model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_1.result())
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_3.result())
model.do()
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_5f-SketchLine_3f-SketchLine_4f")])
Sphere_1 = model.addSphere(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), 10)
Common_1 = model.addCommon(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SOLID", "Sphere_1_1")])
model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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"))
+SketchCircle_1 = Sketch_1.addCircle(3.367708126821666, -16.14093028927689, 18.51144913400999)
+SketchCircle_2 = Sketch_1.addCircle(37.37680688568888, 37.3768068856889, 21.5270932014419)
+SketchCircle_3 = Sketch_1.addCircle(-3.554756249974806, 10.65828989222541, 8.503732568675463)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Compound_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3")]
+Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1"), model.selection("SOLID", "Compound_1_1_3")], [model.selection("SOLID", "Box_1_1")])
+model.do()
+
+model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Common_1, 1)
+model.testNbSubResults(Common_1, [3])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [14])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [48])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [96])
+model.testResultsVolumes(Common_1, [15007.623169576811051229014992714])
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), 5, True)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")])
+Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], 3, 3, 3)
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Partition_1_1_2")], [model.selection("SOLID", "Translation_1_1")])
+model.do()
+
+model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Common_1, 1)
+model.testNbSubResults(Common_1, [2])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.SOLID, [2])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.FACE, [13])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.EDGE, [56])
+model.testNbSubShapes(Common_1, GeomAPI_Shape.VERTEX, [112])
+model.testResultsVolumes(Common_1, [745])
+
+assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchPoint_2 = Sketch_1.addPoint(10.32264529058116, 23.27655310621242)
SketchPoint_3 = Sketch_1.addPoint(47.56513026052106, 23.27655310621242)
model.do()
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")])
-Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_3")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_2")])
+Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_1/SketchPoint_3")])
Compound_1 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Vertex_2_1"), model.selection("VERTEX", "Vertex_2_2")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchPoint_1 = Sketch_1.addPoint(15.05904629113425, 12.50050543761873)
SketchPoint_2 = Sketch_1.addPoint(47.25352258215165, 31.63008715695855)
model.do()
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_2")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2")])
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchPoint_3 = Sketch_2.addPoint(15.05904629113425, 12.50050543761873)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchPoint_1"), False)
SketchPoint_4 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_3.coordinates(), SketchPoint_4.result())
model.do()
-Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/Vertex-SketchPoint_3-SketchProjection_1-SketchPoint_4")])
-Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1")])
+Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/SketchPoint_3")])
+Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1")])
Common_2 = model.addCommon(Part_1_doc, [model.selection("VERTEX", "Vertex_2_1"), model.selection("VERTEX", "Vertex_3_1")])
model.testHaveNamingSubshapes(Common_2, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
from salome.shaper import model
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchLine_5 = Sketch_2.addLine(-75.23467769579756, 14.76574658950986, -60.62456998069012, -7.998839850308684)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
SketchLine_6 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_6.result())
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_6).endPoint(), SketchLine_5.endPoint())
SketchLine_7 = Sketch_2.addLine(-60.62456998069012, -7.998839850308684, -47.51524103341781, 13.8500417284785)
SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_7.startPoint())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
SketchLine_8 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.result())
SketchLine_9 = Sketch_2.addLine(35.74952364371219, 12.81217486039606, 47.60078384600371, -9.954719738742909)
-SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_3"), False)
SketchLine_10 = SketchProjection_3.createdFeature()
SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_9.startPoint(), SketchLine_10.result())
SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_10).endPoint(), SketchLine_9.endPoint())
SketchLine_11 = Sketch_2.addLine(47.60078384600371, -9.954719738742909, 64.13719888777418, 18.68151118724985)
SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_11.startPoint())
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), False)
SketchLine_12 = SketchProjection_4.createdFeature()
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.result())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
-Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7")])
-Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_11")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4")])
+Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_7")])
+Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_2/SketchLine_11")])
Compound_1 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_3_1"), model.selection("WIRE", "Wire_4_1")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
from salome.shaper import model
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchLine_3 = Sketch_2.addLine(-15.313984501828, -1.226571041729713, -1.296213364851965, -18.43019925529121)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
SketchLine_4 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.startPoint(), SketchLine_4.result())
SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_4).endPoint(), SketchLine_3.endPoint())
SketchLine_5 = Sketch_2.addLine(-1.296213364851965, -18.43019925529121, 20.70651786493702, 7.831125115747244)
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_5.startPoint())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
SketchLine_6 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.result())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_5")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_5")])
Common_1 = model.addCommon(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")])
model.testHaveNamingSubshapes(Common_1, model, Part_1_doc)
model.do()
extrudedObjects = []
for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]:
# Build sketch faces
- aSketchResult = eachSketchFeature.firstResult()
- aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
- origin = geomDataAPI_Point(eachSketchFeature.attribute("Origin")).pnt()
- dirX = geomDataAPI_Dir(eachSketchFeature.attribute("DirX")).dir()
- norm = geomDataAPI_Dir(eachSketchFeature.attribute("Norm")).dir()
- aSketchFaces = ShapeList()
- GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
+ aSketchResult = modelAPI_ResultConstruction(eachSketchFeature.firstResult())
# Create extrusion on them
anExtrusionFt = aPart.addFeature("Extrusion")
anExtrusionFt.selectionList("base").append(
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 20)
Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")])
-Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_1"), model.selection("COMPSOLID", "Extrusion_2_2")])
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_2"), model.selection("COMPSOLID", "Extrusion_2_1")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")])
model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchCircle_2 = Sketch_2.addCircle(32.08143103297851, 1.286314091165838, 40.2404383217231)
-SketchLine_2 = Sketch_2.addLine(-8.153954725266397, 0.6486549270159857, 72.23884334545456, 3.869938036363647)
+SketchLine_2 = Sketch_2.addLine(-8.153954725266397, 0.6486549270159857, 72.23884334545455, 3.869938036363647)
SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchCircle_2.results()[1])
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchCircle_2.results()[1])
model.do()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "PartSet/OX"), 20)
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Translation_1_1")])
+Box_3 = model.addBox(Part_1_doc, 20, 6, 20)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], -5, 2, -5)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Compound_1_1_1")], [model.selection("SOLID", "Translation_2_1")])
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Cut_1, 1)
+model.testNbSubResults(Cut_1, [3])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [18])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [72])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [144])
+model.testResultsVolumes(Cut_1, [1400])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchLine_3 = Sketch_1.addLine(-5.074756009927738, 49.65832960815328, -4.828189411077946, 26.48106931627197)
SketchLine_4 = Sketch_1.addLine(7.993273729111718, 49.41176300930348, 8.23984032796152, 26.48106931627197)
model.do()
-Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Compound_2 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")])
model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchLine_1 = Sketch_1.addLine(-28.62948623265935, 53.77363153293705, 40.23707952134417, 53.11775947813702)
SketchLine_2 = Sketch_1.addLine(-26.66187006825925, 26.22700523133564, 40.89295157614425, 26.22700523133564)
model.do()
-Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 10)
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchLine_3 = Sketch_2.addLine(14.6580693841429, 60.98822413573743, -10.2650686982584, 60.98822413573743)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchLine_1 = Sketch_1.addLine(-25.12006861063466, 20.61578044596912, 27.54545454545454, 58.72898799313897)
SketchLine_2 = Sketch_1.addLine(-19.22984562607204, 56.30360205831907, 22.69468267581474, 22.00171526586621)
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_1")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("EDGE", "Edge_1_2")])
model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_4.result())
SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_5.result())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f_wire")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("FACE", "Face_1_1")])
model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
model.do()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+aSession.startOperation()
+Cut_1 = aPart.addFeature("Cut")
+Cut_1.execute()
+assert(Cut_1.error() != "")
+aSession.finishOperation()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchCircle_3 = Sketch_2.addCircle(-15.35052744425385, 1.145561749571189, 23.35148318113706)
SketchCircle_4 = Sketch_2.addCircle(82.70955831903943, -3.436685248713552, 26.06650182177207)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_2_2")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), model.selection("EDGE", "Sketch_1/SketchCircle_2_2")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2")])
Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_1_2")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_2_2")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchCircle_1 = Sketch_1.addCircle(-6.063464837049752, 0.8662092624356818, 32.2304349637617)
+SketchCircle_1 = Sketch_1.addCircle(-6.063464837049752, 0.8662092624356817, 32.2304349637617)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchCircle_1 = Sketch_1.addCircle(-8.850181926352695, 1.062021831162306, 46.73432400996293)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchLine_1 = Sketch_2.addLine(64.95207814695526, 55.29739830292169, -8.272875875352462, 55.29739830292169)
SketchLine_2 = Sketch_2.addLine(-8.272875875352462, 55.29739830292169, -8.272875875352462, -5.036618941767999)
SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 10)
Cut_1 = model.addCut(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
-Group_1_objects = [model.selection("VERTEX", "Cut_1_1/Modified_Edge_divided_2_v_2_1"), model.selection("FACE", "Cut_1_1"), model.selection("FACE", "Cut_1_1"), model.selection("VERTEX", "Cut_1_1/Modified_Face_divided_4_v_3_1")]
+Group_1_objects = [model.selection("VERTEX", "Cut_1_1/Generated_Vertex&Sketch_2/SketchLine_3&Face_1_1/Edge_1"), model.selection("FACE", "Cut_1_1"), model.selection("FACE", "Cut_1_1"), model.selection("VERTEX", "Cut_1_1/Generated_Vertex&Face_1_1/Face_1_1")]
Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
-Group_2_objects = [model.selection("FACE", "Cut_1_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_divided_3_e_2_1"), model.selection("VERTEX", "Cut_1_1/Modified_Face_divided_4_v_3_1"), model.selection("FACE", "Cut_1_1")]
+Group_2_objects = [model.selection("FACE", "Cut_1_1"), model.selection("EDGE", "Cut_1_1/Generated_Edge&Sketch_2/SketchLine_3&Face_1_1/Face_1_1"), model.selection("VERTEX", "Cut_1_1/Generated_Vertex&Face_1_1/Face_1_1"), model.selection("FACE", "Cut_1_1")]
Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
Group_3 = model.addGroup(Part_1_doc, [model.selection("FACE", "Cut_1_1")])
model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchCircle_4.results()[1])
SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchCircle_4.results()[1])
model.do()
-Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_1f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchLine_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchLine_2f")]
+Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_1_2r-SketchLine_1f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchLine_2r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchLine_2f")]
Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
-Shell_2_objects = [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f-SketchLine_3f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f-SketchLine_3r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f-SketchLine_4f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f-SketchLine_4r")]
+Shell_2_objects = [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2r-SketchLine_3f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2r-SketchCircle_3_2r-SketchLine_3r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f-SketchCircle_4_2f-SketchLine_4f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f-SketchLine_4r")]
Shell_2 = model.addShell(Part_1_doc, Shell_2_objects)
Compound_1 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_1_2")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_2_1"), model.selection("SHELL", "Shell_2_2")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchCircle_2.results()[1])
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchCircle_2.results()[1])
model.do()
-Shell_1_objects = [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f-SketchLine_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f-SketchLine_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_1f")]
+Shell_1_objects = [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r-SketchCircle_2_2r-SketchLine_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r-SketchLine_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_1_2r-SketchLine_1f")]
Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
Cut_1 = model.addCut(Part_1_doc, [model.selection("SHELL", "Shell_1_2")], [model.selection("SHELL", "Shell_1_1")])
model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 20, 20)
-Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
-Compound_2 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")])
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_2"), model.selection("SOLID", "Extrusion_2_1")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")])
model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchPoint_3 = Sketch_1.addPoint(25.43147084048027, 34.59596483704974)
SketchPoint_4 = Sketch_1.addPoint(54.29962692967411, 33.67951543739281)
model.do()
-Compound_1_objects = [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_3"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_4")]
+Compound_1_objects = [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_1/SketchPoint_3"), model.selection("VERTEX", "Sketch_1/SketchPoint_4")]
Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchLine_1 = Sketch_2.addLine(42.11715050385933, 45.75316349699826, -43.32915483490565, 45.75316349699826)
SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 10)
Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchPoint_3 = Sketch_1.addPoint(25.43147084048027, 34.59596483704974)
SketchPoint_4 = Sketch_1.addPoint(54.29962692967411, 33.67951543739281)
model.do()
-Compound_1_objects = [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_3"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_4")]
+Compound_1_objects = [model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_1/SketchPoint_3"), model.selection("VERTEX", "Sketch_1/SketchPoint_4")]
Compound_1 = model.addCompound(Part_1_doc, Compound_1_objects)
-Compound_2 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_3")])
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_1/SketchPoint_3")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")])
model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchPoint_1 = Sketch_1.addPoint(0, 50)
SketchPoint_2 = Sketch_1.addPoint(0, 25)
model.do()
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1")])
-Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1")])
-Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1")])
-Vertex_4 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1")])
+Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1")])
+Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_1")])
+Vertex_4 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_2")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], [model.selection("VERTEX", "Vertex_2_1")])
Cut_2 = model.addCut(Part_1_doc, [model.selection("VERTEX", "Vertex_3_1")], [model.selection("VERTEX", "Vertex_4_1")])
-model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
model.testHaveNamingSubshapes(Cut_2, model, Part_1_doc)
model.do()
model.end()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchLine_5 = Sketch_2.addLine(-67.39108061749573, 66.6981132075472, -42.44425385934821, 35.51457975986279)
-SketchLine_6 = Sketch_2.addLine(-42.44425385934821, 35.51457975986279, -16.1114922813036, 69.1234991423671)
+SketchLine_5 = Sketch_2.addLine(-67.39108061749573, 66.69811320754719, -42.44425385934821, 35.51457975986279)
+SketchLine_6 = Sketch_2.addLine(-42.44425385934821, 35.51457975986279, -16.1114922813036, 69.12349914236709)
SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
-SketchLine_7 = Sketch_2.addLine(12.64665523156088, 66.6981132075472, 35.16809605488852, 36.5540308747856)
+SketchLine_7 = Sketch_2.addLine(12.64665523156088, 66.69811320754719, 35.16809605488852, 36.5540308747856)
SketchLine_8 = Sketch_2.addLine(35.16809605488852, 36.5540308747856, 52.49228130360206, 66.35162950257292)
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
-Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_6")])
-Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4")])
+Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_6")])
+Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8")])
Compound_1 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_3_1"), model.selection("WIRE", "Wire_4_1")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], [model.selection("COMPOUND", "Compound_2_1")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchCircle_1 = Sketch_2.addCircle(3.984562607204112, 58.72898799313897, 38.16357190022508)
model.do()
-Wire_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")]
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3")]
Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_1_2")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("FACE", "Face_1_1")])
model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchLine_5 = Sketch_1.addLine(3.508244452542322, 60.3323520809374, 63.1926014393454, 22.94764495733547)
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
model.do()
-Wire_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")]
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3")]
Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_5")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("WIRE", "Wire_2_1")])
model.testHaveNamingSubshapes(Cut_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
-"""
-Test case for Boolean Fill feature. Written on High API.
-"""
-from ModelAPI import *
-from GeomAPI import *
+# -*- coding: utf-8 -*-
from salome.shaper import model
-# Get session
-aSession = ModelAPI_Session.get()
-
-# Create a part
-aDocument = aSession.activeDocument()
-aSession.startOperation()
-model.addPart(aDocument)
-aDocument = aSession.activeDocument()
-aSession.finishOperation()
-
-# Create a sketch with circle to extrude
-aSession.startOperation()
-anOrigin = GeomAPI_Pnt(0, 0, 0)
-aDirX = GeomAPI_Dir(1, 0, 0)
-aNorm = GeomAPI_Dir(0, 0, 1)
-aCircleSketch = model.addSketch(aDocument, GeomAPI_Ax3(anOrigin, aDirX, aNorm))
-aCircleSketch.addCircle(0, 0, 50)
-aSession.finishOperation()
-
-# Create a sketch with triangle to extrude
-aSession.startOperation()
-aTriangleSketch = model.addSketch(aDocument, GeomAPI_Ax3(anOrigin, aDirX, aNorm))
-aTriangleSketch.addLine(25, 25, 100, 25)
-aTriangleSketch.addLine(100, 25, 60, 75)
-aTriangleSketch.addLine(60, 75, 25, 25)
-aSession.finishOperation()
-
-# Make extrusion on circle (cylinder) and triangle (prism)
-aSession.startOperation()
-anExtrusion = model.addExtrusion(aDocument, aCircleSketch.results() + aTriangleSketch.results(), 100)
-aSession.finishOperation()
-
-# Fill prism with cylinder
-aSession.startOperation()
-aBoolean = model.addFill(aDocument, [anExtrusion.results()[0]], [anExtrusion.results()[1]])
-assert (len(aBoolean.results()) > 0)
-aSession.finishOperation()
-
+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"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 50)
+model.do()
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_2.addLine(25, 25, 100, 25)
+SketchLine_2 = Sketch_2.addLine(100, 25, 60, 75)
+SketchLine_3 = Sketch_2.addLine(60, 75, 25, 25)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1"), model.selection("COMPOUND", "Sketch_2")], model.selection(), 100, 0)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_1_2")])
+model.do()
+model.end()
+assert (len(Fill_1.results()) > 0)
assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
+from GeomAPI import GeomAPI_Pnt
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result())
SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_8.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0)
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("FACE", "PartSet/YOZ")])
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", GeomAPI_Pnt(17.35551764280096, -11.01190794150899, 0))], model.selection(), 100, 0)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", GeomAPI_Pnt(-0.3180832609141306, -28.0220443670531, 50.00000000000001))], [model.selection("FACE", "PartSet/YOZ")])
model.do()
-
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
-
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
from GeomAPI import GeomAPI_Shape
-model.testNbResults(Boolean_1, 1)
-model.testNbSubResults(Boolean_1, [4])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.SOLID, [4])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.FACE, [30])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [132])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [264])
-model.testResultsVolumes(Boolean_1, [11003613.329450136050581932067871094])
+model.testNbResults(Fill_1, 1)
+model.testNbSubResults(Fill_1, [4])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.SOLID, [4])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.FACE, [30])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.EDGE, [132])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.VERTEX, [264])
+model.testResultsVolumes(Fill_1, [11003613.329450136050581932067871094])
assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+aSession.startOperation()
+Fill_1 = aPart.addFeature("Fill")
+Fill_1.execute()
+assert(Fill_1.error() != "")
+aSession.finishOperation()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 0)
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 50, -20)
-Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1"), model.selection("COMPSOLID", "Extrusion_1_2")])
-Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_1"), model.selection("COMPSOLID", "Extrusion_2_2")])
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_2"), model.selection("COMPSOLID", "Extrusion_1_1")])
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_2"), model.selection("COMPSOLID", "Extrusion_2_1")])
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")], True)
model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+from GeomAPI import GeomAPI_Shape
+
+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"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_1 = SketchProjection_1.createdFeature()
+SketchCircle_1 = Sketch_1.addCircle(52.27216563767099, 0, 18.66006927176168)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center())
+SketchCircle_2 = Sketch_1.addCircle(79.68333887668101, 0, 24.16077154338278)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
+SketchLine_2 = Sketch_2.addLine(73.13136007081269, -14.25937060400964, 2.118687665902372, -14.25937060400964)
+SketchLine_3 = Sketch_2.addLine(2.118687665902372, -14.25937060400964, 2.118687665902372, 26.70061277610758)
+SketchLine_4 = Sketch_2.addLine(2.118687665902372, 26.70061277610758, 73.13136007081269, 26.70061277610758)
+SketchLine_5 = Sketch_2.addLine(73.13136007081269, 26.70061277610758, 73.13136007081269, -14.25937060400964)
+SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_2.result())
+SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_3.result())
+SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_4.result())
+SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_5.result())
+model.do()
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r")])
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], [model.selection("FACE", "Face_1_1")])
+
+model.testNbResults(Fuse_1, 1)
+model.testNbSubResults(Fuse_1, [2])
+model.testNbSubShapes(Fuse_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Fuse_1, GeomAPI_Shape.FACE, [4])
+model.testNbSubShapes(Fuse_1, GeomAPI_Shape.EDGE, [16])
+model.testNbSubShapes(Fuse_1, GeomAPI_Shape.VERTEX, [32])
+model.testResultsVolumes(Fuse_1, [785.398163397447774514148477465])
+
+Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Extrusion_1_1_1")], [model.selection("FACE", "Fuse_1_1_1")])
+assert(Fuse_2.feature().error() != "")
+
+model.end()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchLine_3 = Sketch_2.addLine(-70.53968253968257, 29.92592592592593, -31.52910052910054, -5.343915343915344)
SketchLine_4 = Sketch_2.addLine(14.96296296296294, 26.18518518518519, 50.23280423280426, -8.015873015873021)
model.do()
-Edge_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4")]
+Edge_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_4")]
Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchLine_2 = Sketch_2.addLine(-24.04761904761907, 40.07936507936508, 39.54497354497357, -14.96296296296296)
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_2")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_2/SketchLine_2")])
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_1")])
model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
model.do()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1"), model.selection("FACE", "PartSet/XOZ")])
+
+Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1")])
+assert(Fuse_1.feature().error() != "")
+Part_1_doc.removeFeature(Fuse_1.feature())
+
+Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_2")])
+assert(Fuse_1.feature().error() != "")
+Part_1_doc.removeFeature(Fuse_1.feature())
+
+Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1")], [model.selection("SOLID", "Partition_1_1_2")])
+assert(Fuse_1.feature().error() != "")
+Part_1_doc.removeFeature(Fuse_1.feature())
+model.end()
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+Fuse_1 = Part_1_doc.addFeature("Fuse")
+Fuse_1.execute()
+assert(Fuse_1.error() != "")
+aSession.finishOperation()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchCircle_3 = Sketch_2.addCircle(-36.12101408450705, -7.148950704225357, 25.24032590912034)
SketchCircle_4 = Sketch_2.addCircle(51.92395774647893, -12.41659859154929, 31.3630728131964)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")])
Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2r")])
Face_4 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")])
Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_4_1")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchCircle_2 = Sketch_2.addCircle(22.86792452830187, 26.50600343053173, 30.90704565816075)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")])
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")], True)
model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_16.startPoint(), SketchLine_20.startPoint())
SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_20.endPoint())
model.do()
-Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_4r-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_3r-SketchLine_5f"), model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_9r-SketchLine_10r"), model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_8r-SketchLine_10f"), model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12r-SketchLine_15f"), model.selection("FACE", "Sketch_2/Face-SketchLine_13r-SketchLine_14r-SketchLine_15r"), model.selection("FACE", "Sketch_2/Face-SketchLine_16r-SketchLine_17r-SketchLine_20f"), model.selection("FACE", "Sketch_2/Face-SketchLine_18r-SketchLine_19r-SketchLine_20r")]
+Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_5r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r"), model.selection("FACE", "Sketch_1/Face-SketchLine_9r-SketchLine_10r-SketchLine_6r"), model.selection("FACE", "Sketch_1/Face-SketchLine_10f-SketchLine_8r-SketchLine_7r"), model.selection("FACE", "Sketch_2/Face-SketchLine_15f-SketchLine_12r-SketchLine_11r"), model.selection("FACE", "Sketch_2/Face-SketchLine_15r-SketchLine_14r-SketchLine_13r"), model.selection("FACE", "Sketch_2/Face-SketchLine_20f-SketchLine_17r-SketchLine_16r"), model.selection("FACE", "Sketch_2/Face-SketchLine_20r-SketchLine_19r-SketchLine_18r")]
Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
Compound_1 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_1_2")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("SHELL", "Shell_1_3"), model.selection("SHELL", "Shell_1_4")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_10.startPoint())
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_10.endPoint())
model.do()
-Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_4r-SketchLine_5r"), model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_3r-SketchLine_5f"), model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7r-SketchLine_10f"), model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_9r-SketchLine_10r")]
+Shell_1_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_5r-SketchLine_1r"), model.selection("FACE", "Sketch_1/Face-SketchLine_5f-SketchLine_3r-SketchLine_2r"), model.selection("FACE", "Sketch_2/Face-SketchLine_10f-SketchLine_7r-SketchLine_6r"), model.selection("FACE", "Sketch_2/Face-SketchLine_10r-SketchLine_9r-SketchLine_8r")]
Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SHELL", "Shell_1_1"), model.selection("SHELL", "Shell_1_2")], True)
model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_16.result())
model.do()
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), 40, -20)
-Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")])
model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 50, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 50, 0)
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchLine_5 = Sketch_2.addLine(-38.01624011480907, 11.11021000825241, -18.03083750064881, 11.11021000825241)
SketchLine_6 = Sketch_2.addLine(-18.03083750064881, 11.11021000825241, -18.03083750064881, 22.05701811772883)
SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 30, -20)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f-SketchLine_8f_wire")], model.selection(), 30, -20)
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchPoint_3 = Sketch_1.addPoint(-19.77248677248678, -16.03174603174603)
SketchPoint_4 = Sketch_1.addPoint(21.37566137566138, -16.03174603174603)
model.do()
-Vertex_1_objects = [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_3"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_4"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2")]
+Vertex_1_objects = [model.selection("VERTEX", "Sketch_1/SketchPoint_3"), model.selection("VERTEX", "Sketch_1/SketchPoint_1"), model.selection("VERTEX", "Sketch_1/SketchPoint_4"), model.selection("VERTEX", "Sketch_1/SketchPoint_2")]
Vertex_1 = model.addVertex(Part_1_doc, Vertex_1_objects)
Compound_1 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("VERTEX", "Vertex_1_3"), model.selection("VERTEX", "Vertex_1_4")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchPoint_1 = Sketch_1.addPoint(-6.078627161807992, -0.4501231771005025)
SketchPoint_2 = Sketch_1.addPoint(7.482208269631659, 3.929326826374309)
model.do()
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchPoint_2"), model.selection("VERTEX", "Sketch_1/SketchPoint_1")])
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_1_2")])
model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchLine_8 = Sketch_2.addLine(35.98446146572105, 27.95221560283687, 53.3341125295508, 47.87218534278959)
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
-Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_6")])
-Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4")])
+Wire_3 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_6")])
+Wire_4 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8")])
Compound_1 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")])
Compound_2 = model.addCompound(Part_1_doc, [model.selection("WIRE", "Wire_3_1"), model.selection("WIRE", "Wire_4_1")])
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1"), model.selection("COMPOUND", "Compound_2_1")])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchLine_4 = Sketch_2.addLine(-4.124361249906777, 34.02598031173091, 14.43526437467373, 6.392759937355498)
SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_4")])
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("WIRE", "Wire_1_1"), model.selection("WIRE", "Wire_2_1")])
model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
model.do()
extrudedObjects = []
for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]:
# Build sketch faces
- aSketchResult = eachSketchFeature.firstResult()
- aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
- origin = geomDataAPI_Point(eachSketchFeature.attribute("Origin")).pnt()
- dirX = geomDataAPI_Dir(eachSketchFeature.attribute("DirX")).dir()
- norm = geomDataAPI_Dir(eachSketchFeature.attribute("Norm")).dir()
- aSketchFaces = ShapeList()
- GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
+ aSketchResult = modelAPI_ResultConstruction(eachSketchFeature.firstResult())
# Create extrusion on them
anExtrusionFt = aPart.addFeature("Extrusion")
anExtrusionFt.selectionList("base").append(
- aSketchResult, aSketchFaces[0])
+ aSketchResult, aSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt.real("to_size").setValue(50)
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(-0.820365148699405, 7.40718257641344, 6.028904154999336)
+SketchCircle_2 = Sketch_1.addCircle(10.62009910116713, 13.94078752172051, 10.99163472554975)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("SOLID", "Box_1_1")])
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Smash_1, 1)
+model.testNbSubResults(Smash_1, [4])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.SOLID, [4])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.FACE, [28])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [120])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.VERTEX, [240])
+model.testResultsVolumes(Smash_1, [4980.404017506245509139262139797])
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face_1")], [model.selection("SOLID", "Cylinder_1_1")])
+assert(Smash_1.feature().error() != "")
+Part_1_doc.removeFeature(Smash_1.feature())
+
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Cylinder_1_1/Face_1")])
+
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("SOLID", "Cylinder_1_1")])
+assert(Smash_1.feature().error() != "")
+Part_1_doc.removeFeature(Smash_1.feature())
+
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], [model.selection("FACE", "Face_1_1")])
+assert(Smash_1.feature().error() != "")
+Part_1_doc.removeFeature(Smash_1.feature())
+
+Sketch_1 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(5, -6, 7)
+SketchCircle_2 = Sketch_1.addCircle(14, 0, 8)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1")], [model.selection("SOLID", "Extrusion_1_1_2")])
+assert(Smash_1.feature().error() != "")
+Part_1_doc.removeFeature(Smash_1.feature())
+
+Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Extrusion_1_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1_1/To_Face")])
+
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("FACE", "Face_2_1")], [model.selection("FACE", "Face_2_2")])
+assert(Smash_1.feature().error() != "")
+Part_1_doc.removeFeature(Smash_1.feature())
+
+model.end()
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+Smash_1 = Part_1_doc.addFeature("Smash")
+Smash_1.execute()
+assert(Smash_1.error() != "")
+aSession.finishOperation()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchCircle_2 = Sketch_2.addCircle(12.30017152658664, 14.37907375643225, 29.61574408620473)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r")])
Smash_1 = model.addSmash(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Face_1_2")])
model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc)
model.do()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), 5, True)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1")])
+Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], 3, 3, 3)
+Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Partition_1_1_2")], [model.selection("SOLID", "Translation_1_1")])
+model.do()
+
+model.testHaveNamingSubshapes(Smash_1, model, Part_1_doc)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Smash_1, 1)
+model.testNbSubResults(Smash_1, [3])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.SOLID, [3])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.FACE, [28])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.EDGE, [130])
+model.testNbSubShapes(Smash_1, GeomAPI_Shape.VERTEX, [260])
+model.testResultsVolumes(Smash_1, [1657])
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "PartSet/YOZ"), model.selection("SOLID", "Cylinder_1_1")])
+
+Cut_1 = model.addCut(Part_1_doc, [], [])
+assert(Cut_1.feature().error() != "")
+Part_1_doc.removeFeature(Cut_1.feature())
+
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1")], [])
+assert(Cut_1.feature().error() != "")
+Part_1_doc.removeFeature(Cut_1.feature())
+
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Partition_1_1_1")], [model.selection("SOLID", "Partition_1_1_2")])
+assert(Cut_1.feature().error() != "")
+Part_1_doc.removeFeature(Cut_1.feature())
+model.end()
# Make extrusion on circle
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
#=========================================================================
# Make extrusion on circle
#=========================================================================
-# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+# Build face from sketcher results
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
-anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
anExtrusionFt.real("to_size").setValue(0) #TODO: remove
anExtrusionFt.real("from_size").setValue(0) #TODO: remove
aSession.finishOperation()
# Extrude clamp
-aClampSketchResult = aClampSketchFeature.firstResult()
-aClampSketchEdges = modelAPI_ResultConstruction(aClampSketchResult).shape()
-origin = geomDataAPI_Point(aClampSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aClampSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aClampSketchFeature.attribute("Norm")).dir()
-aClampSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aClampSketchEdges, aClampSketchFaces)
+aClampSketchResult = modelAPI_ResultConstruction(aClampSketchFeature.firstResult())
aSession.startOperation()
aClampExtrusionFt = aPart.addFeature("Extrusion")
assert (aClampExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
aClampExtrusionFt.selectionList("base").append(
- aClampSketchResult, aClampSketchFaces[0])
+ aClampSketchResult, aClampSketchResult.face(0))
aClampExtrusionFt.string("CreationMethod").setValue("BySizes")
aClampExtrusionFt.real("to_size").setValue(70)
aClampExtrusionFt.real("from_size").setValue(0)
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
-anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
anExtrusionFt.real("to_size").setValue(0) #TODO: remove
anExtrusionFt.real("from_size").setValue(0) #TODO: remove
-anExtrusionFt.selection("to_object").selectSubShape("face", "Extrusion_3_1/Generated_Face_3")
+anExtrusionFt.selection("to_object").selectSubShape("face", "Extrusion_3_1/Generated_Face&Sketch_2/SketchLine_3")
anExtrusionFt.real("to_offset").setValue(0)
-anExtrusionFt.selection("from_object").selectSubShape("face", "Extrusion_3_1/Generated_Face_4")
+anExtrusionFt.selection("from_object").selectSubShape("face", "Extrusion_3_1/Generated_Face&Sketch_2/SketchLine_4")
anExtrusionFt.real("from_offset").setValue(0)
anExtrusionFt.execute()
aSession.finishOperation()
# Make extrusion on circle
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face")
aSession.startOperation()
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
# Make extrusion on circle
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face")
aSession.startOperation()
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Point_2 = model.addPoint(Part_1_doc, 0, 0, 0)
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")])
+
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection(), 10, 0)
+assert(Extrusion_1.feature().error() != "")
+Part_1_doc.removeFeature(Extrusion_1.feature())
+
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(20, 20, 10)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection("EDGE", "PartSet/OX"), 10, 0)
+assert(Extrusion_1.feature().error() != "")
+Part_1_doc.removeFeature(Extrusion_1.feature())
+
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OX"), 10, 0)
+assert(Extrusion_1.feature().error() != "")
+Part_1_doc.removeFeature(Extrusion_1.feature())
+
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchArc_1 = Sketch_2.addArc(25, 10, 40, 10, 25, 25, False)
+model.do()
+
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "Sketch_2/SketchArc_1_2"), 10, 0)
+assert(Extrusion_1.feature().error() != "")
+Part_1_doc.removeFeature(Extrusion_1.feature())
+
+model.end()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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"))
+SketchCircle_1 = Sketch_1.addCircle(9.631110499908317, -35.9437937189679, 36.19447160731126)
+model.do()
+
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, -10)
+assert(Extrusion_1.feature().error() != "")
+
+Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_2 = Sketch_2.addCircle(114.4867836253828, -21.50233830122853, 11.10986684682035)
+SketchCircle_3 = Sketch_2.addCircle(113.4180342136906, 1.426992627069481, 10.29495051811322)
+model.do()
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2r"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")])
+
+Plane_1 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), 10, False)
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
+SketchCircle_4 = Sketch_3.addCircle(91.42492988686666, -20.30106607931821, 6.749165188215104)
+SketchCircle_5 = Sketch_3.addCircle(88.32466240656791, 2.196618803039243, 8.273170230715275)
+model.do()
+Compound_2 = model.addCompound(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_4_2r"), model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2f")])
+
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), model.selection("COMPOUND", "Compound_1_1"), 0, model.selection("COMPOUND", "Compound_2_1"), 0)
+assert(Extrusion_2.feature().error() == "")
+
+model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
model.do()
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Fill_1_1")], [model.selection("SOLID", "Box_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
+Fill_2 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Fill_1_1")], [model.selection("SOLID", "Box_1_1")])
model.do()
-model.checkResult(Boolean_2, model, 1, [6], [0], [6], [22], [44])
-model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
+model.checkResult(Fill_2, model, 1, [6], [0], [6], [22], [44])
+model.testHaveNamingSubshapes(Fill_2, model, Part_1_doc)
model.end()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_1 = SketchProjection_1.createdFeature()
+SketchCircle_1 = Sketch_1.addCircle(11.92861402549826, 0, 16.05621803603458)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_1.center())
+SketchCircle_2 = Sketch_1.addCircle(37.8779560884558, 0, 17.74637067763095)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.result(), SketchCircle_2.center())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")], [model.selection("FACE", "PartSet/XOZ")])
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Fill_1, 1)
+model.testNbSubResults(Fill_1, [5])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.SOLID, [5])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.FACE, [25])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.EDGE, [90])
+model.testNbSubShapes(Fill_1, GeomAPI_Shape.VERTEX, [180])
+model.testResultsVolumes(Fill_1, [16831.622023411000554915517568588])
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchLine_2 = Sketch_2.addLine(-21.12944291883177, 24.09981691608177, 39.13933236574746, 51.82677414066782)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
SketchLine_3 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_3.result())
SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_3.result())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_2")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("EDGE", "Edge_2_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_2")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("EDGE", "Edge_2_1")])
model.do()
-model.checkResult(Boolean_1,model,1,[3],[0],[0],[3],[6])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[3],[0],[0],[3],[6])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
SketchLine_2 = Sketch_2.addLine(-42.46271611030479, 53.71965718432511, 14.83075791001449, -51.73354862119014)
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_2")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("EDGE", "Edge_2_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_2")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("EDGE", "Edge_2_1")])
model.do()
-model.checkResult(Boolean_1,model,1,[2],[0],[0],[2],[4])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[2],[0],[0],[2],[4])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"))
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"))
SketchLine_5 = Sketch_2.addLine(-53.77011318694006, -47.84888937635935, 60.89888292381829, 36.13719175945)
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("FACE", "Face_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_5")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("FACE", "Face_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [3], [0], [0], [3], [6])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [3], [0], [0], [3], [6])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint())
SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1])
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchArc_2_2")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 70, 0)
Shell_1 = model.addShell(Part_1_doc, [model.selection("SHELL", "Extrusion_1_1")])
Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 30, False)
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_3 = Sketch_2.addLine(-64.49168769733997, 17.16789081864163, 146.7677170722727, 22.9901626941168)
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_3")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SHELL", "Shell_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_3")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SHELL", "Shell_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [3], [0], [0], [3], [6])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [3], [0], [0], [3], [6])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front"))
SketchLine_1 = Sketch_1.addLine(4, 10, 7, 0)
-SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), False)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), False)
SketchLine_2 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
-SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"), False)
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), False)
SketchLine_3 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SOLID", "Box_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SOLID", "Box_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [0], [0], [0], [1], [2])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [0], [1], [2])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_1.result())
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 20)
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SOLID", "Cone_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("SOLID", "Cone_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [3], [0], [0], [3], [6])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [3], [0], [0], [3], [6])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
-Point_1 = model.addPoint(Part_1_doc, 10, 10, 0)
+Point_2 = model.addPoint(Part_1_doc, 10, 10, 0)
Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")])
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchLine_1 = Sketch_1.addLine(-27.61369370623992, 41.69872643310781, 64.30052615729069, -35.76145957046036)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.result(), SketchAPI_Point(SketchPoint_1).coordinates())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
model.do()
-
-model.checkResult(Boolean_1,model,1,[2],[0],[0],[2],[4])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[2],[0],[0],[2],[4])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("WIRE", "Wire_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_2"), model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_4")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("WIRE", "Wire_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [3], [0], [0], [3], [6])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [3], [0], [0], [3], [6])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"))
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"))
SketchLine_5 = Sketch_2.addLine(-53.77011318694006, -47.84888937635935, 60.89888292381829, 36.13719175945)
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_5")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")])
model.do()
-model.checkResult(Boolean_1,model,1,[2],[0],[2],[8],[16])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[2],[0],[2],[8],[16])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_3.endPoint())
model.do()
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_1r-SketchLine_2r-SketchLine_3r"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_3r-SketchLine_2r-SketchLine_1r"))
SketchLine_4 = Sketch_2.addLine(-17.59187701681758, -17.53169787967194, -23.97073271029336, 4.338664497959301)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_2"), False)
SketchLine_5 = SketchProjection_1.createdFeature()
SketchConstraintPerpendicular_1 = Sketch_2.setPerpendicular(SketchLine_4.result(), SketchLine_5.result())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_4")])
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_4")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchLine_1")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")])
model.do()
-model.checkResult(Boolean_1,model,1,[0],[0],[1],[5],[10])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[1],[5],[10])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
SketchLine_7 = Sketch_2.addLine(24.33758278426026, -52.48127186534471, 29.40566289183227, 59.45054433956496)
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_7")])
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_7")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_2")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("EDGE", "Edge_1_1")])
model.do()
-model.checkResult(Boolean_1,model,1,[0],[0],[1],[6],[13])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[1],[6],[13])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
-from SketchAPI import *
model.begin()
partSet = model.moduleDocument()
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
SketchLine_4 = Sketch_2.addLine(31.79164821526215, 49.99496405877289, 8.200436015051352, 0)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_1e"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False)
SketchPoint_1 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchPoint_1.result())
SketchLine_5 = Sketch_2.addLine(8.200436015051352, 0, 27.24680168984479, -49.85269382803262)
SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_1"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1"), False)
SketchPoint_2 = SketchProjection_3.createdFeature()
-SketchArc_2 = Sketch_2.addArc(31.08202242513997, 1.147024884467139e-021, 27.24680168984479, -49.85269382803262, 31.79164821526215, 49.99496405877289, False)
+SketchArc_2 = Sketch_2.addArc(31.08202242513997, 1.147024884467139e-21, 27.24680168984479, -49.85269382803262, 31.79164821526215, 49.99496405877289, False)
SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchArc_2.center())
SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchArc_2.startPoint())
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint())
SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_2.results()[1], "R")
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchArc_1_2f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_4f-SketchLine_5f-SketchArc_2_2f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Face_2_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchArc_1_2f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_4r-SketchLine_5f-SketchArc_2_2f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Face_2_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [2], [0], [2], [6], [12])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [2], [0], [2], [6], [12])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.startPoint())
SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_8.startPoint())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_5f-SketchLine_6r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_3f-SketchLine_4f-SketchLine_6f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_6r-SketchLine_5f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_6f_wire")])
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_3_1")], [model.selection("SHELL", "Shell_1_1")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_15r-SketchLine_14r-SketchLine_13r-SketchLine_16f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_3_1")], [model.selection("SHELL", "Shell_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [3], [0], [3], [14], [28])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [3], [0], [3], [14], [28])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), 5)
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("SOLID", "Box_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("SOLID", "Box_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [4], [0], [4], [15], [30])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [4], [0], [4], [15], [30])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_2")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
model.do()
-model.checkResult(Boolean_1,model,1,[0],[0],[1],[4],[9])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[1],[4],[9])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
SketchLine_6 = Sketch_2.addLine(13.89341696052619, 27.33089138697832, 39.39985877388298, 9.747860956493145)
SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
-SketchLine_7 = Sketch_2.addLine(39.39985877388298, 9.747860956493145, 38.20105433548567, 71.93732104572752)
+SketchLine_7 = Sketch_2.addLine(39.39985877388298, 9.747860956493145, 38.20105433548567, 71.93732104572751)
SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
-SketchLine_8 = Sketch_2.addLine(38.20105433548567, 71.93732104572752, -42.38833891077762, 73.71572760627062)
+SketchLine_8 = Sketch_2.addLine(38.20105433548567, 71.93732104572751, -42.38833891077762, 73.71572760627062)
SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_8.endPoint())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchArc_1_2f")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("WIRE", "Wire_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchArc_1_2f_wire")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_4r-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("WIRE", "Wire_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [5], [0], [5], [21], [42])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [5], [0], [5], [21], [42])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint())
SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1])
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchArc_2_2")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 70, 0)
Shell_1 = model.addShell(Part_1_doc, [model.selection("SHELL", "Extrusion_1_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("FACE", "PartSet/XOZ")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("FACE", "PartSet/XOZ")])
model.do()
-model.checkResult(Boolean_1,model,1,[0],[0],[3],[12],[24])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[3],[12],[24])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint())
SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1])
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchArc_2_2")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 70, 0)
Shell_1 = model.addShell(Part_1_doc, [model.selection("SHELL", "Extrusion_1_1")])
Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 30, False)
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_3 = Sketch_2.addLine(-64.49168769733997, 17.16789081864163, 146.7677170722727, 22.9901626941168)
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_3")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("EDGE", "Edge_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_3")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("EDGE", "Edge_1_1")])
model.do()
-model.checkResult(Boolean_1,model,1,[0],[0],[2],[8],[18])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[2],[8],[18])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchLine_10.setName("SketchLine_12")
SketchLine_10.result().setName("SketchLine_12")
SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_10")
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_7.result())
+SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11")
SketchConstraintDistance_4 = Sketch_2.setDistance(SketchLine_8.endPoint(), SketchLine_7.result(), "L", True)
SketchConstraintDistance_5 = Sketch_2.setDistance(SketchLine_9.endPoint(), SketchLine_7.result(), "L/2", True)
SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_10.result())
SketchLine_12.result().setName("SketchLine_14")
SketchLine_11.setName("SketchLine_13")
SketchLine_11.result().setName("SketchLine_13")
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"), False)
SketchPoint_2 = SketchProjection_3.createdFeature()
SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_9.result())
+SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_12")
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchLine_7.result())
+SketchConstraintCoincidence_12.setName("SketchConstraintCoincidence_13")
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_5f-SketchLine_6r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_3f-SketchLine_4f-SketchLine_6f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_6r-SketchLine_5f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_6f_wire")])
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_13r-SketchLine_14r-SketchLine_15r")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("FACE", "Face_3_1")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_15r-SketchLine_14r-SketchLine_13r_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("FACE", "Face_3_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [0], [0], [4], [13], [26])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [4], [13], [26])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchLine_1 = Sketch_1.addLine(-10, 32.04672553984553, 15.61552812808831, 47.66225366793383)
SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
SketchLine_2 = SketchProjection_1.createdFeature()
-SketchLine_3 = Sketch_1.addLine(15.61552812808831, 47.66225366793383, -4.988916520257207e-021, 73.27778179602213)
+SketchLine_3 = Sketch_1.addLine(15.61552812808831, 47.66225366793383, -4.988916520257207e-21, 73.27778179602213)
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint())
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_2.result())
-SketchLine_4 = Sketch_1.addLine(-4.988916520257207e-021, 73.27778179602213, -25.61552812810082, 57.66225366792627)
+SketchLine_4 = Sketch_1.addLine(-4.988916520257207e-21, 73.27778179602213, -25.61552812810082, 57.66225366792627)
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
SketchLine_5 = Sketch_1.addLine(-25.61552812810082, 57.66225366792627, -10, 32.04672553984553)
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_10.endPoint())
SketchLine_11 = Sketch_2.addLine(50, 15.56025031353752, 73.27778179602213, 0)
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_7.startPoint(), SketchLine_11.startPoint())
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_3e"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_3_EndVertex"), False)
SketchPoint_1 = SketchProjection_3.createdFeature()
SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result())
SketchLine_12 = Sketch_2.addLine(73.27778179602213, 0, 50, -15.54016280334104)
SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_9).startPoint(), SketchLine_7.result(), "D", True)
SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_7.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_5f-SketchLine_6r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_3f-SketchLine_4f-SketchLine_6f")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_7r-SketchLine_8r-SketchLine_10r")])
-Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_7f-SketchLine_11r-SketchLine_12r")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_6r-SketchLine_5f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_6f_wire")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_10r-SketchLine_8r-SketchLine_7r_wire")])
+Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_7r-SketchLine_12r-SketchLine_11r_wire")])
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
Shell_2 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_4_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SHELL", "Shell_2_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SHELL", "Shell_2_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [0], [0], [4], [15], [30])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [4], [15], [30])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
model.do()
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SOLID", "Box_1_1")])
+Fill_2 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SOLID", "Box_1_1")])
model.do()
-model.checkResult(Boolean_2, model, 1, [0], [0], [6], [22], [44])
-model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
+model.checkResult(Fill_2, model, 1, [0], [0], [6], [22], [44])
+model.testHaveNamingSubshapes(Fill_2, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_2_2")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchArc_2_2")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 50, 0)
Shell_1 = model.addShell(Part_1_doc, [model.selection("SHELL", "Extrusion_1_1")])
Point_2 = model.addPoint(Part_1_doc, 0, 0, 10)
Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Point_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
model.do()
-model.checkResult(Boolean_1,model,1,[0],[0],[2],[9],[18])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[2],[9],[18])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchPoint_1 = SketchProjection_2.createdFeature()
SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.result(), "L", True)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_5f-SketchLine_6r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_3f-SketchLine_4f-SketchLine_6f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_6r-SketchLine_5f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_6f_wire")])
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_10")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("WIRE", "Wire_1_1")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8"), model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_2/SketchLine_10")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("WIRE", "Wire_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [0], [0], [8], [30], [60])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [8], [30], [60])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10)
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")])
model.do()
-model.checkResult(Boolean_1,model,1,[4],[4],[20],[72],[144])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[4],[4],[20],[72],[144])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchArc_1 = Sketch_1.addArc(0, 0, 11.4564392373896, -5, 0, -12.5, True)
+SketchArc_1 = Sketch_1.addArc(0, 0, 15.49193338482974, -4, 0, -16, True)
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center())
SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
SketchLine_1 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result())
-SketchLine_2 = Sketch_1.addLine(11.4564392373896, -5, 0, 5)
+SketchLine_2 = Sketch_1.addLine(15.49193338482974, -4, 0, 12)
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
-SketchLine_3 = Sketch_1.addLine(0, 5, 0, -12.5)
+SketchLine_3 = Sketch_1.addLine(0, 12, 0, -16)
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.endPoint())
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
model.do()
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Fill_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
+Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Fill_1_1")])
model.do()
-model.checkResult(Boolean_2, model, 1, [2], [2], [14], [60], [120])
-model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
+model.checkResult(Fill_2, model, 1, [2], [2], [14], [60], [120])
+model.testHaveNamingSubshapes(Fill_2, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchArc_1 = Sketch_1.addArc(0, 0, 11.4564392373896, -5, 0, -12.5, True)
+SketchArc_1 = Sketch_1.addArc(0, 0, 15.49193338482974, -4, 0, -16, True)
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center())
SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
SketchLine_1 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result())
-SketchLine_2 = Sketch_1.addLine(11.4564392373896, -5, 0, 5)
+SketchLine_2 = Sketch_1.addLine(15.49193338482974, -4, 0, 12)
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
-SketchLine_3 = Sketch_1.addLine(0, 5, 0, -12.5)
+SketchLine_3 = Sketch_1.addLine(0, 12, 0, -16)
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.endPoint())
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
model.do()
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
-MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), 1, 3)
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "LinearCopy_1_1")])
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), 1, 3)
+Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "LinearCopy_1_1")])
model.do()
-model.checkResult(Boolean_2, model, 1, [4], [4], [30], [132], [264])
-model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
+model.checkResult(Fill_2, model, 1, [4], [4], [30], [132], [264])
+model.testHaveNamingSubshapes(Fill_2, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Front"))
SketchLine_1 = Sketch_1.addLine(4, 10, 7, 0)
-SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), False)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), False)
SketchLine_2 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_2.result())
-SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"), False)
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Bottom]"), False)
SketchLine_3 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.result())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("EDGE", "Edge_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("EDGE", "Edge_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [0], [1], [7], [30], [60])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [1], [7], [30], [60])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchArc_1 = Sketch_1.addArc(0, 0, 11.4564392373896, -5, 0, -12.5, True)
+SketchArc_1 = Sketch_1.addArc(0, 0, 15.49193338482974, -4, 0, -16, True)
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center())
SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
SketchLine_1 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result())
-SketchLine_2 = Sketch_1.addLine(11.4564392373896, -5, 0, 5)
+SketchLine_2 = Sketch_1.addLine(15.49193338482974, -4, 0, 12)
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
-SketchLine_3 = Sketch_1.addLine(0, 5, 0, -12.5)
+SketchLine_3 = Sketch_1.addLine(0, 12, 0, -16)
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.endPoint())
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), "Shift/3")
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("FACE", "Face_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("FACE", "Face_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [2], [2], [12], [48], [96])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [2], [2], [12], [48], [96])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchArc_1 = Sketch_1.addArc(0, 0, 11.4564392373896, -5, 0, -12.5, True)
+SketchArc_1 = Sketch_1.addArc(0, 0, 15.49193338482974, -4, 0, -16, True)
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchArc_1.center())
SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
SketchLine_1 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.result())
-SketchLine_2 = Sketch_1.addLine(11.4564392373896, -5, 0, 5)
+SketchLine_2 = Sketch_1.addLine(15.49193338482974, -4, 0, 12)
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_2.startPoint())
-SketchLine_3 = Sketch_1.addLine(0, 5, 0, -12.5)
+SketchLine_3 = Sketch_1.addLine(0, 12, 0, -16)
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchArc_1.endPoint())
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_1.result())
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
model.do()
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SHELL", "Shell_1_1")])
+Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SHELL", "Shell_1_1")])
model.do()
-model.checkResult(Boolean_2, model, 1, [2], [2], [14], [60], [120])
-model.testHaveNamingSubshapes(Boolean_2, model, Part_1_doc)
+model.checkResult(Fill_2, model, 1, [2], [2], [14], [60], [120])
+model.testHaveNamingSubshapes(Fill_2, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_2.startPoint())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("EDGE", "Edge_1_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_2"), model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_4")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("EDGE", "Edge_1_1")])
model.do()
-model.checkResult(Boolean_1,model,1,[0],[0],[0],[6],[12])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[0],[6],[12])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
SketchLine_4 = Sketch_2.addLine(29.74624907439609, 30.07487215963349, 31.08202242513997, 0)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_1"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1"), False)
SketchPoint_1 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchPoint_1.result())
SketchLine_5 = Sketch_2.addLine(31.08202242513997, 0, 45.45797599933665, 0)
SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_9.endPoint())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchArc_1_2f")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_4f-SketchLine_5f-SketchLine_7f-SketchLine_8f-SketchLine_9f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("FACE", "Face_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchArc_1_2f_wire")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_4r-SketchLine_5f-SketchLine_7f-SketchLine_8f-SketchLine_9f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("FACE", "Face_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [0], [0], [0], [6], [12])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [0], [6], [12])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_12).startPoint(), SketchLine_15.startPoint())
SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_8.startPoint())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_5f-SketchLine_6r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_3f-SketchLine_4f-SketchLine_6f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_6r-SketchLine_5f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3f-SketchLine_4f-SketchLine_6f_wire")])
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_13r-SketchLine_14r-SketchLine_15r-SketchLine_16f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("SHELL", "Shell_1_1")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_15r-SketchLine_14r-SketchLine_13r-SketchLine_16f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("SHELL", "Shell_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [0], [0], [0], [10], [20])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [0], [10], [20])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_2.startPoint(), 5)
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_1).startPoint(), SketchLine_3.startPoint(), "Shift", True)
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("SOLID", "Box_1_1")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchLine_3f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("SOLID", "Box_1_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [0], [0], [0], [9], [18])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [0], [9], [18])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from SketchAPI import *
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result())
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Fill_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
model.do()
-model.checkResult(Boolean_1,model,1,[0],[0],[0],[4],[8])
-model.testHaveNamingSubshapes(Boolean_1,model,Part_1_doc)
+model.checkResult(Fill_1,model,1,[0],[0],[0],[4],[8])
+model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
SketchLine_4 = Sketch_2.addLine(31.79164821526215, 49.99496405877289, 8.200436015051352, 0)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_1e"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False)
SketchPoint_1 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchPoint_1.result())
SketchLine_5 = Sketch_2.addLine(8.200436015051352, 0, 27.24680168984479, -49.85269382803262)
SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_1"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1"), False)
SketchPoint_2 = SketchProjection_3.createdFeature()
-SketchArc_2 = Sketch_2.addArc(31.08202242513997, 1.147024884467139e-021, 27.24680168984479, -49.85269382803262, 31.79164821526215, 49.99496405877289, False)
+SketchArc_2 = Sketch_2.addArc(31.08202242513997, 1.147024884467139e-21, 27.24680168984479, -49.85269382803262, 31.79164821526215, 49.99496405877289, False)
SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchArc_2.center())
SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchArc_2.startPoint())
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_4.startPoint())
SketchConstraintRadius_2 = Sketch_2.setRadius(SketchArc_2.results()[1], "R")
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchArc_1_2f")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_4f-SketchLine_5f-SketchArc_2_2f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("WIRE", "Wire_2_1")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchArc_1_2f_wire")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_4r-SketchLine_5f-SketchArc_2_2f_wire")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], [model.selection("WIRE", "Wire_2_1")])
model.do()
-model.checkResult(Boolean_1, model, 1, [0], [0], [0], [4], [8])
-model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
+model.checkResult(Fill_1, model, 1, [0], [0], [0], [4], [8])
+model.testHaveNamingSubshapes(Fill_1, model, Part_1_doc)
model.end()
aSession.startOperation()
aPoint = aPart.addFeature("Point")
aPoint.string("creation_method").setValue("by_xyz")
-geomDataAPI_Point(aFeature.attribute("point3d")).setValue(20, 5, 0)
+geomDataAPI_Point(aPoint.attribute("point3d")).setValue(20, 5, 0)
aSession.finishOperation()
aSession.startOperation()
aFillet1 = aPart.addFeature("Fillet")
aFillet1.string("creation_method").setValue("fixed_radius")
anObjects = aFillet1.selectionList("main_objects")
-anObjects.append("Box_1_1/Left&Box_1_1/Top", "edge")
+anObjects.append("[Box_1_1/Left][Box_1_1/Top]", "edge")
aFillet1.real("radius1").setValue(3)
aSession.finishOperation()
assert(aFillet1.error() == ""), "FAILED: Fillet reports error \"{}\"".format(aFillet1.error())
aFillet2.string("creation_method").setValue("fixed_radius")
anObjects = aFillet2.selectionList("main_objects")
anObjects.append("Cylinder_1_1/Face_2", "face")
-anObjects.append("_Box_1_1/Right", "face")
+anObjects.append("Box_1_1/Right", "face")
aFillet2.real("radius1").setValue(2)
aSession.finishOperation()
assert(aFillet2.error() != ""), "FAILED: Fillet does not report error"
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+from GeomAPI import GeomAPI_Shape
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "all-in-Box_1")], 2)
+assert(Fillet_1.feature().error() == "")
+
+model.testNbResults(Fillet_1, 1)
+model.testNbSubResults(Fillet_1, [0])
+model.testNbSubShapes(Fillet_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Fillet_1, GeomAPI_Shape.FACE, [26])
+model.testNbSubShapes(Fillet_1, GeomAPI_Shape.EDGE, [104])
+model.testNbSubShapes(Fillet_1, GeomAPI_Shape.VERTEX, [208])
+model.testResultsVolumes(Fillet_1, [907.704992710141368661425076425])
+
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
+SketchCircle_1 = Sketch_1.addCircle(20, -15, 5)
+SketchCircle_2 = Sketch_1.addCircle(30, 10, 3)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+
+Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "all-in-Extrusion_1")], 2)
+assert(Fillet_2.feature().error() != "")
+
+model.end()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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"))
+SketchCircle_1 = Sketch_1.addCircle(-30, 5, 15)
+SketchLine_1 = Sketch_1.addLine(60, -30, 15, -30)
+SketchLine_2 = Sketch_1.addLine(15, -30, 15, 15)
+SketchLine_3 = Sketch_1.addLine(15, 15, 60, 15)
+SketchLine_4 = Sketch_1.addLine(60, 15, 60, -30)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")], 2)
+assert(Fillet_1.feature().error() != "")
+Part_1_doc.removeFeature(Fillet_1.feature())
+
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("FACE", "Extrusion_1_2/To_Face")], 2)
+assert(Fillet_1.feature().error() != "")
+Part_1_doc.removeFeature(Fillet_1.feature())
+
+model.end()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
# Create document
Box_2 = model.addBox(Part_1_doc, 10, 10, 10)
Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("EDGE", "PartSet/OX"), 10)
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Translation_1_1/Translated_Face_1")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Box_1_1/Top"), model.selection("FACE", "Translation_1_1/MF:Translated&Box_2_1/Top")])
model.do()
model.checkResult(Shell_1, model, 1, [0], [0], [2], [8], [16])
# Make extrusion on circle 1
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
# Make extrusion on circle 2
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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"))
+SketchCircle_1 = Sketch_1.addCircle(10, -20, 15)
+model.do()
+
+Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
+assert(Intersection_1.feature().error() != "")
+Part_1_doc.removeFeature(Intersection_1.feature())
+
+model.end()
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
from salome.shaper import model
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
-ParamR = model.addParameter(Part_1_doc, "R", "50")
-ParamL = model.addParameter(Part_1_doc, "L", "40")
-ParamH = model.addParameter(Part_1_doc, "H", "20")
+model.addParameter(Part_1_doc, "R", "50")
+model.addParameter(Part_1_doc, "L", "40")
+model.addParameter(Part_1_doc, "H", "20")
Point_2 = model.addPoint(Part_1_doc, 0, 100, 100)
Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OX"), model.selection("VERTEX", "Point_1"), False)
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "L/2")
SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "H/2")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
SketchLine_7 = Sketch_2.addLine(119.1454520140253, 130.0744845530344, 10, 0)
SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
SketchLine_8 = SketchProjection_3.createdFeature()
TOLERANCE = 1.e-6
# reference data
-REF_DATA = [("Sketch_1/Edge-SketchLine_3", "Sketch_1/Edge-SketchLine_6", [90]),
- ("Extrusion_1_1/Generated_Face_5", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", [45]),
- ("Sketch_1/Edge-SketchCircle_1_2", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", [0]),
- ("Sketch_1/Edge-SketchLine_3", "Sketch_1/Edge-SketchCircle_1_2", []),
- ("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", []),
- ("Sketch_2/Edge-SketchLine_7", "Extrusion_1_1/To_Face_1&Extrusion_1_1/Generated_Face_4", [130]),
- ("Sketch_2/Edge-SketchLine_7", "Extrusion_1_1/To_Face_1&Extrusion_1_1/Generated_Face_1", [40]),
- ("Sketch_2/Edge-SketchLine_7", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", [121.21205374, 84.80231126])
+REF_DATA = [("Sketch_1/SketchLine_3", "Sketch_1/SketchLine_6", [90]),
+ ("([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face])", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", [45]),
+ ("Sketch_1/SketchCircle_1_2", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", [0]),
+ ("Sketch_1/SketchLine_3", "Sketch_1/SketchCircle_1_2", []),
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", []),
+ ("Sketch_2/SketchLine_7", "[Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", [130]),
+ ("Sketch_2/SketchLine_7", "[Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", [40]),
+ ("Sketch_2/SketchLine_7", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", [121.21205374, 84.80231126])
]
for ref in REF_DATA:
assert(math.fabs(a - r) < TOLERANCE), "Angle {} differs from expected value {}".format(a, r)
# select incorrect data
-angle = model.measureAngle(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"))
+angle = model.measureAngle(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("EDGE", "Sketch_2/SketchLine_7"))
assert(angle.size() == 0)
model.end()
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
from salome.shaper import model
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), 100, 0)
model.do()
TOLERANCE = 1.e-6
# reference data
-REF_DATA = [("Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1",
- "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
- "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1",
+REF_DATA = [("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]",
120),
- ("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1",
- "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
- "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1",
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]",
120),
- ("Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
- "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1",
- "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1",
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]",
60),
- ("Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1",
- "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1",
- "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1",
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]",
120),
- ("Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
- "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1",
- "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1",
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]",
104.9068234),
- ("Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
- "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1",
- "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1",
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]",
90),
- ("Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
- "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1",
- "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1",
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]",
52.91916441),
- ("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1",
- "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1",
- "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1",
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]",
+ "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]",
0)
]
assert(math.fabs(angle - ref[3]) < TOLERANCE), "Angle {} differs from expected value {}".format(angle, ref[3])
# select incorrect data
-angle = model.measureAngle(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("VERTEX", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"), model.selection("VERTEX", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1"))
+angle = model.measureAngle(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"))
assert(angle == -1.0)
angle = model.measureAngle(Part_1_doc, model.selection("VERTEX", ""), model.selection("VERTEX", ""), model.selection("VERTEX", ""))
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
import math
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
-ParamR = model.addParameter(Part_1_doc, "R", "50")
-ParamL = model.addParameter(Part_1_doc, "L", "40")
-ParamH = model.addParameter(Part_1_doc, "H", "20")
+model.addParameter(Part_1_doc, "R", "50")
+model.addParameter(Part_1_doc, "L", "40")
+model.addParameter(Part_1_doc, "H", "20")
Point_2 = model.addPoint(Part_1_doc, 0, 100, 100)
Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OX"), model.selection("VERTEX", "Point_1"), False)
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "L/2")
SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "H/2")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
SketchArc_1 = Sketch_2.addArc(100, 48.41229182762603, 87.5, 0, 87.5, 96.82458365525073, False)
SketchArc_2 = Sketch_2.addArc(0, 48.41229182762603, 87.5, 0, 87.5, 96.82458365525073, False)
# reference data
REF_DATA = [(model.selection("VERTEX", "PartSet/Origin"),
- model.selection("VERTEX", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1"),
+ model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"),
122.4744871),
- (model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1"),
- model.selection("VERTEX", "Sketch_2/Vertex-SketchArc_1-SketchLine_7e"),
+ (model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"),
+ model.selection("VERTEX", "Sketch_2/SketchArc_1"),
36.94403089),
- (model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1"),
- model.selection("EDGE", "Extrusion_1_1/Generated_Face_5"),
+ (model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]"),
+ model.selection("EDGE", "([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face])"),
0),
- (model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1"),
- model.selection("EDGE", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/To_Face_1"),
+ (model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]"),
+ model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_1_2][Extrusion_2_1/To_Face]"),
16.00781059),
- (model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_2"),
+ (model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_1_2"),
8.412291828),
- (model.selection("VERTEX", "Sketch_1/Vertex-SketchCircle_1"),
+ (model.selection("VERTEX", "Sketch_1/SketchCircle_1_2__cc"),
model.selection("FACE", "Plane_1"),
35.35533906),
- (model.selection("FACE", "Extrusion_2_2/From_Face_1"),
- model.selection("FACE", "Extrusion_2_2/To_Face_1"),
+ (model.selection("FACE", "Extrusion_2_2/From_Face"),
+ model.selection("FACE", "Extrusion_2_2/To_Face"),
100),
- (model.selection("FACE", "Extrusion_1_1/Generated_Face_5"),
- model.selection("FACE", "Extrusion_2_1/Generated_Face_2"),
+ (model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2"),
+ model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_1_2"),
0),
- (model.selection("FACE", "Extrusion_1_1/Generated_Face_5"),
- model.selection("FACE", "Extrusion_1_1/Generated_Face_2"),
+ (model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2"),
+ model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"),
27.63932023),
(model.selection("SOLID", "Extrusion_1_1"),
- model.selection("FACE", "Extrusion_2_1/To_Face_1"),
+ model.selection("FACE", "Extrusion_2_1/To_Face"),
12.5),
(model.selection("SOLID", "Extrusion_1_1"),
model.selection("SOLID", "Extrusion_2_1"),
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
import math
SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "L/2")
SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "H/2")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
model.do()
TOLERANCE = 1.e-6
# reference data
-REF_DATA = [("Extrusion_1_1/From_Face_1&Extrusion_1_1/Generated_Face_1", ParamH.value()),
- ("Extrusion_1_1/From_Face_1&Extrusion_1_1/Generated_Face_4", ParamL.value()),
- ("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1", ParamR.value() * 2.0 * math.pi),
- ("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1", 381.981436664),
- ("Extrusion_1_1/Generated_Face_5", 60),
- ("Sketch_1/Edge-SketchLine_3", ParamL.value()),
- ("Sketch_1/Edge-SketchLine_4", ParamH.value()),
- ("Sketch_1/Edge-SketchCircle_1_2", ParamR.value() * 2.0 * math.pi)
+REF_DATA = [("[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]", ParamH.value()),
+ ("[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", ParamL.value()),
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]", ParamR.value() * 2.0 * math.pi),
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]", 381.981436664),
+ ("([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face])([Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face])", 60),
+ ("Sketch_1/SketchLine_3", ParamL.value()),
+ ("Sketch_1/SketchLine_4", ParamH.value()),
+ ("Sketch_1/SketchCircle_1_2", ParamR.value() * 2.0 * math.pi)
]
for ref in REF_DATA:
assert(math.fabs(length - ref[1]) < TOLERANCE), "Length {} differs from expected value {}".format(length, ref[1])
# select incorrect data
-length = model.measureLength(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_5"))
+length = model.measureLength(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2"))
assert(length == -1)
model.end()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+from ConfigAPI import *
+Config_PropManager().registerProp("Visualization", "dimension_value_size", "Dimension value size", Config_Prop.IntSpin, "16")
+Config_PropManager().registerProp("Visualization", "dimension_arrow_size", "Dimension arrow size", Config_Prop.IntSpin, "16")
+Config_PropManager().registerProp("Visualization", "dimension_font", "Dimension font", Config_Prop.String, "Times-bold")
+Config_PropManager().registerProp("Visualization", "sketch_dimension_color", "Dimension color", Config_Prop.Color, "64,128,225")
+
+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(-15.79157881408318, 17.46869043106789, -28.20135254460625, -14.21916935022164)
+SketchLine_2 = Sketch_1.addLine(-28.20135254460625, -14.21916935022164, 5.332188506333114, -12.56026625936245)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchArc_1 = Sketch_1.addArc(-8.886980843888518, -0.1184930779185158, 5.332188506333114, -12.56026625936245, -15.79157881408318, 17.46869043106789, False)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_1.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchArc_1.endPoint())
+model.do()
+model.end()
+
+from ModelAPI import *
+
+aSession = ModelAPI_Session.get()
+aSession.startOperation()
+aMeasurement = Part_1_doc.addFeature("Measurement")
+aMeasurement.string("MeasureKind").setValue("Length")
+aMeasurement.selection("edge_for_length").selectSubShape("EDGE", "Sketch_1/SketchLine_1")
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
+aSession.finishOperation()
+
+aSession.startOperation()
+aMeasurement = Part_1_doc.addFeature("Measurement")
+aMeasurement.string("MeasureKind").setValue("Distance")
+aMeasurement.selection("distance_from").selectSubShape("VERTEX", "Sketch_1/SketchLine_1_StartVertex")
+aMeasurement.selection("distance_to").selectSubShape("EDGE", "Sketch_1/SketchLine_2")
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
+aSession.finishOperation()
+
+aSession.startOperation()
+aMeasurement = Part_1_doc.addFeature("Measurement")
+aMeasurement.string("MeasureKind").setValue("Radius")
+aMeasurement.selection("circular").selectSubShape("EDGE", "Sketch_1/SketchArc_1_2")
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
+aSession.finishOperation()
+
+aSession.startOperation()
+aMeasurement = Part_1_doc.addFeature("Measurement")
+aMeasurement.string("MeasureKind").setValue("Angle")
+aMeasurement.selection("angle_from").selectSubShape("EDGE", "Sketch_1/SketchLine_1")
+aMeasurement.selection("angle_to").selectSubShape("EDGE", "Sketch_1/SketchLine_2")
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
+aSession.finishOperation()
+
+aSession.startOperation()
+aMeasurement = Part_1_doc.addFeature("Measurement")
+aMeasurement.string("MeasureKind").setValue("AngleBy3Points")
+aMeasurement.selection("angle_point_1").selectSubShape("VERTEX", "Sketch_1/SketchLine_1_StartVertex")
+aMeasurement.selection("angle_point_2").selectSubShape("VERTEX", "Sketch_1/SketchLine_1_EndVertex")
+aMeasurement.selection("angle_point_3").selectSubShape("VERTEX", "Sketch_1/SketchLine_2_EndVertex")
+anAIS = featureToPresentation(aMeasurement).getAISObject(None)
+assert(anAIS is not None)
+anAIS = featureToPresentation(aMeasurement).getAISObject(anAIS)
+assert(anAIS is not None)
+aSession.finishOperation()
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
import math
SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "L/2")
SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), "H/2")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), model.selection("FACE", "Plane_1"), 0, model.selection(), 10)
model.do()
TOLERANCE = 1.e-6
# reference data
-REF_DATA = [(model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"), ParamR.value()),
- (model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/From_Face_1"), ParamR.value()),
- (model.selection("FACE", "Extrusion_1_1/Generated_Face_5"), ParamR.value())
+REF_DATA = [(model.selection("EDGE", "Sketch_1/SketchCircle_1_2"), ParamR.value()),
+ (model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/From_Face]"), ParamR.value()),
+ (model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2"), ParamR.value())
]
for ref in REF_DATA:
assert(math.fabs(radius - ref[1]) < TOLERANCE), "Radius {} differs from expected value {}".format(radius, ref[1])
# select incorrect data
-radius = model.measureRadius(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+radius = model.measureRadius(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
assert(radius == -1)
model.end()
anExtrusions = []
for i in range(0, N * N):
- aSketchResult = aSketchFeatures[i].firstResult()
- aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
- origin = geomDataAPI_Point(aSketchFeatures[i].attribute("Origin")).pnt()
- dirX = geomDataAPI_Dir(aSketchFeatures[i].attribute("DirX")).dir()
- norm = geomDataAPI_Dir(aSketchFeatures[i].attribute("Norm")).dir()
- aSketchFaces = ShapeList()
- GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
-
+ aSketchResult = modelAPI_ResultConstruction(aSketchFeatures[i].firstResult())
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
anExtrusionFt.selectionList("base").append(
- aSketchResult, aSketchFaces[0])
+ aSketchResult, aSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt.real("to_size").setValue(10)
anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
- # v1.0.2 from master
- # anExtrusionFt.selection("extrusion_face").setValue(
- # aSketchResult, aSketchFaces[0])
- # anExtrusionFt.real("extrusion_size").setValue(10)
- # anExtrusionFt.boolean("extrusion_reverse").setValue(False)
anExtrusions.append(anExtrusionFt)
aSession.finishOperation()
#=========================================================================
# Build a big box extrusion
#=========================================================================
-aSketchResult = aQuadrangleSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aQuadrangleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aQuadrangleSketchFeature.firstResult())
# Create extrusion on them
aBox = aPart.addFeature("Extrusion")
aBox.selectionList("base").append(
- aSketchResult, aSketchFaces[0])
+ aSketchResult, aSketchResult.face(0))
aBox.string("CreationMethod").setValue("BySizes")
aBox.real("from_size").setValue(0)
aBox.real("to_size").setValue(10)
aBox.real("to_offset").setValue(0) #TODO: remove
aBox.real("from_offset").setValue(0) #TODO: remove
-# v 1.0.2 from master
-# aBox.selection("extrusion_face").setValue(
-# aSketchResult, aSketchFaces[0])
-# aBox.real("extrusion_size").setValue(10)
-# aBox.boolean("extrusion_reverse").setValue(False)
aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompound.selectionList("base_objects").append("Box_1_1", "SOLID")
+aSession.finishOperation()
+
+
+aSession.startOperation()
+anAngularCopy1 = aPart.addFeature("AngularCopy")
+anAngularCopy1.execute()
+assert(anAngularCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+anAngularCopy1.selectionList("main_objects").append("Compound_1_1", "COMPOUND")
+anAngularCopy1.execute()
+assert(anAngularCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+anAngularCopy1.selection("axis_angular").selectSubShape("COMPOUND", "Compound_1_1")
+anAngularCopy1.execute()
+assert(anAngularCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+anAngularCopy1.selection("axis_angular").selectSubShape("EDGE", "PartSet/OX")
+anAngularCopy1.integer("nb_angular").setValue(0)
+anAngularCopy1.execute()
+assert(anAngularCopy1.error() != "")
+aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+AngularCopy_1 = model.addMultiRotation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OZ"), 2)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(AngularCopy_1, 2)
+model.testNbSubResults(AngularCopy_1, [0, 0])
+model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.SOLID, [1, 1])
+model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.FACE, [6, 6])
+model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.EDGE, [24, 24])
+model.testNbSubShapes(AngularCopy_1, GeomAPI_Shape.VERTEX, [48, 48])
+model.testResultsVolumes(AngularCopy_1, [1000, 1000])
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompound.selectionList("base_objects").append("Box_1_1", "SOLID")
+aSession.finishOperation()
+
+
+aSession.startOperation()
+aLinearCopy1 = aPart.addFeature("LinearCopy")
+aLinearCopy1.execute()
+assert(aLinearCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy1.selectionList("main_objects").append("Compound_1_1", "COMPOUND")
+aLinearCopy1.execute()
+assert(aLinearCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy1.selection("axis_first_dir").selectSubShape("COMPOUND", "Compound_1_1")
+aLinearCopy1.execute()
+assert(aLinearCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy1.selection("axis_first_dir").selectSubShape("EDGE", "PartSet/OX")
+aLinearCopy1.integer("nb_first_dir").setValue(2)
+aLinearCopy1.execute()
+assert(aLinearCopy1.error() != "")
+aSession.finishOperation()
+
+
+aSession.startOperation()
+aLinearCopy2 = aPart.addFeature("LinearCopy")
+aLinearCopy2.string("use_second_dir").setValue("true")
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.selectionList("main_objects").append("Compound_1_1", "COMPOUND")
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.selection("axis_first_dir").selectSubShape("COMPOUND", "Compound_1_1")
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.selection("axis_first_dir").selectSubShape("EDGE", "PartSet/OX")
+aLinearCopy2.selection("axis_second_dir").selectSubShape("COMPOUND", "Compound_1_1")
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.selection("axis_second_dir").selectSubShape("EDGE", "PartSet/OY")
+aLinearCopy2.integer("nb_first_dir").setValue(0)
+aLinearCopy2.integer("nb_second_dir").setValue(0)
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.integer("nb_first_dir").setValue(2)
+aLinearCopy2.integer("nb_second_dir").setValue(2)
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+LinearCopy_1 = model.addMultiTranslation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OZ"), 20, 2)
+LinearCopy_2 = model.addMultiTranslation(partSet, [model.selection("COMPOUND", "LinearCopy_1/")], model.selection("EDGE", "OX"), 20, 2, model.selection("EDGE", "OY"), 20, 2)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(LinearCopy_1, 2)
+model.testNbSubResults(LinearCopy_1, [0, 0])
+model.testNbSubShapes(LinearCopy_1, GeomAPI_Shape.SOLID, [1, 1])
+model.testNbSubShapes(LinearCopy_1, GeomAPI_Shape.FACE, [6, 6])
+model.testNbSubShapes(LinearCopy_1, GeomAPI_Shape.EDGE, [24, 24])
+model.testNbSubShapes(LinearCopy_1, GeomAPI_Shape.VERTEX, [48, 48])
+model.testResultsVolumes(LinearCopy_1, [1000, 1000])
+
+model.testNbResults(LinearCopy_2, 4)
+model.testNbSubResults(LinearCopy_2, [0, 0, 0, 0])
+model.testNbSubShapes(LinearCopy_2, GeomAPI_Shape.SOLID, [1, 1, 1, 1])
+model.testNbSubShapes(LinearCopy_2, GeomAPI_Shape.FACE, [6, 6, 6, 6])
+model.testNbSubShapes(LinearCopy_2, GeomAPI_Shape.EDGE, [24, 24, 24, 24])
+model.testNbSubShapes(LinearCopy_2, GeomAPI_Shape.VERTEX, [48, 48, 48, 48])
+model.testResultsVolumes(LinearCopy_2, [1000, 1000, 1000, 1000])
# Make extrusion on circle
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchCircle_1 = Sketch_2.addCircle(64.38749999999999, 45.44999999999999, 41.86298795836804)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_2")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_1_2")])
Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1")])
model.do()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
-from GeomAPI import GeomAPI_Shape
model.begin()
-#Create part
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
-#Create Sketch_1 - closed polyline from 5 segments
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
SketchLine_1 = Sketch_1.addLine(-43.90694444444443, 28.05555555555554, 19.21805555555554, 72.66388888888889)
SketchLine_2 = Sketch_1.addLine(19.21805555555554, 72.66388888888889, 82.06249999999999, -36.19166666666666)
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_5.endPoint())
model.do()
-#Create Extrusion_1 on Sketch_1
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r")], model.selection(), 100, 0)
-#Create Sketch_2 from 5 segments
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 100, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"))
SketchLine_6 = Sketch_2.addLine(74.07000206783135, -18.10965884648514, 62.37497281453477, -31.70853007124862)
SketchLine_7 = Sketch_2.addLine(62.37497281453477, -31.70853007124862, 37.35304976096997, -31.43655264675337)
SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchLine_10.endPoint())
model.do()
-#Create Extrusion_2 on Sketch_2
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10r")], model.selection(), 10, 160)
-#Create Partition on objects Extrusion_1 and Extrusion_2
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r")], model.selection(), 10, 160)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
model.do()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_9.endPoint())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_1_2")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_6")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8"), model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_2/SketchArc_1_2")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Wire_2_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_6")]
+Wire_2 = model.addWire(Part_1_doc, Wire_2_objects)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("WIRE", "Wire_2_1"), model.selection("WIRE", "Wire_1_1")])
model.do()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), 100, False)
Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_2"), 100, False)
Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 50, False)
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_3"), model.selection("FACE", "Plane_4"), model.selection("SOLID", "Box_1_1")])
+Partition_1_objects = [model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_3"), model.selection("FACE", "Plane_4"), model.selection("SOLID", "Box_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
model.checkResult(Partition_1,model,1,[8],[8],[48],[192],[384])
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
Cone_1 = model.addCone(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 5, 10)
-Point_1 = model.addPoint(Part_1_doc, 4, 5, 11)
+Point_2 = model.addPoint(Part_1_doc, 4, 5, 11)
Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OX"), model.selection("VERTEX", "Point_1"), False)
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_1 = Sketch_1.addLine(1.156555510724249, 12.03812858614785, 0.5812800089239156, -4.87167684997945)
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cone_1_1"), model.selection("EDGE", "Edge_1_1")])
model.do()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
-from salome.shaper import model
from SketchAPI import *
+from salome.shaper import model
+
model.begin()
partSet = model.moduleDocument()
Part_1 = model.addPart(partSet)
[SketchArc_5, SketchArc_6, SketchArc_7, SketchArc_8] = SketchConstraintMirror_2.mirrored()
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 12, 12)
-
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
SketchLine_3 = Sketch_2.addLine(7.498934040825037, 4.111344571723496, -7.530337532973568, 4.111344571723496)
SketchLine_4 = Sketch_2.addLine(-7.530337532973568, 4.111344571723496, -7.530337532973568, -4.489390918751097)
SketchLine_5 = Sketch_2.addLine(-7.530337532973568, -4.489390918751097, 7.498934040825037, -4.489390918751097)
SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_6.result())
SketchCircle_1 = Sketch_2.addCircle(-0.133117930244568, 0.08984026389066591, 1.099112071963378)
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchCircle_1_2r")], model.selection(), model.selection(), 5, model.selection(), 10)
-
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_3r-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchCircle_1_2r")], model.selection(), model.selection(), 5, model.selection(), 10)
Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchLine_7 = Sketch_3.addLine(21.55890075100801, 30.21822825485694, -17.43219636481839, 31.63011070278906)
SketchLine_8 = Sketch_3.addLine(-17.43219636481839, 31.63011070278906, -12.33809712604348, -45.93749869468675)
SketchConstraintCoincidence_12 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_7.startPoint(), SketchLine_10.endPoint())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_10")])
-
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_1_1")])
+Face_1_objects = [model.selection("EDGE", "Sketch_3/SketchLine_7"), model.selection("EDGE", "Sketch_3/SketchLine_8"), model.selection("EDGE", "Sketch_3/SketchLine_9"), model.selection("EDGE", "Sketch_3/SketchLine_10")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Partition_1_objects = [model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
model.checkResult(Partition_1,model,1,[2],[4],[42],[198],[396])
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_9.endPoint())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5")])
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_5")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Face_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_2/SketchArc_2_2"), model.selection("EDGE", "Sketch_2/SketchLine_6"), model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("WIRE", "Wire_1_1")])
model.do()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchCircle_2 = Sketch_1.addCircle(-18.11540697674418, -21.53002906976744, 31.60961705559024)
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchCircle_2.center())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_2_2r")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_2_2r")], model.selection(), 100, 0)
Point_2 = model.addPoint(Part_1_doc, 100, 40, 80)
Point_3 = model.addPoint(Part_1_doc, 100, -40, 80)
Point_4 = model.addPoint(Part_1_doc, 20, 40, -80)
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3")])
+Face_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_4"), model.selection("EDGE", "Sketch_2/SketchLine_1"), model.selection("EDGE", "Sketch_2/SketchLine_2"), model.selection("EDGE", "Sketch_2/SketchLine_3")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("FACE", "Face_1_1")])
model.do()
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Front"))
Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
-Partition_2 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_3")])
+Partition_2_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Partition_1_1_3")]
+Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects)
model.do()
# check partition
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), model.selection("FACE", "Box_1_1/Front"))
Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
-Partition_2 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Partition_1_1_3")])
+Partition_2_objects = [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Partition_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Partition_1_1_3")]
+Partition_2 = model.addPartition(Part_1_doc, Partition_2_objects)
model.do()
# check partition
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint())
SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "Face_1_1")])
model.do()
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint())
SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "Face_1_1")])
model.do()
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint())
SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "Face_1_1")])
model.do()
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint())
SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "Face_1_1")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "Face_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
# check partition
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchLine_1.startPoint())
SketchConstraintCoincidence_2 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), 90, 0)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_2")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Extrusion_1_1_3")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "Sketch_2/SketchLine_1"), 90, 0)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_2/SketchArc_1_2")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Extrusion_1_1_3")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
# check partition
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius")
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "PartSet/XOZ")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("FACE", "PartSet/XOZ")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
# check partition
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_2.results()[1], "Radius")
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "PartSet/XOZ")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("FACE", "PartSet/XOZ")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
# check partition
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
# check partition
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Box_1_1")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Extrusion_1_1_3"), model.selection("SOLID", "Box_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
# check partition
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_1")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1_2"), model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
# check partition
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "ExtrusionMax", "ExtrusionMin")
Box_1 = model.addBox(Part_1_doc, 50, 100, "BoxHeight")
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")])
+Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_1_1_1"), model.selection("SOLID", "Extrusion_1_1_2")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
# check partition
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
SketchCircle_1 = Sketch_1.addCircle(14.49765103937751, 9.678507230150521, 3.831444106492329)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchCircle_1_2")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
SketchLine_5 = Sketch_2.addLine(-15.11211565655763, 11.99814589971457, -14.79635576556081, -11.77064279967296)
SketchLine_6 = Sketch_2.addLine(-14.79635576556081, -11.77064279967296, -3.043616368139293, -11.46189011940212)
SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_8.endPoint())
model.do()
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Torus_1_1"), model.selection("WIRE", "Wire_1_1")])
+Wire_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_8"), model.selection("EDGE", "Sketch_2/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_6"), model.selection("EDGE", "Sketch_2/SketchLine_7")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Partition_1_objects = [model.selection("FACE", "Face_1_1"), model.selection("SOLID", "Torus_1_1"), model.selection("WIRE", "Wire_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
model.checkResult(Partition_1,model,1,[3],[1],[4],[22],[46])
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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(60, -30, 15, -30)
+SketchLine_2 = Sketch_1.addLine(15, -30, 15, 15)
+SketchLine_3 = Sketch_1.addLine(15, 15, 60, 15)
+SketchLine_4 = Sketch_1.addLine(60, 15, 60, -30)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+assert(Partition_1.feature().error() != "")
+Part_1_doc.removeFeature(Partition_1.feature())
+
+model.end()
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+Partition_1 = Part_1_doc.addFeature("Partition")
+Partition_1.execute()
+assert(Partition_1.error() != "")
+aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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(50, 15, 100, 20)
+SketchLine_2 = Sketch_1.addLine(30, 10, 50, 0)
+SketchArc_1 = Sketch_1.addArc(30, 40, 60, 40, 30, 70, False)
+model.do()
+Compound_1 = model.addCompound(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2")])
+model.do()
+Pipe_1 = model.addPipe(Part_1_doc, [model.selection("COMPOUND", "Compound_1_1")], model.selection("EDGE", "Sketch_1/SketchArc_1_2"))
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Pipe_1, 1)
+model.testNbSubResults(Pipe_1, [2])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.FACE, [2])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.EDGE, [8])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.VERTEX, [16])
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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"))
+SketchArc_1 = Sketch_1.addArc(23.47558064206828, 28.1849874113521, 68.07028657666974, 20.97621888383109, 20.24058919303746, 73.24260576165612, False)
+SketchLine_1 = Sketch_1.addLine(67.41776169413798, 4.173199186912264, 102.8479480835664, 10.72004206910377)
+model.do()
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Pipe_1 = model.addPipe(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "Sketch_1/SketchArc_1_2"))
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Pipe_2 = model.addPipe(Part_1_doc, [model.selection("EDGE", "Edge_2_1")], model.selection("EDGE", "PartSet/OY"), model.selection("EDGE", "PartSet/OZ"))
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Pipe_1, 1)
+model.testNbSubResults(Pipe_1, [0])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.FACE, [1])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.EDGE, [4])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.VERTEX, [8])
+model.testResultsVolumes(Pipe_1, [3693.366575752712378744035959244])
+
+model.testNbResults(Pipe_2, 1)
+model.testNbSubResults(Pipe_2, [0])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.FACE, [1])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.EDGE, [4])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.VERTEX, [8])
+model.testResultsVolumes(Pipe_2, [3543.018638942841789685189723969])
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from ModelAPI import *
+from GeomDataAPI import *
+
+# Get document
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create a sketch with circle for pipe profile
+aSession.startOperation()
+aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+
+# Create circle
+aSketchCircleFeature = aSketchFeature.addFeature("SketchCircle")
+anCircleCentr = geomDataAPI_Point2D(aSketchCircleFeature.attribute("circle_center"))
+aCircleRadius = aSketchCircleFeature.real("circle_radius")
+anCircleCentr.setValue(0, 0)
+aCircleRadius.setValue(10)
+aSession.finishOperation()
+
+aSketchResult = aSketchFeature.firstResult()
+aSketchShape = aSketchResult.shape()
+
+aSession.startOperation()
+aPipeFeature = aPart.addFeature("Pipe")
+aPipeFeature.string("creation_method").setValue("WrongCreationMethod")
+aPipeFeature.execute()
+assert(aPipeFeature.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aBaseObjectsList = aPipeFeature.selectionList("base_objects")
+aBaseObjectsList.append(aSketchResult, None)
+aPipeFeature.execute()
+assert(aPipeFeature.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aPathObjectSelection = aPipeFeature.selection("path_object")
+aPathObjectSelection.selectSubShape("EDGE", "PartSet/OZ")
+aPipeFeature.execute()
+assert(aPipeFeature.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aPipeFeature.string("creation_method").setValue("binormal")
+aPipeFeature.execute()
+assert(aPipeFeature.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aPipeFeature.string("creation_method").setValue("locations")
+aBaseObjectsList = aPipeFeature.selectionList("locations_objects")
+aBaseObjectsList.append(None, None)
+aPipeFeature.execute()
+assert(aPipeFeature.error() != "")
+aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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(25, -20, -20, -20)
+SketchLine_2 = Sketch_1.addLine(-20, -20, -20, 15)
+SketchLine_3 = Sketch_1.addLine(-20, 15, 25, 15)
+SketchLine_4 = Sketch_1.addLine(25, 15, 25, -20)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchLine_5 = Sketch_1.addLine(75, 25, 95, 25)
+SketchLine_6 = Sketch_1.addLine(95, 25, 95, 45)
+SketchLine_7 = Sketch_1.addLine(95, 45, 75, 45)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+model.do()
+Pipe_1 = model.addPipe(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")], model.selection("EDGE", "PartSet/OZ"))
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_6"), model.selection("EDGE", "Sketch_1/SketchLine_7")]
+Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
+Pipe_2 = model.addPipe(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OZ"), [])
+model.do()
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Pipe_1, 1)
+model.testNbSubResults(Pipe_1, [0])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.FACE, [6])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.EDGE, [24])
+model.testNbSubShapes(Pipe_1, GeomAPI_Shape.VERTEX, [48])
+model.testResultsVolumes(Pipe_1, [157500])
+
+model.testNbResults(Pipe_2, 1)
+model.testNbSubResults(Pipe_2, [0])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.SOLID, [0])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.EDGE, [12])
+model.testNbSubShapes(Pipe_2, GeomAPI_Shape.VERTEX, [24])
+model.testResultsVolumes(Pipe_2, [6000])
+++ /dev/null
-## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-##
-## This library is free software; you can redistribute it and/or
-## modify it under the terms of the GNU Lesser General Public
-## License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-##
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public
-## License along with this library; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-##
-## See http:##www.salome-platform.org/ or
-## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-##
-
-#=========================================================================
-# Initialization of the test
-#=========================================================================
-from ModelAPI import *
-from GeomDataAPI import *
-from GeomAlgoAPI import *
-from GeomAPI import *
-import math
-
-__updated__ = "2014-12-16"
-
-aSession = ModelAPI_Session.get()
-aDocument = aSession.moduleDocument()
-
-aSession.startOperation()
-aPartFeature = aDocument.addFeature("Part")
-aSession.finishOperation()
-assert (len(aPartFeature.results()) == 1)
-aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
-aPart = aPartResult.partDoc()
-
-#=========================================================================
-# Create a sketch to extrude
-#=========================================================================
-aSession.startOperation()
-aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
-origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
-origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
-dirx.setValue(1, 0, 0)
-norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
-norm.setValue(0, 0, 1)
-aLineA1 = aSketchFeature.addFeature("SketchLine")
-aLineB1 = aSketchFeature.addFeature("SketchLine")
-aLineC1 = aSketchFeature.addFeature("SketchLine")
-aLineD1 = aSketchFeature.addFeature("SketchLine")
-aLineA1StartPoint = geomDataAPI_Point2D(aLineA1.attribute("StartPoint"))
-aLineA1EndPoint = geomDataAPI_Point2D(aLineA1.attribute("EndPoint"))
-aLineB1StartPoint = geomDataAPI_Point2D(aLineB1.attribute("StartPoint"))
-aLineB1EndPoint = geomDataAPI_Point2D(aLineB1.attribute("EndPoint"))
-aLineC1StartPoint = geomDataAPI_Point2D(aLineC1.attribute("StartPoint"))
-aLineC1EndPoint = geomDataAPI_Point2D(aLineC1.attribute("EndPoint"))
-aLineD1StartPoint = geomDataAPI_Point2D(aLineD1.attribute("StartPoint"))
-aLineD1EndPoint = geomDataAPI_Point2D(aLineD1.attribute("EndPoint"))
-aLineA1StartPoint.setValue(-100, 0)
-aLineA1EndPoint.setValue(-50, 0)
-aLineB1StartPoint.setValue(-50, 0)
-aLineB1EndPoint.setValue(-50, 50)
-aLineC1StartPoint.setValue(-50, 50)
-aLineC1EndPoint.setValue(-100, 50)
-aLineD1StartPoint.setValue(-100, 50)
-aLineD1EndPoint.setValue(-100, 0)
-aLineA2 = aSketchFeature.addFeature("SketchLine")
-aLineB2 = aSketchFeature.addFeature("SketchLine")
-aLineC2 = aSketchFeature.addFeature("SketchLine")
-aLineD2 = aSketchFeature.addFeature("SketchLine")
-aLineA2StartPoint = geomDataAPI_Point2D(aLineA2.attribute("StartPoint"))
-aLineA2EndPoint = geomDataAPI_Point2D(aLineA2.attribute("EndPoint"))
-aLineB2StartPoint = geomDataAPI_Point2D(aLineB2.attribute("StartPoint"))
-aLineB2EndPoint = geomDataAPI_Point2D(aLineB2.attribute("EndPoint"))
-aLineC2StartPoint = geomDataAPI_Point2D(aLineC2.attribute("StartPoint"))
-aLineC2EndPoint = geomDataAPI_Point2D(aLineC2.attribute("EndPoint"))
-aLineD2StartPoint = geomDataAPI_Point2D(aLineD2.attribute("StartPoint"))
-aLineD2EndPoint = geomDataAPI_Point2D(aLineD2.attribute("EndPoint"))
-aLineA2StartPoint.setValue(100, 0)
-aLineA2EndPoint.setValue(50, 0)
-aLineB2StartPoint.setValue(50, 0)
-aLineB2EndPoint.setValue(50, 50)
-aLineC2StartPoint.setValue(50, 50)
-aLineC2EndPoint.setValue(100, 50)
-aLineD2StartPoint.setValue(100, 50)
-aLineD2EndPoint.setValue(100, 0)
-aSession.finishOperation()
-
-#=========================================================================
-# Make extrusion
-#=========================================================================
-aSketchResult = aSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aSketchEdges, aSketchFaces)
-assert (len(aSketchFaces) > 0)
-assert (aSketchFaces[0] is not None)
-assert (aSketchFaces[1] is not None)
-
-aSession.startOperation()
-anExtrusionFt = aPart.addFeature("Extrusion")
-assert (anExtrusionFt.getKind() == "Extrusion")
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[0])
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[1])
-anExtrusionFt.string("CreationMethod").setValue("BySizes")
-anExtrusionFt.real("to_size").setValue(50)
-anExtrusionFt.real("from_size").setValue(0)
-anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
-anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
-anExtrusionFt.execute()
-aSession.finishOperation()
-assert (anExtrusionFt.real("to_size").value() == 50.0)
-
-# Check extrusion results
-assert (len(anExtrusionFt.results()) > 0)
-anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
-assert (anExtrusionResult is not None)
-
-#=========================================================================
-# Test placement by face - face
-#=========================================================================
-aSession.startOperation()
-aPlacementFt = aPart.addFeature("Placement")
-aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("face", "Extrusion_1_2/Generated_Face_3")
-aPlacementFt.boolean("placement_reverse_direction").setValue(False)
-aPlacementFt.boolean("placement_centering").setValue(True)
-aPlacementFt.execute()
-aSession.finishOperation()
-
-# Check placement results
-assert (len(aPlacementFt.results()) > 0)
-aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
-assert (aPlacementResult is not None)
-aSession.undo()
-
-#=========================================================================
-# Test placement by face - edge
-#=========================================================================
-aSession.startOperation()
-aPlacementFt = aPart.addFeature("Placement")
-aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3")
-aPlacementFt.boolean("placement_reverse_direction").setValue(False)
-aPlacementFt.boolean("placement_centering").setValue(True)
-aPlacementFt.execute()
-aSession.finishOperation()
-
-# Check placement results
-assert (len(aPlacementFt.results()) > 0)
-aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
-assert (aPlacementResult is not None)
-aSession.undo()
-
-#=========================================================================
-# Test placement by face - vertex
-#=========================================================================
-aSession.startOperation()
-aPlacementFt = aPart.addFeature("Placement")
-aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3&Extrusion_1_2/Generated_Face_2")
-aPlacementFt.boolean("placement_reverse_direction").setValue(False)
-aPlacementFt.boolean("placement_centering").setValue(True)
-aPlacementFt.execute()
-aSession.finishOperation()
-
-# Check placement results
-assert (len(aPlacementFt.results()) > 0)
-aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
-assert (aPlacementResult is not None)
-aSession.undo()
-
-#=========================================================================
-# Test placement by edge - edge
-#=========================================================================
-aSession.startOperation()
-aPlacementFt = aPart.addFeature("Placement")
-aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/To_Face_1_1&Extrusion_1_1/Generated_Face_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3")
-aPlacementFt.boolean("placement_reverse_direction").setValue(False)
-aPlacementFt.boolean("placement_centering").setValue(True)
-aPlacementFt.execute()
-aSession.finishOperation()
-
-# Check placement results
-assert (len(aPlacementFt.results()) > 0)
-aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
-assert (aPlacementResult is not None)
-aSession.undo()
-
-#=========================================================================
-# Test placement by edge - vertex
-#=========================================================================
-aSession.startOperation()
-aPlacementFt = aPart.addFeature("Placement")
-aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/To_Face_1_1&Extrusion_1_1/Generated_Face_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3&Extrusion_1_2/Generated_Face_2")
-aPlacementFt.boolean("placement_reverse_direction").setValue(False)
-aPlacementFt.boolean("placement_centering").setValue(True)
-aPlacementFt.execute()
-aSession.finishOperation()
-
-# Check placement results
-assert (len(aPlacementFt.results()) > 0)
-aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
-assert (aPlacementResult is not None)
-aSession.undo()
-
-#=========================================================================
-# Test placement by vertex - vertex
-#=========================================================================
-aSession.startOperation()
-aPlacementFt = aPart.addFeature("Placement")
-aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("vertex", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1_1&Extrusion_1_1/Generated_Face_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/To_Face_1_1&Extrusion_1_2/Generated_Face_3&Extrusion_1_2/Generated_Face_2")
-aPlacementFt.boolean("placement_reverse_direction").setValue(False)
-aPlacementFt.boolean("placement_centering").setValue(True)
-aPlacementFt.execute()
-aSession.finishOperation()
-
-# Check placement results
-assert (len(aPlacementFt.results()) > 0)
-aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
-assert (aPlacementResult is not None)
-
-from salome.shaper import model
-assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+model.do()
+
+Part_2 = model.addPart(partSet)
+Part_2_doc = Part_2.document()
+Box_1 = model.addBox(Part_2_doc, 10, 10, 10)
+model.do()
+
+Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("COMPOUND", "all-in-Part_1"), model.selection("FACE", "Part_2/Box_1_1/Top"), False, False)
+assert(Placement_1.feature().error() != "")
+Part_1_doc.removeFeature(Placement_1.feature())
+
+model.end()
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+import math
+
+__updated__ = "2014-12-16"
+
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+assert (len(aPartFeature.results()) == 1)
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+#=========================================================================
+# Create a sketch to extrude
+#=========================================================================
+aSession.startOperation()
+aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aLineA1 = aSketchFeature.addFeature("SketchLine")
+aLineB1 = aSketchFeature.addFeature("SketchLine")
+aLineC1 = aSketchFeature.addFeature("SketchLine")
+aLineD1 = aSketchFeature.addFeature("SketchLine")
+aLineA1StartPoint = geomDataAPI_Point2D(aLineA1.attribute("StartPoint"))
+aLineA1EndPoint = geomDataAPI_Point2D(aLineA1.attribute("EndPoint"))
+aLineB1StartPoint = geomDataAPI_Point2D(aLineB1.attribute("StartPoint"))
+aLineB1EndPoint = geomDataAPI_Point2D(aLineB1.attribute("EndPoint"))
+aLineC1StartPoint = geomDataAPI_Point2D(aLineC1.attribute("StartPoint"))
+aLineC1EndPoint = geomDataAPI_Point2D(aLineC1.attribute("EndPoint"))
+aLineD1StartPoint = geomDataAPI_Point2D(aLineD1.attribute("StartPoint"))
+aLineD1EndPoint = geomDataAPI_Point2D(aLineD1.attribute("EndPoint"))
+aLineA1StartPoint.setValue(-100, 0)
+aLineA1EndPoint.setValue(-50, 0)
+aLineB1StartPoint.setValue(-50, 0)
+aLineB1EndPoint.setValue(-50, 50)
+aLineC1StartPoint.setValue(-50, 50)
+aLineC1EndPoint.setValue(-100, 50)
+aLineD1StartPoint.setValue(-100, 50)
+aLineD1EndPoint.setValue(-100, 0)
+aLineA2 = aSketchFeature.addFeature("SketchLine")
+aLineB2 = aSketchFeature.addFeature("SketchLine")
+aLineC2 = aSketchFeature.addFeature("SketchLine")
+aLineD2 = aSketchFeature.addFeature("SketchLine")
+aLineA2StartPoint = geomDataAPI_Point2D(aLineA2.attribute("StartPoint"))
+aLineA2EndPoint = geomDataAPI_Point2D(aLineA2.attribute("EndPoint"))
+aLineB2StartPoint = geomDataAPI_Point2D(aLineB2.attribute("StartPoint"))
+aLineB2EndPoint = geomDataAPI_Point2D(aLineB2.attribute("EndPoint"))
+aLineC2StartPoint = geomDataAPI_Point2D(aLineC2.attribute("StartPoint"))
+aLineC2EndPoint = geomDataAPI_Point2D(aLineC2.attribute("EndPoint"))
+aLineD2StartPoint = geomDataAPI_Point2D(aLineD2.attribute("StartPoint"))
+aLineD2EndPoint = geomDataAPI_Point2D(aLineD2.attribute("EndPoint"))
+aLineA2StartPoint.setValue(100, 0)
+aLineA2EndPoint.setValue(50, 0)
+aLineB2StartPoint.setValue(50, 0)
+aLineB2EndPoint.setValue(50, 50)
+aLineC2StartPoint.setValue(50, 50)
+aLineC2EndPoint.setValue(100, 50)
+aLineD2StartPoint.setValue(100, 50)
+aLineD2EndPoint.setValue(100, 0)
+aSession.finishOperation()
+
+#=========================================================================
+# Make extrusion
+#=========================================================================
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
+assert (aSketchResult.facesNum() > 1)
+
+aSession.startOperation()
+anExtrusionFt = aPart.addFeature("Extrusion")
+assert (anExtrusionFt.getKind() == "Extrusion")
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(1))
+anExtrusionFt.string("CreationMethod").setValue("BySizes")
+anExtrusionFt.real("to_size").setValue(50)
+anExtrusionFt.real("from_size").setValue(0)
+anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
+anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+anExtrusionFt.execute()
+aSession.finishOperation()
+assert (anExtrusionFt.real("to_size").value() == 50.0)
+
+# Check extrusion results
+assert (len(anExtrusionFt.results()) > 0)
+anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
+assert (anExtrusionResult is not None)
+
+#=========================================================================
+# Test placement by edge - edge
+#=========================================================================
+aSession.startOperation()
+aPlacementFt = aPart.addFeature("Placement")
+aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
+aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]")
+aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]")
+aPlacementFt.boolean("placement_reverse_direction").setValue(False)
+aPlacementFt.boolean("placement_centering").setValue(True)
+aPlacementFt.execute()
+aSession.finishOperation()
+
+# Check placement results
+assert (len(aPlacementFt.results()) > 0)
+aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
+assert (aPlacementResult is not None)
+aSession.finishOperation()
+
+from salome.shaper import model
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+import math
+
+__updated__ = "2014-12-16"
+
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+assert (len(aPartFeature.results()) == 1)
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+#=========================================================================
+# Create a sketch to extrude
+#=========================================================================
+aSession.startOperation()
+aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aLineA1 = aSketchFeature.addFeature("SketchLine")
+aLineB1 = aSketchFeature.addFeature("SketchLine")
+aLineC1 = aSketchFeature.addFeature("SketchLine")
+aLineD1 = aSketchFeature.addFeature("SketchLine")
+aLineA1StartPoint = geomDataAPI_Point2D(aLineA1.attribute("StartPoint"))
+aLineA1EndPoint = geomDataAPI_Point2D(aLineA1.attribute("EndPoint"))
+aLineB1StartPoint = geomDataAPI_Point2D(aLineB1.attribute("StartPoint"))
+aLineB1EndPoint = geomDataAPI_Point2D(aLineB1.attribute("EndPoint"))
+aLineC1StartPoint = geomDataAPI_Point2D(aLineC1.attribute("StartPoint"))
+aLineC1EndPoint = geomDataAPI_Point2D(aLineC1.attribute("EndPoint"))
+aLineD1StartPoint = geomDataAPI_Point2D(aLineD1.attribute("StartPoint"))
+aLineD1EndPoint = geomDataAPI_Point2D(aLineD1.attribute("EndPoint"))
+aLineA1StartPoint.setValue(-100, 0)
+aLineA1EndPoint.setValue(-50, 0)
+aLineB1StartPoint.setValue(-50, 0)
+aLineB1EndPoint.setValue(-50, 50)
+aLineC1StartPoint.setValue(-50, 50)
+aLineC1EndPoint.setValue(-100, 50)
+aLineD1StartPoint.setValue(-100, 50)
+aLineD1EndPoint.setValue(-100, 0)
+aLineA2 = aSketchFeature.addFeature("SketchLine")
+aLineB2 = aSketchFeature.addFeature("SketchLine")
+aLineC2 = aSketchFeature.addFeature("SketchLine")
+aLineD2 = aSketchFeature.addFeature("SketchLine")
+aLineA2StartPoint = geomDataAPI_Point2D(aLineA2.attribute("StartPoint"))
+aLineA2EndPoint = geomDataAPI_Point2D(aLineA2.attribute("EndPoint"))
+aLineB2StartPoint = geomDataAPI_Point2D(aLineB2.attribute("StartPoint"))
+aLineB2EndPoint = geomDataAPI_Point2D(aLineB2.attribute("EndPoint"))
+aLineC2StartPoint = geomDataAPI_Point2D(aLineC2.attribute("StartPoint"))
+aLineC2EndPoint = geomDataAPI_Point2D(aLineC2.attribute("EndPoint"))
+aLineD2StartPoint = geomDataAPI_Point2D(aLineD2.attribute("StartPoint"))
+aLineD2EndPoint = geomDataAPI_Point2D(aLineD2.attribute("EndPoint"))
+aLineA2StartPoint.setValue(100, 0)
+aLineA2EndPoint.setValue(50, 0)
+aLineB2StartPoint.setValue(50, 0)
+aLineB2EndPoint.setValue(50, 50)
+aLineC2StartPoint.setValue(50, 50)
+aLineC2EndPoint.setValue(100, 50)
+aLineD2StartPoint.setValue(100, 50)
+aLineD2EndPoint.setValue(100, 0)
+aSession.finishOperation()
+
+#=========================================================================
+# Make extrusion
+#=========================================================================
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
+assert (aSketchResult.facesNum() > 1)
+
+aSession.startOperation()
+anExtrusionFt = aPart.addFeature("Extrusion")
+assert (anExtrusionFt.getKind() == "Extrusion")
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(1))
+anExtrusionFt.string("CreationMethod").setValue("BySizes")
+anExtrusionFt.real("to_size").setValue(50)
+anExtrusionFt.real("from_size").setValue(0)
+anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
+anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+anExtrusionFt.execute()
+aSession.finishOperation()
+assert (anExtrusionFt.real("to_size").value() == 50.0)
+
+# Check extrusion results
+assert (len(anExtrusionFt.results()) > 0)
+anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
+assert (anExtrusionResult is not None)
+
+#=========================================================================
+# Test placement by edge - vertex
+#=========================================================================
+aSession.startOperation()
+aPlacementFt = aPart.addFeature("Placement")
+aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
+aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_2/To_Face]")
+aPlacementFt.boolean("placement_reverse_direction").setValue(False)
+aPlacementFt.boolean("placement_centering").setValue(True)
+aPlacementFt.execute()
+aSession.finishOperation()
+
+# Check placement results
+assert (len(aPlacementFt.results()) > 0)
+aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
+assert (aPlacementResult is not None)
+aSession.finishOperation()
+
+from salome.shaper import model
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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"))
+SketchCircle_1 = Sketch_1.addCircle(-16.57843122838298, -30.87163595652513, 16.88033171559421)
+SketchCircle_2 = Sketch_1.addCircle(29.74848722752363, 33.32178840955915, 9.026354269133289)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+model.do()
+model.end()
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+
+aShapeToMove = Extrusion_1.feature().results()[1]
+
+# Verify Placement errors on low-level
+aSession.startOperation()
+aPlacementFt = featureToCompositeFeature(Part_1.feature()).addFeature("Placement")
+aPlacementFt.execute()
+aSession.finishOperation()
+assert(aPlacementFt.error() != "")
+
+aSession.startOperation()
+aPlacementFt.selectionList("placement_objects_list").append(aShapeToMove, aShapeToMove.shape())
+aPlacementFt.execute()
+aSession.finishOperation()
+assert(aPlacementFt.error() != "")
+
+aSession.startOperation()
+aPlacementFt.selection("placement_start_shape").selectSubShape("FACE", "Extrusion_1_2/To_Face")
+aPlacementFt.execute()
+aSession.finishOperation()
+assert(aPlacementFt.error() != "")
+
+aSession.startOperation()
+aPlacementFt.selection("placement_start_shape").selectSubShape("FACE", "Extrusion_1_2/Generated_Face&Sketch_1/SketchCircle_2_2")
+aPlacementFt.selection("placement_end_shape").selectSubShape("FACE", "Extrusion_1_1/To_Face")
+aPlacementFt.execute()
+aSession.finishOperation()
+assert(aPlacementFt.error() != "")
+
+aSession.startOperation()
+aPlacementFt.selection("placement_start_shape").selectSubShape("EDGE", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_2/To_Face]")
+aPlacementFt.selection("placement_end_shape").selectSubShape("FACE", "Extrusion_1_1/To_Face")
+aPlacementFt.execute()
+aSession.finishOperation()
+assert(aPlacementFt.error() != "")
+
+# Create correct Placement
+aSession.startOperation()
+aPlacementFt.selection("placement_start_shape").selectSubShape("FACE", "Extrusion_1_2/To_Face")
+aPlacementFt.selection("placement_end_shape").selectSubShape("FACE", "Extrusion_1_1/To_Face")
+aPlacementFt.boolean("placement_reverse_direction").setValue(False)
+aPlacementFt.boolean("placement_centering").setValue(True)
+aPlacementFt.execute()
+aSession.finishOperation()
+assert(aPlacementFt.error() == "")
+
+
+model.begin()
+Placement_2 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Placement_1_1")], model.selection("COMPOUND", "Sketch_1"), model.selection("FACE", "Extrusion_1_1/To_Face"), False, False)
+assert(Placement_2.feature().error() != "")
+Part_1_doc.removeFeature(Placement_2.feature())
+model.end()
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+import math
+
+__updated__ = "2014-12-16"
+
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+assert (len(aPartFeature.results()) == 1)
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+#=========================================================================
+# Create a sketch to extrude
+#=========================================================================
+aSession.startOperation()
+aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aLineA1 = aSketchFeature.addFeature("SketchLine")
+aLineB1 = aSketchFeature.addFeature("SketchLine")
+aLineC1 = aSketchFeature.addFeature("SketchLine")
+aLineD1 = aSketchFeature.addFeature("SketchLine")
+aLineA1StartPoint = geomDataAPI_Point2D(aLineA1.attribute("StartPoint"))
+aLineA1EndPoint = geomDataAPI_Point2D(aLineA1.attribute("EndPoint"))
+aLineB1StartPoint = geomDataAPI_Point2D(aLineB1.attribute("StartPoint"))
+aLineB1EndPoint = geomDataAPI_Point2D(aLineB1.attribute("EndPoint"))
+aLineC1StartPoint = geomDataAPI_Point2D(aLineC1.attribute("StartPoint"))
+aLineC1EndPoint = geomDataAPI_Point2D(aLineC1.attribute("EndPoint"))
+aLineD1StartPoint = geomDataAPI_Point2D(aLineD1.attribute("StartPoint"))
+aLineD1EndPoint = geomDataAPI_Point2D(aLineD1.attribute("EndPoint"))
+aLineA1StartPoint.setValue(-100, 0)
+aLineA1EndPoint.setValue(-50, 0)
+aLineB1StartPoint.setValue(-50, 0)
+aLineB1EndPoint.setValue(-50, 50)
+aLineC1StartPoint.setValue(-50, 50)
+aLineC1EndPoint.setValue(-100, 50)
+aLineD1StartPoint.setValue(-100, 50)
+aLineD1EndPoint.setValue(-100, 0)
+aLineA2 = aSketchFeature.addFeature("SketchLine")
+aLineB2 = aSketchFeature.addFeature("SketchLine")
+aLineC2 = aSketchFeature.addFeature("SketchLine")
+aLineD2 = aSketchFeature.addFeature("SketchLine")
+aLineA2StartPoint = geomDataAPI_Point2D(aLineA2.attribute("StartPoint"))
+aLineA2EndPoint = geomDataAPI_Point2D(aLineA2.attribute("EndPoint"))
+aLineB2StartPoint = geomDataAPI_Point2D(aLineB2.attribute("StartPoint"))
+aLineB2EndPoint = geomDataAPI_Point2D(aLineB2.attribute("EndPoint"))
+aLineC2StartPoint = geomDataAPI_Point2D(aLineC2.attribute("StartPoint"))
+aLineC2EndPoint = geomDataAPI_Point2D(aLineC2.attribute("EndPoint"))
+aLineD2StartPoint = geomDataAPI_Point2D(aLineD2.attribute("StartPoint"))
+aLineD2EndPoint = geomDataAPI_Point2D(aLineD2.attribute("EndPoint"))
+aLineA2StartPoint.setValue(100, 0)
+aLineA2EndPoint.setValue(50, 0)
+aLineB2StartPoint.setValue(50, 0)
+aLineB2EndPoint.setValue(50, 50)
+aLineC2StartPoint.setValue(50, 50)
+aLineC2EndPoint.setValue(100, 50)
+aLineD2StartPoint.setValue(100, 50)
+aLineD2EndPoint.setValue(100, 0)
+aSession.finishOperation()
+
+#=========================================================================
+# Make extrusion
+#=========================================================================
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
+assert (aSketchResult.facesNum() > 1)
+
+aSession.startOperation()
+anExtrusionFt = aPart.addFeature("Extrusion")
+assert (anExtrusionFt.getKind() == "Extrusion")
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(1))
+anExtrusionFt.string("CreationMethod").setValue("BySizes")
+anExtrusionFt.real("to_size").setValue(50)
+anExtrusionFt.real("from_size").setValue(0)
+anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
+anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+anExtrusionFt.execute()
+aSession.finishOperation()
+assert (anExtrusionFt.real("to_size").value() == 50.0)
+
+# Check extrusion results
+assert (len(anExtrusionFt.results()) > 0)
+anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
+assert (anExtrusionResult is not None)
+
+#=========================================================================
+# Test placement by face - edge
+#=========================================================================
+aSession.startOperation()
+aPlacementFt = aPart.addFeature("Placement")
+aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
+aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4")
+aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/To_Face]")
+aPlacementFt.boolean("placement_reverse_direction").setValue(False)
+aPlacementFt.boolean("placement_centering").setValue(True)
+aPlacementFt.execute()
+aSession.finishOperation()
+
+# Check placement results
+assert (len(aPlacementFt.results()) > 0)
+aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
+assert (aPlacementResult is not None)
+aSession.finishOperation()
+
+from salome.shaper import model
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+import math
+
+__updated__ = "2014-12-16"
+
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+assert (len(aPartFeature.results()) == 1)
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+#=========================================================================
+# Create a sketch to extrude
+#=========================================================================
+aSession.startOperation()
+aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aLineA1 = aSketchFeature.addFeature("SketchLine")
+aLineB1 = aSketchFeature.addFeature("SketchLine")
+aLineC1 = aSketchFeature.addFeature("SketchLine")
+aLineD1 = aSketchFeature.addFeature("SketchLine")
+aLineA1StartPoint = geomDataAPI_Point2D(aLineA1.attribute("StartPoint"))
+aLineA1EndPoint = geomDataAPI_Point2D(aLineA1.attribute("EndPoint"))
+aLineB1StartPoint = geomDataAPI_Point2D(aLineB1.attribute("StartPoint"))
+aLineB1EndPoint = geomDataAPI_Point2D(aLineB1.attribute("EndPoint"))
+aLineC1StartPoint = geomDataAPI_Point2D(aLineC1.attribute("StartPoint"))
+aLineC1EndPoint = geomDataAPI_Point2D(aLineC1.attribute("EndPoint"))
+aLineD1StartPoint = geomDataAPI_Point2D(aLineD1.attribute("StartPoint"))
+aLineD1EndPoint = geomDataAPI_Point2D(aLineD1.attribute("EndPoint"))
+aLineA1StartPoint.setValue(-100, 0)
+aLineA1EndPoint.setValue(-50, 0)
+aLineB1StartPoint.setValue(-50, 0)
+aLineB1EndPoint.setValue(-50, 50)
+aLineC1StartPoint.setValue(-50, 50)
+aLineC1EndPoint.setValue(-100, 50)
+aLineD1StartPoint.setValue(-100, 50)
+aLineD1EndPoint.setValue(-100, 0)
+aLineA2 = aSketchFeature.addFeature("SketchLine")
+aLineB2 = aSketchFeature.addFeature("SketchLine")
+aLineC2 = aSketchFeature.addFeature("SketchLine")
+aLineD2 = aSketchFeature.addFeature("SketchLine")
+aLineA2StartPoint = geomDataAPI_Point2D(aLineA2.attribute("StartPoint"))
+aLineA2EndPoint = geomDataAPI_Point2D(aLineA2.attribute("EndPoint"))
+aLineB2StartPoint = geomDataAPI_Point2D(aLineB2.attribute("StartPoint"))
+aLineB2EndPoint = geomDataAPI_Point2D(aLineB2.attribute("EndPoint"))
+aLineC2StartPoint = geomDataAPI_Point2D(aLineC2.attribute("StartPoint"))
+aLineC2EndPoint = geomDataAPI_Point2D(aLineC2.attribute("EndPoint"))
+aLineD2StartPoint = geomDataAPI_Point2D(aLineD2.attribute("StartPoint"))
+aLineD2EndPoint = geomDataAPI_Point2D(aLineD2.attribute("EndPoint"))
+aLineA2StartPoint.setValue(100, 0)
+aLineA2EndPoint.setValue(50, 0)
+aLineB2StartPoint.setValue(50, 0)
+aLineB2EndPoint.setValue(50, 50)
+aLineC2StartPoint.setValue(50, 50)
+aLineC2EndPoint.setValue(100, 50)
+aLineD2StartPoint.setValue(100, 50)
+aLineD2EndPoint.setValue(100, 0)
+aSession.finishOperation()
+
+#=========================================================================
+# Make extrusion
+#=========================================================================
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
+assert (aSketchResult.facesNum() > 1)
+
+aSession.startOperation()
+anExtrusionFt = aPart.addFeature("Extrusion")
+assert (anExtrusionFt.getKind() == "Extrusion")
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(1))
+anExtrusionFt.string("CreationMethod").setValue("BySizes")
+anExtrusionFt.real("to_size").setValue(50)
+anExtrusionFt.real("from_size").setValue(0)
+anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
+anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+anExtrusionFt.execute()
+aSession.finishOperation()
+assert (anExtrusionFt.real("to_size").value() == 50.0)
+
+# Check extrusion results
+assert (len(anExtrusionFt.results()) > 0)
+anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
+assert (anExtrusionResult is not None)
+
+#=========================================================================
+# Test placement by face - face
+#=========================================================================
+aSession.startOperation()
+aPlacementFt = aPart.addFeature("Placement")
+aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
+aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4")
+aPlacementFt.selection("placement_end_shape").selectSubShape("face", "Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7")
+aPlacementFt.boolean("placement_reverse_direction").setValue(False)
+aPlacementFt.boolean("placement_centering").setValue(True)
+aPlacementFt.execute()
+aSession.finishOperation()
+
+# Check placement results
+assert (len(aPlacementFt.results()) > 0)
+aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
+assert (aPlacementResult is not None)
+aSession.finishOperation()
+
+from salome.shaper import model
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+from GeomDataAPI import *
+from GeomAlgoAPI import *
+from GeomAPI import *
+import math
+
+__updated__ = "2014-12-16"
+
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+assert (len(aPartFeature.results()) == 1)
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+#=========================================================================
+# Create a sketch to extrude
+#=========================================================================
+aSession.startOperation()
+aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
+origin.setValue(0, 0, 0)
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
+dirx.setValue(1, 0, 0)
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
+norm.setValue(0, 0, 1)
+aLineA1 = aSketchFeature.addFeature("SketchLine")
+aLineB1 = aSketchFeature.addFeature("SketchLine")
+aLineC1 = aSketchFeature.addFeature("SketchLine")
+aLineD1 = aSketchFeature.addFeature("SketchLine")
+aLineA1StartPoint = geomDataAPI_Point2D(aLineA1.attribute("StartPoint"))
+aLineA1EndPoint = geomDataAPI_Point2D(aLineA1.attribute("EndPoint"))
+aLineB1StartPoint = geomDataAPI_Point2D(aLineB1.attribute("StartPoint"))
+aLineB1EndPoint = geomDataAPI_Point2D(aLineB1.attribute("EndPoint"))
+aLineC1StartPoint = geomDataAPI_Point2D(aLineC1.attribute("StartPoint"))
+aLineC1EndPoint = geomDataAPI_Point2D(aLineC1.attribute("EndPoint"))
+aLineD1StartPoint = geomDataAPI_Point2D(aLineD1.attribute("StartPoint"))
+aLineD1EndPoint = geomDataAPI_Point2D(aLineD1.attribute("EndPoint"))
+aLineA1StartPoint.setValue(-100, 0)
+aLineA1EndPoint.setValue(-50, 0)
+aLineB1StartPoint.setValue(-50, 0)
+aLineB1EndPoint.setValue(-50, 50)
+aLineC1StartPoint.setValue(-50, 50)
+aLineC1EndPoint.setValue(-100, 50)
+aLineD1StartPoint.setValue(-100, 50)
+aLineD1EndPoint.setValue(-100, 0)
+aLineA2 = aSketchFeature.addFeature("SketchLine")
+aLineB2 = aSketchFeature.addFeature("SketchLine")
+aLineC2 = aSketchFeature.addFeature("SketchLine")
+aLineD2 = aSketchFeature.addFeature("SketchLine")
+aLineA2StartPoint = geomDataAPI_Point2D(aLineA2.attribute("StartPoint"))
+aLineA2EndPoint = geomDataAPI_Point2D(aLineA2.attribute("EndPoint"))
+aLineB2StartPoint = geomDataAPI_Point2D(aLineB2.attribute("StartPoint"))
+aLineB2EndPoint = geomDataAPI_Point2D(aLineB2.attribute("EndPoint"))
+aLineC2StartPoint = geomDataAPI_Point2D(aLineC2.attribute("StartPoint"))
+aLineC2EndPoint = geomDataAPI_Point2D(aLineC2.attribute("EndPoint"))
+aLineD2StartPoint = geomDataAPI_Point2D(aLineD2.attribute("StartPoint"))
+aLineD2EndPoint = geomDataAPI_Point2D(aLineD2.attribute("EndPoint"))
+aLineA2StartPoint.setValue(100, 0)
+aLineA2EndPoint.setValue(50, 0)
+aLineB2StartPoint.setValue(50, 0)
+aLineB2EndPoint.setValue(50, 50)
+aLineC2StartPoint.setValue(50, 50)
+aLineC2EndPoint.setValue(100, 50)
+aLineD2StartPoint.setValue(100, 50)
+aLineD2EndPoint.setValue(100, 0)
+aSession.finishOperation()
+
+#=========================================================================
+# Make extrusion
+#=========================================================================
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
+assert (aSketchResult.facesNum() > 1)
+
+aSession.startOperation()
+anExtrusionFt = aPart.addFeature("Extrusion")
+assert (anExtrusionFt.getKind() == "Extrusion")
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(1))
+anExtrusionFt.string("CreationMethod").setValue("BySizes")
+anExtrusionFt.real("to_size").setValue(50)
+anExtrusionFt.real("from_size").setValue(0)
+anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
+anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
+anExtrusionFt.execute()
+aSession.finishOperation()
+assert (anExtrusionFt.real("to_size").value() == 50.0)
+
+# Check extrusion results
+assert (len(anExtrusionFt.results()) > 0)
+anExtrusionResult = modelAPI_ResultBody(anExtrusionFt.firstResult())
+assert (anExtrusionResult is not None)
+
+#=========================================================================
+# Test placement by face - vertex
+#=========================================================================
+aSession.startOperation()
+aPlacementFt = aPart.addFeature("Placement")
+aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
+aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_2/To_Face]")
+aPlacementFt.boolean("placement_reverse_direction").setValue(False)
+aPlacementFt.boolean("placement_centering").setValue(True)
+aPlacementFt.execute()
+aSession.finishOperation()
+
+# Check placement results
+assert (len(aPlacementFt.results()) > 0)
+aPlacementResult = modelAPI_ResultBody(aPlacementFt.firstResult())
+assert (aPlacementResult is not None)
+aSession.finishOperation()
+
+from salome.shaper import model
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+Part_2 = model.addPart(partSet)
+Part_2_doc = Part_2.document()
+Cylinder_1 = model.addCylinder(Part_2_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+model.do()
+Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("FACE", "Part_2/Cylinder_1_1/Face_2"), model.selection("FACE", "Part_1/Box_1_1/Front"), False, True)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Placement_1, 1)
+model.testNbSubResults(Placement_1, [0])
+model.testNbSubShapes(Placement_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Placement_1, GeomAPI_Shape.FACE, [3])
+model.testNbSubShapes(Placement_1, GeomAPI_Shape.EDGE, [6])
+model.testNbSubShapes(Placement_1, GeomAPI_Shape.VERTEX, [12])
+model.testResultsVolumes(Placement_1, [785.398163397448342948337085545])
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+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(-100, 0, -50, 0)
+SketchLine_2 = Sketch_1.addLine(-50, 0, -50, 50)
+SketchLine_3 = Sketch_1.addLine(-50, 50, -100, 50)
+SketchLine_4 = Sketch_1.addLine(-100, 50, -100, 0)
+SketchLine_5 = Sketch_1.addLine(100, 0, 50, 0)
+SketchLine_6 = Sketch_1.addLine(50, 0, 50, 50)
+SketchLine_7 = Sketch_1.addLine(50, 50, 100, 50)
+SketchLine_8 = Sketch_1.addLine(100, 50, 100, 0)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("FACE", "Sketch_1/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r")], model.selection(), 50, 0)
+Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"), model.selection("VERTEX", "[Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_2/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_2/To_Face]"), False, True)
+model.do()
+model.end()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchLine_11 = Sketch_1.addLine(-70, 0, -90, 0)
SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_9.result())
-SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_10.result(), 70)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchPoint_1.coordinates(), SketchLine_10.result(), 70, False)
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_10.result())
SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_2.result())
SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_4.result())
SketchConstraintHorizontal_3.setName("SketchConstraintHorizontal_4")
SketchConstraintHorizontal_4 = Sketch_1.setHorizontal(SketchLine_7.result())
SketchConstraintHorizontal_4.setName("SketchConstraintHorizontal_5")
-SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchLine_1.result(), 80)
-SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_1.result(), 90)
-SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_1.result(), 85)
-SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_1.result(), 90)
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_9.startPoint(), SketchLine_1.result(), 80, False)
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_5.endPoint(), SketchLine_1.result(), 90, False)
+SketchConstraintDistance_4 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_1.result(), 85, False)
+SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_2.endPoint(), SketchLine_1.result(), 90, False)
SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchLine_11.endPoint(), SketchLine_2.startPoint())
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_10.result(), 190)
SketchConstraintLength_1.setName("SketchConstraintLength_3")
SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_13.result(), SketchLine_4.endPoint())
SketchConstraintCoincidence_13.setName("SketchConstraintCoincidence_17")
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10r-SketchLine_11r")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 180, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Revolution_1_1/From_Face_1"), 120, True)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r")], model.selection("EDGE", "Sketch_1/SketchLine_1"), 180, 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Revolution_1_1/From_Face"), 120, True)
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
SketchLine_14 = SketchProjection_1.createdFeature()
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"))
+SketchLine_14.setName("SketchLine_14")
+SketchLine_14.result().setName("SketchLine_14")
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
SketchLine_15 = SketchProjection_2.createdFeature()
-SketchLine_16 = Sketch_2.addLine(-15.00002401644285, 44.20204102886705, 14.99999932366307, 44.20204102886705)
+SketchLine_15.setName("SketchLine_15")
+SketchLine_15.result().setName("SketchLine_15")
+SketchLine_16 = Sketch_2.addLine(-15, 44.202041028867, 15, 44.20204102886701)
SketchLine_16.setName("SketchLine_24")
SketchLine_16.result().setName("SketchLine_24")
-SketchLine_17 = Sketch_2.addLine(-25, 88.20203643108667, -25, 54.20202402898175)
+SketchLine_17 = Sketch_2.addLine(-25, 88.20204102886699, -25, 54.202041028867)
SketchLine_17.setName("SketchLine_28")
SketchLine_17.result().setName("SketchLine_28")
-SketchLine_18 = Sketch_2.addLine(25, 54.2020551101737, 25, 88.20204066628929)
+SketchLine_18 = Sketch_2.addLine(25, 54.20204102886701, 25, 88.202041028867)
SketchLine_18.setName("SketchLine_26")
SketchLine_18.result().setName("SketchLine_26")
-SketchLine_19 = Sketch_2.addLine(14.99999814471567, 98.20204102886706, -15.00002220451297, 98.20204102886706)
+SketchLine_19 = Sketch_2.addLine(15, 98.202041028867, -15.00000000000001, 98.20204102886699)
SketchLine_19.setName("SketchLine_27")
SketchLine_19.result().setName("SketchLine_27")
-SketchLine_21 = Sketch_2.addLine(25, 98.20204102886706, -25, 98.20204102886706)
-SketchLine_21.setName("SketchLine_15")
-SketchLine_21.result().setName("SketchLine_15")
-SketchLine_21.setAuxiliary(True)
-SketchLine_20 = Sketch_2.addLine(25, 44.20204102886705, 25, 98.20204102886706)
-SketchLine_20.setName("SketchLine_18")
-SketchLine_20.result().setName("SketchLine_18")
+SketchLine_20 = Sketch_2.addLine(25, 98.20204102886706, -25, 98.20204102886706)
+SketchLine_20.setName("SketchLine_15")
+SketchLine_20.result().setName("SketchLine_15")
SketchLine_20.setAuxiliary(True)
-SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_21.startPoint())
+SketchLine_21 = Sketch_2.addLine(25, 44.20204102886705, 25, 98.20204102886706)
+SketchLine_21.setName("SketchLine_18")
+SketchLine_21.result().setName("SketchLine_18")
+SketchLine_21.setAuxiliary(True)
+SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_20.startPoint())
SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_13")
SketchLine_22 = Sketch_2.addLine(-25, 98.20204102886706, -25, 44.20204102886705)
SketchLine_22.setName("SketchLine_16")
SketchLine_22.result().setName("SketchLine_16")
SketchLine_22.setAuxiliary(True)
-SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
+SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_22.startPoint())
SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_14")
SketchLine_23 = Sketch_2.addLine(-25, 44.20204102886705, 25, 44.20204102886705)
SketchLine_23.setName("SketchLine_17")
SketchLine_23.setAuxiliary(True)
SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_15")
-SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_23.endPoint(), SketchLine_20.startPoint())
+SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_23.endPoint(), SketchLine_21.startPoint())
SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_16")
-SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_21.result())
+SketchConstraintHorizontal_6 = Sketch_2.setHorizontal(SketchLine_20.result())
+SketchConstraintHorizontal_6.setName("SketchConstraintHorizontal_6")
SketchConstraintVertical_7 = Sketch_2.setVertical(SketchLine_22.result())
SketchConstraintHorizontal_7 = Sketch_2.setHorizontal(SketchLine_23.result())
-SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_20.result())
-SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_21.result(), "l_percage")
+SketchConstraintHorizontal_7.setName("SketchConstraintHorizontal_7")
+SketchConstraintVertical_8 = Sketch_2.setVertical(SketchLine_21.result())
+SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_20.result(), "l_percage")
SketchConstraintLength_6.setName("SketchConstraintLength_8")
-SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_20.result(), 54)
+SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_21.result(), 54)
SketchConstraintLength_7.setName("SketchConstraintLength_9")
-SketchConstraintDistance_6 = Sketch_2.setDistance(SketchLine_14.result(), SketchLine_22.startPoint(), "l_percage/2")
-SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_19"))
+SketchConstraintDistance_6 = Sketch_2.setDistance(SketchLine_14.result(), SketchLine_22.startPoint(), "l_percage/2", False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_19"), False)
SketchLine_24 = SketchProjection_3.createdFeature()
-SketchConstraintDistance_7 = Sketch_2.setDistance(SketchLine_24.result(), SketchLine_21.startPoint(), 20)
-SketchArc_1 = Sketch_2.addArc(-15, 54.20204102886705, -25, 54.20202402898175, -15.00002401644285, 44.20204102886705, False)
-SketchLine_25 = Sketch_2.addLine(-25, 98.20204102886706, -25, 54.20202402898175)
+SketchLine_24.setName("SketchLine_25")
+SketchLine_24.result().setName("SketchLine_25")
+SketchConstraintDistance_7 = Sketch_2.setDistance(SketchLine_24.result(), SketchLine_20.startPoint(), 20, False)
+SketchArc_1 = Sketch_2.addArc(-15, 54.202041028867, -25, 54.202041028867, -15, 44.202041028867, False)
+SketchLine_25 = Sketch_2.addLine(-25, 98.20204102886706, -25, 54.202041028867)
SketchLine_25.setName("SketchLine_22")
SketchLine_25.result().setName("SketchLine_22")
SketchLine_25.setAuxiliary(True)
SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchArc_1.startPoint(), SketchLine_25.endPoint())
-SketchLine_26 = Sketch_2.addLine(-15.00002401644285, 44.20204102886705, 25, 44.20204102886705)
+SketchLine_26 = Sketch_2.addLine(-15, 44.202041028867, 25, 44.20204102886705)
SketchLine_26.setName("SketchLine_21")
SketchLine_26.result().setName("SketchLine_21")
SketchLine_26.setAuxiliary(True)
SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_22.startPoint(), SketchLine_25.startPoint())
SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_26.startPoint(), SketchLine_23.result())
SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_25.endPoint(), SketchLine_22.result())
-SketchArc_2 = Sketch_2.addArc(15, 54.20204102886705, 14.99999932366307, 44.20204102886705, 25, 54.2020551101737, False)
+SketchArc_2 = Sketch_2.addArc(15, 54.20204102886701, 15, 44.20204102886701, 25, 54.20204102886701, False)
SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_16.endPoint())
-SketchLine_27 = Sketch_2.addLine(25, 54.2020551101737, 25, 98.20204102886706)
+SketchLine_27 = Sketch_2.addLine(25, 54.20204102886701, 25, 98.20204102886706)
SketchLine_27.setName("SketchLine_23")
SketchLine_27.result().setName("SketchLine_23")
SketchLine_27.setAuxiliary(True)
SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_27.startPoint())
SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_27.result())
SketchConstraintTangent_4 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_16.result())
-SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_27.endPoint())
+SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_27.endPoint())
SketchConstraintCoincidence_27 = Sketch_2.setCoincident(SketchLine_26.startPoint(), SketchLine_16.startPoint())
-SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_27.startPoint(), SketchLine_20.result())
+SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_27.startPoint(), SketchLine_21.result())
SketchConstraintCoincidence_29 = Sketch_2.setCoincident(SketchLine_16.endPoint(), SketchLine_26.result())
-SketchArc_3 = Sketch_2.addArc(15, 88.20204102886704, 25, 88.20204066628929, 14.99999814471567, 98.20204102886706, False)
+SketchArc_3 = Sketch_2.addArc(15, 88.202041028867, 25, 88.202041028867, 15, 98.202041028867, False)
SketchConstraintCoincidence_30 = Sketch_2.setCoincident(SketchArc_3.startPoint(), SketchLine_18.endPoint())
-SketchLine_28 = Sketch_2.addLine(14.99999814471567, 98.20204102886706, -25, 98.20204102886706)
+SketchLine_28 = Sketch_2.addLine(15, 98.202041028867, -25, 98.20204102886706)
SketchLine_28.setName("SketchLine_25")
SketchLine_28.result().setName("SketchLine_25")
SketchLine_28.setAuxiliary(True)
SketchConstraintCoincidence_31 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_28.startPoint())
SketchConstraintTangent_5 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_28.result())
SketchConstraintTangent_6 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_18.result())
-SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_21.endPoint(), SketchLine_28.endPoint())
+SketchConstraintCoincidence_32 = Sketch_2.setCoincident(SketchLine_20.endPoint(), SketchLine_28.endPoint())
SketchConstraintCoincidence_33 = Sketch_2.setCoincident(SketchLine_27.startPoint(), SketchLine_18.startPoint())
-SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_28.startPoint(), SketchLine_21.result())
+SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_28.startPoint(), SketchLine_20.result())
SketchConstraintCoincidence_35 = Sketch_2.setCoincident(SketchLine_18.endPoint(), SketchLine_27.result())
-SketchArc_4 = Sketch_2.addArc(-15, 88.20204102886706, -15.00002220451297, 98.20204102886706, -25, 88.20203643108667, False)
+SketchArc_4 = Sketch_2.addArc(-15, 88.20204102886699, -15.00000000000001, 98.20204102886699, -25, 88.20204102886699, False)
SketchConstraintCoincidence_36 = Sketch_2.setCoincident(SketchArc_4.startPoint(), SketchLine_19.endPoint())
SketchConstraintCoincidence_37 = Sketch_2.setCoincident(SketchArc_4.endPoint(), SketchLine_17.startPoint())
SketchConstraintTangent_7 = Sketch_2.setTangent(SketchArc_4.results()[1], SketchLine_19.result())
SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_2.results()[1], 10)
SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_1.results()[1], 10)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_24f-SketchLine_28f-SketchLine_26f-SketchLine_27f-SketchArc_1_2f-SketchArc_2_2f-SketchArc_3_2f-SketchArc_4_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/To_Face_1"), -30, model.selection(), 0)
-Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "Extrusion_1_1/From_Face_1&Extrusion_1_1/Generated_Face_8"), "inclinaison")
-Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "PartSet/OZ"), "angle1")
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_24f-SketchArc_2_2f-SketchLine_26f-SketchArc_3_2f-SketchLine_27f-SketchArc_4_2f-SketchLine_28f-SketchArc_1_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/To_Face"), -30, model.selection(), 0)
+Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_24][Extrusion_1_1/From_Face]"), "inclinaison")
+Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_1_1")], model.selection("EDGE", "PartSet/OZ"), "angle1")
Recover_1 = model.addRecover(Part_1_doc, Rotation_2, [Rotation_1.result()])
Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_1_1")], model.selection("EDGE", "PartSet/OZ"), "angle2")
Rotation_3.setName("Rotation_4")
Rotation_5 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_3_1")], model.selection("EDGE", "PartSet/OZ"), "-angle1")
Rotation_5.setName("Rotation_6")
Rotation_5.result().setName("Rotation_6_1")
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Rotation_4_1"), model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Rotation_6_1"), model.selection("SOLID", "Rotation_5_1")])
+Cut_1_objects_2 = [model.selection("SOLID", "Rotation_4_1"), model.selection("SOLID", "Rotation_2_1"), model.selection("SOLID", "Rotation_6_1"), model.selection("SOLID", "Rotation_5_1")]
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], Cut_1_objects_2)
+model.do()
model.end()
-assert(Boolean_1.result().shapeType() == 'SOLID')
+assert(Cut_1.result().shapeType() == 'SOLID')
assert(Part_1_doc.size("Bodies") == 1)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Translation_1_1"), model.selection("FACE", "Face_1_1")])
Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("SHELL", "Shell_1_1"))
-Remove_SubShapes_1.setSubShapesToRemove([model.selection("FACE", "Shell_1_1/Modified_Face_2")])
+Remove_SubShapes_1.setSubShapesToRemove([model.selection("FACE", "Shell_1_1/Modified_Face&Face_2_1/Face_2_1")])
model.do()
model.checkResult(Remove_SubShapes_1, model, 1, [0], [0], [1], [4], [8])
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_4.result())
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 20)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 2, 2)
Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_1_1_2")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_4.result())
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 20)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 2, 2)
Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_1_1_2")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from GeomAPI import *
SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_1.result(), SketchLine_4.result())
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 20)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")])
LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OZ"), 2, 2)
Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_1_1_2")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
aSession.finishOperation()
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
#=========================================================================
# Create a sketch line to revol
assert (aRevolFt.getKind() == "Revolution")
# selection type FACE=4
aRevolFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
aRevolFt.string("CreationMethod").setValue("ByAngles")
aRevolFt.real("from_angle").setValue(10)
assert (aRevolFt.getKind() == "Revolution")
# selection type FACE=4
aRevolFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
aRevolFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
aRevolFt.real("from_angle").setValue(0) #TODO: remove
assert (aRevolFt.getKind() == "Revolution")
# selection type FACE=4
aRevolFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
aRevolFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
aRevolFt.real("from_angle").setValue(0) #TODO: remove
# Make extrusion on circle
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aLineSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aLineSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace_1")
+aLineSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace")
aSketchLine = aLineSketchFeature.addFeature("SketchLine")
aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint"))
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face")
aSession.startOperation()
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
# Make extrusion on circle
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aLineSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aLineSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace_1")
+aLineSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/TopFace")
aSketchLine = aLineSketchFeature.addFeature("SketchLine")
aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint"))
dirx.setValue(1, 0, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
-aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face_1")
+aCircleSketchFeature.selection("External").selectSubShape("face", "Extrusion_1/To_Face")
aSession.startOperation()
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("circle_center"))
# Make extrusion on circle
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 =model.addBox(Part_1_doc, 10, 10, 10)
+model.end()
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+
+aShapeToMove = Box_1.feature().lastResult()
+
+# Verify Rotation errors on low-level
+aSession.startOperation()
+aRotation = featureToCompositeFeature(Part_1.feature()).addFeature("Rotation")
+aRotation.string("CreationMethod").setValue("ByAxisAndAngle")
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
+
+aSession.startOperation()
+aRotation.selectionList("main_objects").append(aShapeToMove, aShapeToMove.shape())
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
+
+aSession.startOperation()
+aRotation.selectionList("main_objects").append(None, None)
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
+
+aSession.startOperation()
+aRotation.string("CreationMethod").setValue("ByThreePoints")
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
+
+aSession.startOperation()
+aRotation.selectionList("main_objects").removeLast()
+aRotation.selectionList("main_objects").removeLast()
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
+
+aSession.startOperation()
+aRotation.selectionList("main_objects").append(aShapeToMove, aShapeToMove.shape())
+aRotation.string("CreationMethod").setValue("ByAxisAndAngle")
+aRotation.selection("axis_object").selectSubShape("FACE", "Box_1_1/Back")
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
+
+aSession.startOperation()
+aRotation.selection("axis_object").selectSubShape("COMPOUND", "Box_1_1/Back")
+aRotation.execute()
+aSession.finishOperation()
+assert(aRotation.error() != "")
anExtrusions = []
for i in range(0, N * N):
- aSketchResult = aSketchFeatures[i].firstResult()
- aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
- origin = geomDataAPI_Point(aSketchFeatures[i].attribute("Origin")).pnt()
- dirX = geomDataAPI_Dir(aSketchFeatures[i].attribute("DirX")).dir()
- norm = geomDataAPI_Dir(aSketchFeatures[i].attribute("Norm")).dir()
- aSketchFaces = ShapeList()
- GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
-
+ aSketchResult = modelAPI_ResultConstruction(aSketchFeatures[i].firstResult())
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
anExtrusionFt.selectionList("base").append(
- aSketchResult, aSketchFaces[0])
+ aSketchResult, aSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt.real("to_size").setValue(10)
anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
- # v1.0.2 from master
- # anExtrusionFt.selection("extrusion_face").setValue(
- # aSketchResult, aSketchFaces[0])
- # anExtrusionFt.real("extrusion_size").setValue(10)
- # anExtrusionFt.boolean("extrusion_reverse").setValue(False)
anExtrusions.append(anExtrusionFt)
aSession.finishOperation()
#=========================================================================
# Build a big box extrusion
#=========================================================================
-aSketchResult = aQuadrangleSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aQuadrangleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aQuadrangleSketchFeature.firstResult())
# Create extrusion on them
aBox = aPart.addFeature("Extrusion")
aBox.selectionList("base").append(
- aSketchResult, aSketchFaces[0])
+ aSketchResult, aSketchResult.face(0))
aBox.string("CreationMethod").setValue("BySizes")
aBox.real("from_size").setValue(0)
aBox.real("to_size").setValue(10)
aBox.real("to_offset").setValue(0) #TODO: remove
aBox.real("from_offset").setValue(0) #TODO: remove
-# v 1.0.2 from master
-# aBox.selection("extrusion_face").setValue(
-# aSketchResult, aSketchFaces[0])
-# aBox.real("extrusion_size").setValue(10)
-# aBox.boolean("extrusion_reverse").setValue(False)
aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+Symmetry_1 = model.addSymmetry(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("VERTEX", "Part_1/[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), False)
+Symmetry_2 = model.addSymmetry(partSet, [model.selection("COMPOUND", "Symmetry_1/")], model.selection("EDGE", "Symmetry_1/[Box_1_1/Back][Box_1_1/Left]"), False)
+Symmetry_3 = model.addSymmetry(partSet, [model.selection("COMPOUND", "Symmetry_2/")], model.selection("FACE", "Symmetry_2/Box_1_1/Bottom"), True)
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Symmetry_3, 2)
+model.testNbSubResults(Symmetry_3, [0, 0])
+model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.SOLID, [1, 1])
+model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.FACE, [6, 6])
+model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.EDGE, [24, 24])
+model.testNbSubShapes(Symmetry_3, GeomAPI_Shape.VERTEX, [48, 48])
+model.testResultsVolumes(Symmetry_3, [-1000, 1000])
# Make extrusion on circle
#=========================================================================
# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+Translation_1 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OX"), 10)
+Translation_2 = model.addTranslation(partSet, [model.selection("COMPOUND", "Translation_1/")], 0, 10, 0)
+Translation_3 = model.addTranslation(partSet, [model.selection("COMPOUND", "Translation_2/")], model.selection("VERTEX", "Translation_2/[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "Translation_2/[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"))
+model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Translation_1, 1)
+model.testNbSubResults(Translation_1, [0])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.FACE, [6])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.EDGE, [24])
+model.testNbSubShapes(Translation_1, GeomAPI_Shape.VERTEX, [48])
+model.testResultsVolumes(Translation_1, [1000])
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint())
SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")])
Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OY"), 200, 0)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "Revolution_1_1")])
Union_1 = model.addUnion(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2")])
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
## version 2.1 of the License, or (at your option) any later version.
##
## This library is distributed in the hope that it will be useful,
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint())
SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result())
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")])
Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OY"), 360, 0)
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/XOY"), model.selection("FACE", "Revolution_1_1")])
-Union_1 = model.addUnion(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2"), model.selection("FACE", "Partition_1_1_3"), model.selection("FACE", "Partition_1_1_4")])
+Partition_1_objects = [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/XOY"), model.selection("FACE", "Revolution_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+Union_1_objects = [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2"), model.selection("FACE", "Partition_1_1_3"), model.selection("FACE", "Partition_1_1_4")]
+Union_1 = model.addUnion(Part_1_doc, Union_1_objects)
model.testHaveNamingSubshapes(Union_1,model,Part_1_doc)
model.do()
model.end()
-## Copyright (C) 2017 CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.startPoint())
model.do()
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"))
SketchLine_6 = Sketch_2.addLine(31.85610465116278, -38.16860465116279, -40.43276493886778, -56.03425756438362)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_6.startPoint(), SketchPoint_1.result())
SketchLine_7 = Sketch_2.addLine(-40.43276493886778, -56.03425756438362, -115.5003601973775, -26.06900348999911)
SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
SketchLine_9 = Sketch_2.addLine(-106.2327558444751, 34.47934494896344, -44.48110465116279, 12.33139534883721)
SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_5e"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), False)
SketchPoint_2 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchPoint_2.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_6"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_8")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "PartSet/YOZ")])
-Union_1 = model.addUnion(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_3"), model.selection("FACE", "Partition_1_1_4")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchLine_5")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Face_2_objects = [model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_2/SketchLine_6"), model.selection("EDGE", "Sketch_2/SketchLine_7"), model.selection("EDGE", "Sketch_2/SketchLine_8")]
+Face_2 = model.addFace(Part_1_doc, Face_2_objects)
+Partition_1_objects = [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "PartSet/YOZ")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+Union_1_objects = [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_3"), model.selection("FACE", "Partition_1_1_4")]
+Union_1 = model.addUnion(Part_1_doc, Union_1_objects)
model.do()
model.checkResult(Union_1,model,1,[2],[0],[2],[13],[26])
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchCircle_1 = Sketch_1.addCircle(-5.197255574614073, 0.1732418524871273, 67.586529314451)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
+Partition_1_objects = [model.selection("FACE", "Face_1_1"), model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
Union_1 = model.addUnion(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2")])
model.do()
model.end()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Partition_1_objects = [model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("SOLID", "Box_1_1")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Partition_1_1_3"), model.selection("SOLID", "Partition_1_1_1")])
-Union_2 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Partition_1_1_4/Partition_1_1_4"), model.selection("SOLID", "Partition_1_1_2/Partition_1_1_2")])
+Union_2 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Union_1_1_2"), model.selection("SOLID", "Union_1_1_1")])
+model.do()
model.end()
from GeomAPI import GeomAPI_Shape
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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.standardPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(0, -30, 15)
+SketchCircle_2 = Sketch_1.addCircle(10, -25, 10)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+
+Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_1"), model.selection("COMPOUND", "Sketch_1")])
+assert(Union_1.feature().error() != "")
+Part_1_doc.removeFeature(Union_1.feature())
+
+model.end()
label="Direction"
tooltip="Select an edge for direction"
shape_types="edge"
+ geometrical_selection="true"
default="<base normal>">
<validator id="GeomValidators_ShapeType" parameters="empty,line"/>
</shape_selector>
label="Plane face"
tooltip="Bounding plane (select a planar face)"
shape_types="face"
+ geometrical_selection="true"
default="<base sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
label="Plane face"
tooltip="Bounding plane (select a planar face)"
shape_types="face"
+ geometrical_selection="true"
default="<base sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
label="Direction"
tooltip="Select an edge for direction"
shape_types="edge"
+ geometrical_selection="true"
default="<base normal>">
<validator id="GeomValidators_ShapeType" parameters="empty,line"/>
</shape_selector>
label="Plane face"
tooltip="Bounding plane (select a planar face)"
shape_types="face"
+ geometrical_selection="true"
default="<base sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
label="Plane face"
tooltip="Bounding plane (select a planar face)"
shape_types="face"
+ geometrical_selection="true"
default="<base sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
label="Direction"
tooltip="Select an edge for direction"
shape_types="edge"
+ geometrical_selection="true"
default="<base normal>">
<validator id="GeomValidators_ShapeType" parameters="empty,line"/>
</shape_selector>
label="Plane face"
tooltip="Bounding plane (select a planar face)"
shape_types="face"
+ geometrical_selection="true"
default="<base sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
label="Plane face"
tooltip="Bounding plane (select a planar face)"
shape_types="face"
+ geometrical_selection="true"
default="<base sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
label="Axis"
tooltip="Select an edge for the axis of rotation"
shape_types="edge"
- default="">
+ default=""
+ geometrical_selection="true">
<validator id="GeomValidators_ShapeType" parameters="line"/>
</shape_selector>
<optionalbox id="use_step_angular" title="Angular step">
label="Axis"
tooltip="Select an edge for the first direction"
shape_types="edge"
- default="">
+ default=""
+ geometrical_selection="true">
<validator id="GeomValidators_ShapeType" parameters="line"/>
</shape_selector>
<doublevalue id="step_first_dir"
label="Axis"
tooltip="Select an edge for the second direction"
shape_types="edge"
- default="">
+ default=""
+ geometrical_selection="true">
<validator id="GeomValidators_ShapeType" parameters="line"/>
</shape_selector>
<doublevalue id="step_second_dir"
label="Select an object"
icon="icons/Features/placement_from.png"
tooltip="Select a start face, edge or vertex"
- shape_types="face edge vertex">
+ shape_types="face edge vertex"
+ geometrical_selection="true">
<validator id="GeomValidators_BodyShapes"/>
</shape_selector>
<shape_selector id="placement_end_shape"
label="Select an object"
icon="icons/Features/placement_to.png"
tooltip="Select an end face, edge or vertex"
- shape_types="face edge vertex">
+ shape_types="face edge vertex"
+ geometrical_selection="true">
<validator id="PartSet_DifferentObjects"/>
<validator id="GeomValidators_BodyShapes"/>
</shape_selector>
label="Axis"
tooltip="Select an edge for axis"
shape_types="edge"
+ geometrical_selection="true"
default="">
<validator id="GeomValidators_ShapeType" parameters="line"/>
</shape_selector>
label="Plane face"
tooltip="Bounding plane (select a planar face)"
shape_types="face"
+ geometrical_selection="true"
default="<base sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
label="Plane face"
tooltip="Bounding plane (select a planar face)"
shape_types="face"
+ geometrical_selection="true"
default="<base sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
label="Axis"
tooltip="Select an edge for axis"
shape_types="edge"
+ geometrical_selection="true"
default="">
<validator id="GeomValidators_ShapeType" parameters="line"/>
</shape_selector>
label="Plane face"
tooltip="Bounding plane (select a planar face)"
shape_types="face"
+ geometrical_selection="true"
default="<sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
label="Plane face"
tooltip="Bounding plane (select a planar face)"
shape_types="face"
+ geometrical_selection="true"
default="<sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
label="Axis"
tooltip="Select an edge for axis"
shape_types="edge"
+ geometrical_selection="true"
default="">
<validator id="GeomValidators_ShapeType" parameters="line"/>
</shape_selector>
label="Plane face"
tooltip="Bounding plane (select a planar face)"
shape_types="face"
+ geometrical_selection="true"
default="<sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
label="Plane face"
tooltip="Bounding plane (select a planar face)"
shape_types="face"
+ geometrical_selection="true"
default="<sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
label="Axis"
tooltip="Select an edge for axis"
shape_types="edge"
- default="">
+ default=""
+ geometrical_selection="true">
<validator id="GeomValidators_ShapeType" parameters="line"/>
</shape_selector>
<doublevalue id="angle"
label="Axis"
tooltip="Select an axis"
shape_types="edge"
- default="">
+ default=""
+ geometrical_selection="true">
<validator id="GeomValidators_ShapeType" parameters="line"/>
</shape_selector>
</box>
label="Axis"
tooltip="Select an edge for axis"
shape_types="edge"
- default="">
+ default=""
+ geometrical_selection="true">
<validator id="GeomValidators_ShapeType" parameters="line"/>
</shape_selector>
<doublevalue id="distance"
theConeSegmentAlgo->prepareNamingFaces();
// Insert to faces
- int num = 1;
std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
theConeSegmentAlgo->getCreatedFaces();
- for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
- it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
- std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
- theResultConeSegment->generated(aFace, (*it).first, num++);
+ for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+ it != listOfFaces.end();
+ ++it)
+ {
+ theResultConeSegment->generated((*it).second, (*it).first);
}
}
// Insert to faces
// Naming for faces and edges
- int num = 1;
std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
theEllipsoidAlgo->getCreatedFaces();
- for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
- it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
- std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
- theResultEllipsoid->generated(aFace, (*it).first, num++);
+ for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+ it!=listOfFaces.end();
+ ++it)
+ {
+ theResultEllipsoid->generated((*it).second, (*it).first);
}
// Naming vertices
GeomAPI_DataMapOfShapeShape aVertices;
- GeomAPI_ShapeExplorer aVertExp(theEllipsoidAlgo->shape(), GeomAPI_Shape::VERTEX);
- for(int anIndex = 1; aVertExp.more(); aVertExp.next()) {
+ int anIndex = 1;
+ for (GeomAPI_ShapeExplorer aVertExp(theEllipsoidAlgo->shape(), GeomAPI_Shape::VERTEX);
+ aVertExp.more();
+ aVertExp.next())
+ {
if (!aVertices.isBound(aVertExp.current())) {
std::ostringstream aStream;
aStream<<"Vertex_"<<anIndex++;
- theResultEllipsoid->generated(aVertExp.current(), aStream.str(), num++);
+ theResultEllipsoid->generated(aVertExp.current(), aStream.str());
aVertices.bind(aVertExp.current(), aVertExp.current());
}
}
virtual std::shared_ptr<GeomAPI_Pnt> middlePoint() const;
};
-//! Pointer on attribute object
+//! Pointer on object
typedef std::shared_ptr<GeomAPI_Edge> GeomEdgePtr;
#endif
return false;
TopoDS_Shape& aMyShape = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
TopoDS_Shape aTheShape = theShape->impl<TopoDS_Shape>();
+ if (aMyShape.ShapeType() != aTheShape.ShapeType()) // to don't confuse by the face of same edges
+ return false;
TopExp_Explorer aMyExp(aMyShape, TopAbs_EDGE);
TopExp_Explorer aTheExp(aTheShape, TopAbs_EDGE);
for (; aMyExp.More() && aTheExp.More(); aMyExp.Next(), aTheExp.Next()) {
* \ingroup DataModel
* \brief Interface to the set of edges located in one plane
*
- * Normally this interface corresponds to theedges of the sketch
+ * Normally this interface corresponds to the edges of the sketch
*/
class GeomAPI_PlanarEdges : public GeomAPI_Shape
{
return aMyPln.Distance(anOtherPln);
}
+double GeomAPI_Pln::distance(const std::shared_ptr<GeomAPI_Pnt> thePoint) const
+{
+ const gp_Pln& aMyPln = impl<gp_Pln>();
+ const gp_Pnt& aPnt = thePoint->impl<gp_Pnt>();
+ return aMyPln.Distance(aPnt);
+}
+
void GeomAPI_Pln::translate(const std::shared_ptr<GeomAPI_Dir> theDir, double theDist)
{
gp_Vec aVec(theDir->impl<gp_Dir>());
GEOMAPI_EXPORT
double distance(const std::shared_ptr<GeomAPI_Pln> thePlane) const;
+ /// \return distance from a point to this plane.
+ GEOMAPI_EXPORT
+ double distance(const std::shared_ptr<GeomAPI_Pnt> thePoint) const;
+
/// Translates the plane along direction theDir on distance theDist
GEOMAPI_EXPORT
void translate(const std::shared_ptr<GeomAPI_Dir> theDir, const double theDist);
//==================================================================================================
GeomShapePtr GeomAPI_Tools::getTypedShape(const GeomShapePtr& theShape)
{
+ if (!theShape.get())
+ return GeomShapePtr();
+
GeomShapePtr aTypedShape = theShape;
GeomAPI_Shape::ShapeType aType = theShape->shapeType();
GEOMAPI_EXPORT double squareModulus() const;
};
+//! Pointer on object
+typedef std::shared_ptr<GeomAPI_XYZ> GeomXYZPtr;
+
#endif
SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchPoint_2.coordinates(), SketchCircle_1.results()[1])
SketchConstraintDistance_4 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.endPoint(), 325)
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchLine_7r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_1")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_2_2f-SketchLine_7r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7")])
from GeomAPI import *
ParamAngle = model.addParameter(Part_1_doc, "Angle", "30")
Box_1 = model.addBox(Part_1_doc, "BoxSize", "BoxSize", "BoxSize")
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
-SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top"), False)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchLine_1 = Sketch_1.addLine(30, 10, 10, 10)
SketchLine_2 = Sketch_1.addLine(10, 10, 10, 20)
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "Width")
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), "Depth")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), "Height", 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), "Height", 0)
model.do()
# Test 1. Check boxes
checkBox(Extrusion_1, aCornerPara, ParamWidth.value(), ParamDepth.value(), ParamHeight.value())
# Test 2. Rotate box to keep it still axes-aligned
-Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1"), 90)
+Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"), 90)
aCornerPara.setX(aCornerPara.x() + ParamWidth.value() - ParamDepth.value())
aCornerPara.setY(aCornerPara.y() - ParamWidth.value())
checkBox(Rotation_1, aCornerPara, ParamDepth.value(), ParamWidth.value(), ParamHeight.value())
# Test 3. Rotate boxes
-Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom"), model.selection("VERTEX", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top"))
+Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]"), model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]"))
Rotation_2 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "Axis_1"), "Angle")
Rotation_3 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Rotation_1_1")], model.selection("EDGE", "Axis_1"), "Angle")
checkRotatedBox(Rotation_3, aCornerPara, aCornerPara1)
# Test 4. Compose a non-closed shell of the box faces and check it is not a box
-Shell_objects = ["Rotation_3_1/Rotated_Face_1", "Rotation_3_1/Rotated_Face_2", "Rotation_3_1/Rotated_Face_3", "Rotation_3_1/Rotated_Face_4"]
+Shell_objects = ["Rotation_3_1/MF:Rotated&Extrusion_1_1/To_Face", "Rotation_3_1/MF:Rotated&Extrusion_1_1/From_Face", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_1", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_2"]
checkShellNotBox(Part_1_doc, Shell_objects)
# Test 5. Compose a shell of all box faces
-Shell_objects = ["Rotation_3_1/Rotated_Face_1", "Rotation_3_1/Rotated_Face_2", "Rotation_3_1/Rotated_Face_3", "Rotation_3_1/Rotated_Face_4", "Rotation_3_1/Rotated_Face_5", "Rotation_3_1/Rotated_Face_6"]
+Shell_objects = ["Rotation_3_1/MF:Rotated&Extrusion_1_1/To_Face", "Rotation_3_1/MF:Rotated&Extrusion_1_1/From_Face", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_1", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_2", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_3", "Rotation_3_1/MF:Rotated&Sketch_1/SketchLine_4"]
checkShellRotatedBox(Part_1_doc, Shell_objects, aCornerPara, aCornerPara1)
model.end()
anAxis = GeomAPI.GeomAPI_Dir(0, 0, 1)
checkConeAll(Part_1_doc, Cone_1, "Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR2.value(), ParamR1.value(), ParamH.value())
checkCircleFace(Part_1_doc, "Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
-checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
+checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
checkCircleFace(Part_1_doc, "Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
-checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
-checkSegment(Part_1_doc, "Cone_1_1/Face_1", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
+checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
+checkSegment(Part_1_doc, "[Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
# Test 2. Update cone radii
ParamR1.setValue(0)
anApex.setZ(0)
checkConeAll(Part_1_doc, Cone_1, "Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
checkCircleFace(Part_1_doc, "Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
-checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
-checkSegment(Part_1_doc, "Cone_1_1/Face_1", GeomAPI.GeomAPI_Pnt(0, 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
+checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
+checkSegment(Part_1_doc, "[Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
checkVertex(Part_1_doc, "Cone_1_1/Vertex_2", GeomAPI.GeomAPI_Pnt(0, 0, 0))
ParamR2.setValue(50)
anApex.setZ(-ParamR1.value() / math.tan(aSemiAngle))
checkConeAll(Part_1_doc, Cone_1, "Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
checkCircleFace(Part_1_doc, "Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
-checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
+checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(0, 0, ParamH.value()), ParamR2.value())
checkCircleFace(Part_1_doc, "Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
-checkCircleEdge(Part_1_doc, "Cone_1_1/Face_1&Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
-checkSegment(Part_1_doc, "Cone_1_1/Face_1", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
+checkCircleEdge(Part_1_doc, "[Cone_1_1/Face_1][Cone_1_1/Face_3]", GeomAPI.GeomAPI_Pnt(0, 0, 0), ParamR1.value())
+checkSegment(Part_1_doc, "[Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value(), 0, ParamH.value()))
# Test 3. Translate cone
Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Cone_1_1")], model.selection("EDGE", "PartSet/OX"), "Shift")
anApex.setX(anApex.x() + ParamShift.value())
-checkConeAll(Part_1_doc, Translation_1, "Translation_1_1/Translated_Face_3", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
-checkCircleFace(Part_1_doc, "Translation_1_1/Translated_Face_2", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value())
-checkCircleEdge(Part_1_doc, "Translation_1_1/Translated_Face_3&Translation_1_1/Translated_Face_2", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value())
-checkCircleFace(Part_1_doc, "Translation_1_1/Translated_Face_1", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value())
-checkCircleEdge(Part_1_doc, "Translation_1_1/Translated_Face_3&Translation_1_1/Translated_Face_1", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value())
-checkSegment(Part_1_doc, "Translation_1_1/Translated_Face_3", GeomAPI.GeomAPI_Pnt(ParamR1.value() + ParamShift.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value() + ParamShift.value(), 0, ParamH.value()))
+checkConeAll(Part_1_doc, Translation_1, "Translation_1_1/MF:Translated&Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
+checkCircleFace(Part_1_doc, "Translation_1_1/MF:Translated&Cone_1_1/Face_2", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value())
+checkCircleEdge(Part_1_doc, "[Translation_1_1/MF:Translated&Cone_1_1/Face_1][Translation_1_1/MF:Translated&Cone_1_1/Face_2]", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, ParamH.value()), ParamR2.value())
+checkCircleFace(Part_1_doc, "Translation_1_1/MF:Translated&Cone_1_1/Face_3", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value())
+checkCircleEdge(Part_1_doc, "[Translation_1_1/MF:Translated&Cone_1_1/Face_1][Translation_1_1/MF:Translated&Cone_1_1/Face_3]", GeomAPI.GeomAPI_Pnt(ParamShift.value(), 0, 0), ParamR1.value())
+checkSegment(Part_1_doc, "[Translation_1_1/MF:Translated&Cone_1_1/Face_1][weak_name_3]", GeomAPI.GeomAPI_Pnt(ParamR1.value() + ParamShift.value(), 0, 0), GeomAPI.GeomAPI_Pnt(ParamR2.value() + ParamShift.value(), 0, ParamH.value()))
# Test 4. Rotate cone
Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OY"), "Angle")
x, z = anApex.x(), anApex.z()
anApex.setX(x * math.cos(anAngle) + z * math.sin(anAngle))
anApex.setZ(-x * math.sin(anAngle) + z * math.cos(anAngle))
-checkConeAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_3", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
+checkConeAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Cone_1_1/Face_1", anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
aCenter = GeomAPI.GeomAPI_Pnt(ParamShift.value() * math.cos(anAngle) + ParamH.value() * math.sin(anAngle), 0, -ParamShift.value() * math.sin(anAngle) + ParamH.value() * math.cos(anAngle))
-checkCircleFace(Part_1_doc, "Rotation_1_1/Rotated_Face_2", aCenter, ParamR2.value())
-checkCircleEdge(Part_1_doc, "Rotation_1_1/Rotated_Face_3&Rotation_1_1/Rotated_Face_2", aCenter, ParamR2.value())
+checkCircleFace(Part_1_doc, "Rotation_1_1/MF:Rotated&Cone_1_1/Face_2", aCenter, ParamR2.value())
+checkCircleEdge(Part_1_doc, "[Rotation_1_1/MF:Rotated&Cone_1_1/Face_1][Rotation_1_1/MF:Rotated&Cone_1_1/Face_2]", aCenter, ParamR2.value())
aCenter = GeomAPI.GeomAPI_Pnt(ParamShift.value() * math.cos(anAngle), 0, -ParamShift.value() * math.sin(anAngle))
-checkCircleFace(Part_1_doc, "Rotation_1_1/Rotated_Face_1", aCenter, ParamR1.value())
-checkCircleEdge(Part_1_doc, "Rotation_1_1/Rotated_Face_3&Rotation_1_1/Rotated_Face_1", aCenter, ParamR1.value())
+checkCircleFace(Part_1_doc, "Rotation_1_1/MF:Rotated&Cone_1_1/Face_3", aCenter, ParamR1.value())
+checkCircleEdge(Part_1_doc, "[Rotation_1_1/MF:Rotated&Cone_1_1/Face_1][Rotation_1_1/MF:Rotated&Cone_1_1/Face_3]", aCenter, ParamR1.value())
# Test 5. Split cone by plane and check conical shell and elliptic face
Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 20, False)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Rotation_1_1"), model.selection("FACE", "Plane_1")])
-checkConeShell(Part_1_doc, ["Partition_1_1_1/Modified_Face_2_2", "Partition_1_1_2/Modified_Face_2_2"], anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
+checkConeShell(Part_1_doc, ["Partition_1_1_1/Modified_Face&Cone_1_1/Face_1", "Partition_1_1_2/Modified_Face&Cone_1_1/Face_1"], anApex, anAxis, aSemiAngle, ParamR1.value(), ParamR2.value(), ParamH.value())
aFirstFocus = GeomAPI.GeomAPI_Pnt(20, 0, 31.062397266842858)
aSecondFocus = GeomAPI.GeomAPI_Pnt(20, 0, -1.0935246846933797)
aMajorRadius = 27.91915871311068
aMinorRadius = 22.824955511666207
-checkEllipseFace(Part_1_doc, "Partition_1_1_2/Modified_Face_2_1", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius)
-checkEllipseEdge(Part_1_doc, "Partition_1_1_1/Modified_Face_1_divided_1_e_1", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius)
+checkEllipseFace(Part_1_doc, "_weak_name_1_Partition_1_1_2", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius)
+checkEllipseEdge(Part_1_doc, "Partition_1_1_1/Generated_Edge&Cone_1_1/Face_1", aFirstFocus, aSecondFocus, aMajorRadius, aMinorRadius)
model.end()
ParamAngle = model.addParameter(Part_1_doc, "Angle", "30")
Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), "2*R", "H")
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_2"))
-SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2__cc"), False)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]__cc"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchCircle_1 = Sketch_1.addCircle(0, 0, 10)
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_4.result())
SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_1.result(), "R/2")
SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_2.result(), "H")
-SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"), False)
[SketchPoint_2, SketchPoint_3] = SketchIntersectionPoint_1.intersectionPoints()
SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_1.result())
SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OZ"), False)
SketchLine_5 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_2.endPoint(), SketchLine_5.result())
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection("EDGE", "PartSet/OZ"), 270, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 270, 0)
model.do()
# Test 1. Check cylinders
aLoc3 = GeomAPI.GeomAPI_Pnt(0, 0, 3 * ParamH.value())
anAxis = GeomAPI.GeomAPI_Dir(0, 0, 1)
checkCylinderAll(Part_1_doc, Cylinder_1, "Cylinder_1_1/Face_1", aLoc1, anAxis, 2 * ParamR.value(), ParamH.value())
-checkCylinderAll(Part_1_doc, Extrusion_1, "Extrusion_1_1/Generated_Face_1", aLoc2, anAxis, ParamR.value(), ParamH.value())
+checkCylinderAll(Part_1_doc, Extrusion_1, "Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2", aLoc2, anAxis, ParamR.value(), ParamH.value())
checkNonCylinder(Revolution_1)
-checkCylinderShell(Part_1_doc, ["Revolution_1_1/Generated_Face_4"], aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
-checkCylinderFace(Part_1_doc, "Revolution_1_1/Generated_Face_4", aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
+checkCylinderShell(Part_1_doc, ["Revolution_1_1/Generated_Face&Sketch_2/SketchLine_4"], aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
+checkCylinderFace(Part_1_doc, "Revolution_1_1/Generated_Face&Sketch_2/SketchLine_4", aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
# Test 2. Rotate cylinders
Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Cylinder_1_1")], model.selection("EDGE", "PartSet/OX"), "Angle")
aLoc1 = GeomAPI.GeomAPI_Pnt(0, aLoc1.y() * aCosAngle - aLoc1.z() * aSinAngle, aLoc1.y() * aSinAngle + aLoc1.z() * aCosAngle)
aLoc2 = GeomAPI.GeomAPI_Pnt(0, aLoc2.y() * aCosAngle - aLoc2.z() * aSinAngle, aLoc2.y() * aSinAngle + aLoc2.z() * aCosAngle)
aLoc3 = GeomAPI.GeomAPI_Pnt(0, aLoc3.y() * aCosAngle - aLoc3.z() * aSinAngle, aLoc3.y() * aSinAngle + aLoc3.z() * aCosAngle)
-checkCylinderAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_3", aLoc1, anAxis, 2 * ParamR.value(), ParamH.value())
-checkCylinderAll(Part_1_doc, Rotation_2, "Rotation_2_1/Rotated_Face_3", aLoc2, anAxis, ParamR.value(), ParamH.value())
+checkCylinderAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Cylinder_1_1/Face_1", aLoc1, anAxis, 2 * ParamR.value(), ParamH.value())
+checkCylinderAll(Part_1_doc, Rotation_2, "Rotation_2_1/MF:Rotated&Sketch_1/SketchCircle_1_2", aLoc2, anAxis, ParamR.value(), ParamH.value())
checkNonCylinder(Rotation_3)
-checkCylinderShell(Part_1_doc, ["Rotation_3_1/Rotated_Face_5"], aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
-checkCylinderFace(Part_1_doc, "Rotation_3_1/Rotated_Face_5", aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
+checkCylinderShell(Part_1_doc, ["Rotation_3_1/MF:Rotated&Sketch_2/SketchLine_4"], aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
+checkCylinderFace(Part_1_doc, "Rotation_3_1/MF:Rotated&Sketch_2/SketchLine_4", aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
# Test 3. Split cylinder and compose a shell
Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), "2.2*H", False)
Partition_1_objects = [model.selection("SOLID", "Rotation_3_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
-Shell_1_objects = ["Partition_1_1_1/Modified_Face_3_5", "Partition_1_1_4/Modified_Face_3_3", "Partition_1_1_2/Modified_Face_1_divided_2_1"]
+Shell_1_objects = ["Partition_1_1_1/Modified_Face&Sketch_2/SketchLine_4",
+ "Partition_1_1_4/Modified_Face&Sketch_2/SketchLine_4",
+ "(Partition_1_1_2/Modified_Face&Revolution_1_1/To_Face)(Partition_1_1_2/Modified_Face&Sketch_2/SketchLine_1)"]
checkCylinderShell(Part_1_doc, Shell_1_objects, aLoc3, anAxis, 0.5 * ParamR.value(), ParamH.value())
model.end()
# Test 1. Check face/wire of box is a rectangle
checkRectangleFace(Part_1_doc, "Box_1_1/Top")
-Wire_edges = ["Box_1_1/Left&Box_1_1/Top", "Box_1_1/Front&Box_1_1/Top", "Box_1_1/Right&Box_1_1/Top", "Box_1_1/Back&Box_1_1/Top"]
+Wire_edges = ["[Box_1_1/Left][Box_1_1/Top]", "[Box_1_1/Front][Box_1_1/Top]", "[Box_1_1/Right][Box_1_1/Top]", "[Box_1_1/Back][Box_1_1/Top]"]
checkRectangleWire(Part_1_doc, Wire_edges)
# Test 2. Build a polygon from edges
-Wire_edges = ["Box_1_1/Left&Box_1_1/Bottom", "Box_1_1/Front&Box_1_1/Left", "Box_1_1/Left&Box_1_1/Top", "Box_1_1/Back&Box_1_1/Top", "Box_1_1/Right&Box_1_1/Top"]
+Wire_edges = ["[Box_1_1/Left][Box_1_1/Bottom]", "[Box_1_1/Front][Box_1_1/Left]", "[Box_1_1/Left][Box_1_1/Top]", "[Box_1_1/Back][Box_1_1/Top]", "[Box_1_1/Right][Box_1_1/Top]"]
checkPolygonWire(Part_1_doc, Wire_edges)
# Test 3. Build a polygon from vertices
-Poly_vertices = ["Box_1_1/Back&Box_1_1/Left&Box_1_1/Bottom", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Bottom", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Bottom", "Box_1_1/Front&Box_1_1/Right&Box_1_1/Top", "Box_1_1/Front&Box_1_1/Left&Box_1_1/Top", "Box_1_1/Back&Box_1_1/Right&Box_1_1/Top"]
+Poly_vertices = ["[Box_1_1/Back][Box_1_1/Left][Box_1_1/Bottom]", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Bottom]", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Bottom]", "[Box_1_1/Front][Box_1_1/Right][Box_1_1/Top]", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"]
checkPolyline(Part_1_doc, Poly_vertices)
model.end()
checkSphereShell(theDocument, theFaceName, theCenter, theRadius)
checkSphereFace(theDocument, theFaceName, theCenter, theRadius)
- checkArc(theDocument, theFaceName, theCenter, theRadius)
+
+ anArcName = "[" + theFaceName + "][weak_name_3]"
+ checkArc(theDocument, anArcName, theCenter, theRadius)
model.begin()
model.do()
# Test 1. Compose sphere
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_1f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), "Aperture", 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_1f")], model.selection("EDGE", "Sketch_1/SketchLine_1"), "Aperture", 0)
aCenter = GeomAPI.GeomAPI_Pnt(0, 0, 0)
-checkSphereAll(Part_1_doc, Revolution_1, "Revolution_1_1/Generated_Face_2", aCenter, ParamR.value())
+checkSphereAll(Part_1_doc, Revolution_1, "Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2", aCenter, ParamR.value())
# Test 2. Translate sphere
Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], model.selection("EDGE", "PartSet/OX"), "Shift")
aCenter.setX(aCenter.x() + ParamShift.value())
-checkSphereAll(Part_1_doc, Translation_1, "Translation_1_1/Translated_Face_1", aCenter, ParamR.value())
+checkSphereAll(Part_1_doc, Translation_1, "Translation_1_1/MF:Translated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value())
# Test 3. Rotate sphere
Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("EDGE", "PartSet/OY"), "Angle")
anAngle = ParamAngle.value() * math.pi / 180.0
aCenter.setX(ParamShift.value() * math.cos(anAngle))
aCenter.setZ(-ParamShift.value() * math.sin(anAngle))
-checkSphereAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_1", aCenter, ParamR.value())
+checkSphereAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value())
# Test 4. Check result by changing parameters
ParamR.setValue(100)
model.do()
-checkSphereAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_1", aCenter, ParamR.value())
+checkSphereAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value())
ParamAperture.setValue(270)
model.do()
-checkSphereFace(Part_1_doc, "Rotation_1_1/Rotated_Face_3", aCenter, ParamR.value())
-checkSphereShell(Part_1_doc, "Rotation_1_1/Rotated_Face_3", aCenter, ParamR.value())
-checkArc(Part_1_doc, "Rotation_1_1/Rotated_Face_3&Rotation_1_1/Rotated_Face_1", aCenter, ParamR.value())
-checkArc(Part_1_doc, "Rotation_1_1/Rotated_Face_3&Rotation_1_1/Rotated_Face_2", aCenter, ParamR.value())
+checkSphereFace(Part_1_doc, "Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value())
+checkSphereShell(Part_1_doc, "Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2", aCenter, ParamR.value())
+checkArc(Part_1_doc, "[Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2][Rotation_1_1/MF:Rotated&Revolution_1_1/From_Face]", aCenter, ParamR.value())
+checkArc(Part_1_doc, "[Rotation_1_1/MF:Rotated&Sketch_1/SketchArc_1_2][Rotation_1_1/MF:Rotated&Revolution_1_1/To_Face]", aCenter, ParamR.value())
model.end()
aSinAngle = math.sin(anAngle)
aCenter = GeomAPI.GeomAPI_Pnt(0, aCenter.y() * aCosAngle - aCenter.z() * aSinAngle, aCenter.y() * aSinAngle + aCenter.z() * aCosAngle)
anAxis = GeomAPI.GeomAPI_Dir(0, anAxis.y() * aCosAngle - anAxis.z() * aSinAngle, anAxis.y() * aSinAngle + anAxis.z() * aCosAngle)
-checkTorusAll(Part_1_doc, Rotation_1, "Rotation_1_1/Rotated_Face_1", aCenter, anAxis, ParamRMax.value(), ParamRMin.value())
+checkTorusAll(Part_1_doc, Rotation_1, "Rotation_1_1/MF:Rotated&Torus_1_1/Face_1", aCenter, anAxis, ParamRMax.value(), ParamRMin.value())
# Test 3. Split torus and compose a shell
Partition_1_objects = [model.selection("SOLID", "Rotation_1_1"), model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/XOY")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
-Shell_1_objects = ["Partition_1_1_6/Modified_Face_4_4", "Partition_1_1_7/Modified_Face_4_3", "Partition_1_1_7/Modified_Face_1_divided_2_1", "Partition_1_1_5/Modified_Face_4_4"]
+Shell_1_objects = ["Partition_1_1_6/Modified_Face&Torus_1_1/Face_1",
+ "Partition_1_1_7/Modified_Face&Torus_1_1/Face_1&weak_name_2",
+ "Partition_1_1_7/Modified_Face&Torus_1_1/Face_1&weak_name_1",
+ "Partition_1_1_5/Modified_Face&Torus_1_1/Face_1"]
checkTorusShell(Part_1_doc, Shell_1_objects, aCenter, anAxis, ParamRMax.value(), ParamRMin.value())
model.end()
//==================================================================================================
GeomAlgoAPI_Intersection::GeomAlgoAPI_Intersection(const ListOfShape& theObjects)
+ : myFiller(0)
{
build(theObjects);
}
+GeomAlgoAPI_Intersection::~GeomAlgoAPI_Intersection() {
+ if (myFiller)
+ delete (BOPAlgo_PaveFiller*)myFiller;
+}
//==================================================================================================
void GeomAlgoAPI_Intersection::build(const ListOfShape& theObjects)
{
}
}
- BOPAlgo_PaveFiller aDSFiller;
- aDSFiller.SetArguments(anObjects);
+ BOPAlgo_PaveFiller* aDSFiller = new BOPAlgo_PaveFiller;
+ myFiller = aDSFiller;
+ aDSFiller->SetArguments(anObjects);
- aDSFiller.SetRunParallel(false);
- aDSFiller.SetNonDestructive(false);
- aDSFiller.SetGlue(BOPAlgo_GlueOff);
+ aDSFiller->SetRunParallel(false);
+ aDSFiller->SetNonDestructive(false);
+ aDSFiller->SetGlue(BOPAlgo_GlueOff);
// optimization for the issue #2399
BOPAlgo_SectionAttribute theSecAttr(Standard_True,
Standard_True,
Standard_True);
- aDSFiller.SetSectionAttribute(theSecAttr);
+ aDSFiller->SetSectionAttribute(theSecAttr);
- aDSFiller.Perform();
- if (aDSFiller.HasErrors()) {
+ aDSFiller->Perform();
+ if (aDSFiller->HasErrors()) {
return;
}
anOperation->SetRunParallel(false);
anOperation->SetCheckInverted(true);
- anOperation->PerformWithFiller(aDSFiller);
+ anOperation->PerformWithFiller(*aDSFiller); // it references a filler fields, so keep the filler
if(anOperation->HasErrors()) {
return;
}
/// \brief Performs the intersection operations.
class GeomAlgoAPI_Intersection : public GeomAlgoAPI_MakeShape
{
+ void* myFiller; ///< store filler to avoid memory leaks
public:
/// \brief Constructor.
/// \param[in] theObjects list of objects.
/// \param[in] theTools list of tools.
GEOMALGOAPI_EXPORT GeomAlgoAPI_Intersection(const ListOfShape& theObjects);
+ /// Destructor to erase the filler
+ GEOMALGOAPI_EXPORT virtual ~GeomAlgoAPI_Intersection();
+
private:
/// Builds resulting shape.
void build(const ListOfShape& theObjects);
+
};
#endif
#include "GeomAlgoAPI_MakeShape.h"
#include <BOPAlgo_Builder.hxx>
+#include <BRep_Tool.hxx>
#include <BRepBuilderAPI_MakeShape.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <BRepGProp.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <GeomAPI_ShapeExplorer.h>
#include <GeomAPI_ShapeIterator.h>
+#include <TopoDS.hxx>
#include <TopoDS_Builder.hxx>
+#include <TopoDS_Edge.hxx>
// new shape -> old shapes -> index in the old shape
typedef NCollection_DataMap<TopoDS_Shape,
NCollection_DataMap<int, NCollection_DataMap<TopoDS_Shape, MapNewToOld, TopTools_ShapeMapHasher> >
HistoryMap;
-//=================================================================================================
+//==================================================================================================
GeomAlgoAPI_MakeShape::GeomAlgoAPI_MakeShape()
: myBuilderType(Unknown),
myDone(false)
myHist = 0;
}
-GeomAlgoAPI_MakeShape::~GeomAlgoAPI_MakeShape() {
+//==================================================================================================
+GeomAlgoAPI_MakeShape::~GeomAlgoAPI_MakeShape()
+{
if (myHist) {
delete (HistoryMap*)myHist;
}
}
-//=================================================================================================
+//==================================================================================================
bool GeomAlgoAPI_MakeShape::isDone() const
{
return myDone;
}
-//=================================================================================================
-const std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_MakeShape::shape() const
+//==================================================================================================
+const GeomShapePtr GeomAlgoAPI_MakeShape::shape() const
{
return myShape;
}
-//=================================================================================================
+//==================================================================================================
bool GeomAlgoAPI_MakeShape::isValid() const
{
BRepCheck_Analyzer aChecker(myShape->impl<TopoDS_Shape>());
return (aChecker.IsValid() == Standard_True);
}
-//=================================================================================================
+//==================================================================================================
bool GeomAlgoAPI_MakeShape::hasVolume() const
{
bool hasVolume = false;
return hasVolume;
}
-//=================================================================================================
+//==================================================================================================
std::shared_ptr<GeomAPI_DataMapOfShapeShape> GeomAlgoAPI_MakeShape::mapOfSubShapes() const
{
return myMap;
}
-//=================================================================================================
-void GeomAlgoAPI_MakeShape::generated(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape& theHistory)
+//==================================================================================================
+void GeomAlgoAPI_MakeShape::generated(const GeomShapePtr theOldShape,
+ ListOfShape& theNewShapes)
{
TopTools_ListOfShape aList;
if(myBuilderType == OCCT_BRepBuilderAPI_MakeShape) {
BRepBuilderAPI_MakeShape* aMakeShape = implPtr<BRepBuilderAPI_MakeShape>();
- aList = aMakeShape->Generated(theShape->impl<TopoDS_Shape>());
+ aList = aMakeShape->Generated(theOldShape->impl<TopoDS_Shape>());
} else if(myBuilderType == OCCT_BOPAlgo_Builder) {
BOPAlgo_Builder* aBOPBuilder = implPtr<BOPAlgo_Builder>();
- aList = aBOPBuilder->Generated(theShape->impl<TopoDS_Shape>());
+ aList = aBOPBuilder->Generated(theOldShape->impl<TopoDS_Shape>());
}
for(TopTools_ListIteratorOfListOfShape anIt(aList); anIt.More(); anIt.Next()) {
- if(anIt.Value().IsNull()) {
- continue;
- }
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ GeomShapePtr aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(anIt.Value()));
- theHistory.push_back(aShape);
+ if (!isValidForHistory(aShape)) continue;
+ fixOrientation(aShape);
+ theNewShapes.push_back(aShape);
}
}
-//=================================================================================================
-void GeomAlgoAPI_MakeShape::modified(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape& theHistory)
+//==================================================================================================
+void GeomAlgoAPI_MakeShape::modified(const GeomShapePtr theOldShape,
+ ListOfShape& theNewShapes)
{
TopTools_ListOfShape aList;
if(myBuilderType == OCCT_BRepBuilderAPI_MakeShape) {
BRepBuilderAPI_MakeShape* aMakeShape = implPtr<BRepBuilderAPI_MakeShape>();
try {
- aList = aMakeShape->Modified(theShape->impl<TopoDS_Shape>());
+ aList = aMakeShape->Modified(theOldShape->impl<TopoDS_Shape>());
} catch(Standard_NoSuchObject) {
}
} else if(myBuilderType == OCCT_BOPAlgo_Builder) {
BOPAlgo_Builder* aBOPBuilder = implPtr<BOPAlgo_Builder>();
- aList = aBOPBuilder->Modified(theShape->impl<TopoDS_Shape>());
+ aList = aBOPBuilder->Modified(theOldShape->impl<TopoDS_Shape>());
}
for(TopTools_ListIteratorOfListOfShape anIt(aList); anIt.More(); anIt.Next()) {
- if(anIt.Value().IsNull()) {
- continue;
- }
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ GeomShapePtr aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(anIt.Value()));
- theHistory.push_back(aShape);
+ if (!isValidForHistory(aShape)) continue;
+ fixOrientation(aShape);
+ theNewShapes.push_back(aShape);
}
}
-//=================================================================================================
-bool GeomAlgoAPI_MakeShape::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShape::isDeleted(const GeomShapePtr theOldShape)
{
bool isDeleted = false;
if(myBuilderType == OCCT_BRepBuilderAPI_MakeShape) {
BRepBuilderAPI_MakeShape* aMakeShape = implPtr<BRepBuilderAPI_MakeShape>();
- isDeleted = aMakeShape->IsDeleted(theShape->impl<TopoDS_Shape>()) == Standard_True;
+ isDeleted = aMakeShape->IsDeleted(theOldShape->impl<TopoDS_Shape>()) == Standard_True;
} else if(myBuilderType == OCCT_BOPAlgo_Builder) {
BOPAlgo_Builder* aBOPBuilder = implPtr<BOPAlgo_Builder>();
- isDeleted = aBOPBuilder->IsDeleted(theShape->impl<TopoDS_Shape>()) == Standard_True;
+ isDeleted = aBOPBuilder->IsDeleted(theOldShape->impl<TopoDS_Shape>()) == Standard_True;
}
return isDeleted;
}
-//=================================================================================================
+//==================================================================================================
void GeomAlgoAPI_MakeShape::setBuilderType(const BuilderType theBuilderType)
{
myBuilderType = theBuilderType;
}
-//=================================================================================================
+//==================================================================================================
void GeomAlgoAPI_MakeShape::setDone(const bool theFlag)
{
myDone = theFlag;
}
-//=================================================================================================
-void GeomAlgoAPI_MakeShape::setShape(const std::shared_ptr<GeomAPI_Shape> theShape)
+//==================================================================================================
+void GeomAlgoAPI_MakeShape::setShape(const GeomShapePtr theShape)
{
if(myShape.get() && myShape->isEqual(theShape)) {
return;
const TopoDS_Shape& aTopoDSShape = myShape->impl<TopoDS_Shape>();
for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_VERTEX); anExp.More(); anExp.Next()) {
- std::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
+ GeomShapePtr aCurrentShape(new GeomAPI_Shape());
aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current()));
myMap->bind(aCurrentShape, aCurrentShape);
}
for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_EDGE); anExp.More(); anExp.Next()) {
- std::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
+ GeomShapePtr aCurrentShape(new GeomAPI_Shape());
aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current()));
myMap->bind(aCurrentShape, aCurrentShape);
}
for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_FACE); anExp.More(); anExp.Next()) {
- std::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
+ GeomShapePtr aCurrentShape(new GeomAPI_Shape());
aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current()));
myMap->bind(aCurrentShape, aCurrentShape);
}
}
}
-//=================================================================================================
-void GeomAlgoAPI_MakeShape::initialize() {
+//==================================================================================================
+bool GeomAlgoAPI_MakeShape::isValidForHistory(const GeomShapePtr theShape)
+{
+ if (!theShape.get()) return false;
+
+ const TopoDS_Shape& aShape_ = theShape->impl<TopoDS_Shape>();
+ if (aShape_.IsNull()) return false;
+
+ if (aShape_.ShapeType() == TopAbs_EDGE) {
+ TopoDS_Edge anEdge_ = TopoDS::Edge(aShape_);
+ if (BRep_Tool::Degenerated(anEdge_)) return false;
+ }
+
+ return true;
+}
+
+//==================================================================================================
+void GeomAlgoAPI_MakeShape::fixOrientation(GeomShapePtr& theShape) {
+ if (myMap->isBound(theShape)) theShape = myMap->find(theShape);
+}
+
+//==================================================================================================
+void GeomAlgoAPI_MakeShape::initialize()
+{
switch (myBuilderType) {
case OCCT_BRepBuilderAPI_MakeShape: {
myDone = implPtr<BRepBuilderAPI_MakeShape>()->IsDone() == Standard_True;
const TopoDS_Shape& aTopoDSShape = myShape->impl<TopoDS_Shape>();
for(TopExp_Explorer anExp(aTopoDSShape,TopAbs_FACE); anExp.More(); anExp.Next()) {
- std::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
+ GeomShapePtr aCurrentShape(new GeomAPI_Shape());
aCurrentShape->setImpl(new TopoDS_Shape(anExp.Current()));
myMap->bind(aCurrentShape, aCurrentShape);
}
}
-//=================================================================================================
+//==================================================================================================
void GeomAlgoAPI_MakeShape::prepareNamingFaces()
{
long long index = 1;
GeomAPI_ShapeExplorer anExp(shape(), GeomAPI_Shape::FACE);
for(GeomAPI_ShapeExplorer anExp(shape(), GeomAPI_Shape::FACE); anExp.more(); anExp.next()) {
- std::shared_ptr<GeomAPI_Shape> aFace = anExp.current();
+ GeomShapePtr aFace = anExp.current();
myCreatedFaces["Face_" + std::to_string(index++)] = aFace;
}
}
-//=================================================================================================
-bool GeomAlgoAPI_MakeShape::checkValid(std::string theMessage){
-
+//==================================================================================================
+bool GeomAlgoAPI_MakeShape::checkValid(std::string theMessage)
+{
// isValid() is called from this method
if (!isValid()) {
myError = theMessage + " :: resulting shape is not valid.";
return true ;
}
-bool GeomAlgoAPI_MakeShape::newShapesCollected(
- std::shared_ptr<GeomAPI_Shape> theWholeOld, const int theShapeType)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShape::isNewShapesCollected(GeomShapePtr theWholeOld,
+ const int theShapeType)
{
if (!myHist)
return false;
}
void GeomAlgoAPI_MakeShape::collectNewShapes(
- std::shared_ptr<GeomAPI_Shape> theWholeOld, const int theShapeType)
+ GeomShapePtr theWholeOld, const int theShapeType)
{
if (!myHist)
myHist = new HistoryMap;
}
}
-std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_MakeShape::oldShapesForNew(
- std::shared_ptr<GeomAPI_Shape> theWholeOld,
- std::shared_ptr<GeomAPI_Shape> theNewShape, const int theShapeType)
+//==================================================================================================
+GeomShapePtr GeomAlgoAPI_MakeShape::oldShapesForNew(GeomShapePtr theWholeOld,
+ GeomShapePtr theNewShape,
+ const int theShapeType)
{
GeomShapePtr aResult(new GeomAPI_Shape);
TopoDS_Compound aResComp;
/// \brief Constructor by builder and builder type.
/// \param[in] theBuilder pointer to the builder.
/// \param[in] theBuilderType builder type.
- template<class T> explicit GeomAlgoAPI_MakeShape(T* theBuilder,
+ template<class T> explicit GeomAlgoAPI_MakeShape(
+ T* theBuilder,
const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape)
: GeomAPI_Interface(theBuilder),
myBuilderType(theBuilderType)
/// \brief Initializes internals.
/// \param[in] theBuilder pointer to the builder.
/// \param[in] theBuilderType builder type.
- template<class T> void initialize(T* theBuilder,
+ template<class T> void initialize(
+ T* theBuilder,
const BuilderType theBuilderType = OCCT_BRepBuilderAPI_MakeShape)
{
setImpl(theBuilder);
GEOMALGOAPI_EXPORT bool isDone() const;
/// \return a shape built by the shape construction algorithm.
- GEOMALGOAPI_EXPORT virtual const std::shared_ptr<GeomAPI_Shape> shape() const;
+ GEOMALGOAPI_EXPORT virtual const GeomShapePtr shape() const;
/// \return true if resulting shape is valid.
GEOMALGOAPI_EXPORT bool isValid() const;
GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_DataMapOfShapeShape> mapOfSubShapes() const;
/// \return the list of shapes generated from the shape \a theShape.
- /// \param[in] theShape base shape.
- /// \param[out] theHistory generated shapes.
- GEOMALGOAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape& theHistory);
+ /// \param[in] theOldShape base shape.
+ /// \param[out] theNewShapes shapes generated from \a theShape. Does not cleared!
+ GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theOldShape,
+ ListOfShape& theNewShapes);
/// \return the list of shapes modified from the shape \a theShape.
- /// \param[in] theShape base shape.
- /// \param[out] theHistory modified shapes. Does not cleared!
- GEOMALGOAPI_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape& theHistory);
+ /// \param[in] theOldShape base shape.
+ /// \param[out] theNewShapes shapes modified from \a theShape. Does not cleared!
+ GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theOldShape,
+ ListOfShape& theNewShapes);
/// \return true if theShape was deleted.
- /// \param[in] theShape base shape.
- GEOMALGOAPI_EXPORT virtual bool isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
+ /// \param[in] theOldShape base shape.
+ GEOMALGOAPI_EXPORT virtual bool isDeleted(const GeomShapePtr theOldShape);
/// \return true if the data were correct.
GEOMALGOAPI_EXPORT virtual bool check() { return true; };
+ /// \brief Prepare the naming of faces.
+ GEOMALGOAPI_EXPORT virtual void prepareNamingFaces();
+
/// \return the list of created faces.
- GEOMALGOAPI_EXPORT std::map< std::string, std::shared_ptr<GeomAPI_Shape> > getCreatedFaces()
- {return myCreatedFaces;}
+ GEOMALGOAPI_EXPORT std::map< std::string, GeomShapePtr > getCreatedFaces() {
+ return myCreatedFaces;
+ }
/// \return the error.
GEOMALGOAPI_EXPORT std::string getError() { return myError; }
- /// \brief Prepare the naming of faces.
- GEOMALGOAPI_EXPORT virtual void prepareNamingFaces();
-
/// \brief Check the validity of the produced shape.
GEOMALGOAPI_EXPORT bool checkValid(std::string theMessage);
/// \param theWholeOld the whole old shape
/// \param theShapeType type of the sub-shapes that is used for optimization
/// \returns true if optimization containers are already filled
- GEOMALGOAPI_EXPORT bool newShapesCollected(
- std::shared_ptr<GeomAPI_Shape> theWholeOld, const int theShapeType);
+ GEOMALGOAPI_EXPORT bool isNewShapesCollected(GeomShapePtr theWholeOld,
+ const int theShapeType);
/// Optimization of access the new shapes by old shapes for the limited set of needed new shapes.
/// \param theWholeOld the whole old shape
/// \param theShapeType type of the sub-shapes that is used for optimization
/// \returns true if optimization containers are already filled
- GEOMALGOAPI_EXPORT void collectNewShapes(
- std::shared_ptr<GeomAPI_Shape> theWholeOld, const int theShapeType);
+ GEOMALGOAPI_EXPORT void collectNewShapes(GeomShapePtr theWholeOld,
+ const int theShapeType);
/// Optimization of access the new shapes by old shapes for the limited set of needed new shapes.
/// \param theWholeOld the whole old shape
/// \param theNewShape the whole new shape
/// \param theShapeType type of the old sub-shapes
/// \returns compound of all old shapes that were used for creation of the given new
- GEOMALGOAPI_EXPORT std::shared_ptr<GeomAPI_Shape> oldShapesForNew(
- std::shared_ptr<GeomAPI_Shape> theWholeOld,
- std::shared_ptr<GeomAPI_Shape> theNewShape, const int theShapeType);
+ GEOMALGOAPI_EXPORT GeomShapePtr oldShapesForNew(GeomShapePtr theWholeOld,
+ GeomShapePtr theNewShape,
+ const int theShapeType);
+
+ /// Replaces \a theShape with shape from \a myMap.
+ GEOMALGOAPI_EXPORT void fixOrientation(GeomShapePtr& theShape);
protected:
/// \brief Sets builder type.
/// \brief Sets result shape.
/// \param[in] theShape new shape.
- void setShape(const std::shared_ptr<GeomAPI_Shape> theShape);
+ void setShape(const GeomShapePtr theShape);
+
+ /// \return true if passed shape is valid for history.
+ bool isValidForHistory(const GeomShapePtr theShape);
protected:
/// Data map to keep correct orientation of sub-shapes.
/// Error occurred during the execution of an algorithm.
std::string myError;
/// Map of created faces with their name for naming.
- std::map< std::string, std::shared_ptr<GeomAPI_Shape> > myCreatedFaces;
+ std::map< std::string, GeomShapePtr > myCreatedFaces;
private:
/// \brief Initializes internals.
private:
GeomAlgoAPI_MakeShape::BuilderType myBuilderType; ///< Type of make shape builder.
bool myDone; ///< Builder status.
- std::shared_ptr<GeomAPI_Shape> myShape; ///< Resulting shape.
+ GeomShapePtr myShape; ///< Resulting shape.
/// map that is used to keep the optimization structure for access to the history
/// kind of sub-shapes -> whole old shape -> new shape -> list of old shapes that create this new
void* myHist;
};
-typedef std::list<std::shared_ptr<GeomAlgoAPI_MakeShape> > ListOfMakeShape;
+typedef std::shared_ptr<GeomAlgoAPI_MakeShape> GeomMakeShapePtr;
+typedef std::list<GeomMakeShapePtr> ListOfMakeShape;
#endif
#include <GeomAlgoAPI_MakeShapeCustom.h>
-//=================================================================================================
+//==================================================================================================
GeomAlgoAPI_MakeShapeCustom::GeomAlgoAPI_MakeShapeCustom()
-{}
+{
+}
-//=================================================================================================
-void GeomAlgoAPI_MakeShapeCustom::setResult(const std::shared_ptr<GeomAPI_Shape> theShape)
+//==================================================================================================
+void GeomAlgoAPI_MakeShapeCustom::setResult(const GeomShapePtr theShape)
{
setShape(theShape);
}
-//=================================================================================================
-bool GeomAlgoAPI_MakeShapeCustom::addModified(const std::shared_ptr<GeomAPI_Shape> theBase,
- const std::shared_ptr<GeomAPI_Shape> theResult)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShapeCustom::addModified(const GeomShapePtr theOldShape,
+ const GeomShapePtr theNewShape)
{
- return myModified.add(theBase, theResult);
+ if (!isValidForHistory(theNewShape)) return false;
+ GeomShapePtr aNewShape = theNewShape;
+ return myModified.add(theOldShape, aNewShape);
}
-//=================================================================================================
-bool GeomAlgoAPI_MakeShapeCustom::addGenerated(const std::shared_ptr<GeomAPI_Shape> theBase,
- const std::shared_ptr<GeomAPI_Shape> theResult)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShapeCustom::addGenerated(const GeomShapePtr theOldShape,
+ const GeomShapePtr theNewShape)
{
- return myGenerated.add(theBase, theResult);
+ if (!isValidForHistory(theNewShape)) return false;
+ GeomShapePtr aNewShape = theNewShape;
+ return myGenerated.add(theOldShape, aNewShape);
}
-//=================================================================================================
-bool GeomAlgoAPI_MakeShapeCustom::addDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShapeCustom::addDeleted(const GeomShapePtr theOldShape)
{
- return myDeleted.bind(theShape, theShape);
+ return myDeleted.bind(theOldShape, theOldShape);
}
-//=================================================================================================
-void GeomAlgoAPI_MakeShapeCustom::generated(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape& theHistory)
+//==================================================================================================
+void GeomAlgoAPI_MakeShapeCustom::generated(const GeomShapePtr theOldShape,
+ ListOfShape& theNewShapes)
{
ListOfShape aGenerated;
- if(myGenerated.find(theShape, aGenerated)) {
- theHistory.insert(theHistory.end(), aGenerated.begin(), aGenerated.end());
+ if(myGenerated.find(theOldShape, aGenerated)) {
+ theNewShapes.insert(theNewShapes.end(), aGenerated.begin(), aGenerated.end());
}
}
-//=================================================================================================
-void GeomAlgoAPI_MakeShapeCustom::modified(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape& theHistory)
+//==================================================================================================
+void GeomAlgoAPI_MakeShapeCustom::modified(const GeomShapePtr theOldShape,
+ ListOfShape& theNewShapes)
{
ListOfShape aModified;
- if(myModified.find(theShape, aModified)) {
- theHistory.insert(theHistory.end(), aModified.begin(), aModified.end());
+ if(myModified.find(theOldShape, aModified)) {
+ theNewShapes.insert(theNewShapes.end(), aModified.begin(), aModified.end());
}
}
-//=================================================================================================
-bool GeomAlgoAPI_MakeShapeCustom::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShapeCustom::isDeleted(const GeomShapePtr theOldShape)
{
- return myDeleted.isBound(theShape);
-}
\ No newline at end of file
+ return myDeleted.isBound(theOldShape);
+}
GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShapeCustom();
/// Sets result shape.
- GEOMALGOAPI_EXPORT void setResult(const std::shared_ptr<GeomAPI_Shape> theShape);
+ GEOMALGOAPI_EXPORT void setResult(const GeomShapePtr theShape);
/// Adds modified shape.
- GEOMALGOAPI_EXPORT bool addModified(const std::shared_ptr<GeomAPI_Shape> theBase,
- const std::shared_ptr<GeomAPI_Shape> theResult);
+ GEOMALGOAPI_EXPORT bool addModified(const GeomShapePtr theOldShape,
+ const GeomShapePtr theNewShape);
/// Adds generated shape.
- GEOMALGOAPI_EXPORT bool addGenerated(const std::shared_ptr<GeomAPI_Shape> theBase,
- const std::shared_ptr<GeomAPI_Shape> theResult);
+ GEOMALGOAPI_EXPORT bool addGenerated(const GeomShapePtr theOldShape,
+ const GeomShapePtr theNewShape);
/// Adds deleted shape.
- GEOMALGOAPI_EXPORT bool addDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
+ GEOMALGOAPI_EXPORT bool addDeleted(const GeomShapePtr theOldShape);
/// \return the list of shapes generated from the shape theShape
- GEOMALGOAPI_EXPORT void generated(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape& theHistory);
+ GEOMALGOAPI_EXPORT void generated(const GeomShapePtr theOldShape,
+ ListOfShape& theNewShapes);
/// \return the list of shapes modified from the shape theShape
- GEOMALGOAPI_EXPORT void modified(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape& theHistory);
+ GEOMALGOAPI_EXPORT void modified(const GeomShapePtr theShape,
+ ListOfShape& theNewShapes);
/// \return whether the shape is deleted
- GEOMALGOAPI_EXPORT bool isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
+ GEOMALGOAPI_EXPORT bool isDeleted(const GeomShapePtr theOldShape);
private:
GeomAPI_DataMapOfShapeMapOfShapes myGenerated;
#include <NCollection_Map.hxx>
#include <TopoDS_Shape.hxx>
-//=================================================================================================
+//==================================================================================================
GeomAlgoAPI_MakeShapeList::GeomAlgoAPI_MakeShapeList()
: GeomAlgoAPI_MakeShape()
{}
-//=================================================================================================
+//==================================================================================================
GeomAlgoAPI_MakeShapeList::GeomAlgoAPI_MakeShapeList(const ListOfMakeShape& theMakeShapeList)
: GeomAlgoAPI_MakeShape()
{
init(theMakeShapeList);
}
-//=================================================================================================
+//==================================================================================================
void GeomAlgoAPI_MakeShapeList::init(const ListOfMakeShape& theMakeShapeList)
{
if(myMap.get()) {
}
}
-//=================================================================================================
+const ListOfMakeShape& GeomAlgoAPI_MakeShapeList::list() const
+{
+ return myListOfMakeShape;
+}
+
+
+//==================================================================================================
void GeomAlgoAPI_MakeShapeList::appendAlgo(
- const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape)
+ const GeomMakeShapePtr theMakeShape)
{
myListOfMakeShape.push_back(theMakeShape);
if(!myMap.get()) {
myMap->merge(theMakeShape->mapOfSubShapes());
}
-//=================================================================================================
-const std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_MakeShapeList::shape() const
+//==================================================================================================
+const GeomShapePtr GeomAlgoAPI_MakeShapeList::shape() const
{
- std::shared_ptr<GeomAPI_Shape> aShape = GeomAlgoAPI_MakeShape::shape();
+ GeomShapePtr aShape = GeomAlgoAPI_MakeShape::shape();
if(aShape.get() && !aShape->impl<TopoDS_Shape>().IsNull()) {
return aShape;
} else if(!myListOfMakeShape.empty()) {
return myListOfMakeShape.back()->shape();
}
- return std::shared_ptr<GeomAPI_Shape>();
+ return GeomShapePtr();
}
-//=================================================================================================
-void GeomAlgoAPI_MakeShapeList::generated(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape& theHistory)
+//==================================================================================================
+void GeomAlgoAPI_MakeShapeList::generated(const GeomShapePtr theOldShape,
+ ListOfShape& theNewShapes)
{
- result(theShape, GeomAlgoAPI_MakeShapeList::Generated, theHistory);
+ result(theOldShape, GeomAlgoAPI_MakeShapeList::Generated, theNewShapes);
}
-//=================================================================================================
-void GeomAlgoAPI_MakeShapeList::modified(const std::shared_ptr<GeomAPI_Shape> theShape,
- ListOfShape& theHistory)
+//==================================================================================================
+void GeomAlgoAPI_MakeShapeList::modified(const GeomShapePtr theOldShape,
+ ListOfShape& theNewShapes)
{
- result(theShape, GeomAlgoAPI_MakeShapeList::Modified, theHistory);
+ result(theOldShape, GeomAlgoAPI_MakeShapeList::Modified, theNewShapes);
}
-bool GeomAlgoAPI_MakeShapeList::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
+//==================================================================================================
+bool GeomAlgoAPI_MakeShapeList::isDeleted(const GeomShapePtr theOldShape)
{
- for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
- aBuilderIt != myListOfMakeShape.end(); aBuilderIt++) {
- std::shared_ptr<GeomAlgoAPI_MakeShape> aMakeShape = *aBuilderIt;
- if(aMakeShape->isDeleted(theShape)) {
+ for (ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
+ aBuilderIt != myListOfMakeShape.end();
+ ++aBuilderIt)
+ {
+ GeomMakeShapePtr aMakeShape = *aBuilderIt;
+ if(aMakeShape->isDeleted(theOldShape)) {
return true;
}
}
return false;
}
-void GeomAlgoAPI_MakeShapeList::result(const std::shared_ptr<GeomAPI_Shape> theShape,
+//==================================================================================================
+void GeomAlgoAPI_MakeShapeList::result(const GeomShapePtr theOldShape,
OperationType theOperationType,
- ListOfShape& theHistory)
+ ListOfShape& theNewShapes)
{
if(myListOfMakeShape.empty()) {
return;
NCollection_Map<TopoDS_Shape> anAlgoShapes;
NCollection_Map<TopoDS_Shape> aResultShapesMap;
NCollection_List<TopoDS_Shape> aResultShapesList;
- anAlgoShapes.Add(theShape->impl<TopoDS_Shape>());
- aResultShapesMap.Add(theShape->impl<TopoDS_Shape>());
- aResultShapesList.Append(theShape->impl<TopoDS_Shape>());
+ anAlgoShapes.Add(theOldShape->impl<TopoDS_Shape>());
+ aResultShapesMap.Add(theOldShape->impl<TopoDS_Shape>());
+ aResultShapesList.Append(theOldShape->impl<TopoDS_Shape>());
for(ListOfMakeShape::iterator aBuilderIt = myListOfMakeShape.begin();
- aBuilderIt != myListOfMakeShape.end(); aBuilderIt++) {
- std::shared_ptr<GeomAlgoAPI_MakeShape> aMakeShape = *aBuilderIt;
+ aBuilderIt != myListOfMakeShape.end();
+ ++aBuilderIt)
+ {
+ GeomMakeShapePtr aMakeShape = *aBuilderIt;
NCollection_Map<TopoDS_Shape> aTempShapes;
- for(NCollection_Map<TopoDS_Shape>::Iterator
- aShapeIt(anAlgoShapes); aShapeIt.More(); aShapeIt.Next()) {
+ for (NCollection_Map<TopoDS_Shape>::Iterator aShapeIt(anAlgoShapes);
+ aShapeIt.More();
+ aShapeIt.Next())
+ {
bool hasResults = false;
bool anArgumentIsInResult = false;
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
+ GeomShapePtr aShape(new GeomAPI_Shape);
aShape->setImpl(new TopoDS_Shape(aShapeIt.Value()));
ListOfShape aGeneratedShapes;
aMakeShape->generated(aShape, aGeneratedShapes);
- for (ListOfShape::const_iterator
- anIt = aGeneratedShapes.cbegin(); anIt != aGeneratedShapes.cend(); anIt++) {
+ for (ListOfShape::const_iterator anIt = aGeneratedShapes.cbegin();
+ anIt != aGeneratedShapes.cend();
+ ++anIt)
+ {
const TopoDS_Shape& anItShape = (*anIt)->impl<TopoDS_Shape>();
if (anItShape.IsSame(aShapeIt.Value())) {
anArgumentIsInResult = true;
}
ListOfShape aModifiedShapes;
aMakeShape->modified(aShape, aModifiedShapes);
- for(ListOfShape::const_iterator
- anIt = aModifiedShapes.cbegin(); anIt != aModifiedShapes.cend(); anIt++) {
+ for (ListOfShape::const_iterator anIt = aModifiedShapes.cbegin();
+ anIt != aModifiedShapes.cend();
+ ++anIt)
+ {
const TopoDS_Shape& anItShape = (*anIt)->impl<TopoDS_Shape>();
if (anItShape.IsSame(aShapeIt.Value())) {
anArgumentIsInResult = true;
anAlgoShapes.Unite(aTempShapes);
}
- for(NCollection_List<TopoDS_Shape>::Iterator
- aShapeIt(aResultShapesList); aShapeIt.More(); aShapeIt.Next()) {
- std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ for (NCollection_List<TopoDS_Shape>::Iterator aShapeIt(aResultShapesList);
+ aShapeIt.More();
+ aShapeIt.Next())
+ {
+ GeomShapePtr aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(aShapeIt.Value()));
- theHistory.push_back(aShape);
+ if (!isValidForHistory(aShape)) continue;
+ fixOrientation(aShape);
+ theNewShapes.push_back(aShape);
}
}
/// \param[in] theMakeShapeList list of algorithms.
GEOMALGOAPI_EXPORT void init(const ListOfMakeShape& theMakeShapeList);
+ /// \return the list reference
+ GEOMALGOAPI_EXPORT const ListOfMakeShape& list() const;
+
/// \brief Adds algo to the end of list.
/// \param[in] theMakeShape algo to be added.
- GEOMALGOAPI_EXPORT void appendAlgo(const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape);
+ GEOMALGOAPI_EXPORT void appendAlgo(const GeomMakeShapePtr theMakeShape);
/// \return a shape built by the shape construction algorithms
- GEOMALGOAPI_EXPORT virtual const std::shared_ptr<GeomAPI_Shape> shape() const;
+ GEOMALGOAPI_EXPORT virtual const GeomShapePtr shape() const;
/// \return the list of shapes generated from the shape \a theShape
- GEOMALGOAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape> theShape,
+ GEOMALGOAPI_EXPORT virtual void generated(const GeomShapePtr theShape,
ListOfShape& theHistory);
/// \return the list of shapes modified from the shape \a theShape
- GEOMALGOAPI_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape> theShape,
+ GEOMALGOAPI_EXPORT virtual void modified(const GeomShapePtr theShape,
ListOfShape& theHistory);
/// \return whether the shape is deleted
- GEOMALGOAPI_EXPORT virtual bool isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
+ GEOMALGOAPI_EXPORT virtual bool isDeleted(const GeomShapePtr theShape);
private:
- void result(const std::shared_ptr<GeomAPI_Shape> theShape,
+ void result(const GeomShapePtr theShape,
OperationType theOperationType,
ListOfShape& theHistory);
GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
aFromShape->setImpl(new TopoDS_Shape(aPipeBuilder->FirstShape()));
aToShape->setImpl(new TopoDS_Shape(aPipeBuilder->LastShape()));
+ fixOrientation(aFromShape);
+ fixOrientation(aToShape);
this->addFromShape(aFromShape);
this->addToShape(aToShape);
#include "GeomAlgoAPI_Placement.h"
#include <GeomAlgoAPI_DFLoader.h>
+#include <GeomAlgoAPI_ShapeTools.h>
#include <GeomAPI_Dir.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Pln.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_Vertex.h>
#include <GeomAPI_XYZ.h>
GProp_GProps aProps;
static const double aPropEps = 1.e-4;
+ GeomShapePtr aShape;
+ bool isCompound = false;
for (int i = 0; i < aNbObjects; i++) {
- if (aShapes[i]->isFace()) {
- std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aShapes[i]));
+ aShape = aShapes[i];
+ isCompound = false;
+ if (aShapes[i]->isCompound()) {
+ isCompound = true;
+ GeomAPI_ShapeIterator anIt(aShapes[i]);
+ aShape = anIt.current();
+
+ GeomPointPtr aPnt = GeomAlgoAPI_ShapeTools::centreOfMass(aShapes[i]);
+ aSrcDstPoints[i].SetCoord(aPnt->x(), aPnt->y(), aPnt->z());
+ }
+
+ if (aShape->isFace()) {
+ std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aShape));
std::shared_ptr<GeomAPI_Pln> aPlane = aFace->getPlane();
std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
aSrcDstNormals[i].SetCoord(aDir->x(), aDir->y(), aDir->z());
- BRepGProp::SurfaceProperties(aFace->impl<TopoDS_Face>(), aProps, aPropEps);
- gp_Pnt aLoc = aProps.CentreOfMass();
- aSrcDstPoints[i].SetCoord(aLoc.X(), aLoc.Y(), aLoc.Z());
+ if (!isCompound) {
+ BRepGProp::SurfaceProperties(aFace->impl<TopoDS_Face>(), aProps, aPropEps);
+ gp_Pnt aLoc = aProps.CentreOfMass();
+ aSrcDstPoints[i].SetCoord(aLoc.X(), aLoc.Y(), aLoc.Z());
+ }
}
- else if (aShapes[i]->isEdge()) {
- std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShapes[i]));
+ else if (aShape->isEdge()) {
+ std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShape));
std::shared_ptr<GeomAPI_Lin> aLine = anEdge->line();
std::shared_ptr<GeomAPI_Dir> aDir = aLine->direction();
- std::shared_ptr<GeomAPI_Pnt> aFirstPnt = anEdge->firstPoint();
- std::shared_ptr<GeomAPI_Pnt> aLastPnt = anEdge->lastPoint();
- std::shared_ptr<GeomAPI_XYZ> aLoc = aFirstPnt->xyz()->added(aLastPnt->xyz())->multiplied(0.5);
- aSrcDstPoints[i].SetCoord(aLoc->x(), aLoc->y(), aLoc->z());
aSrcDstDirections[i].SetCoord(aDir->x(), aDir->y(), aDir->z());
+
+ if (!isCompound) {
+ std::shared_ptr<GeomAPI_Pnt> aFirstPnt = anEdge->firstPoint();
+ std::shared_ptr<GeomAPI_Pnt> aLastPnt = anEdge->lastPoint();
+ std::shared_ptr<GeomAPI_XYZ> aLoc = aFirstPnt->xyz()->added(aLastPnt->xyz())
+ ->multiplied(0.5);
+ aSrcDstPoints[i].SetCoord(aLoc->x(), aLoc->y(), aLoc->z());
+ }
}
- else if (aShapes[i]->isVertex()) {
- std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aShapes[i]));
+ else if (aShape->isVertex()) {
+ std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aShape));
std::shared_ptr<GeomAPI_Pnt> aPnt = aVertex->point();
aSrcDstPoints[i].SetCoord(aPnt->x(), aPnt->y(), aPnt->z());
} else // something goes wrong
for(TopTools_ListIteratorOfListOfShape anIt(aToShapes); anIt.More(); anIt.Next()) {
GeomShapePtr aGeomSh(new GeomAPI_Shape());
aGeomSh->setImpl(new TopoDS_Shape(anIt.Value()));
+ fixOrientation(aGeomSh);
this->addToShape(aGeomSh);
}
}
for(TopTools_ListIteratorOfListOfShape anIt(aFromShapes); anIt.More(); anIt.Next()) {
GeomShapePtr aGeomSh(new GeomAPI_Shape());
aGeomSh->setImpl(new TopoDS_Shape(anIt.Value()));
+ fixOrientation(aGeomSh);
this->addFromShape(aGeomSh);
}
}
GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
aFromShape->setImpl(new TopoDS_Shape(thePrismBuilder->FirstShape(aShape)));
aToShape->setImpl(new TopoDS_Shape(thePrismBuilder->LastShape(aShape)));
+ thePrismAlgo->fixOrientation(aFromShape);
+ thePrismAlgo->fixOrientation(aToShape);
thePrismAlgo->addFromShape(aFromShape);
thePrismAlgo->addToShape(aToShape);
}
if(anIntTools.IsValidPointForFace(aPnt,
theToFace, Precision::Confusion()) == Standard_True) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ thePrismAlgo->fixOrientation(aGeomSh);
thePrismAlgo->addToShape(aGeomSh);
}
if(anIntTools.IsValidPointForFace(aPnt,
theFromFace, Precision::Confusion()) == Standard_True) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ thePrismAlgo->fixOrientation(aGeomSh);
thePrismAlgo->addFromShape(aGeomSh);
}
} else if(theType == TopAbs_EDGE) {
anEdgeCheck.Perform();
if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ thePrismAlgo->fixOrientation(aGeomSh);
thePrismAlgo->addToShape(aGeomSh);
}
anEdgeCheck.Init(anEdge, theFromFace);
anEdgeCheck.Perform();
if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ thePrismAlgo->fixOrientation(aGeomSh);
thePrismAlgo->addFromShape(aGeomSh);
}
} else {
for(TopTools_ListIteratorOfListOfShape anIt(aBndShapes); anIt.More(); anIt.Next()) {
GeomShapePtr aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(anIt.Value()));
+ fixOrientation(aShape);
isFromFaceSet ? this->addFromShape(aShape) : this->addToShape(aShape);
}
}
for(TopTools_ListIteratorOfListOfShape anIt(aBsShapes); anIt.More(); anIt.Next()) {
GeomShapePtr aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(anIt.Value()));
+ fixOrientation(aShape);
isFromFaceSet ? this->addToShape(aShape) : this->addFromShape(aShape);
}
}
GeomShapePtr aFromShape(new GeomAPI_Shape), aToShape(new GeomAPI_Shape);
aFromShape->setImpl(new TopoDS_Shape(theRevolBuilder->FirstShape(aShape)));
aToShape->setImpl(new TopoDS_Shape(theRevolBuilder->LastShape(aShape)));
+ theRevolutionAlgo->fixOrientation(aFromShape);
+ theRevolutionAlgo->fixOrientation(aToShape);
theRevolutionAlgo->addFromShape(aFromShape);
theRevolutionAlgo->addToShape(aToShape);
}
if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theToFace),
Precision::Confusion()) == Standard_True) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ theRevolutionAlgo->fixOrientation(aGeomSh);
theRevolutionAlgo->addToShape(aGeomSh);
}
if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theFromFace),
Precision::Confusion()) == Standard_True) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ theRevolutionAlgo->fixOrientation(aGeomSh);
theRevolutionAlgo->addFromShape(aGeomSh);
}
} else if(theType == TopAbs_EDGE) {
anEdgeCheck.Perform();
if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ theRevolutionAlgo->fixOrientation(aGeomSh);
theRevolutionAlgo->addToShape(aGeomSh);
}
anEdgeCheck.Init(anEdge, TopoDS::Face(theFromFace));
anEdgeCheck.Perform();
if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ theRevolutionAlgo->fixOrientation(aGeomSh);
theRevolutionAlgo->addFromShape(aGeomSh);
}
} else {
Handle(Geom_Surface) aToSurface = BRep_Tool::Surface(TopoDS::Face(theToFace));
if(aFaceSurface == aFromSurface) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ theRevolutionAlgo->fixOrientation(aGeomSh);
theRevolutionAlgo->addFromShape(aGeomSh);
}
if(aFaceSurface == aToSurface) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ theRevolutionAlgo->fixOrientation(aGeomSh);
theRevolutionAlgo->addToShape(aGeomSh);
}
}
if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theRotatedBoundingFace),
Precision::Confusion()) == Standard_True) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ theRevolutionAlgo->fixOrientation(aGeomSh);
theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) :
theRevolutionAlgo->addToShape(aGeomSh);
}
if(anIntTools.IsValidPointForFace(aPnt, TopoDS::Face(theModifiedBaseShape),
Precision::Confusion()) == Standard_True) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ theRevolutionAlgo->fixOrientation(aGeomSh);
theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) :
theRevolutionAlgo->addFromShape(aGeomSh);
}
anEdgeCheck.Perform();
if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ theRevolutionAlgo->fixOrientation(aGeomSh);
theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) :
theRevolutionAlgo->addToShape(aGeomSh);
}
anEdgeCheck.Perform();
if(anEdgeCheck.MaxDistance() < Precision::Confusion()) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ theRevolutionAlgo->fixOrientation(aGeomSh);
theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) :
theRevolutionAlgo->addFromShape(aGeomSh);
}
Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(TopoDS::Face(theModifiedBaseShape));
if(aFaceSurface == aBoundingSurface) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ theRevolutionAlgo->fixOrientation(aGeomSh);
theIsFromFaceSet ? theRevolutionAlgo->addFromShape(aGeomSh) :
theRevolutionAlgo->addToShape(aGeomSh);
}
if(aFaceSurface == aBaseSurface) {
aGeomSh->setImpl(new TopoDS_Shape(aShape));
+ theRevolutionAlgo->fixOrientation(aGeomSh);
theIsFromFaceSet ? theRevolutionAlgo->addToShape(aGeomSh) :
theRevolutionAlgo->addFromShape(aGeomSh);
}
}
}
- // Map subshapes and shapes.
+ // Map sub-shapes and shapes.
TopTools_IndexedDataMapOfShapeListOfShape aMapSA;
TopExp::MapShapesAndAncestors(aShapesComp, aTS, aTA, aMapSA);
if(aMapSA.IsEmpty()) {
return aResult;
}
- // Get all shapes with common subshapes and free shapes.
+ // Get all shapes with common sub-shapes and free shapes.
NCollection_Map<TopoDS_Shape> aFreeShapes;
NCollection_Vector<NCollection_Map<TopoDS_Shape>> aShapesWithCommonSubshapes;
for(TopTools_IndexedDataMapOfShapeListOfShape::Iterator
}
}
- // Combine shapes with common subshapes.
+ // Combine shapes with common sub-shapes.
for(NCollection_Vector<NCollection_Map<TopoDS_Shape>>::Iterator
anIter(aShapesWithCommonSubshapes); anIter.More(); anIter.Next()) {
TopoDS_Shell aShell;
aKeysIt.Next()) {
const TopTools_ListOfShape& anOtherConnected = aVertexShapesMap(aKeysIt.Value());
if (!anOtherConnected.Contains(aConnected)) {
- // Other connected group does not containt shape from our connected group
+ // Other connected group does not contain shape from our connected group
continue;
}
// Other is connected to our, so add them to our connected
//
#include "GeomAlgoAPI_Tools.h"
+#include "GeomAlgoAPI_MakeShape.h"
#include <clocale>
OSD_Path aPath(aFileName);
return aPath.Name().ToCString();
}
+
+bool AlgoError::isAlgorithmFailed(const GeomMakeShapePtr& theAlgorithm,
+ const std::string& theFeature,
+ std::string& theError)
+{
+ theError.clear();
+ if (!theAlgorithm->isDone()) {
+ theError = "Error: " + (theFeature.empty() ? "The" : theFeature) + " algorithm failed.";
+ std::string anAlgoError = theAlgorithm->getError();
+ if (!anAlgoError.empty())
+ theError += " " + anAlgoError;
+ return true;
+ }
+ if (!theAlgorithm->shape() || theAlgorithm->shape()->isNull()) {
+ theError = "Error: Resulting shape";
+ if (!theFeature.empty())
+ theError += "of " + theFeature;
+ theError += " is Null.";
+ return true;
+ }
+ if (!theAlgorithm->isValid()) {
+ theError = "Error: Resulting shape";
+ if (!theFeature.empty())
+ theError += "of " + theFeature;
+ theError += " is not valid.";
+ return true;
+ }
+ return false;
+}
#include <GeomAlgoAPI.h>
+#include <memory>
#include <string>
+class GeomAlgoAPI_MakeShape;
+
namespace GeomAlgoAPI_Tools {
/** \class Localizer
GEOMALGOAPI_EXPORT static std::string name(const std::string& theFileName);
};
+/** \class AlgoError
+ * \ingroup DataAlgo
+ * \brief Verify error in MakeShape algorithm.
+ */
+class AlgoError {
+public:
+ /** \brief Verify MakeShape algorithm for failures
+ * \param[in] theAlgorithm object to verify the failure
+ * \param[in] theFeature kind of the feature, the algorithm belongs to
+ * \param[out] theError error string (empty if the feature succeed)
+ * \return \c true if succeed
+ */
+ GEOMALGOAPI_EXPORT static bool isAlgorithmFailed(
+ const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgorithm,
+ const std::string& theFeature,
+ std::string& theError);
+};
+
} // GeomAlgoAPI_Tools
#endif /* GEOMALGOAPI_TOOLS_H_ */
GeomValidators_Face.h
GeomValidators_FeatureKind.h
GeomValidators_Finite.h
- GeomValidators_PartitionArguments.h
GeomValidators_Plugin.h
GeomValidators_Positive.h
GeomValidators_ShapeType.h
GeomValidators_Face.cpp
GeomValidators_FeatureKind.cpp
GeomValidators_Finite.cpp
- GeomValidators_PartitionArguments.cpp
GeomValidators_Plugin.cpp
GeomValidators_Positive.cpp
GeomValidators_ShapeType.cpp
}
GeomShapePtr aOtherTypedShape = GeomAPI_Tools::getTypedShape(anOtherShape);
+ if (!aTypedShape.get())
+ return !aTypedShape.get() && !aOtherTypedShape.get();
return aTypedShape->isEqual(aOtherTypedShape);
-}
\ No newline at end of file
+}
#include "ModelAPI_AttributeSelection.h"
#include <GeomAPI_Face.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAbs_SurfaceType.hxx>
return GeomAbs_Plane;
}
+bool isValidFace(const GeomShapePtr theShape,
+ const GeomAbs_SurfaceType theFaceType,
+ Events_InfoMessage& theError)
+{
+ GeomFacePtr aGeomFace = theShape->face();
+
+ if (!aGeomFace.get()) {
+ theError = "The shape is not a face.";
+ return false;
+ }
+
+ bool aValid = true;
+
+ switch (theFaceType) {
+ case GeomAbs_Plane: {
+ aValid = aGeomFace->isPlanar();
+ if (!aValid) theError = "The shape is not a plane.";
+ break;
+ }
+ case GeomAbs_Cylinder: {
+ aValid = aGeomFace->isCylindrical();
+ if (!aValid) theError = "The shape is not a cylinder.";
+ break;
+ }
+ default: {
+ aValid = false;
+ theError = "The shape is not an available face.";
+ break;
+ }
+ }
+
+ return aValid;
+}
+
bool GeomValidators_Face::isValid(const AttributePtr& theAttribute,
const std::list<std::string>& theArguments,
Events_InfoMessage& theError) const
// it is necessary to check whether the shape is face in order to set in selection a value
// with any type and check the type in this validator
// It is realized to select any object in OB and filter it in this validator (sketch plane)
- if (!aGeomShape->isFace()) {
- aValid = false;
- theError = "The shape is not a face.";
+ GeomAbs_SurfaceType aFaceType = GeomAbs_Plane;
+ if (theArguments.size() == 1)
+ aFaceType = faceType(theArguments.front());
+ if (aGeomShape->isFace()) {
+ aValid = isValidFace(aGeomShape, aFaceType, theError);
}
- else {
- std::shared_ptr<GeomAPI_Face> aGeomFace(new GeomAPI_Face(aGeomShape));
- if (!aGeomFace.get()) {
- aValid = false;
- theError = "The shape is not a face.";
- }
- else {
- GeomAbs_SurfaceType aFaceType = GeomAbs_Plane;
- if (theArguments.size() == 1)
- aFaceType = faceType(theArguments.front());
-
- switch (aFaceType) {
- case GeomAbs_Plane: {
- aValid = aGeomFace->isPlanar();
- if (!aValid)
- theError = "The shape is not a plane.";
- }
- break;
- case GeomAbs_Cylinder:{
- aValid = aGeomFace->isCylindrical();
- if (!aValid)
- theError = "The shape is not a cylinder.";
- }
- break;
- default: {
- aValid = false;
- theError = "The shape is not an available face.";
- break;
- }
- }
+ else if (aSelectionAttr->isGeometricalSelection() && aGeomShape->isCompound()) {
+ for (GeomAPI_ShapeIterator anIt(aGeomShape); anIt.more() && aValid; anIt.next()) {
+ aValid = isValidFace(anIt.current(), aFaceType, theError);
}
}
+ else {
+ aValid = false;
+ theError = "The shape is not a face.";
+ }
}
return aValid;
}
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#include <GeomValidators_PartitionArguments.h>
-
-#include <Events_InfoMessage.h>
-
-#include <ModelAPI_AttributeBoolean.h>
-#include <ModelAPI_AttributeSelectionList.h>
-
-//=================================================================================================
-bool GeomValidators_PartitionArguments::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<std::string>& theArguments,
- Events_InfoMessage& theError) const
-{
- if(theArguments.size() != 3) {
- theError = "Wrong number of arguments (expected 3).";
- return false;
- }
-
- int anObjectsNb = 0, aToolsNb = 0;
- bool isCombine = true;
-
- std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
-
- std::shared_ptr<ModelAPI_AttributeSelectionList> anAttrSelList = theFeature->selectionList(*anIt);
- if(anAttrSelList) {
- anObjectsNb = anAttrSelList->size();
- }
- anIt++;
-
- anAttrSelList = theFeature->selectionList(*anIt);
- if(anAttrSelList) {
- aToolsNb = anAttrSelList->size();
- }
- anIt++;
-
- std::shared_ptr<ModelAPI_AttributeBoolean> anAttrBool = theFeature->boolean(*anIt);
- if(anAttrBool) {
- isCombine = anAttrBool->value();
- }
-
- if((anObjectsNb > 0 && aToolsNb > 0) ||
- (isCombine && anObjectsNb != 0 && (anObjectsNb + aToolsNb > 1))) {
- return true;
- }
-
- theError = "Not enough arguments";
- return false;
-}
-
-//=================================================================================================
-bool GeomValidators_PartitionArguments::isNotObligatory(std::string theFeature,
- std::string theAttribute)
-{
- if(theAttribute == "tool_objects") {
- return true;
- }
-
- return false;
-}
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#ifndef GeomValidators_PartitionArguments_H
-#define GeomValidators_PartitionArguments_H
-
-#include <GeomValidators.h>
-#include <ModelAPI_Feature.h>
-#include <ModelAPI_FeatureValidator.h>
-
-/** \class GeomValidators_PartitionArguments
- * \ingroup Validators
- * \brief Validates that partition operation have enough arguments.
- */
-class GeomValidators_PartitionArguments : public ModelAPI_FeatureValidator
-{
-public:
- /** \brief Returns true if feature and/or attributes are valid.
- * \param[in] theFeature the validated feature.
- * \param[in] theArguments the arguments in the configuration file for this validator.
- * \param[out] theError error message.
- * \returns true if feature is valid.
- */
- GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
- const std::list<std::string>& theArguments,
- Events_InfoMessage& theError) const;
-
- /// \return true if the attribute in feature is not obligatory for the feature execution.
- GEOMVALIDATORS_EXPORT virtual
- bool isNotObligatory(std::string theFeature, std::string theAttribute);
-};
-
-#endif
#include <GeomValidators_DifferentShapes.h>
#include <GeomValidators_Face.h>
#include <GeomValidators_Finite.h>
-#include <GeomValidators_PartitionArguments.h>
#include <GeomValidators_ShapeType.h>
#include <GeomValidators_ZeroOffset.h>
#include <GeomValidators_FeatureKind.h>
new GeomValidators_DifferentShapes);
aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face);
aFactory->registerValidator("GeomValidators_Finite", new GeomValidators_Finite);
- aFactory->registerValidator("GeomValidators_PartitionArguments",
- new GeomValidators_PartitionArguments);
aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType);
aFactory->registerValidator("GeomValidators_ZeroOffset", new GeomValidators_ZeroOffset);
aFactory->registerValidator("GeomValidators_FeatureKind", new GeomValidators_FeatureKind);
#include "GeomValidators_Tools.h"
#include <GeomAPI_Curve.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomDataAPI_Point2D.h>
#include <ModelAPI_Result.h>
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
GeomShapePtr aShape = anAttr->value();
if (aShape.get())
- aValid = isValidShape(aShape, theShapeType, theError);
+ aValid = isValidShape(aShape, theShapeType, anAttr->isGeometricalSelection(), theError);
else {
if (anAttr->context().get())
- aValid = isValidObject(anAttr->context(), theShapeType, theError);
+ aValid = isValidObject(anAttr->context(),
+ theShapeType,
+ anAttr->isGeometricalSelection(),
+ theError);
else
- aValid = isValidObject(anAttr->contextFeature(), theShapeType, theError);
+ aValid = isValidObject(anAttr->contextFeature(),
+ theShapeType,
+ anAttr->isGeometricalSelection(),
+ theError);
}
}
else if (anAttributeType == ModelAPI_AttributeRefAttr::typeId()) {
AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
if (anAttr->isObject()) {
- aValid = isValidObject(anAttr->object(), theShapeType, theError);
+ aValid = isValidObject(anAttr->object(),
+ theShapeType,
+ false,
+ theError);
}
else if (theShapeType == Vertex) {
AttributePtr aRefAttr = anAttr->attr();
else if (anAttributeType == ModelAPI_AttributeReference::typeId()) {
AttributeReferencePtr anAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
- aValid = isValidObject(anAttr->value(), theShapeType, theError);
+ aValid = isValidObject(anAttr->value(), theShapeType, false, theError);
}
else if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
AttributeSelectionListPtr aListAttr =
bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject,
const TypeOfShape theShapeType,
+ const bool theIsGeometricalSelection,
Events_InfoMessage& theError) const
{
bool aValid = true;
aValid = false;
theError = "The result is empty";
} else {
- aValid = isValidShape(aResult->shape(), theShapeType, theError);
+ aValid = isValidShape(aResult->shape(), theShapeType, theIsGeometricalSelection, theError);
}
} else {
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape,
const TypeOfShape theShapeType,
+ const bool theIsGeometricalSelection,
Events_InfoMessage& theError) const
{
bool aValid = true;
case Edge:
aValid = theShape->isEdge();
break;
- case Line:
- aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isLine();
+ case Line: {
+ if (theIsGeometricalSelection && theShape->isCompound()) {
+ aValid = true;
+ for (GeomAPI_ShapeIterator anIt(theShape); anIt.more(); anIt.next()) {
+ if (!anIt.current()->isEdge() || !GeomAPI_Curve(anIt.current()).isLine()) {
+ aValid = false;
+ break;
+ }
+ }
+ }
+ else {
+ aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isLine();
+ }
break;
+ }
case Circle:
aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isCircle();
break;
/// \param[out] theError error message.
bool isValidObject(const ObjectPtr& theObject,
const TypeOfShape theShapeType,
+ const bool theIsGeometricalSelection,
Events_InfoMessage& theError) const;
/// Returns true if the attibute's object type satisfies the argument value
/// \param[out] theError error message.
bool isValidShape(const GeomShapePtr theShape,
const TypeOfShape theShapeType,
+ const bool theIsGeometricalSelection,
Events_InfoMessage& theError) const;
};
#include <GeomAPI_Dir.h>
#include <GeomAPI_Face.h>
#include <GeomAPI_Shape.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_Pln.h>
#include <GeomAPI_Pnt.h>
if(aToShape.get() == NULL && anAttrSel->context().get() != NULL) {
aToShape = anAttrSel->context()->shape();
}
+ if (aToShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aToShape);
+ aToShape = anIt.current();
+ }
}
anIt++;
if(aFromShape.get() == NULL && anAttrSel->context().get() != NULL) {
aFromShape = anAttrSel->context()->shape();
}
+ if (aFromShape->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aFromShape);
+ aFromShape = anIt.current();
+ }
}
anIt++;
Model_ResultParameter.h
Model_FeatureValidator.h
Model_AttributeValidator.h
- Model_SelectionNaming.h
)
SET(PROJECT_SOURCES
Model_ResultParameter.cpp
Model_FeatureValidator.cpp
Model_AttributeValidator.cpp
- Model_SelectionNaming.cpp
)
SET(PROJECT_LIBRARIES
ModelAPI
Events
Config
+ Selector
GeomData
GeomAPI
GeomAlgoAPI
../ModelAPI
../Events
../Config
+ ../Selector
../GeomData
../GeomDataAPI
../GeomAlgoAPI
myExtDocRef->Append(anEntry);
} else return; // something is wrong
+ if (myHashUsed) {
+ myHashObjects.insert(theObject);
+ myHashIndex[myRef->Extent() - 1] = theObject;
+ myHashIndexNoEmpty[int(myHashIndexNoEmpty.size())] = theObject;
+ }
+
// do it before the transaction finish to make just created/removed objects know dependencies
// and reference from composite feature is removed automatically
ADD_BACK_REF(theObject);
void Model_AttributeRefList::remove(ObjectPtr theObject)
{
+ eraseHash();
if (theObject.get() != NULL) {
if (owner()->document() == theObject->document()) {
std::shared_ptr<Model_Data> aData;
if (anExtIter.Value() == anIdString.str().c_str()) {
TDataStd_ListIteratorOfListOfExtendedString anExtIter2 = anExtIter;
anExtIter2.Next();
- if (anExtIter2.Value() == anEntry) { // fully maches, so, remove(don't copy)
+ if (anExtIter2.Value() == anEntry) { // fully matches, so, remove(don't copy)
aFound = true;
continue;
}
REMOVE_BACK_REF((*anOldIter));
}
myExtDocRef->Clear();
+ eraseHash();
owner()->data()->sendAttributeUpdated(this);
}
{
if (theWithEmpty)
return myRef->Extent();
+
+ if (myHashUsed)
+ return int(myHashIndexNoEmpty.size());
+
int aResult = 0;
const TDF_LabelList& aList = myRef->List();
for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) {
std::list<ObjectPtr> Model_AttributeRefList::list()
{
+ createHash();
std::list<ObjectPtr> aResult;
- std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
- owner()->document());
- if (aDoc) {
- const TDF_LabelList& aList = myRef->List();
- TDataStd_ListIteratorOfListOfExtendedString anExtIter(myExtDocRef->List());
- for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) {
- aResult.push_back(iteratedObject(aLIter, anExtIter, aDoc));
- }
+ std::map<int, ObjectPtr>::iterator aHashIter = myHashIndex.begin();
+ for(; aHashIter != myHashIndex.end(); aHashIter++) {
+ aResult.push_back(aHashIter->second);
}
return aResult;
}
if(!theObj.get()) {
return false;
}
- if (theObj->document() == owner()->document()) { // this document object
- std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
- owner()->document());
- if (aDoc) {
- std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theObj->data());
- if (aData.get() && aData->isValid()) {
- TDF_Label anObjLab = aData->label().Father();
- const TDF_LabelList& aList = myRef->List();
- for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) {
- if (aLIter.Value().IsEqual(anObjLab)) {
- return true;
- }
- }
- }
- }
- } else { // external document object
- // create new lists because for the current moment remove one of the duplicated elements
- // from the list is buggy
- std::ostringstream anIdString; // string with document Id
- anIdString<<theObj->document()->id();
- std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theObj->data());
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(aData->label().Father(), anEntry);
- bool aFound = false;
- TDataStd_ListIteratorOfListOfExtendedString anExtIter(myExtDocRef->List());
- for (; anExtIter.More(); anExtIter.Next()) {
- if (anExtIter.Value() == anIdString.str().c_str()) {
- anExtIter.Next();
- if (anExtIter.Value() == anEntry) { // fully maches
- return true;
- }
- } else {
- anExtIter.Next();
- }
- }
- }
- return false;
+ createHash();
+ return myHashObjects.count(theObj) != 0;
}
-ObjectPtr Model_AttributeRefList::object(const int theIndex, const bool theWithEmpty) const
+ObjectPtr Model_AttributeRefList::object(const int theIndex, const bool theWithEmpty)
{
- std::shared_ptr<Model_Document> aDoc =
- std::dynamic_pointer_cast<Model_Document>(owner()->document());
- if (aDoc) {
- int anIndex = -1;
- TDataStd_ListIteratorOfListOfExtendedString anExtIter(myExtDocRef->List());
- for (TDF_ListIteratorOfLabelList aLIter(myRef->List()); aLIter.More(); aLIter.Next()) {
- if (theWithEmpty || (!aLIter.Value().IsNull() && !aLIter.Value().IsRoot()))
- anIndex++;
- if (anIndex == theIndex) {
- return iteratedObject(aLIter, anExtIter, aDoc);
- }
- if (aLIter.Value() == myRef->Label()) {
- anExtIter.Next();
- anExtIter.Next();
- }
- }
+ createHash();
+ std::map<int, ObjectPtr>::iterator aFind;
+ if (theWithEmpty) {
+ aFind = myHashIndex.find(theIndex);
+ if (aFind == myHashIndex.end())
+ return ObjectPtr();
+ } else {
+ aFind = myHashIndexNoEmpty.find(theIndex);
+ if (aFind == myHashIndexNoEmpty.end())
+ return ObjectPtr();
}
- return ObjectPtr();
+ return aFind->second;
}
void Model_AttributeRefList::substitute(const ObjectPtr& theCurrent, const ObjectPtr& theNew)
aNewLab = aCurrentLab.Root(); // root means null object
}
// do the substitution
+ eraseHash();
ADD_BACK_REF(theNew);
if (myRef->InsertAfter(aNewLab, aCurrentLab)) {
myRef->Remove(aCurrentLab);
std::shared_ptr<Model_Data> aData2 =
std::dynamic_pointer_cast<Model_Data>(theObject2->data());
if (aData2.get() && aData2->isValid()) {
+ eraseHash();
TDF_Label aLab2 = aData2->label().Father();
// do the substitution: use the temporary label, as usually in exchange
TDF_Label aTmpLab = aLab1.Root();
if (aDoc && !myRef->IsEmpty()) {
ObjectPtr anObj = aDoc->objects()->object(myRef->Last());
if (anObj.get()) {
+ eraseHash();
myRef->Remove(myRef->Last());
REMOVE_BACK_REF(anObj);
owner()->data()->sendAttributeUpdated(this);
std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
owner()->document());
if (aDoc && !myRef->IsEmpty()) {
- // collet labels that will be removed
+ // collect labels that will be removed
TDF_LabelList aLabelsToRemove;
TDF_ListIteratorOfLabelList aLabIter(myRef->List());
for(int aCurrent = 0; aLabIter.More(); aLabIter.Next(), aCurrent++) {
}
}
if (!aLabelsToRemove.IsEmpty()) {
+ eraseHash();
owner()->data()->sendAttributeUpdated(this);
}
}
if (!myLab.FindAttribute(TDataStd_ExtStringList::GetID(), myExtDocRef)) {
myExtDocRef = TDataStd_ExtStringList::Set(myLab);
}
+ eraseHash();
+}
+
+void Model_AttributeRefList::createHash()
+{
+ if (myHashUsed)
+ return;
+ eraseHash();
+ std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
+ owner()->document());
+ if (aDoc) {
+ const TDF_LabelList& aList = myRef->List();
+ TDataStd_ListIteratorOfListOfExtendedString anExtIter(myExtDocRef->List());
+ for (TDF_ListIteratorOfLabelList aLIter(aList); aLIter.More(); aLIter.Next()) {
+ ObjectPtr anObj = iteratedObject(aLIter, anExtIter, aDoc);
+ myHashIndex[int(myHashIndex.size())] = anObj;
+ if (anObj.get()) {
+ myHashIndexNoEmpty[int(myHashIndexNoEmpty.size())] = anObj;
+ myHashObjects.insert(anObj);
+ }
+ }
+ if (!myHashObjects.empty()) // on open document with multi-rotation referenced have no results
+ myHashUsed = true;
+ }
+}
+
+
+void Model_AttributeRefList::eraseHash()
+{
+ myHashObjects.clear();
+ myHashIndex.clear();
+ myHashIndexNoEmpty.clear();
+ myHashUsed = false;
}
class Model_AttributeRefList : public ModelAPI_AttributeRefList
{
TDF_Label myLab; ///< the main label of this attribute
+
Handle_TDataStd_ReferenceList myRef; ///< references to the features labels
/// pairs of doc ID and entries if reference is to external object, appends some in this list if
/// something in myRef is empty
Handle_TDataStd_ExtStringList myExtDocRef;
- public:
+ bool myHashUsed; ///< true if the hash stored is valid
+ std::set<ObjectPtr> myHashObjects; ///< hashed information: objects existing in the list
+ std::map<int, ObjectPtr> myHashIndex; ///< index to object in the list
+ std::map<int, ObjectPtr> myHashIndexNoEmpty; ///< index to not empty object in the list
+public:
/// Appends the feature to the end of a list
MODEL_EXPORT virtual void append(ObjectPtr theObject);
/// Returns the list of features
///\param theIndex zero-based index in the list
///\param theWithEmpty if it is false, counts the not-empty referenced objects only
- MODEL_EXPORT virtual ObjectPtr object(const int theIndex, const bool theWithEmpty = true) const;
+ MODEL_EXPORT virtual ObjectPtr object(const int theIndex, const bool theWithEmpty = true);
/// Substitutes the feature by another one. Does nothing if such object is not found.
/// Does not support the external documents objects yet.
ObjectPtr iteratedObject(TDF_ListIteratorOfLabelList& theLIter,
TDataStd_ListIteratorOfListOfExtendedString& theExtIter,
std::shared_ptr<Model_Document> theDoc) const;
+ /// Creates the hash-objects containers (does nothing if hash is already correct)
+ void createHash();
+ /// Erases the hashed objects caused by complicated modifications in the list
+ void eraseHash();
friend class Model_Data;
};
#include "Model_Events.h"
#include "Model_Data.h"
#include "Model_Document.h"
-#include "Model_SelectionNaming.h"
#include <Model_Objects.h>
#include <Model_AttributeSelectionList.h>
#include <Model_ResultConstruction.h>
#include <Events_InfoMessage.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Pnt.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_Vertex.h>
+#include <GeomAPI_ShapeExplorer.h>
#include <GeomAlgoAPI_CompoundBuilder.h>
#include <GeomAlgoAPI_NExplode.h>
+#include <Selector_Selector.h>
-#include <TNaming_Selector.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_Tool.hxx>
#include <TNaming_Builder.hxx>
#include <TNaming_SameShapeIterator.hxx>
+#include <TNaming_NewShapeIterator.hxx>
#include <TNaming_Iterator.hxx>
#include <TDataStd_Integer.hxx>
#include <TDataStd_UAttribute.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
#include <TopExp.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_ChildIDIterator.hxx>
Standard_GUID kELLIPSE_CENTER1("f70df04c-3168-4dc9-87a4-f1f840c1275d");
// identifier of the selection of the second focus point of ellipse on edge
Standard_GUID kELLIPSE_CENTER2("1395ae73-8e02-4cf8-b204-06ff35873a32");
-// identifier of the weak naming index
-Standard_GUID kWEAK_NAMING("9dcdd9be-a3a9-46eb-9b16-1c957ab20142");
-// identifier of the weak naming sub-shape type
-Standard_GUID kWEAK_NAMING_SHAPETYPE("6b9cc709-e320-4a1f-9c42-df5622369ea7");
// prefix for the whole feature context identification
const static std::string kWHOLE_FEATURE = "all-in-";
myRef.setValue(theContext);
}
- // do noth use naming if selected shape is result shape itself, but not sub-shape
+ // do not use naming if selected shape is result shape itself, but not sub-shape
TDF_Label aSelLab = selectionLabel();
aSelLab.ForgetAttribute(kSIMPLE_REF_ID);
aSelLab.ForgetAttribute(kINVALID_SELECTION);
aSelLab.ForgetAttribute(kCIRCLE_CENTER);
aSelLab.ForgetAttribute(kELLIPSE_CENTER1);
aSelLab.ForgetAttribute(kELLIPSE_CENTER2);
- aSelLab.ForgetAttribute(kWEAK_NAMING);
- aSelLab.ForgetAttribute(kWEAK_NAMING_SHAPETYPE);
bool isDegeneratedEdge = false;
// do not use the degenerated edge as a shape, a null context and shape is used in the case
owner()->data()->blockSendAttributeUpdated(false);
return false;
}
- if (theContext->groupName() == ModelAPI_ResultBody::group()) {
- ResultBodyPtr aContextBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theContext);
+ bool isSelectBody = theContext->groupName() == ModelAPI_ResultBody::group();
+ if (!isSelectBody) {
+ ResultConstructionPtr aContextConstruction =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theContext);
+ isSelectBody = aContextConstruction.get() && !aContextConstruction->isInfinite();
+ }
+ if (isSelectBody) {
+ ResultPtr aContextResult = std::dynamic_pointer_cast<ModelAPI_Result>(theContext);
+ GeomShapePtr aContextShape = aContextResult->shape();
// do not select the whole shape for body:it is already must be in the data framework
// equal and null selected objects mean the same: object is equal to context,
- if (aContextBody->shape().get() &&
- (aContextBody->shape()->isEqual(theSubShape) || !theSubShape.get())) {
+ if (aContextShape.get() && (aContextShape->isEqual(theSubShape) || !theSubShape.get())) {
aSelLab.ForgetAllAttributes(true);
TDataStd_UAttribute::Set(aSelLab, kSIMPLE_REF_ID);
} else {
- selectBody(aContextBody, theSubShape);
+ selectBody(aContextResult, theSubShape);
}
} else if (theContext->groupName() == ModelAPI_ResultConstruction::group()) {
- ResultConstructionPtr aContextConstruction =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theContext);
aSelLab.ForgetAllAttributes(true); // to remove old selection data
std::shared_ptr<Model_ResultConstruction> aConstruction =
std::dynamic_pointer_cast<Model_ResultConstruction>(theContext);
std::shared_ptr<GeomAPI_Shape> aSubShape;
- if (theSubShape.get() && !aContextConstruction->shape()->isEqual(theSubShape))
+ if (theSubShape.get() && !aConstruction->shape()->isEqual(theSubShape))
aSubShape = theSubShape; // the whole context
- if (aConstruction->isInfinite()) {
- // For correct naming selection, put the shape into the naming structure.
- // It seems sub-shapes are not needed: only this shape is (and can be ) selected.
- TNaming_Builder aBuilder(aSelLab);
- aBuilder.Generated(aContextConstruction->shape()->impl<TopoDS_Shape>());
- }
- int anIndex = aConstruction->select(theSubShape, owner()->document());
- TDataStd_Integer::Set(aSelLab, anIndex);
} else if (theContext->groupName() == ModelAPI_ResultPart::group()) {
aSelLab.ForgetAllAttributes(true);
TDataStd_UAttribute::Set(aSelLab, kPART_REF_ID);
if (myRef.isInitialized()) {
if (aSelLab.IsAttribute(kSIMPLE_REF_ID)) { // it is just reference to shape, not sub-shape
ResultPtr aContext = context();
- if (!aContext.get())
- return aResult; // empty result
+ if (!aContext.get() || aContext->groupName() == ModelAPI_ResultConstruction::group())
+ return aResult; // empty result, for whole construction selection also
return aContext->shape();
}
if (aSelLab.IsAttribute(kPART_REF_ID)) {
}
return GeomAlgoAPI_CompoundBuilder::compound(allShapes);
}
- }
-
- if (aSelLab.IsAttribute(kWEAK_NAMING)) { // a weak naming is used
- Handle(TDataStd_Integer) aWeakId;
- aSelLab.FindAttribute(kWEAK_NAMING, aWeakId);
- // get the context shape
- GeomShapePtr aContextShape;
- ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(context());
- if (aBody.get()) {
- aContextShape = aBody->shape();
- } else {
- ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(myRef.value());
- if (aResult) {
- aContextShape = aResult->shape();
- }
+ } else {
+ if (contextFeature().get()) {
+ return aResult; // for the whole sketch feature selected return null => all faces
}
- if (!aContextShape.get())
- return GeomShapePtr();
- Handle(TDataStd_Integer) aWeakShapeType;
- aSelLab.FindAttribute(kWEAK_NAMING_SHAPETYPE, aWeakShapeType);
- GeomAlgoAPI_NExplode aNExplode(
- aContextShape, GeomAPI_Shape::ShapeType(aWeakShapeType->Get()));
- GeomShapePtr aValue = aNExplode.shape(aWeakId->Get());
- return aValue;
}
Handle(TNaming_NamedShape) aSelection;
aResult = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape);
aResult->setImpl(new TopoDS_Shape(aSelShape));
} else if (aConstr) { // simple construction element: just shape of this construction element
- Handle(TDataStd_Integer) anIndex;
- if (aSelLab.FindAttribute(TDataStd_Integer::GetID(), anIndex)) {
- if (anIndex->Get() == 0) // it is just reference to construction, nothing is in value
- return aResult;
- return aConstr->shape(anIndex->Get(), owner()->document());
- }
+ aResult = aConstr->shape();
}
}
return aResult;
std::shared_ptr<Model_ResultConstruction> aConstr =
std::dynamic_pointer_cast<Model_ResultConstruction>(context());
if (aConstr.get()) {
- Handle(TDataStd_Integer) anIndex;
- if (aSelLab.FindAttribute(TDataStd_Integer::GetID(), anIndex)) {
- // for the whole shape it may return null, so, if index exists, returns true
return true;
- }
}
// for the whole feature, a feature object
FeaturePtr aFeat = contextFeature();
}
Model_AttributeSelection::Model_AttributeSelection(TDF_Label& theLabel)
- : myRef(theLabel)
+: myRef(theLabel),
+ myIsGeometricalSelection(false)
{
myIsInitialized = myRef.isInitialized();
myParent = NULL;
{
myRef.setID(theID);
ModelAPI_AttributeSelection::setID(theID);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
+ if (myParent) {
+ myIsGeometricalSelection = true;//myParent->isGeometricalSelection();
+ } else {
+ myIsGeometricalSelection =
+ ModelAPI_Session::get()->validators()->isGeometricalSelection(aFeature->getKind(), id());
+ }
}
ResultPtr Model_AttributeSelection::context()
if(aPart.get() && aPart->data() == aResult->data()) {
ResultPtr aPartResult = std::dynamic_pointer_cast<ModelAPI_Result>(aPart);
FeaturePtr anOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
- // check that this result is not this-feature result (it is forbidden t oselect itself)
+ // check that this result is not this-feature result (it is forbidden to select itself)
if(anOwnerFeature.get() && anOwnerFeature->firstResult() != aPartResult) {
return aPartResult;
}
myRef.setObject(theObject);
}
-TDF_LabelMap& Model_AttributeSelection::scope()
-{
- if (myScope.IsEmpty()) { // create a new scope if not yet done
- // gets all features with named shapes that are before this feature label (before in history)
- DocumentPtr aMyDoc = owner()->document();
- std::list<std::shared_ptr<ModelAPI_Feature> > allFeatures = aMyDoc->allFeatures();
- std::list<std::shared_ptr<ModelAPI_Feature> >::iterator aFIter = allFeatures.begin();
- bool aMePassed = false;
- CompositeFeaturePtr aComposite =
- std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(owner());
- FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
- CompositeFeaturePtr aCompositeOwner, aCompositeOwnerOwner;
- if (aFeature.get()) {
- aCompositeOwner = ModelAPI_Tools::compositeOwner(aFeature);
- if (aCompositeOwner.get()) {
- aCompositeOwnerOwner = ModelAPI_Tools::compositeOwner(aCompositeOwner);
- }
- }
- // for group Scope is not limitet: this is always up to date objects
- // this causes problem in galeries.py
- //bool isGroup = aFeature.get() && aFeature->getKind() == "Group";
- for(; aFIter != allFeatures.end(); aFIter++) {
- if (*aFIter == owner()) { // the left features are created later (except subs of composite)
- aMePassed = true;
- continue;
- }
- //if (isGroup) aMePassed = false;
- bool isInScope = !aMePassed;
- if (!isInScope && aComposite.get()) {
- // try to add sub-elements of composite if this is composite
- if (aComposite->isSub(*aFIter))
- isInScope = true;
- }
- // remove the composite-owner of this feature (sketch in extrusion-cut)
- if (isInScope && (aCompositeOwner == *aFIter || aCompositeOwnerOwner == *aFIter))
- isInScope = false;
-
- if (isInScope && aFIter->get() && (*aFIter)->data()->isValid()) {
- TDF_Label aFeatureLab = std::dynamic_pointer_cast<Model_Data>(
- (*aFIter)->data())->label().Father();
- TDF_ChildIDIterator aNSIter(aFeatureLab, TNaming_NamedShape::GetID(), true);
- for(; aNSIter.More(); aNSIter.Next()) {
- Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(aNSIter.Value());
- if (!aNS.IsNull() && aNS->Evolution() != TNaming_SELECTED) {
- myScope.Add(aNS->Label());
- }
- }
- }
- }
- // also add all naming labels created for external constructions
- std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(aMyDoc);
- TDF_Label anExtDocLab = aDoc->extConstructionsLabel();
- TDF_ChildIDIterator aNSIter(anExtDocLab, TNaming_NamedShape::GetID(), true);
- for(; aNSIter.More(); aNSIter.Next()) {
- Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(aNSIter.Value());
- if (!aNS.IsNull() && aNS->Evolution() != TNaming_SELECTED) {
- myScope.Add(aNS->Label());
- }
- }
- }
- return myScope;
-}
-
/// Sets the invalid flag if flag is false, or removes it if "true"
/// Returns theFlag
static bool setInvalidIfFalse(TDF_Label& theLab, const bool theFlag) {
{
FeaturePtr aContextFeature = contextFeature();
if (aContextFeature.get()) {
+ owner()->data()->sendAttributeUpdated(this); // send updated if "update" called in any way
return true;
}
TDF_Label aSelLab = selectionLabel();
}
if (aContext->groupName() == ModelAPI_ResultBody::group()) {
- if (aSelLab.IsAttribute(kWEAK_NAMING)) { // a weak naming is used
- Handle(TDataStd_Integer) aWeakId;
- aSelLab.FindAttribute(kWEAK_NAMING, aWeakId);
- // get the context shape
- GeomShapePtr aContextShape;
- ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aContext);
- if (aBody.get()) {
- aContextShape = aBody->shape();
- } else {
- ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(myRef.value());
- if (aResult) {
- aContextShape = aResult->shape();
- }
- }
- if (!setInvalidIfFalse(aSelLab, aContextShape.get() != NULL)) // context shape not found
- return false;
- Handle(TDataStd_Integer) aWeakShapeType;
- aSelLab.FindAttribute(kWEAK_NAMING_SHAPETYPE, aWeakShapeType);
- GeomAlgoAPI_NExplode aNExplode(
- aContextShape, GeomAPI_Shape::ShapeType(aWeakShapeType->Get()));
- GeomShapePtr aValue = aNExplode.shape(aWeakId->Get());
- return setInvalidIfFalse(aSelLab, aValue.get() != NULL);
- }
- // body: just a named shape, use selection mechanism from OCCT
- TNaming_Selector aSelector(aSelLab);
+ // body: just a named shape, use topological selection mechanism
+ bool aResult = false;
TopoDS_Shape anOldShape;
- if (!aSelector.NamedShape().IsNull()) {
- anOldShape = aSelector.NamedShape()->Get();
- }
- bool aResult = aSelector.Solve(scope()) == Standard_True;
- // must be before sending of updated attribute (1556)
- aResult = setInvalidIfFalse(aSelLab, aResult);
+ Handle(TNaming_NamedShape) aNS;
+ if (aSelLab.FindAttribute(TNaming_NamedShape::GetID(), aNS))
+ anOldShape = aNS->Get();
+
+ TopoDS_Shape aContextShape = aContext->shape()->impl<TopoDS_Shape>();
+ Selector_Selector aSelector(aSelLab, baseDocumentLab());
+ aResult = aSelector.restore(aContextShape);
+ setInvalidIfFalse(aSelLab, aResult);
+
TopoDS_Shape aNewShape;
- if (!aSelector.NamedShape().IsNull()) {
- aNewShape = aSelector.NamedShape()->Get();
- }
- if (anOldShape.IsNull() || aNewShape.IsNull() ||
- !anOldShape.IsEqual(aSelector.NamedShape()->Get())) {
- // shape type shoud not not changed: if shape becomes compound of such shapes, then split
- if (myParent && !anOldShape.IsNull() && !aNewShape.IsNull() &&
+ if (aSelLab.FindAttribute(TNaming_NamedShape::GetID(), aNS))
+ aNewShape = aNS->Get();
+
+ if (anOldShape.IsNull() || aNewShape.IsNull() || !anOldShape.IsEqual(aNewShape)) {
+ // shape type should not be changed: if shape becomes compound of such shapes, then split
+ if (!myIsGeometricalSelection && myParent && !anOldShape.IsNull() && !aNewShape.IsNull() &&
anOldShape.ShapeType() != aNewShape.ShapeType() &&
(aNewShape.ShapeType() == TopAbs_COMPOUND || aNewShape.ShapeType() == TopAbs_COMPSOLID))
{
}
if (aContext->groupName() == ModelAPI_ResultConstruction::group()) {
- Handle(TDataStd_Integer) anIndex;
- if (aSelLab.FindAttribute(TDataStd_Integer::GetID(), anIndex)) {
- std::shared_ptr<Model_ResultConstruction> aConstructionContext =
- std::dynamic_pointer_cast<Model_ResultConstruction>(aContext);
- bool aModified = true;
- bool aValid = aConstructionContext->update(anIndex->Get(), owner()->document(), aModified);
- setInvalidIfFalse(aSelLab, aValid);
- if (aConstructionContext->isInfinite()) {
- // Update the selected shape.
- TNaming_Builder aBuilder(aSelLab);
- aBuilder.Generated(aConstructionContext->shape()->impl<TopoDS_Shape>());
- }
- if (aModified)
- owner()->data()->sendAttributeUpdated(this);
- return aValid;
+ bool aResult = true;
+ std::shared_ptr<Model_ResultConstruction> aConstructionContext =
+ std::dynamic_pointer_cast<Model_ResultConstruction>(aContext);
+ if (!aConstructionContext->isInfinite()) {
+ TopoDS_Shape aContextShape = aContext->shape()->impl<TopoDS_Shape>();
+ Selector_Selector aSelector(aSelLab, baseDocumentLab());
+ TopoDS_Shape anOldShape = aSelector.value();
+ aResult = aSelector.restore(aContextShape);
+ setInvalidIfFalse(aSelLab, aResult);
+ if (aResult && !anOldShape.IsEqual(aSelector.value()))
+ owner()->data()->sendAttributeUpdated(this); // send updated if shape is changed
+ } else {
+ owner()->data()->sendAttributeUpdated(this); // send updated if "update" called in any way
}
+ return aResult;
}
return setInvalidIfFalse(aSelLab, false); // unknown case
}
const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape)
{
// perform the selection
- TNaming_Selector aSel(selectionLabel());
TopoDS_Shape aContext;
- ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theContext);//myRef.value()
+ ResultPtr aBody = std::dynamic_pointer_cast<ModelAPI_Result>(theContext);
if (aBody) {
aContext = aBody->shape()->impl<TopoDS_Shape>();
} else {
}
}
- // with "recover" feature the selected context may be not up to date (issue 1710)
- Handle(TNaming_NamedShape) aResult;
- TDF_Label aSelLab = selectionLabel();
- TopoDS_Shape aNewContext = aContext;
- bool isUpdated = true;
- while(!aNewContext.IsNull() && isUpdated) {
- // searching for the very last shape that was produced from this one
- isUpdated = false;
- if (!TNaming_Tool::HasLabel(aSelLab, aNewContext))
- // to avoid crash of TNaming_SameShapeIterator if pure shape does not exists
- break;
- for(TNaming_SameShapeIterator anIter(aNewContext, aSelLab); anIter.More(); anIter.Next()) {
- TDF_Label aNSLab = anIter.Label();
- if (!scope().Contains(aNSLab))
- continue;
- Handle(TNaming_NamedShape) aNS;
- if (aNSLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- for(TNaming_Iterator aShapesIter(aNS); aShapesIter.More(); aShapesIter.Next()) {
- if (aShapesIter.Evolution() == TNaming_SELECTED)
- continue; // don't use the selection evolution
- if (!aShapesIter.OldShape().IsNull() && aShapesIter.OldShape().IsSame(aNewContext)) {
- // found the original shape
- aNewContext = aShapesIter.NewShape(); // go to the newer shape
- isUpdated = true;
- break;
- }
- }
- }
- }
- }
- if (aNewContext.IsNull()) { // a context is already deleted
- setInvalidIfFalse(aSelLab, false);
- Events_InfoMessage("Model_AttributeSelection", "Failed to select shape already deleted").send();
- return;
- }
-
- TopoDS_Shape aNewSub = theSubShape ? theSubShape->impl<TopoDS_Shape>() : aContext;
- if (!aNewSub.IsEqual(aContext)) { // searching for subshape in the new context
- bool isFound = false;
- TopExp_Explorer anExp(aNewContext, aNewSub.ShapeType());
- for(; anExp.More(); anExp.Next()) {
- if (anExp.Current().IsSame(aNewSub)) {
- isFound = true;
- break;
- }
- }
- if (!isFound) { // sub-shape is not found in the up-to-date instance of the context shape
- // if context is sub-result of compound/compsolid, selection of sub-shape better propagate to
- // the main result (which is may be modified); the case is in 1799
- ResultBodyPtr aMain = ModelAPI_Tools::bodyOwner(theContext);
- while(ModelAPI_Tools::bodyOwner(aMain).get())
- aMain = ModelAPI_Tools::bodyOwner(theContext);
- if (aMain.get()) {
- selectBody(aMain, theSubShape);
- return;
- }
- setInvalidIfFalse(aSelLab, false);
- Events_InfoMessage("Model_AttributeSelection",
- "Failed to select sub-shape already modified").send();
- return;
- }
- }
-
- /// fix for issue 411: result modified shapes must not participate in this selection mechanism
if (!aContext.IsNull()) {
- FeaturePtr aFeatureOwner = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
- bool aEraseResults = false;
- if (aFeatureOwner.get()) {
- aEraseResults = !aFeatureOwner->results().empty();
- if (aEraseResults) // erase results without flash deleted and redisplay: do it after Select
- aFeatureOwner->removeResults(0, false, false);
- }
+ TDF_Label aSelLab = selectionLabel();
+ TopoDS_Shape aNewSub = theSubShape->impl<TopoDS_Shape>();
+
bool aSelectorOk = true;
+ Selector_Selector aSelector(aSelLab, baseDocumentLab());
try {
- aSel.Select(aNewSub, aNewContext);
+ aSelectorOk = aSelector.select(aContext, aNewSub, myIsGeometricalSelection);
+ if (aSelectorOk) {
+ aSelectorOk = aSelector.store(aContext);
+ }
} catch(...) {
aSelectorOk = false;
}
- // face may become divided after the model update, so, new labels may be added to the scope
- myScope.Clear();
-
- // check that selection is correct, otherwise use weak naming solution
- TDF_Label aSelLab = selectionLabel();
- aSelLab.ForgetAttribute(kWEAK_NAMING);
- Handle(TNaming_NamedShape) aSelectorShape;
- if (aSelectorOk && aSelLab.FindAttribute(TNaming_NamedShape::GetID(), aSelectorShape))
- {
- TopoDS_Shape aShape = aSelectorShape->Get();
- if (aShape.IsNull() || aShape.ShapeType() != aNewSub.ShapeType())
- aSelectorOk = false;
- }
- if (!aSelectorOk) { // weak naming identifier instead
- GeomShapePtr aContextShape(new GeomAPI_Shape);
- aContextShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aNewContext));
- GeomShapePtr aValueShape(new GeomAPI_Shape);
- aValueShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aNewSub));
-
- GeomAlgoAPI_NExplode aNExplode(aContextShape, aValueShape->shapeType());
- int anId = aNExplode.index(aValueShape);
- if (anId) {
- TDataStd_Integer::Set(aSelLab, kWEAK_NAMING, anId);
- TDataStd_Integer::Set(aSelLab, kWEAK_NAMING_SHAPETYPE, int(aValueShape->shapeType()));
- }
- }
-
- if (aEraseResults) { // flash after Select : in Groups it makes selection with shift working
- static Events_Loop* aLoop = Events_Loop::loop();
- static const Events_ID kDeletedEvent = aLoop->eventByName(EVENT_OBJECT_DELETED);
- aLoop->flush(kDeletedEvent);
+ if (aSelectorOk) {
+ TopoDS_Shape aShape = aSelector.value();
+ aSelectorOk = !aShape.IsNull() && aShape.ShapeType() == aNewSub.ShapeType();
}
+ setInvalidIfFalse(aSelLab, aSelectorOk);
}
}
}
TDF_Label aSelLab = selectionLabel();
- Handle(TDataStd_Integer) aWeakId;
- if (aSelLab.FindAttribute(kWEAK_NAMING, aWeakId)) { // a weak naming is used
- std::ostringstream aNameStream;
- aNameStream<<aCont->data()->name()<<"/weak_name_"<<aWeakId->Get();
- return aNameStream.str();
+ if (aSelLab.IsAttribute(kSIMPLE_REF_ID)) { // whole context, no value
+ return contextName(aCont);
+ }
+
+ // if it is in result of another part
+ if (aCont->groupName() == ModelAPI_ResultPart::group()) {
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aCont);
+ int anIndex;
+ GeomShapePtr aValue = value();
+ if (aValue.get())
+ return aPart->data()->name() + "/" + aPart->nameInPart(aValue, anIndex);
+ else
+ return aPart->data()->name();
+ }
+
+
+ // whole infinitive construction
+ if (aCont->groupName() == ModelAPI_ResultConstruction::group()) {
+ ResultConstructionPtr aConstr = std::dynamic_pointer_cast<Model_ResultConstruction>(aCont);
+ if (aConstr->isInfinite()) {
+ return contextName(aCont);
+ }
}
- Model_SelectionNaming aSelNaming(aSelLab);
- std::string aResult = aSelNaming.namingName(
- aCont, aSubSh, theDefaultName, owner()->document() != aCont->document());
+ Selector_Selector aSelector(aSelLab, baseDocumentLab());
+ std::string aResult;
+ if (aCont->shape().get() && aSelector.restore(aCont->shape()->impl<TopoDS_Shape>()))
+ aResult = aSelector.name(this);
if (aCenterType != NOT_CENTER) {
aResult += centersMap()[aCenterType];
}
CenterType aCenterType = theType[0] == 'v' || theType[0] == 'V' ? // only for vertex-type
centerTypeByName(aSubShapeName) : NOT_CENTER;
std::string aType = aCenterType == NOT_CENTER ? theType : "EDGE"; // search for edge now
+ static const GeomShapePtr anEmptyShape;
// first iteration is selection by name without center prefix, second - in case of problem,
// try with initial name
- for(int aUseCenter = 1; aUseCenter >= 0; aUseCenter--) {
+ for(int aUseCenter = 1; aUseCenter >= 0; aUseCenter--) {
if (aUseCenter == 0 && aCenterType != NOT_CENTER) {
aSubShapeName = theSubShapeName;
aCenterType = NOT_CENTER;
aType = theType;
} else if (aUseCenter != 1) continue;
+ TopAbs_ShapeEnum aShapeType = TopAbs_ShapeEnum(GeomAPI_Shape::shapeTypeByStr(aType));
+ std::shared_ptr<Model_Document> aDoc =
+ std::dynamic_pointer_cast<Model_Document>(owner()->document());
// check this is Part-name: 2 delimiters in the name
std::size_t aPartEnd = aSubShapeName.find('/');
- if (aPartEnd != std::string::npos && aPartEnd != aSubShapeName.rfind('/')) {
+ if (aPartEnd != std::string::npos) {
std::string aPartName = aSubShapeName.substr(0, aPartEnd);
- ObjectPtr aFound = owner()->document()->objectByName(ModelAPI_ResultPart::group(), aPartName);
- if (aFound.get()) { // found such part, so asking it for the name
- ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aFound);
- std::string aNameInPart = aSubShapeName.substr(aPartEnd + 1);
- int anIndex;
- std::shared_ptr<GeomAPI_Shape> aSelected = aPart->shapeInPart(aNameInPart, aType, anIndex);
- if (aSelected.get()) {
- if (aCenterType != NOT_CENTER) {
- if (!aSelected->isEdge())
- continue;
- std::shared_ptr<GeomAPI_Edge> aSelectedEdge(new GeomAPI_Edge(aSelected));
- setValueCenter(aPart, aSelectedEdge, aCenterType);
- } else
- setValue(aPart, aSelected);
- TDataStd_Integer::Set(selectionLabel(), anIndex);
- return;
+ DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+ if (aPartName == aRootDoc->kind()) {
+ aDoc = std::dynamic_pointer_cast<Model_Document>(aRootDoc);
+ aSubShapeName = aSubShapeName.substr(aPartEnd + 1);
+ } else {
+ ObjectPtr aFound =
+ owner()->document()->objectByName(ModelAPI_ResultPart::group(), aPartName);
+ if (aFound.get()) { // found such part, so asking it for the name
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aFound);
+ std::string aNameInPart = aSubShapeName.substr(aPartEnd + 1);
+ if (aNameInPart.empty()) { // whole part
+ setValue(aPart, anEmptyShape);
+ return;
+ }
+ int anIndex;
+ std::shared_ptr<GeomAPI_Shape> aSelected =
+ aPart->shapeInPart(aNameInPart, aType, anIndex);
+ if (aSelected.get()) {
+ if (aCenterType != NOT_CENTER) {
+ if (!aSelected->isEdge())
+ continue;
+ std::shared_ptr<GeomAPI_Edge> aSelectedEdge(new GeomAPI_Edge(aSelected));
+ setValueCenter(aPart, aSelectedEdge, aCenterType);
+ } else
+ setValue(aPart, aSelected);
+ TDataStd_Integer::Set(selectionLabel(), anIndex);
+ return;
+ }
}
}
}
- std::shared_ptr<Model_Document> aDoc =
- std::dynamic_pointer_cast<Model_Document>(owner()->document());
// check this is a whole feature context
if (aSubShapeName.size() > kWHOLE_FEATURE.size() &&
aSubShapeName.substr(0, kWHOLE_FEATURE.size()) == kWHOLE_FEATURE) {
std::string aFeatureName = aSubShapeName.substr(kWHOLE_FEATURE.size());
ObjectPtr anObj = aDoc->objectByName(ModelAPI_Feature::group(), aFeatureName);
if (anObj.get()) {
- static const GeomShapePtr anEmptyShape;
setValue(anObj, anEmptyShape);
return;
}
}
- Model_SelectionNaming aSelNaming(selectionLabel());
- std::shared_ptr<GeomAPI_Shape> aShapeToBeSelected;
- ResultPtr aCont;
- if (aSelNaming.selectSubShape(aType, aSubShapeName, aDoc, aShapeToBeSelected, aCont)) {
- // try to find the last context to find the up to date shape
- if (aCont->shape().get() && !aCont->shape()->isNull() &&
- aCont->groupName() == ModelAPI_ResultBody::group() && aDoc == owner()->document()) {
- const TopoDS_Shape aConShape = aCont->shape()->impl<TopoDS_Shape>();
- if (!aConShape.IsNull()) {
- Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aConShape, selectionLabel());
- if (!aNS.IsNull()) {
- aNS = TNaming_Tool::CurrentNamedShape(aNS);
- if (!aNS.IsNull() && scope().Contains(aNS->Label())) { // scope check is for 2228
- TDF_Label aLab = aNS->Label();
- if (aLab.Depth() % 2 == 0)
- aLab = aLab.Father();
- ObjectPtr anObj = aDoc->objects()->object(aLab);
- while(!anObj.get() && aLab.Depth() > 5) {
- aLab = aLab.Father().Father();
- anObj = aDoc->objects()->object(aLab);
- }
-
- if (anObj.get()) {
- ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
- if (aRes)
- aCont = aRes;
- }
- }
- }
- }
- }
- // if compsolid is context, try to take sub-solid as context: like in GUI and scripts
- if (aCont.get() && aShapeToBeSelected.get()) {
- ResultBodyPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aCont);
- if (aComp && aComp->numberOfSubs()) {
- std::list<ResultPtr> allSubs;
- ModelAPI_Tools::allSubs(aComp, allSubs);
- std::list<ResultPtr>::iterator aS = allSubs.begin();
- for(; aS != allSubs.end(); aS++) {
- ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aS);
- if (aSub && aSub->numberOfSubs() == 0 && aSub->shape().get() &&
- aSub->shape()->isSubShape(aShapeToBeSelected)) {
- aCont = aSub;
- break;
- }
- }
- }
+ // the whole result selection check
+ if (aSubShapeName.find('/') == std::string::npos) {
+ ObjectPtr aRes = aDoc->objectByName(ModelAPI_ResultConstruction::group(), aSubShapeName);
+ if (!aRes.get())
+ aRes = aDoc->objectByName(ModelAPI_ResultBody::group(), aSubShapeName);
+ if (aRes.get()) {
+ setValue(aRes, anEmptyShape);
+ return;
}
- // try to find the latest active result that must be used instead of the selected
- // to set the active context (like in GUI selection), not concealed one
- bool aFindNewContext = true;
- while(aFindNewContext && aCont.get()) {
- aFindNewContext = false;
- // take references to all results: root one, any sub
- ResultBodyPtr aCompContext = ModelAPI_Tools::bodyOwner(aCont, true);
- std::list<ResultPtr> allRes;
- if (aCompContext.get()) {
- ModelAPI_Tools::allSubs(aCompContext, allRes);
- allRes.push_back(aCompContext);
- } else {
- allRes.push_back(aCont);
- }
- for(std::list<ResultPtr>::iterator aSub = allRes.begin(); aSub != allRes.end(); aSub++) {
- ResultPtr aResCont = *aSub;
- ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResCont);
- // only lower and higher level subs are counted
- if (aResBody.get() && aResBody->numberOfSubs() > 0 && aResBody != aCompContext)
- continue;
- const std::set<AttributePtr>& aRefs = aResCont->data()->refsToMe();
- std::set<AttributePtr>::const_iterator aRef = aRefs.begin();
- for(; !aFindNewContext && aRef != aRefs.end(); aRef++) {
- if (!aRef->get() || !(*aRef)->owner().get())
- continue;
- // concealed attribute only
- FeaturePtr aRefFeat = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRef)->owner());
- if (!ModelAPI_Session::get()->validators()->isConcealed(
- aRefFeat->getKind(), (*aRef)->id()))
+ }
+
+ Selector_Selector aSelector(selectionLabel(), baseDocumentLab());
+ myRestoreDocument = aDoc;
+ TDF_Label aContextLabel = aSelector.restoreByName(
+ aSubShapeName, aShapeType, this, myIsGeometricalSelection);
+ myRestoreDocument.reset();
+ if (!aContextLabel.IsNull()) {
+ ResultPtr aContext = aDoc->resultByLab(aContextLabel); // any label for document access
+ if (aContext.get() && aContext->shape().get()) {
+ TopoDS_Shape aContextShape = aContext->shape()->impl<TopoDS_Shape>();
+ if (aSelector.solve(aContextShape)) {
+ TopoDS_Shape aSelectorShape = aSelector.value();
+ GeomShapePtr aShapeToBeSelected(new GeomAPI_Shape);
+ aShapeToBeSelected->setImpl<TopoDS_Shape>(new TopoDS_Shape(aSelectorShape));
+ // make the context result the latest existing
+ aContext = newestContext(aContext, aShapeToBeSelected);
+ if (myIsGeometricalSelection || aCenterType == NOT_CENTER) {
+ // store the currently generated name
+ selectionLabel().ForgetAllAttributes(true);
+ bool aToUnblock = false;
+ aToUnblock = !owner()->data()->blockSendAttributeUpdated(true);
+ myRef.setValue(aContext);
+ aSelector.store(aContextShape);
+ owner()->data()->sendAttributeUpdated(this);
+ if (aToUnblock)
+ owner()->data()->blockSendAttributeUpdated(false);
+ return;
+ } else { // re-select center of circle/arc by context and value
+ if (!aShapeToBeSelected->isEdge())
continue;
- // search the feature result that contains sub-shape selected
- std::list<std::shared_ptr<ModelAPI_Result> > aResults;
-
- // take all sub-results or one result
- std::list<ResultPtr> aRefFeatResults;
- ModelAPI_Tools::allResults(aRefFeat, aRefFeatResults);
- std::list<ResultPtr>::iterator aRefResIter = aRefFeatResults.begin();
- for(; aRefResIter != aRefFeatResults.end(); aRefResIter++) {
- ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRefResIter);
- if (aBody.get() && aBody->numberOfSubs() == 0) // add only lower level subs
- aResults.push_back(aBody);
- }
- std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = aResults.begin();
- for(; aResIter != aResults.end(); aResIter++) {
- if (!aResIter->get() || !(*aResIter)->data()->isValid() || (*aResIter)->isDisabled())
- continue;
- GeomShapePtr aShape = (*aResIter)->shape();
- GeomShapePtr aSelectedShape =
- aShapeToBeSelected.get() ? aShapeToBeSelected : aCont->shape();
- if (aShape.get() && aShape->isSubShape(aSelectedShape, false)) {
- aCont = *aResIter; // found new context (produced from this) with same subshape
- aFindNewContext = true; // continue searching futher
- break;
- }
- }
+ std::shared_ptr<GeomAPI_Edge> aSelectedEdge(new GeomAPI_Edge(aShapeToBeSelected));
+ setValueCenter(aContext, aSelectedEdge, aCenterType);
}
+ return;
}
}
-
- if (aCenterType != NOT_CENTER) {
- if (!aShapeToBeSelected->isEdge())
- continue;
- std::shared_ptr<GeomAPI_Edge> aSelectedEdge(new GeomAPI_Edge(aShapeToBeSelected));
- setValueCenter(aCont, aSelectedEdge, aCenterType);
- } else
- setValue(aCont, aShapeToBeSelected);
- return;
}
}
-
+ // invalid
TDF_Label aSelLab = selectionLabel();
setInvalidIfFalse(aSelLab, false);
reset();
const std::string& theContextName, const int theIndex)
{
// selection of context by name
- //std::string aNamingContextName = theContextName + "/";
- //selectSubShape(theType, aNamingContextName);
- std::shared_ptr<Model_Document> aDoc =
- std::dynamic_pointer_cast<Model_Document>(owner()->document());
- if (aDoc.get()) {
- bool aUnique = true;
- std::string aContextName = theContextName;
- std::string anEmptySub = "";
- ResultPtr aContext = aDoc->findByName(aContextName, anEmptySub, aUnique);
- //ResultPtr aContext = context();
- if (aContext.get()) {
- GeomShapePtr aContShape = aContext->shape();
- if (aContShape.get()) {
- GeomAlgoAPI_NExplode aNExp(aContShape, GeomAPI_Shape::shapeTypeByStr(theType));
- GeomShapePtr aValue = aNExp.shape(theIndex);
- if (aValue.get())
- setValue(aContext, aValue);
- }
+ selectSubShape(theType, theContextName);
+ ResultPtr aContext = context();
+ if (aContext.get()) {
+ GeomShapePtr aContShape = aContext->shape();
+ if (aContShape.get()) {
+ GeomAlgoAPI_NExplode aNExp(aContShape, GeomAPI_Shape::shapeTypeByStr(theType));
+ GeomShapePtr aValue = aNExp.shape(theIndex);
+ if (aValue.get())
+ setValue(aContext, aValue);
}
}
}
{
bool aWasWholeContext = theValShape.IsNull();
if (aWasWholeContext) {
- //theShapes.Append(theValShape);
- //return;
theValShape = theOldContext->shape()->impl<TopoDS_Shape>();
}
- //TopoDS_Shape anOldContShape = theOldContext->shape()->impl<TopoDS_Shape>();
TopoDS_Shape aNewContShape = theNewContext->shape()->impl<TopoDS_Shape>();
- //if (anOldContShape.IsSame(theValShape)) { // full context shape substituted by new full context
- //theShapes.Append(aNewContShape);
- //return;
- //}
// if a new value is unchanged in the new context, do nothing: value is correct
TopExp_Explorer aSubExp(aNewContShape, theValShape.ShapeType());
for(; aSubExp.More(); aSubExp.Next()) {
for(; aNewContIter != aNewToIterate.end(); aNewContIter++) {
std::shared_ptr<Model_Data> aNewData =
std::dynamic_pointer_cast<Model_Data>((*aNewContIter)->data());
- TDF_Label aNewLab = aNewData->label();
+ TDF_Label aNewLab = aNewData->shapeLab();
// searching for produced sub-shape fully on some label
- TDF_ChildIDIterator aNSIter(aNewLab, TNaming_NamedShape::GetID(), Standard_True);
+ TDF_ChildIDIterator aNSIter(aNewLab, TNaming_NamedShape::GetID());
for(; aNSIter.More(); aNSIter.Next()) {
Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(aNSIter.Value());
for(TNaming_Iterator aPairIter(aNS); aPairIter.More(); aPairIter.Next()) {
}
}
if (aToFindPart == 2 && !aNewToOld.IsEmpty()) {
- // map of sub-shapes -> number of occurences of these shapes in containers
+ // map of sub-shapes -> number of occurrences of these shapes in containers
NCollection_DataMap<TopoDS_Shape, TopTools_MapOfShape, TopTools_ShapeMapHasher> aSubs;
TopTools_DataMapOfShapeShape::Iterator aContIter(aNewToOld);
for(; aContIter.More(); aContIter.Next()) {
if (!aModifierFeat.get())
continue;
FeaturePtr aThisFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
- if (aModifierFeat == aThisFeature || theDoc->objects()->isLater(aModifierFeat, aThisFeature))
+ if (aModifierFeat == aThisFeature || !theDoc->isLaterByDep(aThisFeature, aModifierFeat))
continue; // the modifier feature is later than this, so, should not be used
FeaturePtr aCurrentModifierFeat = theDoc->feature(theContext);
if (aCurrentModifierFeat == aModifierFeat ||
- theDoc->objects()->isLater(aCurrentModifierFeat, aModifierFeat))
+ !theDoc->isLaterByDep(aModifierFeat, aCurrentModifierFeat))
continue; // the current modifier is later than the found, so, useless
Handle(TNaming_NamedShape) aNewNS;
aModifIter.Label().FindAttribute(TNaming_NamedShape::GetID(), aNewNS);
if (aNewNS->Evolution() == TNaming_MODIFY || aNewNS->Evolution() == TNaming_GENERATED) {
aResults.insert(aModifierObj);
- //TNaming_Iterator aPairIter(aNewNS);
- //aResContShapes.Append(aPairIter.NewShape());
aResContShapes.Append(aModifierObj->shape()->impl<TopoDS_Shape>());
} else if (aNewNS->Evolution() == TNaming_DELETE) { // a shape was deleted => result is empty
aResults.insert(ResultPtr());
- } else { // not-precessed modification => don't support it
+ } else { // not-processed modification => don't support it
continue;
}
}
}
if (aResults.empty())
return false; // no modifications found, must stay the same
- // iterate all results to find futher modifications
+ // iterate all results to find further modifications
std::set<ResultPtr>::iterator aResIter = aResults.begin();
for(; aResIter != aResults.end(); aResIter++) {
if (aResIter->get() != NULL) {
- // compute new values by two contextes: the old and the new
+ // compute new values by two contexts: the old and the new
TopTools_ListOfShape aValShapes;
computeValues(theContext, *aResIter, theValShape, aValShapes);
if (searchNewContext(theDoc, aNewContShape, *aResIter, aNewValSh,
theAccessLabel, aNewRes, aNewUpdatedVal))
{
- // appeand new results instead of the current ones
+ // append new results instead of the current ones
std::list<ResultPtr>::iterator aNewIter = aNewRes.begin();
TopTools_ListIteratorOfListOfShape aNewUpdVal(aNewUpdatedVal);
for(; aNewIter != aNewRes.end(); aNewIter++, aNewUpdVal.Next()) {
std::shared_ptr<Model_Data> aContData = std::dynamic_pointer_cast<Model_Data>(aContext->data());
if (!aContData.get() || !aContData->isValid())
return;
- TDF_Label aContLab = aContData->label(); // named shape where the selected context is located
+ TDF_Label aContLab = aContData->shapeLab(); // named shape where the selected context is located
Handle(TNaming_NamedShape) aContNS;
if (!aContLab.FindAttribute(TNaming_NamedShape::GetID(), aContNS)) {
bool aFoundNewContext = true;
// to avoid detection of part changes by local selection only
AttributeSelectionPtr aSel =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRef);
- if (aSel.get() && !aSel->value()->isSame(aSel->context()->shape()))
+ if (aSel.get() && aSel->value().get() &&
+ !aSel->value()->isSame(aSel->context()->shape()))
continue;
FeaturePtr aRefFeat = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRef)->owner());
if (aRefFeat.get() && aRefFeat != owner()) {
FeaturePtr aThisFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
- if (aDoc->objects()->isLater(aThisFeature, aRefFeat)) { // found better feature
+ if (!aDoc->isLaterByDep(aRefFeat, aThisFeature)) { // found better feature
aFoundNewContext = true;
aNewContext = aRefFeat->firstResult();
}
TopTools_ListOfShape aValShapes;
if (searchNewContext(aDoc, aNewCShape, aContext, aValShape, aContLab, aNewContexts, aValShapes))
{
- // update scope to reset to a new one
- myScope.Clear();
+ GeomAPI_Shape::ShapeType aListShapeType = GeomAPI_Shape::SHAPE;
+ if (myParent) {
+ if (myParent->selectionType() == "VERTEX") aListShapeType = GeomAPI_Shape::VERTEX;
+ else if (myParent->selectionType() == "EDGE") aListShapeType = GeomAPI_Shape::EDGE;
+ else if (myParent->selectionType() == "FACE") aListShapeType = GeomAPI_Shape::FACE;
+ }
std::list<ResultPtr>::iterator aNewCont = aNewContexts.begin();
TopTools_ListIteratorOfListOfShape aNewValues(aValShapes);
- if (aNewCont == aNewContexts.end()) { // all results were deleted
+ bool aFirst = true; // first is set to this, next are appended to parent
+ for(; aNewCont != aNewContexts.end(); aNewCont++, aNewValues.Next()) {
+
+ GeomShapePtr aValueShape;
+ if (!aNewValues.Value().IsNull()) {
+ aValueShape = std::make_shared<GeomAPI_Shape>();
+ aValueShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aNewValues.Value()));
+ }
+ // Check that list has the same type of shape selection before adding.
+ GeomAPI_Shape::ShapeType aShapeShapeType = GeomAPI_Shape::SHAPE;
+ if (aValueShape.get()) {
+ aShapeShapeType = aValueShape->shapeType();
+ } else {
+ aShapeShapeType = (*aNewCont)->shape()->shapeType();
+ }
+ if (aListShapeType != GeomAPI_Shape::SHAPE && aListShapeType != aShapeShapeType) {
+ continue;
+ }
+ if (aFirst) {
+ setValue(*aNewCont, aValueShape);
+ aFirst = false;
+ } else if (myParent) {
+ myParent->append(*aNewCont, aValueShape);
+ }
+ }
+ if (aFirst) { // nothing was added, all results were deleted
ResultPtr anEmptyContext;
std::shared_ptr<GeomAPI_Shape> anEmptyShape;
setValue(anEmptyContext, anEmptyShape); // nullify the selection
return;
}
+ }
+}
+
+void Model_AttributeSelection::setParent(Model_AttributeSelectionList* theParent)
+{
+ myParent = theParent;
+}
- GeomShapePtr aValueShape;
- if (!aNewValues.Value().IsNull()) {
- aValueShape = std::make_shared<GeomAPI_Shape>();
- aValueShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aNewValues.Value()));
+std::string Model_AttributeSelection::contextName(const TDF_Label theSelectionLab)
+{
+ std::shared_ptr<Model_Document> aDoc = myRestoreDocument.get() ? myRestoreDocument :
+ std::dynamic_pointer_cast<Model_Document>(owner()->document());
+ FeaturePtr aFeatureOwner = aDoc->featureByLab(theSelectionLab);
+ bool aBaseDocumnetUsed = false;
+ if (!aFeatureOwner.get()) { // use module document
+ aDoc = std::dynamic_pointer_cast<Model_Document>(ModelAPI_Session::get()->moduleDocument());
+ aFeatureOwner = aDoc->featureByLab(theSelectionLab);
+ aBaseDocumnetUsed = true;
+ }
+ if (aFeatureOwner.get()) {
+ // if it is sub-element of the sketch, the context name is the name of the sketch
+ // searching also for result - real context
+ ResultPtr aResult;
+ FeaturePtr aComposite = ModelAPI_Tools::compositeOwner(aFeatureOwner);
+ if (aComposite.get() && aComposite->results().size() == 1 &&
+ aComposite->firstResult()->groupName() == ModelAPI_ResultConstruction::group()) {
+ aFeatureOwner = aComposite;
+ aResult = aFeatureOwner->firstResult();
+ } else {
+ aResult = aDoc->resultByLab(theSelectionLab);
}
- setValue(*aNewCont, aValueShape);
- // if there are more than one result, put them by "append" into "parent" list
- if (myParent) {
- for(aNewCont++, aNewValues.Next(); aNewCont != aNewContexts.end();
- aNewCont++, aNewValues.Next()) {
- GeomShapePtr aValueShape;
- if (!aNewValues.Value().IsNull()) {
- aValueShape = std::make_shared<GeomAPI_Shape>();
- aValueShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aNewValues.Value()));
+ if (aResult.get()) {
+ // this is to avoid duplicated names of results problem
+ std::string aContextName = aResult->data()->name();
+ // myLab corresponds to the current time
+ TDF_Label aCurrentLab = selectionLabel();
+ while(aCurrentLab.Depth() > 3)
+ aCurrentLab = aCurrentLab.Father();
+
+ int aNumInHistoryNames =
+ aDoc->numberOfNameInHistory(aResult, aCurrentLab);
+ while(aNumInHistoryNames > 1) { // add "_" before name the needed number of times
+ aContextName = "_" + aContextName;
+ aNumInHistoryNames--;
+ }
+ if (aBaseDocumnetUsed)
+ aContextName = aDoc->kind() + "/" + aContextName;
+ return aContextName;
+ }
+ }
+ return ""; // invalid case
+}
+
+/// This method restores by the context and value name the context label and
+/// sub-label where the value is. Returns true if it is valid.
+bool Model_AttributeSelection::restoreContext(std::string theName,
+ TDF_Label& theContext, TDF_Label& theValue)
+{
+ static const GeomShapePtr anEmptyShape; // to store context only
+ std::string aName = theName;
+ std::shared_ptr<Model_Document> aDoc = myRestoreDocument.get() ? myRestoreDocument :
+ std::dynamic_pointer_cast<Model_Document>(owner()->document());
+
+ // remove the sub-value part if exists
+ std::string aSubShapeName = aName;
+ std::string::size_type n = aName.find('/');
+ if (n != std::string::npos) {
+ aName = aName.substr(0, n);
+ }
+
+ if (aName.empty()) return false;
+ bool anUniqueContext = false;
+ ResultPtr aCont = aDoc->findByName(aName, aSubShapeName, anUniqueContext);
+ if (!aCont.get() || !aCont->shape().get() || aCont->shape()->isNull()) {
+ // name in PartSet?
+ aDoc = std::dynamic_pointer_cast<Model_Document>(
+ ModelAPI_Session::get()->moduleDocument());
+ if (theName.find(aDoc->kind()) == 0) { // remove the document identifier from name if exists
+ aSubShapeName = theName.substr(aDoc->kind().size() + 1);
+ aName = aSubShapeName;
+ std::string::size_type n = aName.find('/');
+ if (n != std::string::npos) {
+ aName = aName.substr(0, n);
+ }
+ }
+ aCont = aDoc->findByName(aName, aSubShapeName, anUniqueContext);
+ if (!aCont.get() || !aCont->shape().get() || aCont->shape()->isNull())
+ return false;
+ }
+
+ // searching the sub-shape
+ static const ResultPtr anEmpty;
+ theValue = aDoc->findNamingName(aSubShapeName, anUniqueContext ? aCont : anEmpty);
+
+ // sketch sub-component shape and name is located in separated feature label, try the sub-name
+ if (theValue.IsNull() && aCont->groupName() == ModelAPI_ResultConstruction::group()) {
+ std::string::size_type aSlash = aSubShapeName.rfind('/');
+ if (aSlash != std::string::npos) {
+ std::string aCompName = aSubShapeName.substr(aSlash + 1);
+ CompositeFeaturePtr aComposite =
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aDoc->feature(aCont));
+ if (aComposite.get() && aComposite->numberOfSubs()) {
+ const int aSubNum = aComposite->numberOfSubs();
+ for (int a = 0; a < aSubNum && theValue.IsNull(); a++) {
+ FeaturePtr aSub = aComposite->subFeature(a);
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
+ for (; aRes != aResults.cend() && theValue.IsNull(); aRes++) {
+ if ((*aRes)->data()->name() == aCompName) {
+ theValue = std::dynamic_pointer_cast<Model_Data>((*aRes)->data())->shapeLab();
+ break;
+ } else { // any sub-label because the sketch line may be renamed, but not sub-vertices
+ TDF_Label aLab = std::dynamic_pointer_cast<Model_Data>((*aRes)->data())->shapeLab();
+ TDF_ChildIDIterator aSubNames(aLab, TDataStd_Name::GetID());
+ for(; aSubNames.More(); aSubNames.Next()) {
+ if (Handle(TDataStd_Name)::DownCast(aSubNames.Value())->Get().
+ IsEqual(aCompName.c_str())) {
+ theValue = aSubNames.Value()->Label();
+ break;
+ }
+ }
+ }
+ }
}
+ }
+ }
+ }
+
+ if (aCont.get()) {
+ theContext = std::dynamic_pointer_cast<Model_Data>(aCont->data())->label();
+ }
+ return true;
+}
+
+TDF_Label Model_AttributeSelection::newestContext(const TDF_Label theCurrentContext) {
+ std::shared_ptr<Model_Document> aDoc = myRestoreDocument.get() ? myRestoreDocument :
+ std::dynamic_pointer_cast<Model_Document>(owner()->document());
+ ResultPtr aContext = aDoc->resultByLab(theCurrentContext);
+ if (aContext.get()) {
+ aContext = newestContext(aContext, GeomShapePtr(), true);
+ if (aContext.get())
+ return std::dynamic_pointer_cast<Model_Data>(aContext->data())->label();
+ }
+ return theCurrentContext; // nothing is changed
+}
+
+bool Model_AttributeSelection::isLater(
+ const TDF_Label theResult1, const TDF_Label theResult2) const
+{
+ std::shared_ptr<Model_Document> aDoc = myRestoreDocument.get() ? myRestoreDocument :
+ std::dynamic_pointer_cast<Model_Document>(owner()->document());
+ FeaturePtr aFeat1 = aDoc->featureByLab(theResult1);
+ if (!aFeat1.get())
+ return false;
+ FeaturePtr aFeat2 = aDoc->featureByLab(theResult2);
+ if (!aFeat2.get())
+ return false;
+ return aDoc->isLaterByDep(aFeat1, aFeat2);
+}
- // Check that list has the same type of shape selection before adding.
- GeomAPI_Shape::ShapeType aListShapeType = GeomAPI_Shape::SHAPE;
- if (myParent->selectionType() == "VERTEX") aListShapeType = GeomAPI_Shape::VERTEX;
- else if (myParent->selectionType() == "EDGE") aListShapeType = GeomAPI_Shape::EDGE;
- else if (myParent->selectionType() == "FACE") aListShapeType = GeomAPI_Shape::FACE;
-
- GeomAPI_Shape::ShapeType aShapeShapeType = GeomAPI_Shape::SHAPE;
- if (aValueShape.get()) {
- aShapeShapeType = aValueShape->shapeType();
- } else {
- (*aNewCont)->shape()->shapeType();
+ResultPtr Model_AttributeSelection::newestContext(
+ const ResultPtr theCurrent, const GeomShapePtr theValue, const bool theAnyValue)
+{
+ ResultPtr aResult = theCurrent;
+ GeomShapePtr aSelectedShape = theValue.get() ? theValue : theCurrent->shape();
+ std::shared_ptr<Model_Document> aDoc =
+ std::dynamic_pointer_cast<Model_Document>(owner()->document());
+ bool aFindNewContext = true;
+ while (aFindNewContext && aResult.get()) {
+ aFindNewContext = false;
+ // try to find the last context to find the up to date shape
+ TopoDS_Shape aConShape = aResult->shape()->impl<TopoDS_Shape>();
+ if (TNaming_Tool::HasLabel(selectionLabel(), aConShape)) {
+ Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aConShape, selectionLabel());
+ if (!aNS.IsNull()) {
+ aNS = TNaming_Tool::CurrentNamedShape(aNS);
+ if (!aNS.IsNull()
+ && isLater(selectionLabel(), aNS->Label())
+ && isLater(aNS->Label(),
+ std::dynamic_pointer_cast<Model_Data>(aResult->data())->label()))
+ {
+ TDF_Label aLab = aNS->Label();
+ ResultPtr aRes = aDoc->resultByLab(aLab);
+ if (aRes.get()) {
+ if (theAnyValue || aRes->shape()->isSubShape(aSelectedShape)) {
+ aResult = aRes;
+ aFindNewContext = true;
+ continue;
+ }
+ }
}
+ }
+ }
+ if (theAnyValue) { // only for neighbors for now
+ // try to find modification of sub-shapes: the best number of matches
+ std::map<ResultPtr, int> aMatches; // result -> number of matches of shapes to find the best
+ TDF_Label aResLab = std::dynamic_pointer_cast<Model_Data>(aResult->data())->shapeLab();
+ TDF_ChildIDIterator aModifIter(aResLab, TNaming_NamedShape::GetID());
+ for(; aModifIter.More(); aModifIter.Next()) {
+ Handle(TNaming_NamedShape) aNS = Handle(TNaming_NamedShape)::DownCast(aModifIter.Value());
+ if (aNS->Evolution() == TNaming_MODIFY || aNS->Evolution() == TNaming_GENERATED) {
+ for(TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) {
+ TNaming_NewShapeIterator aNewIter(aNSIter.NewShape(), aNS->Label());
+ for(; aNewIter.More(); aNewIter.Next()) {
+ TDF_Label aLab = aNewIter.Label();
+ if (isLater(aLab, aNS->Label()) && isLater(selectionLabel(), aLab)) {
+ ResultPtr aRes = aDoc->resultByLab(aLab);
+ if (aRes.get()) {
+ if (aMatches.find(aRes) == aMatches.end())
+ aMatches[aRes] = 0;
+ aMatches[aRes]++; // found result, add matches
+ }
+ }
+ }
+ }
+ }
+ }
+ // searching for the best result-candidate
+ int aBest = 0;
+ ResultPtr aBestResult;
+ std::map<ResultPtr, int>::iterator aMatchIter = aMatches.begin();
+ for(; aMatchIter != aMatches.end(); aMatchIter++) {
+ if (aMatchIter->second > aBest) {
+ aBest = aMatchIter->second;
+ aBestResult = aMatchIter->first;
+ }
+ }
+ if (aBestResult.get()) {
+ aResult = aBestResult;
+ aFindNewContext = true;
+ continue;
+ }
+ }
+
- if (aListShapeType != GeomAPI_Shape::SHAPE && aListShapeType != aShapeShapeType) {
+ // TestFillWireVertex.py - sketch constructions for wire may participate too
+ //if (aResult->groupName() == ModelAPI_ResultBody::group()) {
+ // try to search newer context by the concealment references
+ // take references to all results: root one, any sub
+ std::list<ResultPtr> allRes;
+ ResultPtr aCompContext;
+ ResultBodyPtr aCompBody = ModelAPI_Tools::bodyOwner(aResult, true);
+ if (aCompBody.get()) {
+ ModelAPI_Tools::allSubs(aCompBody, allRes);
+ allRes.push_back(aCompBody);
+ aCompContext = aCompBody;
+ }
+ if (allRes.empty())
+ allRes.push_back(aResult);
+
+ for (std::list<ResultPtr>::iterator aSub = allRes.begin(); aSub != allRes.end(); aSub++) {
+ ResultPtr aResCont = *aSub;
+ ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResCont);
+ if (aResBody.get() && aResBody->numberOfSubs() > 0 && aResBody != aCompContext)
+ continue; // only lower and higher level subs are counted
+ const std::set<AttributePtr>& aRefs = aResCont->data()->refsToMe();
+ std::set<AttributePtr>::const_iterator aRef = aRefs.begin();
+ for (; !aFindNewContext && aRef != aRefs.end(); aRef++) {
+ if (!aRef->get() || !(*aRef)->owner().get())
+ continue;
+ // concealed attribute only
+ FeaturePtr aRefFeat = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRef)->owner());
+ if (!ModelAPI_Session::get()->validators()->isConcealed(
+ aRefFeat->getKind(), (*aRef)->id()))
continue;
+ // search the feature result that contains sub-shape selected
+ std::list<std::shared_ptr<ModelAPI_Result> > aResults;
+
+ // take all sub-results or one result
+ std::list<ResultPtr> aRefFeatResults;
+ ModelAPI_Tools::allResults(aRefFeat, aRefFeatResults);
+ std::list<ResultPtr>::iterator aRefResIter = aRefFeatResults.begin();
+ for (; aRefResIter != aRefFeatResults.end(); aRefResIter++) {
+ ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRefResIter);
+ if (aBody.get() && aBody->numberOfSubs() == 0) // add only lower level subs
+ aResults.push_back(aBody);
}
+ std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = aResults.begin();
- myParent->append(*aNewCont, aValueShape);
+ if (theAnyValue) { // searching the best sub-result by maximum number of references to orig
+ int aReferencesCount = 0;
+ ResultPtr aBestResult;
+ for (; aResIter != aResults.end(); aResIter++) {
+ if (!aResIter->get() || !(*aResIter)->data()->isValid() || (*aResIter)->isDisabled())
+ continue;
+ TDF_Label aCandidateLab =
+ std::dynamic_pointer_cast<Model_Data>((*aResIter)->data())->shapeLab();
+ Handle(TDF_Reference) aRef;
+ if (aCandidateLab.FindAttribute(TDF_Reference::GetID(), aRef)) {
+ TDF_Label aRefLab = aRef->Get();
+ ResultPtr aRefRes = aDoc->resultByLab(aRefLab);
+ if (aRefRes.get() && aRefRes->shape().get() &&
+ aRefRes->shape()->isEqual(aResult->shape())) {// it directly references to result
+ aResult = *aResIter; // found new context (produced from this) with same subshape
+ aFindNewContext = true; // continue searching further
+ break;
+ }
+ } else {
+ if (!aBestResult.get())
+ aBestResult = *aResIter;
+ }
+ }
+ if (aBestResult.get() && !aFindNewContext) { // the first good result for now
+ aResult = aBestResult; // found new context
+ aFindNewContext = true;
+ }
+ } else { // searching by sub-shape
+ for (; aResIter != aResults.end(); aResIter++) {
+ if (!aResIter->get() || !(*aResIter)->data()->isValid() || (*aResIter)->isDisabled())
+ continue;
+ GeomShapePtr aShape = (*aResIter)->shape();
+ if (aShape.get() && (theAnyValue || aShape->isSubShape(aSelectedShape, false))) {
+ aResult = *aResIter; // found new context (produced from this) with same subshape
+ aFindNewContext = true; // continue searching further
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ // if compsolid is context, try to take sub-solid as context: like in GUI and scripts
+ ResultBodyPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
+ if (aComp && aComp->numberOfSubs()) {
+ std::list<ResultPtr> allSubs;
+ ModelAPI_Tools::allSubs(aComp, allSubs);
+ std::list<ResultPtr>::iterator aS = allSubs.begin();
+ for (; aS != allSubs.end(); aS++) {
+ ResultBodyPtr aSub = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aS);
+ if (aSub && aSub->numberOfSubs() == 0 && aSub->shape().get() &&
+ (theAnyValue || aSub->shape()->isSubShape(aSelectedShape))) {
+ aResult = aSub;
+ break;
}
}
}
+ // in case sketch line was selected for wire, but wire was concealed and not such line anymore,
+ // so, actually, the sketch element was selected (which is never concealed)
+ if (aResult != theCurrent && aResult->isConcealed())
+ aResult = theCurrent;
+ return aResult;
}
-void Model_AttributeSelection::setParent(Model_AttributeSelectionList* theParent)
+void Model_AttributeSelection::combineGeometrical()
{
- myParent = theParent;
+ if (myTmpContext.get() || myTmpSubShape.get())
+ return;
+ TDF_Label aSelLab = selectionLabel();
+ if (aSelLab.IsAttribute(kINVALID_SELECTION) || !myRef.isInitialized())
+ return;
+
+ if (aSelLab.IsAttribute(kCIRCLE_CENTER) || aSelLab.IsAttribute(kELLIPSE_CENTER1) ||
+ aSelLab.IsAttribute(kELLIPSE_CENTER2) || aSelLab.IsAttribute(kSIMPLE_REF_ID))
+ return;
+
+ if (aSelLab.IsAttribute(kPART_REF_ID)) {
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(context());
+ if (!aPart.get() || !aPart->isActivated())
+ return; // postponed naming needed
+ Handle(TDataStd_Integer) anIndex;
+ if (aSelLab.FindAttribute(TDataStd_Integer::GetID(), anIndex)) {
+ if (anIndex->Get()) { // special selection attribute was created, use it
+ std::string aNewName;
+ aPart->combineGeometrical(anIndex->Get(), aNewName);
+ TDataStd_Name::Set(aSelLab, aNewName.c_str());
+ }
+ }
+ return;
+ }
+
+ std::shared_ptr<Model_ResultConstruction> aConstr =
+ std::dynamic_pointer_cast<Model_ResultConstruction>(context());
+ if (aConstr.get())
+ return;
+ FeaturePtr aFeature = contextFeature();
+ if (aFeature.get())
+ return;
+
+ Selector_Selector aSelector(aSelLab, baseDocumentLab());
+ TopoDS_Shape aContextShape = context()->shape()->impl<TopoDS_Shape>();
+ if (aSelector.restore(aContextShape)) {
+ aSelector.combineGeometrical(aContextShape);
+ }
}
-bool Model_AttributeSelection::isWeakNaming()
+TDF_Label Model_AttributeSelection::baseDocumentLab()
{
- return selectionLabel().IsAttribute(kWEAK_NAMING);
+ if (ModelAPI_Session::get()->moduleDocument() != owner()->document())
+ return std::dynamic_pointer_cast<Model_Document>
+ (ModelAPI_Session::get()->moduleDocument())->extConstructionsLabel();
+ static TDF_Label anEmpty;
+ return anEmpty;
}
#include "Model.h"
#include "Model_AttributeReference.h"
#include <ModelAPI_AttributeSelection.h>
+#include <Selector_NameGenerator.h>
#include <TDF_LabelMap.hxx>
#include <TopoDS_Shape.hxx>
#include <TopTools_ListOfShape.hxx>
* \ingroup DataModel
* \brief Attribute that contains reference to the sub-shape of some result, the selected shape.
*/
-class Model_AttributeSelection : public ModelAPI_AttributeSelection
+class Model_AttributeSelection : public ModelAPI_AttributeSelection,
+ public Selector_NameGenerator
{
- Model_AttributeReference myRef; ///< The reference functionality reusage
- TDF_LabelMap myScope; ///< the map of valid labels for naming selection solving
+ Model_AttributeReference myRef; ///< The reference functionality re-usage
/// temporarily storages to avoid keeping in the data structure if not needed
ResultPtr myTmpContext;
/// temporarily storages to avoid keeping in the data structure if not needed
std::shared_ptr<GeomAPI_Shape> myTmpSubShape;
/// temporarily storages to avoid keeping in the data structure if not needed
CenterType myTmpCenterType;
- /// Reference to the partent attribute, if any (to split selection compounds in issue 1799)
+ /// Reference to the parent attribute, if any (to split selection compounds in issue 1799)
Model_AttributeSelectionList* myParent;
+
+ std::shared_ptr<Model_Document> myRestoreDocument; // current document to restore by name
+ /// If true attribute selects geometry instead of shape.
+ bool myIsGeometricalSelection;
+
public:
/// Defines the result and its selected sub-shape
/// \param theContext object where the sub-shape was selected
/// \param theSubShape selected sub-shape (if null, the whole context is selected)
/// \param theTemporarily if it is true, do not store and name the added in the data framework
- /// (used to remove immideately, without the following updates)
+ /// (used to remove immediately, without the following updates)
/// \returns true if attribute was updated
MODEL_EXPORT virtual bool setValue(
const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
/// Sets the feature object
MODEL_EXPORT virtual void setObject(const std::shared_ptr<ModelAPI_Object>& theObject);
- /// Updates the underlied selection due to the changes in the referenced objects
+ /// Updates the selection due to the changes in the referenced objects
/// \returns false if update is failed
MODEL_EXPORT virtual bool update();
/// NOTE: This method is opposite to Id() method.
MODEL_EXPORT virtual void setId(int theID);
- /// Selects (i.e. creates Naming data structure) of sub-shape specifed by textual name
+ /// Selects (i.e. creates Naming data structure) of sub-shape specified by textual name
MODEL_EXPORT virtual void selectSubShape(const std::string& theType,
const std::string& theSubShapeName);
/// Returns true if attribute was initialized by some value
MODEL_EXPORT virtual bool isInitialized();
- /// Returns true if recomute of selection become impossible
+ /// Returns true if recompute of selection become impossible
MODEL_EXPORT virtual bool isInvalid();
/// Updates the arguments of selection if something was affected by creation
/// or reorder of features upper in the history line (issue #1757)
MODEL_EXPORT virtual void updateInHistory();
- /// Returns true if the name was stored using weak naming principle
- MODEL_EXPORT virtual bool isWeakNaming();
+ // Implementation of the name generator method from the Selector package
+ // This method returns the context name by the label of the sub-selected shape
+ MODEL_EXPORT virtual std::string contextName(const TDF_Label theSelectionLab) override;
+
+ /// This method restores by the context and value name the context label and
+ /// sub-label where the value is. Returns true if it is valid.
+ MODEL_EXPORT virtual bool restoreContext(std::string theName,
+ TDF_Label& theContext, TDF_Label& theValue) override;
+
+ /// Returns the label of the newest context presented by the current one
+ MODEL_EXPORT virtual TDF_Label newestContext(const TDF_Label theCurrentContext) override;
+ /// Returns true if the first result is newer than the second one in the tree of features
+ MODEL_EXPORT virtual bool isLater(const TDF_Label theResult1, const TDF_Label theResult2)
+ const override;
+
+ /// Returns the name by context. Adds the part name if the context is located in other document
+ MODEL_EXPORT virtual std::string contextName(const ResultPtr& theContext) const;
+
+ /// Makes the current local selection becomes all sub-shapes with same base geometry.
+ MODEL_EXPORT virtual void combineGeometrical();
protected:
/// Objects are created for features automatically
/// Returns theType type of the center, or NOT_CENTER if it is not.
std::shared_ptr<GeomAPI_Shape> internalValue(CenterType& theType);
-
- /// Performs the selection for the body result (TNaming Selection)
-
/// Performs the selection for the body result (TNaming selection)
virtual void selectBody(
const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
/// \param theContext the result - owner of the selection
/// \param theSubShape selected shape
/// \param theUpdate flag that shows that it must be just update, theShape is null
- /// \returns true if eveything is selected correctly
+ /// \returns true if everything is selected correctly
virtual bool selectPart(
const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
const bool theUpdate = false);
/// Note: there must be no attributes stored at the same label because Selector clears this lab
TDF_Label selectionLabel();
- /// Returns the prepared map of valid labels for naming selection solving (creates if not exists)
- TDF_LabelMap& scope();
-
/// Sets the ID of the attribute in Data (called from Data): here it is used for myRef ID setting
MODEL_EXPORT virtual void setID(const std::string theID);
- /// Returns the name by context. Adds the part name if the context is located in other document
- std::string contextName(const ResultPtr& theContext) const;
-
/// Sets the parent attribute
void setParent(Model_AttributeSelectionList* theParent);
ResultPtr theContext, TopoDS_Shape theValShape, TDF_Label theAccessLabel,
std::list<ResultPtr>& theResults, TopTools_ListOfShape& theValShapes);
+ /// Searches for the newest context, modification of the current, that contains theValue
+ ResultPtr newestContext(const ResultPtr theCurrent,
+ const std::shared_ptr<GeomAPI_Shape> theValue, const bool theAnyValue = false);
+
/// computes theShapes list - shapes that were generated/modified/deleted the theValShape
/// during creation from new to old context
void computeValues(ResultPtr theOldContext, ResultPtr theNewContext, TopoDS_Shape theValShape,
TopTools_ListOfShape& theShapes);
+ /// Returns true if is geometrical selection.
+ virtual bool isGeometricalSelection() const {
+ return myIsGeometricalSelection;
+ };
+
+ /// Returns the module document label if this selection attribute is not in this document.
+ /// Returns null label otherwise.
+ TDF_Label baseDocumentLab();
+
friend class Model_Data;
friend class Model_AttributeSelectionList;
};
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Shape.h>
+#include <GeomAPI_ShapeIterator.h>
#include <TDF_AttributeIterator.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_RelocationTable.hxx>
#include <TDF_DeltaOnAddition.hxx>
+#include <TDataStd_UAttribute.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TNaming_NamedShape.hxx>
#include <NCollection_List.hxx>
+/// GUID for UAttribute that indicates the list has "To add all elements that share the same
+/// topology" flag enabled
+static const Standard_GUID kIS_GEOMETRICAL_SELECTION("f16987b6-e6c8-435c-99fa-03a7e0b06e83");
+
void Model_AttributeSelectionList::append(
const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
const bool theTemporarily)
{
int anOldSize = mySize->Get();
int aRemoved = 0;
- // iterate one by one and shifting the removed indicies
+ // iterate one by one and shifting the removed indices
for(int aCurrent = 0; aCurrent < anOldSize; aCurrent++) {
if (theIndices.find(aCurrent) == theIndices.end()) { // not removed
if (aRemoved) { // but must be shifted to the removed position
return mySize->Get();
}
+// returns true if theShape is same with theInList or is contained in it (a compound)
+static bool isIn(GeomShapePtr theInList, GeomShapePtr theShape) {
+ if (theShape->isSame(theInList))
+ return true;
+ if (theInList.get() && theInList->shapeType() == GeomAPI_Shape::COMPOUND) {
+ for(GeomAPI_ShapeIterator anIter(theInList); anIter.more(); anIter.next()) {
+ if (!anIter.current()->isNull() && anIter.current()->isSame(theShape))
+ return true;
+ }
+ }
+ return false;
+}
+
bool Model_AttributeSelectionList::isInList(const ObjectPtr& theContext,
const std::shared_ptr<GeomAPI_Shape>& theSubShape,
const bool theTemporarily)
return true;
} else {
// we need to call here isSame instead of isEqual to do not check shapes orientation
- if (theSubShape->isSame(*aShapes))
+ if (isIn(*aShapes, theSubShape))
return true;
}
}
}
} else {
// we need to call here isSame instead of isEqual to do not check shapes orientation
- if (theSubShape->isSame(aValue)) // shapes are equal
+ if (isIn(aValue, theSubShape)) // shapes are equal
return true;
}
}
}
TDF_Label aLabel = mySize->Label().FindChild(theIndex + 1);
// create a new attribute each time, by demand
- // supporting of old attributes is too slow (synch each time) and buggy on redo
- // (if attribute is deleted and created, the abort updates attriute and makes the Attr invalid)
+ // supporting of old attributes is too slow (sync each time) and buggy on redo
+ // (if attribute is deleted and created, the abort updates attribute and makes the Attr invalid)
std::shared_ptr<Model_AttributeSelection> aNewAttr =
std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aLabel));
- aNewAttr->setID(id());
if (owner()) {
aNewAttr->setObject(owner());
aNewAttr->setParent(this);
}
+ aNewAttr->setID(id());
return aNewAttr;
}
}
Model_AttributeSelectionList::Model_AttributeSelectionList(TDF_Label& theLabel)
+: myLab(theLabel)
{
- myLab = theLabel;
reinit();
}
}
}
}
+
+bool Model_AttributeSelectionList::isGeometricalSelection() const
+{
+ return myLab.IsAttribute(kIS_GEOMETRICAL_SELECTION);
+}
+
+void Model_AttributeSelectionList::setGeometricalSelection(const bool theIsGeometricalSelection)
+{
+ if (isGeometricalSelection() == theIsGeometricalSelection)
+ return; // nothing to do
+ if (theIsGeometricalSelection) // store the state
+ TDataStd_UAttribute::Set(myLab, kIS_GEOMETRICAL_SELECTION);
+ else
+ myLab.ForgetAttribute(kIS_GEOMETRICAL_SELECTION);
+ std::set<int> anIndiciesToRemove; // Update list according to the flag
+ if (theIsGeometricalSelection) { // all objects with same geometry must be combined into single
+ std::list<AttributeSelectionPtr> anAttributes; // collect attributes with geometrical compounds
+ for(int anIndex = 0; anIndex < size(); anIndex++) {
+ AttributeSelectionPtr anAttr = value(anIndex);
+ if (!anAttr.get() || !anAttr->context().get())
+ continue;
+ anAttr->combineGeometrical();
+ if (!anAttr->value().get() || anAttr->value()->shapeType() != GeomAPI_Shape::COMPOUND)
+ continue;
+ // check it is equal to some other attribute already presented in the list
+ std::list<AttributeSelectionPtr>::iterator anAttrIter = anAttributes.begin();
+ for(; anAttrIter != anAttributes.end(); anAttrIter++) {
+ if (anAttr->context() == (*anAttrIter)->context() &&
+ anAttr->namingName() == (*anAttrIter)->namingName()) {
+ anIndiciesToRemove.insert(anIndex);
+ break;
+ }
+ }
+ if (anAttrIter == anAttributes.end()) // not removed, so, add to the compare-list
+ anAttributes.push_back(anAttr);
+ }
+ } else { // all objects with same geometry must be divided into separated sub-attributes
+ int anInitialSize = size();
+ for(int anIndex = 0; anIndex < anInitialSize; anIndex++) {
+ AttributeSelectionPtr anAttr = value(anIndex);
+ if (!anAttr.get() || !anAttr->context().get())
+ continue;
+ GeomShapePtr aValue = anAttr->value();
+ if (!aValue.get() || aValue->shapeType() != GeomAPI_Shape::COMPOUND)
+ continue;
+ for(GeomAPI_ShapeIterator anIter(aValue); anIter.more(); anIter.next()) {
+ append(anAttr->context(), anIter.current());
+ }
+ anIndiciesToRemove.insert(anIndex);
+ }
+ }
+ remove(anIndiciesToRemove);
+ myIsCashed = false;
+ myCash.clear(); // empty list as indicator that cash is not used
+ owner()->data()->sendAttributeUpdated(this);
+}
/// \param theContext object where the sub-shape was selected
/// \param theSubShape selected sub-shape (if null, the whole context is selected)
/// \param theTemporarily if it is true, do not store and name the added in the data framework
- /// (used to remove immideately, without the following updates)
+ /// (used to remove immediately, without the following updates)
MODEL_EXPORT virtual void append(
const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
const bool theTemporarily = false);
/// \param theIndices a list of indices of elements to be removed
MODEL_EXPORT virtual void remove(const std::set<int>& theIndices);
- /// Returns the number ofselection attributes in the list
+ /// Returns the number of selection attributes in the list
MODEL_EXPORT virtual int size();
/// Returns true if the object with the shape are in list
/// \param theContext object where the sub-shape was selected
/// \param theSubShape selected sub-shape (if null, the whole context is selected)
/// \param theTemporarily if it is true, it checks also the temporary added item
- /// \returns true if the pair is found in the attirbute
+ /// \returns true if the pair is found in the attribute
MODEL_EXPORT virtual bool isInList(
const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
const bool theTemporarily = false);
/// during non-modification operations with this attribute)
MODEL_EXPORT virtual void cashValues(const bool theEnabled);
+ MODEL_EXPORT virtual void setGeometricalSelection(const bool theIsGeometricalSelection) override;
+
+ /// Returns true if is geometrical selection.
+ MODEL_EXPORT virtual bool isGeometricalSelection() const override;
+
protected:
/// Objects are created for features automatically
MODEL_EXPORT Model_AttributeSelectionList(TDF_Label& theLabel);
#include <Model_Data.h>
#include <Model_Document.h>
+#include <ModelAPI_Session.h>
#include <TNaming_Builder.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_Iterator.hxx>
#include <TNaming_Tool.hxx>
+#include <TNaming_SameShapeIterator.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_Integer.hxx>
+#include <TDataStd_ExtStringList.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <TDF_ChildIterator.hxx>
#include <TDF_ChildIDIterator.hxx>
#include <TDF_Reference.hxx>
+#include <TDF_Tool.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_ListOfShape.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools_History.hxx>
#include <GeomAPI_Shape.h>
+#include <GeomAPI_ShapeExplorer.h>
#include <GeomAlgoAPI_MakeShape.h>
#include <GeomAlgoAPI_SortListOfShapes.h>
#include <Config_PropManager.h>
// DEB
//#include <TCollection_AsciiString.hxx>
-//#include <TDF_Tool.hxx>
//#define DEB_IMPORT 1
-Model_BodyBuilder::Model_BodyBuilder(ModelAPI_Object* theOwner)
-: ModelAPI_BodyBuilder(theOwner),
- myDividedIndex(1),
- myVIndex(1),
- myEIndex(1),
- myFIndex(1)
-{
+/// reference to the shape in external document: sting list attribute identifier
+static const Standard_GUID kEXTERNAL_SHAPE_REF("9aa5dd14-6d34-4a8d-8786-05842fd7bbbd");
+
+static const int INVALID_TAG = -1;
+static const int GENERATED_VERTICES_TAG = 1;
+static const int GENERATED_EDGES_TAG = 2;
+static const int GENERATED_FACES_TAG = 3;
+static const int MODIFIED_VERTICES_TAG = 4;
+static const int MODIFIED_EDGES_TAG = 5;
+static const int MODIFIED_FACES_TAG = 6;
+static const int DELETED_TAG = 7;
+static const int PRIMITIVES_START_TAG = 11;
+
+static int getGenerationTag(const TopoDS_Shape& theShape) {
+ TopAbs_ShapeEnum aShapeType = theShape.ShapeType();
+ switch (aShapeType) {
+ case TopAbs_VERTEX: return GENERATED_VERTICES_TAG;
+ case TopAbs_EDGE: return GENERATED_EDGES_TAG;
+ case TopAbs_FACE: return GENERATED_FACES_TAG;
+ }
+
+ return INVALID_TAG;
}
-// Converts evolution of naming shape to selection evelution and back to avoid
-// naming support on the disabled results. Deeply in the labels tree, recursively.
-static void evolutionToSelectionRec(TDF_Label theLab, const bool theFlag) {
- std::list<std::pair<TopoDS_Shape, TopoDS_Shape> > aShapePairs; // to store old and new shapes
- Handle(TNaming_NamedShape) aName;
- int anEvolution = -1;
- if (theLab.FindAttribute(TNaming_NamedShape::GetID(), aName)) {
- TNaming_Evolution aNSEvol = aName->Evolution();
- if ((aNSEvol == TNaming_SELECTED && theFlag) ||
- (aNSEvol != TNaming_SELECTED && !theFlag)) { // nothing to do, it is already correct
- return;
- }
- anEvolution = (int)(aNSEvol);
- if (!theFlag) {
- Handle(TDataStd_Integer) anAttrEvol;
- if (theLab.FindAttribute(TDataStd_Integer::GetID(), anAttrEvol)) {
- anEvolution = anAttrEvol->Get();
- }
- } else {
- TDataStd_Integer::Set(theLab, anEvolution);
- }
+static int getModificationTag(const TopoDS_Shape& theShape) {
+ TopAbs_ShapeEnum aShapeType = theShape.ShapeType();
+ switch (aShapeType) {
+ case TopAbs_VERTEX: return MODIFIED_VERTICES_TAG;
+ case TopAbs_EDGE: return MODIFIED_EDGES_TAG;
+ case TopAbs_FACE: return MODIFIED_FACES_TAG;
+ }
- for(TNaming_Iterator anIter(aName); anIter.More(); anIter.Next()) {
- // iterator goes in reversed order relatively to the Builder, to, make the list reversed
- aShapePairs.push_front(std::pair<TopoDS_Shape, TopoDS_Shape>
- (anIter.OldShape(), anIter.NewShape()));
- }
+ return INVALID_TAG;
+}
- // 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
- if (anEvolution == TNaming_DELETE) // issue 2274 : don't put too many same null shapes
- aBuilder.Select(aPairsIter->first, aPairsIter->first);
- else if (anEvolution == TNaming_PRIMITIVE)
- aBuilder.Select(aPairsIter->second, aPairsIter->second);
- else
- 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);
- }
+static bool isAlreadyStored(const TNaming_Builder* theBuilder,
+ const TopoDS_Shape& theOldShape,
+ const TopoDS_Shape& theNewShape)
+{
+ for (TNaming_Iterator aNamingIt(theBuilder->NamedShape());
+ aNamingIt.More();
+ aNamingIt.Next())
+ {
+ if (aNamingIt.NewShape().IsSame(theNewShape)
+ && aNamingIt.OldShape().IsSame(theOldShape))
+ {
+ return true;
}
}
- // recursive call for all sub-labels
- TDF_ChildIterator anIter(theLab, Standard_False);
- for(; anIter.More(); anIter.Next()) {
- evolutionToSelectionRec(anIter.Value(), theFlag);
- }
+
+ return false;
}
-void Model_BodyBuilder::evolutionToSelection(const bool theFlag)
+Model_BodyBuilder::Model_BodyBuilder(ModelAPI_Object* theOwner)
+: ModelAPI_BodyBuilder(theOwner),
+ myFreePrimitiveTag(PRIMITIVES_START_TAG)
{
- std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
- if (!aData || !aData->isValid()) // unknown case
- return;
- TDF_Label& aShapeLab = aData->shapeLab();
- evolutionToSelectionRec(aShapeLab, theFlag);
}
-void Model_BodyBuilder::store(const std::shared_ptr<GeomAPI_Shape>& theShape,
+void Model_BodyBuilder::store(const GeomShapePtr& theShape,
const bool theIsStoreSameShapes)
{
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
if (aData) {
- TDF_Label& aShapeLab = aData->shapeLab();
+ TDF_Label aShapeLab = aData->shapeLab();
// clean builders
clean();
// store the new shape as primitive
if(!theIsStoreSameShapes) {
Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aShape, aShapeLab);
- if(!aNS.IsNull() && !aNS->IsEmpty()) {
+ // the last condition is for the issue 2751 : existing shape may be found in compound-NS
+ if(!aNS.IsNull() && !aNS->IsEmpty() && aNS->Get().IsSame(aShape)) {
// This shape is already in document, store reference instead of shape;
const TDF_Label aFoundLabel = aNS->Label();
TDF_Reference::Set(aShapeLab, aFoundLabel);
}
}
-void Model_BodyBuilder::storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
- const std::shared_ptr<GeomAPI_Shape>& theToShape)
+void Model_BodyBuilder::storeGenerated(const GeomShapePtr& theFromShape,
+ const GeomShapePtr& theToShape)
{
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
if (aData) {
- TDF_Label& aShapeLab = aData->shapeLab();
+ TDF_Label aShapeLab = aData->shapeLab();
// clean builders
clean();
// store the new shape as primitive
return aFind->second;
}
-void Model_BodyBuilder::storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theDecomposeSolidsTag)
+void Model_BodyBuilder::storeModified(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const bool theIsCleanStored)
{
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
if (aData) {
- TDF_Label& aShapeLab = aData->shapeLab();
// clean builders
- if (theDecomposeSolidsTag != -2)
- clean();
+ if (theIsCleanStored) clean();
// store the new shape as primitive
TNaming_Builder* aBuilder = builder(0);
if (!theOldShape || !theNewShape)
}
}
-void Model_BodyBuilder::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
-{
- std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
- if (aData) {
- clean();
- if (!theShape.get())
- return; // bad shape
- TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
- if (aShape.IsNull())
- return; // null shape inside
- TNaming_Builder aBuilder(aData->shapeLab());
- aBuilder.Select(aShape, aShape);
- }
-}
-
void Model_BodyBuilder::clean()
{
TDF_Label aLab = std::dynamic_pointer_cast<Model_Data>(data())->shapeLab();
return;
std::map<int, TNaming_Builder*>::iterator aBuilder = myBuilders.begin();
for(; aBuilder != myBuilders.end(); aBuilder++) {
+ Handle(TNaming_NamedShape) aNS = aBuilder->second->NamedShape();
delete aBuilder->second;
- // clear also shapes on cleaned sub-labels (#2241)
- Handle(TNaming_NamedShape) aNS;
- if (aLab.FindChild(aBuilder->first).FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- aNS->Clear();
- }
+ if (!aNS.IsNull() && !aNS->Label().IsNull())
+ aNS->Label().ForgetAttribute(TNaming_NamedShape::GetID());
}
myBuilders.clear();
+ myPrimitivesNamesIndexMap.clear();
// remove the old reference (if any)
aLab.ForgetAttribute(TDF_Reference::GetID());
- myDividedIndex = 1;
- myVIndex = 1;
- myEIndex = 1;
- myFIndex = 1;
+ myFreePrimitiveTag = PRIMITIVES_START_TAG;
+ TDF_ChildIDIterator anEntriesIter(aLab, kEXTERNAL_SHAPE_REF, true);
+ for(; anEntriesIter.More(); anEntriesIter.Next()) {
+ anEntriesIter.Value()->Label().ForgetAttribute(kEXTERNAL_SHAPE_REF);
+ }
}
Model_BodyBuilder::~Model_BodyBuilder()
void Model_BodyBuilder::buildName(const int theTag, const std::string& theName)
{
- std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(document());
- //aDoc->addNamingName(builder(theTag)->NamedShape()->Label(), theName);
- TDataStd_Name::Set(builder(theTag)->NamedShape()->Label(), theName.c_str());
+ std::string aName = theName;
+ std::string aPrefix = "";
+ switch (theTag) {
+ case GENERATED_VERTICES_TAG: aPrefix = aName.empty() ? "Generated_Vertex" : "GV:"; break;
+ case GENERATED_EDGES_TAG: aPrefix = aName.empty() ? "Generated_Edge" : "GE:"; break;
+ case GENERATED_FACES_TAG: aPrefix = aName.empty() ? "Generated_Face" : "GF:"; break;
+ case MODIFIED_VERTICES_TAG: aPrefix = aName.empty() ? "Modified_Vertex" : "MV:"; break;
+ case MODIFIED_EDGES_TAG: aPrefix = aName.empty() ? "Modified_Edge" : "ME:"; break;
+ case MODIFIED_FACES_TAG: aPrefix = aName.empty() ? "Modified_Face" : "MF:"; break;
+ }
+ aName.insert(0, aPrefix);
+
+ TDataStd_Name::Set(builder(theTag)->NamedShape()->Label(), aName.c_str());
}
-void Model_BodyBuilder::generated(
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag)
+bool Model_BodyBuilder::generated(const GeomShapePtr& theNewShape,
+ const std::string& theName,
+ const bool theCheckIsInResult)
{
+ GeomShapePtr aResultShape = shape();
+ if (theCheckIsInResult) {
+ bool aNewShapeIsNotInResultShape = !aResultShape->isSubShape(theNewShape, false);
+ if (aNewShapeIsNotInResultShape) {
+ return false;
+ }
+ }
+
TopoDS_Shape aShape = theNewShape->impl<TopoDS_Shape>();
- builder(theTag)->Generated(aShape);
- if(!theName.empty())
- buildName(theTag, theName);
+ builder(myFreePrimitiveTag)->Generated(aShape);
+ if (!theName.empty()) {
+ std::string aName = theName;
+ if (myPrimitivesNamesIndexMap.find(theName) != myPrimitivesNamesIndexMap.end()) {
+ IndexTags& anIndexTags = myPrimitivesNamesIndexMap.find(theName)->second;
+ aName += "_" + std::to_string(++(anIndexTags.index));
+ anIndexTags.tags.push_back(myFreePrimitiveTag);
+ if (anIndexTags.index == 2) {
+ buildName(anIndexTags.tags.front(), theName + "_1");
+ }
+ }
+ else {
+ IndexTags anIndexTags;
+ anIndexTags.index = 1;
+ anIndexTags.tags.push_back(myFreePrimitiveTag);
+ myPrimitivesNamesIndexMap[theName] = anIndexTags;
+ }
+
+ buildName(myFreePrimitiveTag, aName);
+ }
+ ++myFreePrimitiveTag;
+ return true;
}
-void Model_BodyBuilder::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag)
+void Model_BodyBuilder::generated(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const std::string& theName)
{
TopoDS_Shape anOldShape = theOldShape->impl<TopoDS_Shape>();
TopoDS_Shape aNewShape = theNewShape->impl<TopoDS_Shape>();
- builder(theTag)->Generated(anOldShape, aNewShape);
- if(!theName.empty())
- buildName(theTag, theName);
- TopAbs_ShapeEnum aGenShapeType = aNewShape.ShapeType();
- if(aGenShapeType == TopAbs_WIRE || aGenShapeType == TopAbs_SHELL) {
- TopAbs_ShapeEnum anExplodeShapeType = aGenShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE;
- const TDF_Label aLabel = builder(theTag)->NamedShape()->Label();
- int aTag = 1;
- std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(document());
- for(TopExp_Explorer anExp(aNewShape, anExplodeShapeType); anExp.More(); anExp.Next()) {
- TDF_Label aChildLabel = aLabel.FindChild(aTag);
- TNaming_Builder aBuilder(aChildLabel);
- aBuilder.Generated(anOldShape, anExp.Current());
- TCollection_AsciiString aChildName = TCollection_AsciiString((theName + "_").c_str()) + aTag;
- //aDoc->addNamingName(aChildLabel, aChildName.ToCString());
- TDataStd_Name::Set(aChildLabel, aChildName.ToCString());
- aTag++;
- }
+ TopAbs_ShapeEnum aNewShapeType = aNewShape.ShapeType();
+ int aTag;
+ if (aNewShapeType == TopAbs_WIRE || aNewShapeType == TopAbs_SHELL) {
+ // TODO: This is a workaround. New shape should be only vertex, edge or face.
+ TopAbs_ShapeEnum aShapeTypeToExplore = aNewShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE;
+ aTag = TopAbs_WIRE ? GENERATED_EDGES_TAG : GENERATED_FACES_TAG;
+ for (TopExp_Explorer anExp(aNewShape, aShapeTypeToExplore); anExp.More(); anExp.Next()) {
+ builder(aTag)->Generated(anOldShape, anExp.Current());
+ }
+ buildName(aTag, theName);
+ } else {
+ aTag = getGenerationTag(aNewShape);
+ if (aTag == INVALID_TAG) return;
+ builder(aTag)->Generated(anOldShape, aNewShape);
+ buildName(aTag, theName);
}
}
-
-void Model_BodyBuilder::modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName, const int theTag)
+void Model_BodyBuilder::modified(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const std::string& theName)
{
TopoDS_Shape anOldShape = theOldShape->impl<TopoDS_Shape>();
TopoDS_Shape aNewShape = theNewShape->impl<TopoDS_Shape>();
- builder(theTag)->Modify(anOldShape, aNewShape);
- if(!theName.empty())
- buildName(theTag, theName);
-}
-
-void Model_BodyBuilder::deleted(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const int theTag)
-{
- TopoDS_Shape aShape = theOldShape->impl<TopoDS_Shape>();
- builder(theTag)->Delete(aShape);
+ int aTag = getModificationTag(aNewShape);
+ if (aTag == INVALID_TAG) return;
+ builder(aTag)->Modify(anOldShape, aNewShape);
+ buildName(aTag, theName);
}
-void Model_BodyBuilder::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn,
- const int theKindOfShape,
- const int theTag,
- const GeomShapePtr theShapes)
+void Model_BodyBuilder::loadDeletedShapes(const GeomMakeShapePtr& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const GeomShapePtr& theShapesToExclude)
{
- TopoDS_Shape aShapeIn = theShapeIn->impl<TopoDS_Shape>();
- TopTools_MapOfShape aView;
- TopExp_Explorer ShapeExplorer (aShapeIn, (TopAbs_ShapeEnum)theKindOfShape);
+ TopTools_MapOfShape anAlreadyProcessedShapes;
GeomShapePtr aResultShape = shape();
- for (; ShapeExplorer.More(); ShapeExplorer.Next ()) {
- const TopoDS_Shape& aRoot = ShapeExplorer.Current ();
- if (!aView.Add(aRoot)) continue;
- std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
- aRShape->setImpl((new TopoDS_Shape(aRoot)));
- if (!theMS->isDeleted(aRShape)
- || aResultShape->isSubShape(aRShape, false)
- || (theShapes.get() && theShapes->isSubShape(aRShape, false))) {
+ for (GeomAPI_ShapeExplorer anExp(theOldShape, theShapeTypeToExplore);
+ anExp.more();
+ anExp.next())
+ {
+ GeomShapePtr anOldSubShape = anExp.current();
+ const TopoDS_Shape& anOldSubShape_ = anOldSubShape->impl<TopoDS_Shape>();
+ if (!anAlreadyProcessedShapes.Add(anOldSubShape_)
+ || !theAlgo->isDeleted(anOldSubShape)
+ || aResultShape->isSubShape(anOldSubShape, false)
+ || (theShapesToExclude.get() && theShapesToExclude->isSubShape(anOldSubShape, false)))
+ {
continue;
}
- ListOfShape aHist;
- if (BRepTools_History::IsSupportedType(aRoot)) // to avoid crash in #2572
- theMS->modified(aRShape, aHist);
- if (aHist.size() == 0 || (aHist.size() == 1 && aHist.front()->isSame(aRShape)))
- builder(theTag)->Delete(aRoot);
- }
-}
+ ListOfShape aNewShapes;
+ if (BRepTools_History::IsSupportedType(anOldSubShape_)) { // to avoid crash in #2572
+ theAlgo->modified(anOldSubShape, aNewShapes);
+ }
-static void removeBadShapes(ListOfShape& theShapes)
-{
- ListOfShape::iterator anIt = theShapes.begin();
- while (anIt != theShapes.end()) {
- TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
- bool aSkip = aNewShape.IsNull()
- || (aNewShape.ShapeType() == TopAbs_EDGE && BRep_Tool::Degenerated(TopoDS::Edge(aNewShape)));
- if (aSkip) {
- ListOfShape::iterator aRemoveIt = anIt++;
- theShapes.erase(aRemoveIt);
- } else {
- ++anIt;
+ if (aNewShapes.size() == 0
+ || (aNewShapes.size() == 1 && aNewShapes.front()->isSame(anOldSubShape))) {
+ builder(DELETED_TAG)->Delete(anOldSubShape_);
}
}
}
// Keep only the shapes with minimal shape type
-static void keepTopLevelShapes(ListOfShape& theShapes, const TopoDS_Shape& theRoot,
- const GeomShapePtr& theResultShape = GeomShapePtr())
+static void keepTopLevelShapes(ListOfShape& theShapes,
+ const TopoDS_Shape& theRoot,
+ const GeomShapePtr& theResultShape = GeomShapePtr())
{
GeomAPI_Shape::ShapeType aKeepShapeType = GeomAPI_Shape::SHAPE;
ListOfShape::iterator anIt = theShapes.begin();
}
}
-// returns an ancestor shape-type thaty used for naming-definition of the sub-type
-TopAbs_ShapeEnum typeOfAncestor(const TopAbs_ShapeEnum theSubType) {
- if (theSubType == TopAbs_VERTEX)
- return TopAbs_EDGE;
- if (theSubType == TopAbs_EDGE)
- return TopAbs_FACE;
- return TopAbs_VERTEX; // bad case
+/// Checks that shape is presented in the tree with not-selection evolution
+/// In theOriginalLabel it returns label where NS of old sub-shape is stored
+static bool isShapeInTree(const TDF_Label& theAccess1, const TDF_Label& theAccess2,
+ TopoDS_Shape theShape, TDF_Label& theOriginalLabel)
+{
+ bool aResult = TNaming_Tool::HasLabel(theAccess1, theShape);
+ if (aResult) { //check evolution and a label of this shape
+ for(TNaming_SameShapeIterator aShapes(theShape, theAccess1); aShapes.More(); aShapes.Next())
+ {
+ static Handle(TNaming_NamedShape) aNS;
+ if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ if (aNS->Evolution() != TNaming_SELECTED) {
+ theOriginalLabel = aNS->Label();
+ return true;
+ }
+ }
+ }
+ }
+ if (!theAccess2.IsNull()) {
+ static const TDF_Label anEmpty;
+ return isShapeInTree(theAccess2, anEmpty, theShape, theOriginalLabel);
+ }
+ return false;
}
-void Model_BodyBuilder::loadAndOrientModifiedShapes (
- GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn,
- const int theKindOfShape,
- const int theTag,
- const std::string& theName,
- GeomAPI_DataMapOfShapeShape& theSubShapes,
- const bool theIsStoreSeparate,
- const bool theIsStoreAsGenerated)
+/// Stores entry to the external label in the entries list at this label
+static void storeExternalReference(const TDF_Label& theExternal, const TDF_Label theThis)
{
- static const int THE_ANCHOR_TAG = 100000;
+ // store information about the external document reference to restore old shape on open
+ if (!theExternal.IsNull() && !theExternal.Root().IsEqual(theThis.Root())) {
+ Handle(TDataStd_ExtStringList) anEntries;
+ if (!theThis.FindAttribute(kEXTERNAL_SHAPE_REF, anEntries)) {
+ anEntries = TDataStd_ExtStringList::Set(theThis, kEXTERNAL_SHAPE_REF);
+ }
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(theExternal, anEntry);
+ // check it already contains this entry
+ TDataStd_ListOfExtendedString::Iterator anIter(anEntries->List());
+ for(; anIter.More(); anIter.Next())
+ if (anIter.Value() == anEntry)
+ break;
+ if (!anIter.More()) {
+ anEntries->Append(anEntry);
+ }
+ }
+}
- int anIndex = 1;
- int aTag = theTag;
- bool isBuilt = !theName.empty();
- std::string aName = theName;
- std::ostringstream aStream;
+void Model_BodyBuilder::loadModifiedShapes(const GeomMakeShapePtr& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName)
+{
GeomShapePtr aResultShape = shape();
- TopoDS_Shape aShapeIn = theShapeIn->impl<TopoDS_Shape>();
- TopTools_MapOfShape aView;
- std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
-
- TopoDS_Shape aShapeToIterate;
- if (theMS->newShapesCollected(theShapeIn, theKindOfShape)) {
+ GeomShapePtr aShapeToExplore = theOldShape;
+ if (theAlgo->isNewShapesCollected(theOldShape, theShapeTypeToExplore)) {
// use optimized set of old shapes for this
- GeomShapePtr aCompound = theMS->oldShapesForNew(theShapeIn, aResultShape, theKindOfShape);
- if (aCompound.get())
- aShapeToIterate = aCompound->impl<TopoDS_Shape>();
- } else {
- aShapeToIterate = aShapeIn;
+ GeomShapePtr aCompound = theAlgo->oldShapesForNew(theOldShape,
+ aResultShape,
+ theShapeTypeToExplore);
+ if (aCompound.get()) aShapeToExplore = aCompound;
}
- TopExp_Explorer aShapeExplorer (aShapeToIterate, (TopAbs_ShapeEnum)theKindOfShape);
- for (; aShapeExplorer.More(); aShapeExplorer.Next ()) {
- const TopoDS_Shape& aRoot = aShapeExplorer.Current ();
- if (!aView.Add(aRoot)) continue;
-
- bool aNotInTree =
- TNaming_Tool::NamedShape(aRoot, aData->shapeLab()).IsNull();
- if (aNotInTree && !theIsStoreSeparate) {
- // there is no sense to write history if old shape does not exist in the document
- continue; // but if it is stored separately, it will be builded as a primitive
+ TopTools_MapOfShape anAlreadyProcessedShapes;
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+ for (GeomAPI_ShapeExplorer anOldShapeExp(aShapeToExplore, theShapeTypeToExplore);
+ anOldShapeExp.more();
+ anOldShapeExp.next())
+ {
+ GeomShapePtr anOldSubShape = anOldShapeExp.current();
+ const TopoDS_Shape& anOldSubShape_ = anOldSubShape->impl<TopoDS_Shape>();
+
+ // There is no sense to write history if shape already processed
+ // or old shape does not exist in the document.
+ bool anOldSubShapeAlreadyProcessed = !anAlreadyProcessedShapes.Add(anOldSubShape_);
+ TDF_Label anAccess2 = std::dynamic_pointer_cast<Model_Document>(
+ ModelAPI_Session::get()->moduleDocument())->generalLabel();
+ TDF_Label anOriginalLabel;
+ bool anOldSubShapeNotInTree =
+ !isShapeInTree(aData->shapeLab(), anAccess2, anOldSubShape_, anOriginalLabel);
+ if (anOldSubShapeAlreadyProcessed || anOldSubShapeNotInTree) {
+ continue;
}
- ListOfShape aList;
- std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
- aRShape->setImpl((new TopoDS_Shape(aRoot)));
- theMS->modified(aRShape, aList);
- if (!theIsStoreSeparate) {
- //keepTopLevelShapes(aList, aRoot, aResultShape);
- removeBadShapes(aList);
- }
- // sort the list of images before naming
- GeomAlgoAPI_SortListOfShapes::sort(aList);
+ // Get new shapes.
+ ListOfShape aNewShapes;
+ theAlgo->modified(anOldSubShape, aNewShapes);
- // to trace situation where several objects are produced by one parent (#2317)
- int aSameParentShapes = (aShapeIn.ShapeType() == TopAbs_WIRE
- || aShapeIn.ShapeType() == TopAbs_SHELL
- || aShapeIn.ShapeType() == TopAbs_COMPOUND) ? 0 : -1;
- std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator
- anIt = aList.begin(), aLast = aList.end();
- for (; anIt != aLast; anIt++) {
- TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
- if (theSubShapes.isBound(*anIt)) {
- std::shared_ptr<GeomAPI_Shape> aMapShape(theSubShapes.find(*anIt));
- aNewShape.Orientation(aMapShape->impl<TopoDS_Shape>().Orientation());
- }
- isBuilt = !theName.empty();
- if(!aRoot.IsSame(aNewShape)
- && aResultShape->isSubShape((*anIt), false)
- && !aResultShape->isSame(*anIt)) // to avoid put of same shape on main label and sub
+ for (ListOfShape::const_iterator aNewShapesIt = aNewShapes.cbegin();
+ aNewShapesIt != aNewShapes.cend();
+ ++aNewShapesIt)
+ {
+ GeomShapePtr aNewShape = *aNewShapesIt;
+ const TopoDS_Shape& aNewShape_ = aNewShape->impl<TopoDS_Shape>();
+ bool isGenerated = anOldSubShape_.ShapeType() != aNewShape_.ShapeType();
+
+ bool aNewShapeIsSameAsOldShape = anOldSubShape->isSame(aNewShape);
+ bool aNewShapeIsNotInResultShape = !aResultShape->isSubShape(aNewShape, false);
+ if (aNewShapeIsSameAsOldShape
+ || aNewShapeIsNotInResultShape)
{
- if (!theIsStoreSeparate) {
- aSameParentShapes++;
- } else if (aNotInTree) // check this new shape can not be represented as
- // a sub-shape of higher level sub-shapes
- {
- TopAbs_ShapeEnum aNewType = aNewShape.ShapeType();
- TopAbs_ShapeEnum anAncestorType = typeOfAncestor(aNewType);
- if (anAncestorType != TopAbs_VERTEX) {
- bool aFound = false;
- TopoDS_Shape aResultTShape = aResultShape->impl<TopoDS_Shape>();
- TopExp_Explorer anAncestorExp(aResultTShape, anAncestorType);
- for(; anAncestorExp.More() && !aFound; anAncestorExp.Next()) {
- if (aResultTShape.IsSame(anAncestorExp.Current()))
- continue;
- TopExp_Explorer aSubExp(anAncestorExp.Current(), aNewType);
- for(; aSubExp.More(); aSubExp.Next()) {
- if (aNewShape.IsSame(aSubExp.Current())) {
- aFound = true;
- break;
- }
- }
- }
- if (aFound) {
- continue; // not need to store this shape in the BRep structure
- }
- }
- }
-
- int aFoundTag = 0;
- bool isFoundSameOld = false;
- bool isFoundDiffOld = false;
-
- // Check if new shape was already stored.
- for (std::map<int, TNaming_Builder*>::iterator aBuildersIt = myBuilders.begin();
- aBuildersIt != myBuilders.end();
- ++aBuildersIt)
- {
- TNaming_Builder* aBuilder = aBuildersIt->second;
- for (TNaming_Iterator aNamingIt(aBuilder->NamedShape());
- aNamingIt.More();
- aNamingIt.Next())
- {
- if (aNamingIt.NewShape().IsSame(aNewShape))
- {
- aNamingIt.OldShape().IsSame(aRoot) ? isFoundSameOld = true
- : isFoundDiffOld = true;
- aFoundTag = aBuildersIt->first;
- }
- }
-
- if (isFoundSameOld || isFoundDiffOld) break;
- }
+ continue;
+ }
- if (isFoundSameOld) {
- // Builder already contains same old->new shapes, don't store it twice.
+ TNaming_Builder* aBuilder;
+ if (aResultShape->isSame(aNewShape)) {
+ // keep the modification evolution on the root level (2241 - history propagation issue)
+ aBuilder = builder(0);
+ TDF_Label aShapeLab = aBuilder->NamedShape()->Label();
+ Handle(TDF_Reference) aRef;
+ if (aShapeLab.FindAttribute(TDF_Reference::GetID(), aRef)) {
+ // Store only in case if it does not have reference.
continue;
}
- int aBuilderTag = aSameParentShapes > 0 ? THE_ANCHOR_TAG : aTag;
-
- int aCurShapeType = (int)((*anIt)->shapeType());
- bool needSuffix = false; // suffix for the name based on the shape type
- if (aCurShapeType != theKindOfShape) {
- // modified shape has different type => set another tag
- // to avoid shapes of different types on the same label
- aBuilderTag = THE_ANCHOR_TAG;
- needSuffix = true;
- }
- std::string aSuffix;
- if (needSuffix) {
- switch (aCurShapeType) {
- case GeomAPI_Shape::VERTEX: aSuffix = "_v_" + std::to_string(myVIndex++); break;
- case GeomAPI_Shape::EDGE: aSuffix = "_e_" + std::to_string(myEIndex++); break;
- case GeomAPI_Shape::FACE: aSuffix = "_f_" + std::to_string(myFIndex++); break;
- default: break;
- }
- }
-
- std::vector<std::pair<TopoDS_Shape, TopoDS_Shape>> aKeepShapes, aMoveShapes;
- if (isFoundDiffOld) {
- // Found same new shape with different old shape.
- if (aFoundTag >= THE_ANCHOR_TAG) {
- // Found on separated tag.
- aBuilderTag = aFoundTag; // Store it on the same tag.
- isBuilt = false; // Don't change name;
- } else {
- // Found on previous tag.
- if (aBuilderTag < THE_ANCHOR_TAG) {
- // New shape shouls not be separated.
- aBuilderTag = aFoundTag; // Store it on the same tag.
- isBuilt = false; // Don't change name;
- } else {
- // New shape should be separated from others. Move shapes from found tag to new tag.
- while (myBuilders.find(aBuilderTag) != myBuilders.end()) {
- ++aBuilderTag;
- }
-
- TNaming_Builder* aFoundBuilder = myBuilders.at(aFoundTag);
- Handle(TNaming_NamedShape) aFoundNamedShape = aFoundBuilder->NamedShape();
- TDF_Label aFoundLabel = aFoundNamedShape->Label();
- TNaming_Evolution anEvolution = aFoundNamedShape->Evolution();
- for (TNaming_Iterator aNamingIt(aFoundNamedShape);
- aNamingIt.More();
- aNamingIt.Next())
- {
- std::pair<TopoDS_Shape, TopoDS_Shape> aShapesPair =
- std::make_pair(aNamingIt.OldShape(), aNamingIt.NewShape());
- aNamingIt.NewShape().IsSame(aNewShape) ? aMoveShapes.push_back(aShapesPair)
- : aKeepShapes.push_back(aShapesPair);
- }
-
- aFoundNamedShape->Clear();
- for (std::vector<std::pair<TopoDS_Shape, TopoDS_Shape>>::iterator aKeepIt =
- aKeepShapes.begin();
- aKeepIt != aKeepShapes.end();
- ++aKeepIt)
- {
- if (anEvolution == TNaming_GENERATED) {
- aFoundBuilder->Generated(aKeepIt->first, aKeepIt->second);
- } else {
- aFoundBuilder->Modify(aKeepIt->first, aKeepIt->second);
- }
- }
- }
- }
- } else if (aBuilderTag == THE_ANCHOR_TAG) {
- while (myBuilders.find(aBuilderTag) != myBuilders.end()) {
- ++aBuilderTag;
- }
- }
+ // Check if new shape was already stored.
+ if (isAlreadyStored(aBuilder, anOldSubShape_, aNewShape_)) continue;
- if(theIsStoreAsGenerated) {
- // Here we store shapes as generated, to avoid problem when one parent shape produce
- // several child shapes. In this case naming could not determine which shape to select.
- builder(aBuilderTag)->Generated(aRoot, aNewShape);
- for (std::vector<std::pair<TopoDS_Shape, TopoDS_Shape>>::iterator aMoveIt =
- aMoveShapes.begin();
- aMoveIt != aMoveShapes.end();
- ++aMoveIt)
- {
- builder(aBuilderTag)->Generated(aMoveIt->first, aMoveIt->second);
- }
- } else if (aNotInTree) {
- // not in tree -> store as primitive (stored as separated)
- builder(aBuilderTag)->Generated(aNewShape);
- } else if (aCurShapeType != theKindOfShape) {
- // if different shape type is produced, make it as generated
- builder(aBuilderTag)->Generated(aRoot, aNewShape);
- } else {
- builder(aBuilderTag)->Modify(aRoot, aNewShape);
- for (std::vector<std::pair<TopoDS_Shape, TopoDS_Shape>>::iterator aMoveIt =
- aMoveShapes.begin();
- aMoveIt != aMoveShapes.end();
- ++aMoveIt) {
- builder(aBuilderTag)->Modify(aMoveIt->first, aMoveIt->second);
- }
+ if (!aBuilder->NamedShape().IsNull() &&
+ ((isGenerated && aBuilder->NamedShape()->Evolution() != TNaming_GENERATED)
+ || (!isGenerated && aBuilder->NamedShape()->Evolution() != TNaming_MODIFY)))
+ {
+ myBuilders.erase(0); // clear old builder to avoid different evolutions crash
+ aBuilder = builder(0);
}
- if(isBuilt) {
- aStream.str(std::string());
- aStream.clear();
- aStream << theName;
- if (theIsStoreSeparate && !isFoundDiffOld)
- aStream << "_" << anIndex++;
+ } else {
+ int aTag = isGenerated ? getGenerationTag(aNewShape_)
+ : getModificationTag(aNewShape_);
+ aBuilder = builder(aTag);
- if (aSameParentShapes > 0) {
- aStream.str(std::string());
- aStream.clear();
- aStream << aName << "_" << "divided" << "_" << myDividedIndex++;
- }
+ // Check if new shape was already stored.
+ if (isAlreadyStored(aBuilder, anOldSubShape_, aNewShape_)) continue;
- aStream << aSuffix;
- buildName(aBuilderTag, aStream.str());
- }
- if(theIsStoreSeparate && !isFoundDiffOld) {
- aTag++;
- }
- } else if (aResultShape->isSame(*anIt)) {
- // keep the modification evolution on the root level (2241 - history propagation issue)
- TNaming_Builder* aBuilder = builder(0);
- TDF_Label aShapeLab = aBuilder->NamedShape()->Label();
- Handle(TDF_Reference) aRef;
- // Store only in case if it does not have reference.
- if (!aShapeLab.FindAttribute(TDF_Reference::GetID(), aRef)) {
- if (theIsStoreAsGenerated) {
- TNaming_Builder* aBuilder = builder(0);
- if (!aBuilder->NamedShape().IsNull() &&
- aBuilder->NamedShape()->Evolution() != TNaming_GENERATED) {
- myBuilders.erase(0); // clear old builder to avoid different evolutions crash
- }
- builder(0)->Generated(aRoot, aNewShape);
- } else {
- TNaming_Builder* aBuilder = builder(0);
- if (!aBuilder->NamedShape().IsNull() &&
- aBuilder->NamedShape()->Evolution() != TNaming_MODIFY) {
- myBuilders.erase(0); // clear old builder to avoid different evolutions crash
- }
- builder(0)->Modify(aRoot, aNewShape);
- }
- }
+ buildName(aTag, theName);
}
+
+ isGenerated ? aBuilder->Generated(anOldSubShape_, aNewShape_)
+ : aBuilder->Modify(anOldSubShape_, aNewShape_);
+ // store information about the external document reference to restore old shape on open
+ storeExternalReference(anOriginalLabel, aBuilder->NamedShape()->Label());
}
}
}
-void Model_BodyBuilder::loadAndOrientGeneratedShapes (
- GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn,
- const int theKindOfShape,
- const int theTag,
- const std::string& theName,
- GeomAPI_DataMapOfShapeShape& theSubShapes)
+void Model_BodyBuilder::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName)
{
- TopoDS_Shape aShapeIn = theShapeIn->impl<TopoDS_Shape>();
- TopTools_MapOfShape aView;
- bool isBuilt = !theName.empty();
- TopExp_Explorer aShapeExplorer (aShapeIn, (TopAbs_ShapeEnum)theKindOfShape);
- for (; aShapeExplorer.More(); aShapeExplorer.Next ()) {
- const TopoDS_Shape& aRoot = aShapeExplorer.Current ();
- if (!aView.Add(aRoot)) continue;
- //if (TNaming_Tool::NamedShape(aRoot, builder(theTag)->NamedShape()->Label()).IsNull())
- // continue; // there is no sense to write history if old shape does not exist in the document
- ListOfShape aList;
- std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
- aRShape->setImpl((new TopoDS_Shape(aRoot)));
- theMS->generated(aRShape, aList);
- keepTopLevelShapes(aList, aRoot);
- std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator
- anIt = aList.begin(), aLast = aList.end();
- for (; anIt != aLast; anIt++) {
- TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
- if (theSubShapes.isBound(*anIt)) {
- std::shared_ptr<GeomAPI_Shape> aMapShape(theSubShapes.find(*anIt));
- aNewShape.Orientation(aMapShape->impl<TopoDS_Shape>().Orientation());
- }
- if (!aRoot.IsSame (aNewShape)) {
- builder(theTag)->Generated(aRoot,aNewShape);
- if(isBuilt)
- buildName(theTag, theName);
+ GeomShapePtr aResultShape = shape();
+ TopTools_MapOfShape anAlreadyProcessedShapes;
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+ for (GeomAPI_ShapeExplorer anOldShapeExp(theOldShape, theShapeTypeToExplore);
+ anOldShapeExp.more();
+ anOldShapeExp.next())
+ {
+ GeomShapePtr anOldSubShape = anOldShapeExp.current();
+ const TopoDS_Shape& anOldSubShape_ = anOldSubShape->impl<TopoDS_Shape>();
+
+ // There is no sense to write history if shape already processed
+ // or old shape does not exist in the document.
+ bool anOldSubShapeAlreadyProcessed = !anAlreadyProcessedShapes.Add(anOldSubShape_);
+ TDF_Label anAccess2 = std::dynamic_pointer_cast<Model_Document>(
+ ModelAPI_Session::get()->moduleDocument())->generalLabel();
+ TDF_Label anOriginalLabel;
+ bool anOldSubShapeNotInTree =
+ !isShapeInTree(aData->shapeLab(), anAccess2, anOldSubShape_, anOriginalLabel);
+ if (anOldSubShapeAlreadyProcessed || anOldSubShapeNotInTree) {
+ continue;
+ }
+
+ // Get new shapes.
+ ListOfShape aNewShapes;
+ theAlgo->generated(anOldSubShape, aNewShapes);
+
+ keepTopLevelShapes(aNewShapes, anOldSubShape_);
+
+ for (ListOfShape::const_iterator aNewShapesIt = aNewShapes.cbegin();
+ aNewShapesIt != aNewShapes.cend();
+ ++aNewShapesIt)
+ {
+ GeomShapePtr aNewShape = *aNewShapesIt;
+ const TopoDS_Shape& aNewShape_ = aNewShape->impl<TopoDS_Shape>();
+
+ bool aNewShapeIsSameAsOldShape = anOldSubShape->isSame(aNewShape);
+ bool aNewShapeIsNotInResultShape = !aResultShape->isSubShape(aNewShape, false);
+ if (aNewShapeIsSameAsOldShape
+ || aNewShapeIsNotInResultShape)
+ {
+ continue;
}
- TopAbs_ShapeEnum aGenShapeType = aNewShape.ShapeType();
- if(aGenShapeType == TopAbs_WIRE || aGenShapeType == TopAbs_SHELL) {
- TopAbs_ShapeEnum anExplodeShapeType =
- aGenShapeType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_FACE;
- const TDF_Label aLabel = builder(theTag)->NamedShape()->Label();
- int aTag = 1;
- std::shared_ptr<Model_Document> aDoc =
- std::dynamic_pointer_cast<Model_Document>(document());
- for(TopExp_Explorer anExp(aNewShape, anExplodeShapeType); anExp.More(); anExp.Next()) {
- TDF_Label aChildLabel = aLabel.FindChild(aTag);
- TNaming_Builder aBuilder(aChildLabel);
- aBuilder.Generated(aRoot, anExp.Current());
- TCollection_AsciiString aChildName =
- TCollection_AsciiString((theName + "_").c_str()) + aTag;
- TDataStd_Name::Set(aChildLabel, aChildName.ToCString());
- aTag++;
+
+ TopAbs_ShapeEnum aNewShapeType = aNewShape_.ShapeType();
+ if (aNewShapeType == TopAbs_WIRE || aNewShapeType == TopAbs_SHELL) {
+ // TODO: This is a workaround. New shape should be only edge or face.
+ TopAbs_ShapeEnum aShapeTypeToExplore = aNewShapeType == TopAbs_WIRE ? TopAbs_EDGE
+ : TopAbs_FACE;
+ int aTag = TopAbs_WIRE ? GENERATED_EDGES_TAG : GENERATED_FACES_TAG;
+ for (TopExp_Explorer anExp(aNewShape_, aShapeTypeToExplore); anExp.More(); anExp.Next()) {
+ builder(aTag)->Generated(anOldSubShape_, anExp.Current());
+ // store information about the external document reference to restore old shape on open
+ storeExternalReference(anOriginalLabel, builder(aTag)->NamedShape()->Label());
}
+ buildName(aTag, theName);
+ }
+ else {
+ int aTag = getGenerationTag(aNewShape_);
+ if (aTag == INVALID_TAG) return;
+ builder(aTag)->Generated(anOldSubShape_, aNewShape_);
+ buildName(aTag, theName);
+ // store information about the external document reference to restore old shape on open
+ storeExternalReference(anOriginalLabel, builder(aTag)->NamedShape()->Label());
}
}
}
}
+// LCOV_EXCL_START
//=======================================================================
int getDangleShapes(const TopoDS_Shape& theShapeIn,
const TopAbs_ShapeEnum theGeneratedFrom,
for (; itr.More(); itr.Next())
theBuilder->Generated(itr.Key(), itr.Value());
}
+// LCOV_EXCL_STOP
//=======================================================================
-void Model_BodyBuilder::loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag)
+void Model_BodyBuilder::loadNextLevels(GeomShapePtr theShape,
+ const std::string& theName)
{
if(theShape->isNull()) return;
TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
if (aShape.ShapeType() == TopAbs_SOLID) {
TopExp_Explorer expl(aShape, TopAbs_FACE);
for (; expl.More(); expl.Next()) {
- builder(theTag)->Generated(expl.Current());
- TCollection_AsciiString aStr(theTag);
- aName = theName + aStr.ToCString();
- buildName(theTag, aName);
- theTag++;
+ builder(myFreePrimitiveTag)->Generated(expl.Current());
+ TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+ aName = theName + "_" + aStr.ToCString();
+ buildName(myFreePrimitiveTag, aName);
+ ++myFreePrimitiveTag;
}
}
else if (aShape.ShapeType() == TopAbs_SHELL || aShape.ShapeType() == TopAbs_FACE) {
if (Faces.Extent() > 1 || (aShape.ShapeType() == TopAbs_SHELL && Faces.Extent() == 1)) {
TopExp_Explorer expl(aShape, TopAbs_FACE);
for (; expl.More(); expl.Next()) {
- builder(theTag)->Generated(expl.Current());
- TCollection_AsciiString aStr(theTag);
- aName = theName + aStr.ToCString();
- buildName(theTag, aName);
- theTag++;
+ builder(myFreePrimitiveTag)->Generated(expl.Current());
+ TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+ aName = theName + "_" + aStr.ToCString();
+ buildName(myFreePrimitiveTag, aName);
+ ++myFreePrimitiveTag;
}
}
TopTools_IndexedDataMapOfShapeListOfShape anEdgeAndNeighbourFaces;
if (aLL.Extent() < 2) {
if (BRep_Tool::Degenerated(TopoDS::Edge(anEdgeAndNeighbourFaces.FindKey(i))))
continue;
- builder(theTag)->Generated(anEdgeAndNeighbourFaces.FindKey(i));
- TCollection_AsciiString aStr(theTag);
- aName = theName + aStr.ToCString();
- buildName(theTag, aName);
- theTag++;
+ builder(myFreePrimitiveTag)->Generated(anEdgeAndNeighbourFaces.FindKey(i));
+ TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+ aName = theName + "_" + aStr.ToCString();
+ buildName(myFreePrimitiveTag, aName);
+ ++myFreePrimitiveTag;
} else {
TopTools_ListIteratorOfListOfShape anIter(aLL);
const TopoDS_Face& aFace = TopoDS::Face(anIter.Value());
anIter.Next();
if(aFace.IsEqual(anIter.Value())) {
- builder(theTag)->Generated(anEdgeAndNeighbourFaces.FindKey(i));
- TCollection_AsciiString aStr(theTag);
- aName = theName + aStr.ToCString();
- buildName(theTag, aName);
- theTag++;
+ builder(myFreePrimitiveTag)->Generated(anEdgeAndNeighbourFaces.FindKey(i));
+ TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+ aName = theName + "_" + aStr.ToCString();
+ buildName(myFreePrimitiveTag, aName);
+ ++myFreePrimitiveTag;
}
}
}
TopTools_IndexedMapOfShape Edges;
BRepTools::Map3DEdges(aShape, Edges);
if (Edges.Extent() == 1) {
- builder(theTag++)->Generated(Edges.FindKey(1));
+ builder(myFreePrimitiveTag++)->Generated(Edges.FindKey(1));
TopExp_Explorer expl(aShape, TopAbs_VERTEX);
for (; expl.More(); expl.Next()) {
- builder(theTag)->Generated(expl.Current());
- TCollection_AsciiString aStr(theTag);
- aName = theName + aStr.ToCString();
- buildName(theTag, aName);
- theTag++;
+ builder(myFreePrimitiveTag)->Generated(expl.Current());
+ TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+ aName = theName + "_" + aStr.ToCString();
+ buildName(myFreePrimitiveTag, aName);
+ ++myFreePrimitiveTag;
}
} else {
TopExp_Explorer expl(aShape, TopAbs_EDGE);
for (; expl.More(); expl.Next()) {
- builder(theTag)->Generated(expl.Current());
- TCollection_AsciiString aStr(theTag);
- aName = theName + aStr.ToCString();
- buildName(theTag, aName);
- theTag++;
+ builder(myFreePrimitiveTag)->Generated(expl.Current());
+ TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+ aName = theName + "_" + aStr.ToCString();
+ buildName(myFreePrimitiveTag, aName);
+ ++myFreePrimitiveTag;
}
// and load generated vertices.
TopTools_DataMapOfShapeShape generated;
if (getDangleShapes(aShape, TopAbs_EDGE, generated))
{
- TNaming_Builder* pBuilder = builder(theTag++);
+ TNaming_Builder* pBuilder = builder(myFreePrimitiveTag++);
loadGeneratedDangleShapes(aShape, TopAbs_EDGE, pBuilder);
}
}
} else if (aShape.ShapeType() == TopAbs_EDGE) {
TopExp_Explorer expl(aShape, TopAbs_VERTEX);
for (; expl.More(); expl.Next()) {
- builder(theTag)->Generated(expl.Current());
- TCollection_AsciiString aStr(theTag);
- aName = theName + aStr.ToCString();
- buildName(theTag, aName);
- theTag++;
+ builder(myFreePrimitiveTag)->Generated(expl.Current());
+ TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+ aName = theName + "_" + aStr.ToCString();
+ buildName(myFreePrimitiveTag, aName);
+ ++myFreePrimitiveTag;
}
}
}
}
//=======================================================================
-void Model_BodyBuilder::loadFirstLevel(
- std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag)
+void Model_BodyBuilder::loadFirstLevel(GeomShapePtr theShape, const std::string& theName)
{
if(theShape->isNull()) return;
TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
if (aShape.ShapeType() == TopAbs_COMPOUND || aShape.ShapeType() == TopAbs_COMPSOLID) {
TopoDS_Iterator itr(aShape);
for (; itr.More(); itr.Next()) {
- builder(theTag)->Generated(itr.Value());
- TCollection_AsciiString aStr(theTag);
- aName = theName + aStr.ToCString();
- buildName(theTag, aName);
- if(!theName.empty()) buildName(theTag, aName);
- theTag++;
+ builder(myFreePrimitiveTag)->Generated(itr.Value());
+ TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+ aName = theName + "_" + aStr.ToCString();
+ buildName(myFreePrimitiveTag, aName);
+ ++myFreePrimitiveTag;
if (itr.Value().ShapeType() == TopAbs_COMPOUND ||
itr.Value().ShapeType() == TopAbs_COMPSOLID)
{
- std::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
+ GeomShapePtr itrShape(new GeomAPI_Shape());
itrShape->setImpl(new TopoDS_Shape(itr.Value()));
- loadFirstLevel(itrShape, theName, theTag);
+ loadFirstLevel(itrShape, theName);
} else {
- std::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
+ GeomShapePtr itrShape(new GeomAPI_Shape());
itrShape->setImpl(new TopoDS_Shape(itr.Value()));
- loadNextLevels(itrShape, theName, theTag);
+ loadNextLevels(itrShape, theName);
}
}
} else {
- std::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
+ GeomShapePtr itrShape(new GeomAPI_Shape());
itrShape->setImpl(new TopoDS_Shape(aShape));
- loadNextLevels(itrShape, theName, theTag);
+ loadNextLevels(itrShape, theName);
}
TopTools_ListOfShape aList;
if(findAmbiguities(aShape, aList)) {
TopTools_ListIteratorOfListOfShape it(aList);
- for (; it.More(); it.Next(),theTag++) {
- builder(theTag)->Generated(it.Value());
- TCollection_AsciiString aStr(theTag);
- aName = theName + aStr.ToCString();
- buildName(theTag, aName);
- }
- }
-}
-
-//=======================================================================
-void Model_BodyBuilder::loadDisconnectedEdges(
- std::shared_ptr<GeomAPI_Shape> theShape, const std::string& theName, int& theTag)
-{
- if(theShape->isNull()) return;
- TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
- TopTools_DataMapOfShapeListOfShape edgeNaborFaces;
- TopTools_ListOfShape empty;
- TopExp_Explorer explF(aShape, TopAbs_FACE);
- for (; explF.More(); explF.Next()) {
- const TopoDS_Shape& aFace = explF.Current();
- TopExp_Explorer explV(aFace, TopAbs_EDGE);
- for (; explV.More(); explV.Next()) {
- const TopoDS_Shape& anEdge = explV.Current();
- if (!edgeNaborFaces.IsBound(anEdge)) edgeNaborFaces.Bind(anEdge, empty);
- Standard_Boolean faceIsNew = Standard_True;
- TopTools_ListIteratorOfListOfShape itrF(edgeNaborFaces.Find(anEdge));
- for (; itrF.More(); itrF.Next()) {
- if (itrF.Value().IsSame(aFace)) {
- faceIsNew = Standard_False;
- break;
- }
- }
- if (faceIsNew)
- edgeNaborFaces.ChangeFind(anEdge).Append(aFace);
- }
- }
-
- TopTools_MapOfShape anEdgesToDelete;
- TopExp_Explorer anEx(aShape,TopAbs_EDGE);
- std::string aName;
- for(;anEx.More();anEx.Next()) {
- Standard_Boolean aC0 = Standard_False;
- TopoDS_Shape anEdge1 = anEx.Current();
- if (edgeNaborFaces.IsBound(anEdge1)) {
- const TopTools_ListOfShape& aList1 = edgeNaborFaces.Find(anEdge1);
- if (aList1.Extent()<2) continue;
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itr(edgeNaborFaces);
- for (; itr.More(); itr.Next()) {
- TopoDS_Shape anEdge2 = itr.Key();
- if(anEdgesToDelete.Contains(anEdge2)) continue;
- if (anEdge1.IsSame(anEdge2)) continue;
- const TopTools_ListOfShape& aList2 = itr.Value();
- // compare lists of the neighbour faces of edge1 and edge2
- if (aList1.Extent() == aList2.Extent()) {
- Standard_Integer aMatches = 0;
- for(TopTools_ListIteratorOfListOfShape aLIter1(aList1);aLIter1.More();aLIter1.Next())
- for(TopTools_ListIteratorOfListOfShape aLIter2(aList2);aLIter2.More();aLIter2.Next())
- if (aLIter1.Value().IsSame(aLIter2.Value())) aMatches++;
- if (aMatches == aList1.Extent()) {
- aC0=Standard_True;
- builder(theTag)->Generated(anEdge2);
- anEdgesToDelete.Add(anEdge2);
- TCollection_AsciiString aStr(theTag);
- aName = theName + aStr.ToCString();
- buildName(theTag, aName);
- theTag++;
- }
- }
- }
- TopTools_MapIteratorOfMapOfShape itDelete(anEdgesToDelete);
- for(;itDelete.More();itDelete.Next())
- edgeNaborFaces.UnBind(itDelete.Key());
- edgeNaborFaces.UnBind(anEdge1);
- }
- if (aC0) {
- builder(theTag)->Generated(anEdge1);
- TCollection_AsciiString aStr(theTag);
- aName = theName + aStr.ToCString();
- buildName(theTag, aName);
- theTag++;
- }
- }
-}
-
-void Model_BodyBuilder::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag)
-{
- if(theShape->isNull()) return;
- TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
- TopTools_DataMapOfShapeListOfShape vertexNaborEdges;
- TopTools_ListOfShape empty;
- TopExp_Explorer explF(aShape, TopAbs_EDGE);
- for (; explF.More(); explF.Next()) {
- const TopoDS_Shape& anEdge = explF.Current();
- TopExp_Explorer explV(anEdge, TopAbs_VERTEX);
- for (; explV.More(); explV.Next()) {
- const TopoDS_Shape& aVertex = explV.Current();
- if (!vertexNaborEdges.IsBound(aVertex)) vertexNaborEdges.Bind(aVertex, empty);
- Standard_Boolean faceIsNew = Standard_True;
- TopTools_ListIteratorOfListOfShape itrF(vertexNaborEdges.Find(aVertex));
- for (; itrF.More(); itrF.Next()) {
- if (itrF.Value().IsSame(anEdge)) {
- faceIsNew = Standard_False;
- break;
- }
- }
- if (faceIsNew) {
- vertexNaborEdges.ChangeFind(aVertex).Append(anEdge);
- }
- }
- }
- std::string aName;
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape itr(vertexNaborEdges);
- for (; itr.More(); itr.Next()) {
- const TopTools_ListOfShape& naborEdges = itr.Value();
- if (naborEdges.Extent() < 2) {
- builder(theTag)->Generated(itr.Key());
- TCollection_AsciiString aStr(theTag);
- aName = theName + aStr.ToCString();
- buildName(theTag, aName);
- theTag++;
+ for (; it.More(); it.Next(), ++myFreePrimitiveTag) {
+ builder(myFreePrimitiveTag)->Generated(it.Value());
+ TCollection_AsciiString aStr(myFreePrimitiveTag - PRIMITIVES_START_TAG + 1);
+ aName = theName + "_" + aStr.ToCString();
+ buildName(myFreePrimitiveTag, aName);
}
}
}
-std::shared_ptr<GeomAPI_Shape> Model_BodyBuilder::shape()
+GeomShapePtr Model_BodyBuilder::shape()
{
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
if (aData && aData->isValid()) {
if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aName)) {
TopoDS_Shape aShape = aName->Get();
if (!aShape.IsNull()) {
- std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+ GeomShapePtr aRes(new GeomAPI_Shape);
aRes->setImpl(new TopoDS_Shape(aShape));
return aRes;
}
}
}
- return std::shared_ptr<GeomAPI_Shape>();
-}
-
-bool Model_BodyBuilder::isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape)
-{
- if (theShape.get()) {
- TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
- std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
- if (aData) {
- TDF_Label& aShapeLab = aData->shapeLab();
- Handle(TNaming_NamedShape) aName;
- if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aName)) {
- TopoDS_Shape aLatest = TNaming_Tool::CurrentShape(aName);
- if (aLatest.IsNull())
- return false;
- if (aLatest.IsEqual(aShape))
- return true;
- // check sub-shapes for comp-solids:
- for (TopExp_Explorer anExp(aShape, aLatest.ShapeType()); anExp.More(); anExp.Next()) {
- if (aLatest.IsEqual(anExp.Current()))
- return true;
- }
- }
- }
- }
- return false;
+ return GeomShapePtr();
}
std::map<int, TNaming_Builder*> myBuilders;
public:
/// Stores the shape (called by the execution method).
- MODEL_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape,
+ MODEL_EXPORT virtual void store(const GeomShapePtr& theShape,
const bool theIsStoreSameShapes = true);
/// Stores the generated shape (called by the execution method).
- MODEL_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
- const std::shared_ptr<GeomAPI_Shape>& theToShape);
+ MODEL_EXPORT virtual void storeGenerated(const GeomShapePtr& theFromShape,
+ const GeomShapePtr& theToShape);
/// Stores the modified shape (called by the execution method).
/// \param theOldShape shape that produces result
/// \param theNewShape resulting shape
/// \param theDecomposeSolidsTag tag for starting of solids sub-elements placement in case
/// theNewShape is compound of solids, if zero it is not used
- MODEL_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape,
- const int theDecomposeSolidsTag = 0);
-
- /// Stores the shape without naming support
- /// \param theShape shape to store
- MODEL_EXPORT virtual void storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape);
+ MODEL_EXPORT virtual void storeModified(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const bool theIsCleanStored = true) override;
/// Returns the shape-result produced by this feature
- MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
+ MODEL_EXPORT virtual GeomShapePtr shape();
/// Records the subshape newShape which was generated during a topological construction.
/// As an example, consider the case of a face generated in construction of a box.
- MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
- const std::string& theName, const int theTag = 1);
+ /// Returns true if it is stored correctly (the final shape contains this new sub-shape)
+ MODEL_EXPORT virtual bool generated(const GeomShapePtr& theNewShape,
+ const std::string& theName, const bool theCheckIsInResult = true) override;
/// Records the shape newShape which was generated from the shape oldShape during a topological
/// construction. As an example, consider the case of a face generated from an edge in
/// construction of a prism.
- MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape,
- const std::string& theName, const int theTag = 1);
+ MODEL_EXPORT virtual void generated(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const std::string& theName = "") override;
/// Records the shape newShape which is a modification of the shape oldShape.
/// As an example, consider the case of a face split or merged in a Boolean operation.
- MODEL_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape,
- const std::string& theName, const int theTag = 1);
-
- /// Records the shape oldShape which was deleted from the current label.
- /// As an example, consider the case of a face removed by a Boolean operation.
- MODEL_EXPORT virtual void deleted(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const int theTag = 1);
+ MODEL_EXPORT virtual void modified(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const std::string& theName = "") override;
/// load deleted shapes
- MODEL_EXPORT virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn,
- const int theKindOfShape,
- const int theTag,
- const GeomShapePtr theShapes = GeomShapePtr());
+ MODEL_EXPORT
+ virtual void loadDeletedShapes(const GeomMakeShapePtr& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const GeomShapePtr& theShapesToExclude = GeomShapePtr()) override;
+
/// load and orient modified shapes
- MODEL_EXPORT virtual void loadAndOrientModifiedShapes (
- GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn,
- const int theKindOfShape,
- const int theTag,
- const std::string& theName,
- GeomAPI_DataMapOfShapeShape& theSubShapes,
- const bool theIsStoreSeparate = false,
- const bool theIsStoreAsGenerated = false);
- /// load and orient generated shapes
- MODEL_EXPORT virtual void loadAndOrientGeneratedShapes (
- GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn,
- const int theKindOfShape,
- const int theTag,
- const std::string& theName,
- GeomAPI_DataMapOfShapeShape& theSubShapes);
+ MODEL_EXPORT
+ virtual void loadModifiedShapes(const GeomMakeShapePtr& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName = "") override;
+
+ /// load and orient generated shapes
+ MODEL_EXPORT
+ virtual void loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName = "") override;
/// Loads shapes of the first level (to be used during shape import)
- MODEL_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag);
-
- /// Loads disconnected edges
- MODEL_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag);
-
- /// Loads disconnected vetexes
- MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag);
+ MODEL_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape,
+ const std::string& theName) override;
/// Removes the stored builders
MODEL_EXPORT virtual ~Model_BodyBuilder();
- /// Converts evolution of sub-shapes stored in naming structure to selection
- /// (theFlag = true) and back (theFlag = false)
- MODEL_EXPORT virtual void evolutionToSelection(const bool theFlag);
-
- /// Returns true if the latest modification of this body in the naming history
- // is equal to the given shape
- MODEL_EXPORT virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape);
-
protected:
/// Default constructor accessible only by Model_Objects
Model_BodyBuilder(ModelAPI_Object* theOwner);
private:
/// Loads shapes of the next level (to be used during shape import)
- void loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag);
+ void loadNextLevels(GeomShapePtr theShape,
+ const std::string& theName);
/// builds name for the shape kept at the specified tag
void buildName(const int theTag, const std::string& theName);
private:
- int myDividedIndex;
- int myVIndex;
- int myEIndex;
- int myFIndex;
+ struct IndexTags {
+ int index;
+ std::vector<int> tags;
+ };
+
+private:
+ int myFreePrimitiveTag;
+ std::map<std::string, IndexTags> myPrimitivesNamesIndexMap;
private:
friend class Model_ResultBody;
std::string Model_Data::name()
{
Handle(TDataStd_Name) aName;
- if (myLab.FindAttribute(TDataStd_Name::GetID(), aName)) {
+ if (shapeLab().FindAttribute(TDataStd_Name::GetID(), aName)) {
#ifdef DEBUG_NAMES
myObject->myName = TCollection_AsciiString(aName->Get()).ToCString();
#endif
bool isModified = false;
std::string anOldName = name();
Handle(TDataStd_Name) aName;
- if (!myLab.FindAttribute(TDataStd_Name::GetID(), aName)) {
- TDataStd_Name::Set(myLab, theName.c_str());
+ if (!shapeLab().FindAttribute(TDataStd_Name::GetID(), aName)) {
+ TDataStd_Name::Set(shapeLab(), theName.c_str());
isModified = true;
} else {
isModified = !aName->Get().IsEqual(theName.c_str());
}
if (isUserDefined) {
// name is user-defined, thus special attribute is set
- TDataStd_UAttribute::Set(myLab, kUSER_DEFINED_NAME);
+ TDataStd_UAttribute::Set(shapeLab(), kUSER_DEFINED_NAME);
}
}
}
ModelAPI_ObjectRenamedMessage::send(myObject, anOldName, theName, this);
if (isModified && myObject && myObject->document()) {
std::dynamic_pointer_cast<Model_Document>(myObject->document())->
- changeNamingName(anOldName, theName, myLab);
+ changeNamingName(anOldName, theName, shapeLab());
}
#ifdef DEBUG_NAMES
myObject->myName = theName;
bool Model_Data::hasUserDefinedName() const
{
- return myLab.IsAttribute(kUSER_DEFINED_NAME);
+ return shapeLab().IsAttribute(kUSER_DEFINED_NAME);
}
AttributePtr Model_Data::addAttribute(const std::string& theID, const std::string theAttrType)
}
} else {
// trim: need to redisplay
- if (myObject) {
+ /*if (myObject) {
static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY);
ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent);
- }
+ }*/
}
}
MODEL_EXPORT virtual bool isValid();
/// Returns the label where the shape must be stored (used in ResultBody)
- TDF_Label& shapeLab()
+ TDF_Label shapeLab() const
{
- return myLab;
+ return myLab.IsNull() ? myLab : myLab.Father().FindChild(2);
}
/// Initializes object by the attributes: must be called just after the object is created
#include <ModelAPI_ResultBody.h>
#include <Events_Loop.h>
#include <Events_InfoMessage.h>
+#include <GeomAPI_Tools.h>
#include <TDataStd_Integer.hxx>
#include <TDataStd_Comment.hxx>
#include <TDF_ListIteratorOfAttributeDeltaList.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
#include <TDF_LabelMap.hxx>
+#include <TDF_Tool.hxx>
#include <TDF_DeltaOnAddition.hxx>
+#include <TDataStd_ExtStringList.hxx>
#include <TDataStd_UAttribute.hxx>
#include <TNaming_Builder.hxx>
#include <TNaming_SameShapeIterator.hxx>
#include <TNaming_Iterator.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_Tool.hxx>
+#include<TNaming_OldShapeIterator.hxx>
+#include <TopTools_DataMapOfShapeShape.hxx>
+#include <TopTools_ListOfShape.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Shape.hxx>
// general sub-labels
/// where the reference to the current feature label is located (or no attribute if null feature)
static const int TAG_CURRENT_FEATURE = 1; ///< reference to the current feature
-/// integer, index of the transaction + GUID for auto recomutation blocking
+/// integer, index of the transaction + GUID for auto recomputation blocking
static const int TAG_CURRENT_TRANSACTION = 2;
static const int TAG_SELECTION_FEATURE = 3; ///< integer, tag of the selection feature label
static const int TAG_NODES_STATE = 4; ///< array, tag of the Object Browser nodes states
///< naming structures constructions selected from other document
static const int TAG_EXTERNAL_CONSTRUCTIONS = 5;
+/// reference to the shape in external document: sting list attribute identifier
+static const Standard_GUID kEXTERNAL_SHAPE_REF("9aa5dd14-6d34-4a8d-8786-05842fd7bbbd");
+
Model_Document::Model_Document(const int theID, const std::string theKind)
: myID(theID), myKind(theKind), myIsActive(false), myIsSetCurrentFeature(false),
myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format
return this == Model_Session::get()->moduleDocument().get();
}
+/// Makes all modification and generation naming shapes that have old shapes corresponding to
+/// shapes in a root document be equal to this root document
+static void updateShapesFromRoot(const TDF_Label theThisAccess, const TDF_Label theRootAccess)
+{
+ TopTools_DataMapOfShapeShape aCurrentToRoot; // shapes that must be updated: from this to root
+ TDF_ChildIDIterator aThisIter(theThisAccess.Root(), kEXTERNAL_SHAPE_REF, true);
+ for(; aThisIter.More(); aThisIter.Next()) {
+ aCurrentToRoot.Clear();
+ Handle(TNaming_NamedShape) aNS;
+ if (!aThisIter.Value()->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS))
+ continue;
+ if (aNS->Evolution() != TNaming_GENERATED && aNS->Evolution() != TNaming_MODIFY)
+ continue;
+ for (TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) {
+ const TopoDS_Shape& anOld = aNSIter.OldShape();
+ if (anOld.IsNull())
+ continue;
+ TNaming_OldShapeIterator aNewIter(anOld, theThisAccess);
+ for (; aNewIter.More(); aNewIter.Next()) {
+ TNaming_Evolution anEvolution = aNewIter.NamedShape()->Evolution();
+ if (anEvolution != TNaming_SELECTED && anEvolution != TNaming_DELETE)
+ break;
+ }
+ if (aNewIter.More())
+ continue;
+ GeomShapePtr anOldShape(new GeomAPI_Shape), aRootShape(new GeomAPI_Shape);
+ anOldShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(anOld));
+ anOldShape = GeomAPI_Tools::getTypedShape(anOldShape);
+
+ // search the same shape in the root document
+ Handle(TDataStd_ExtStringList) anEntries =
+ Handle(TDataStd_ExtStringList)::DownCast(aThisIter.Value());
+ TDataStd_ListOfExtendedString::Iterator anIter(anEntries->List());
+ for (; anIter.More(); anIter.Next()) {
+ TDF_Label aRootLab;
+ TDF_Tool::Label(theRootAccess.Data(), anIter.Value(), aRootLab);
+ if (aRootLab.IsNull())
+ continue;
+ Handle(TNaming_NamedShape) aRootNS;
+ if (!aRootLab.FindAttribute(TNaming_NamedShape::GetID(), aRootNS))
+ continue;
+ TNaming_Iterator aRootShapes(aRootNS);
+ for (; aRootShapes.More(); aRootShapes.Next()) {
+ if (aRootShapes.NewShape().IsNull())
+ continue;
+ aRootShape->setImpl(new TopoDS_Shape(aRootShapes.NewShape()));
+ aRootShape = GeomAPI_Tools::getTypedShape(aRootShape);
+ if (!anOldShape->isEqual(aRootShape)) // special checking by geometry
+ continue;
+ // found a good corresponded shape
+ if (!anOld.IsEqual(aRootShapes.NewShape()))
+ aCurrentToRoot.Bind(anOld, aRootShapes.NewShape());
+ }
+ }
+ }
+ if (!aCurrentToRoot.IsEmpty()) { // update the whole named shape content
+ TopTools_ListOfShape anOld, aNew;
+ TNaming_Evolution anEvol = aNS->Evolution();
+ for(TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) {
+ anOld.Prepend(aCurrentToRoot.IsBound(aNSIter.OldShape()) ?
+ aCurrentToRoot.Find(aNSIter.OldShape()) : aNSIter.OldShape());
+ aNew.Prepend(aNSIter.NewShape());
+ }
+ TNaming_Builder aBuilder(aNS->Label());
+ TopTools_ListOfShape::Iterator anOldIter(anOld), aNewIter(aNew);
+ for(; anOldIter.More(); anOldIter.Next(), aNewIter.Next()) {
+ if (anEvol == TNaming_GENERATED) {
+ aBuilder.Generated(anOldIter.Value(), aNewIter.Value());
+ } else if (anEvol == TNaming_MODIFY) {
+ aBuilder.Modify(anOldIter.Value(), aNewIter.Value());
+ }
+ }
+ }
+ }
+}
+
bool Model_Document::load(const char* theDirName, const char* theFileName, DocumentPtr theThis)
{
Handle(Model_Application) anApp = Model_Application::getApplication();
aSession->setCheckTransactions(false);
if (myObjs)
delete myObjs;
- myObjs = new Model_Objects(myDoc->Main()); // synchronisation is inside
+ myObjs = new Model_Objects(myDoc->Main()); // synchronization is inside
myObjs->setOwner(theThis);
// update the current features status
setCurrentFeature(currentFeature(false), false);
aSession->setCheckTransactions(true);
- aSession->setActiveDocument(Model_Session::get()->moduleDocument(), false);
+ aSession->setActiveDocument(aSession->moduleDocument(), false);
// this is done in Part result "activate", so no needed here. Causes not-blue active part.
// aSession->setActiveDocument(anApp->getDocument(myID), true);
anApp->setLoadByDemand(aPart->data()->name(),
aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->docId());
}
-
- } else { // open failed, but new documnet was created to work with it: inform the model
+ if (!isRoot()) {
+ updateShapesFromRoot(myDoc->Main(),
+ std::dynamic_pointer_cast<Model_Document>(aSession->moduleDocument())->generalLabel());
+ }
+ } else { // open failed, but new document was created to work with it: inform the model
aSession->setActiveDocument(Model_Session::get()->moduleDocument(), false);
}
return !isError;
aSub->close(theForever);
}
- // close for thid document needs no transaction in this document
+ // close for this document needs no transaction in this document
std::static_pointer_cast<Model_Session>(Model_Session::get())->setCheckTransactions(false);
- // close all only if it is really asked, otherwise it can be undoed/redoed
+ // close all only if it is really asked, otherwise it can be undone/redone
if (theForever) {
// flush everything to avoid messages with bad objects
delete myObjs;
aSumOfTransaction += myTransactions.rbegin()->myOCAFNum;
myTransactions.pop_back();
}
- // the latest transaction is the start of lower-level operation which startes the nested
+ // the latest transaction is the start of lower-level operation which starts the nested
myTransactions.rbegin()->myOCAFNum += aSumOfTransaction;
myNestedNum.pop_back();
}
return false;
}
-/// Returns true if the last transaction is actually empty: modification to te same values
+/// Returns true if the last transaction is actually empty: modification to the same values
/// were performed only
static bool isEmptyTransaction(const Handle(TDocStd_Document)& theDoc) {
Handle(TDF_Delta) aDelta;
// do it before flashes to enable and recompute nesting features correctly
if (myNestedNum.empty() || (isNestedClosed && myNestedNum.size() == 1)) {
// if all nested operations are closed, make current the higher level objects (to perform
- // it in the python scripts correctly): sketch become current after creation ofsub-elements
+ // it in the python scripts correctly): sketch become current after creation of sub-elements
FeaturePtr aCurrent = currentFeature(false);
CompositeFeaturePtr aMain, aNext = ModelAPI_Tools::compositeOwner(aCurrent);
while(aNext.get()) {
// transaction may be empty if this document was created during this transaction (create part)
if (!myTransactions.empty() && myDoc->CommitCommand()) {
- // if commit is successfull, just increment counters
+ // if commit is successful, just increment counters
if (isEmptyTransaction(myDoc)) { // erase this transaction
myDoc->Undo();
myDoc->ClearRedos();
// nothing inside in all documents, so remove this transaction from the transactions list
undoInternal(true, false);
}
- // on finish clear redos in any case (issue 446) and for all subs (issue 408)
+ // on finish clear redo in any case (issue 446) and for all subs (issue 408)
myDoc->ClearRedos();
myRedos.clear();
for (aSubIter = aSubs.begin(); aSubIter != aSubs.end(); aSubIter++) {
if (anAttr.Value()->Attribute()->ID() == TNaming_NamedShape::GetID()) {
anExcludedInt.Add(anAttr.Value()->Label());
// named shape evolution is changed in history update => skip them,
- // they are not the features arguents
+ // they are not the features arguments
continue;
}
if (anAttr.Value()->Attribute()->ID() == TDataStd_Integer::GetID()) {
bool Model_Document::isModified()
{
- // is modified if at least one operation was commited and not undoed
+ // is modified if at least one operation was committed and not undone
return myTransactions.size() != myTransactionSave || isOperation();
}
(myNestedNum.empty() || *myNestedNum.rbegin() - aCurrentNum > 0) &&
myTransactions.size() - aCurrentNum > 0 /* for omitting the first useless transaction */)
return true;
- // check other subs contains operation that can be undoed
+ // check other subs contains operation that can be undone
const std::set<int> aSubs = subDocuments();
std::set<int>::iterator aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++) {
{
if (!myRedos.empty())
return true;
- // check other subs contains operation that can be redoed
+ // check other subs contains operation that can be redone
const std::set<int> aSubs = subDocuments();
std::set<int>::iterator aSubIter = aSubs.begin();
for (; aSubIter != aSubs.end(); aSubIter++) {
void Model_Document::removeFeature(FeaturePtr theFeature)
{
myObjs->removeFeature(theFeature);
+ // fix for #2723: send signal that part is updated
+ if (!isRoot()) {
+ std::shared_ptr<Model_Document> aRoot =
+ std::dynamic_pointer_cast<Model_Document>(ModelAPI_Session::get()->moduleDocument());
+ std::list<ResultPtr> allParts;
+ aRoot->objects()->allResults(ModelAPI_ResultPart::group(), allParts);
+ std::list<ResultPtr>::iterator aParts = allParts.begin();
+ for(; aParts != allParts.end(); aParts++) {
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aParts);
+ if (aPart->partDoc().get() == this) {
+ static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+ ModelAPI_EventCreator::get()->sendUpdated(aRoot->feature(aPart), anEvent);
+ break;
+ }
+ }
+ }
}
// recursive function to check if theSub is a child of theMain composite feature
FeaturePtr anAfterThisSub = theAfterThis;
if (aCompositeAfter.get()) {
FeaturePtr aSub = aCompositeAfter;
+ int anIndex = kUNDEFINED_FEATURE_INDEX;
do {
- FeaturePtr aNext = myObjs->nextFeature(aSub);
+ FeaturePtr aNext = myObjs->nextFeature(aSub, anIndex);
if (!isSub(aCompositeAfter, aNext)) {
anAfterThisSub = aSub;
break;
void Model_Document::updateHistory(const std::shared_ptr<ModelAPI_Object> theObject)
{
- myObjs->updateHistory(theObject);
+ if (myObjs)
+ myObjs->updateHistory(theObject);
}
void Model_Document::updateHistory(const std::string theGroup)
{
- myObjs->updateHistory(theGroup);
+ if (myObjs)
+ myObjs->updateHistory(theGroup);
}
const std::set<int> Model_Document::subDocuments() const
TDF_Label aLab = aRef->Get();
FeaturePtr aResult = myObjs->feature(aLab);
if (theVisible) { // get nearest visible (in history) going up
+ int anIndex = kUNDEFINED_FEATURE_INDEX;
while(aResult.get() && !aResult->isInHistory()) {
- aResult = myObjs->nextFeature(aResult, true);
+ aResult = myObjs->nextFeature(aResult, anIndex, true);
}
}
return aResult;
if (theVisible && !theCurrent.get()) {
// needed to avoid disabling of PartSet initial constructions
+ int anIndex = kUNDEFINED_FEATURE_INDEX;
FeaturePtr aNext =
- theCurrent.get() ? myObjs->nextFeature(theCurrent) : myObjs->firstFeature();
- for (; aNext.get(); aNext = myObjs->nextFeature(theCurrent)) {
+ theCurrent.get() ? myObjs->nextFeature(theCurrent, anIndex, false) : myObjs->firstFeature();
+ for (; aNext.get(); aNext = myObjs->nextFeature(theCurrent, anIndex, false)) {
if (aNext->isInHistory()) {
break; // next in history is not needed
} else { // next not in history is good for making current
aRefLab.ForgetAttribute(TDF_Reference::GetID());
}
// make all features after this feature disabled in reversed order
- // (to remove results without deps)
+ // (to remove results without dependencies)
static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
bool aPassed = false; // flag that the current object is already passed in cycle
FeaturePtr anIter = myObjs->lastFeature();
bool aWasChanged = false;
bool isCurrentParameter = theCurrent.get() && theCurrent->getKind() == "Parameter";
- for(; anIter.get(); anIter = myObjs->nextFeature(anIter, true)) {
+ int anIndex = kUNDEFINED_FEATURE_INDEX;
+ for(; anIter.get(); anIter = myObjs->nextFeature(anIter, anIndex, true)) {
// check this before passed become enabled: the current feature is enabled!
if (anIter == theCurrent) aPassed = true;
//if (!isCurrentParameter)
aDisabledFlag = false;
} else if (isCurrentParameter) {
- // if paramater is active, all other features become enabled (issue 1307)
+ // if parameter is active, all other features become enabled (issue 1307)
aDisabledFlag = false;
}
ModelAPI_EventCreator::get()->sendUpdated(anIter, aRedispEvent /*, false*/);
aWasChanged = true;
}
- // update for everyone the concealment flag immideately: on edit feature in the midle of history
+ // update for everyone concealment flag immediately: on edit feature in the middle of history
if (aWasChanged) {
std::list<ResultPtr> aResults;
ModelAPI_Tools::allResults(anIter, aResults);
if ((*aRes).get() && (*aRes)->data()->isValid() && !(*aRes)->isDisabled())
std::dynamic_pointer_cast<Model_Data>((*aRes)->data())->updateConcealmentFlag();
}
- // update the concealment status for disply in isConcealed of ResultBody
+ // update the concealment status for display in isConcealed of ResultBody
for(aRes = aResults.begin(); aRes != aResults.end(); aRes++) {
if ((*aRes).get() && (*aRes)->data()->isValid() && !(*aRes)->isDisabled())
(*aRes)->isConcealed();
// problems if it is true: here and in "setCurrentFeature"
FeaturePtr aCurrent = currentFeature(false);
if (aCurrent.get()) { // if not, do nothing because null is the upper
- FeaturePtr aPrev = myObjs->nextFeature(aCurrent, true);
+ int anIndex = kUNDEFINED_FEATURE_INDEX;
+ FeaturePtr aPrev = myObjs->nextFeature(aCurrent, anIndex, true);
// make the higher level composite as current (sketch becomes disabled if line is enabled)
if (aPrev.get()) {
FeaturePtr aComp = ModelAPI_Tools::compositeOwner(aPrev);
// without cycle (issue 1555): otherwise extrusion fuse
- // will be enabled and displayed whaen inside sketch
+ // will be enabled and displayed when inside sketch
if (aComp.get())
aPrev = aComp;
}
return TDF_LabelMapHasher::IsEqual(theLab1, theLab2);
}
-// searches in this document feature that contains this label
FeaturePtr Model_Document::featureByLab(const TDF_Label& theLab) {
TDF_Label aCurrentLab = theLab;
while(aCurrentLab.Depth() > 3)
return myObjs->feature(aCurrentLab);
}
+ResultPtr Model_Document::resultByLab(const TDF_Label& theLab)
+{
+ TDF_Label aCurrentLab = theLab;
+ while(aCurrentLab.Depth() > 3) {
+ ObjectPtr aResultObj = myObjs->object(aCurrentLab);
+ if (aResultObj.get()) {
+ return std::dynamic_pointer_cast<ModelAPI_Result>(aResultObj); // this may be null if feature
+ }
+ aCurrentLab = aCurrentLab.Father();
+ }
+ return ResultPtr(); // not found
+}
+
+
void Model_Document::addNamingName(const TDF_Label theLabel, std::string theName)
{
std::map<std::string, std::list<TDF_Label> >::iterator aFind = myNamingNames.find(theName);
if (aFind != myNamingNames.end()) { // to avoid duplicate-labels
- // to keep correct order inspite of history line management
+ // to keep correct order in spite of history line management
std::list<TDF_Label>::iterator anAddAfterThis = aFind->second.end();
FeaturePtr anAddedFeature = featureByLab(theLabel);
std::list<TDF_Label>::iterator aLabIter = aFind->second.begin();
} else { // remove from the list
aFind->second.erase(aLabIter);
}
+ // check the sketch vertex name located under renamed sketch line
+ TDF_ChildIDIterator aChild(theLabel, TDataStd_Name::GetID());
+ for(; aChild.More(); aChild.Next()) {
+ Handle(TDataStd_Name) aSubName = Handle(TDataStd_Name)::DownCast(aChild.Value());
+ std::string aName = TCollection_AsciiString(aSubName->Get()).ToCString();
+ if (aName.find(theOldName) == 0) { // started from parent name
+ std::string aNewSubName = theNewName + aName.substr(theNewName.size());
+ changeNamingName(aName, aNewSubName, aSubName->Label());
+ aSubName->Set(aNewSubName.c_str());
+ }
+ }
return;
}
}
return *aLabIter;
}
}
- return *(aFind->second.rbegin()); // no more variannts, so, return the last
+ return *(aFind->second.rbegin()); // no more variants, so, return the last
}
// not found exact name, try to find by sub-components
std::string::size_type aSlash = theName.rfind('/');
if (!aRefFeat.get()) { // take feature of the result
aRefFeat = feature(std::dynamic_pointer_cast<ModelAPI_Result>(aRefObj));
}
- if (aRefFeat.get() && aRefFeat == theThis) {
- return false; // other references to this, so this later than other
+ if (aRefFeat.get()) {
+ if (aRefFeat == theThis)
+ return false; // other references to this, so other later than this
+ //if (std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aRefFeat)) {
+ // if (!isLaterByDep(theThis, aRefFeat)) // nested composites: recursion
+ // return false;
+ //}
}
}
}
}
+ FeaturePtr aThisOwner = ModelAPI_Tools::compositeOwner(theThis);
+ if (aThisOwner.get()) {
+ if (aThisOwner == theOther)
+ return true; // composite owner is later that its sub
+ if (!isLaterByDep(aThisOwner, theOther))
+ return false;
+ }
return myObjs->isLater(theThis, theOther);
}
std::string aName = theName;
ResultPtr aRes = myObjs->findByName(aName);
theUniqueContext = !(aRes.get() && myNamingNames.find(aName) != myNamingNames.end());
- while(!aRes.get() && aName[0] == '_') { // this may be thecontext with the history index
+ while(!aRes.get() && aName[0] == '_') { // this may be theContext with the history index
aNumInHistory++;
aName = aName.substr(1);
aRes = myObjs->findByName(aName);
Model_Document* aRoot =
std::dynamic_pointer_cast<Model_Document>(ModelAPI_Session::get()->moduleDocument()).get();
if (aRoot == this)
- return; // don't need to synchronise root with root
+ return; // don't need to synchronize root with root
std::shared_ptr<Model_Session> aSession =
std::dynamic_pointer_cast<Model_Session>(Model_Session::get());
- while(myRedos.size() > aRoot->myRedos.size()) { // remove redos in this
+ while(myRedos.size() > aRoot->myRedos.size()) { // remove redo in this
aSession->setCheckTransactions(false);
redo();
aSession->setCheckTransactions(true);
}
/* this case can not be reproduced in any known case for the current moment, so, just comment
- while(myRedos.size() < aRoot->myRedos.size()) { // add more redos in this
+ while(myRedos.size() < aRoot->myRedos.size()) { // add more redo in this
undoInternal(false, true);
}*/
}
if (!aBodyData.get() || !aBodyData->isValid())
return FeaturePtr();
- TopoDS_Shape anOldShape; // old shape in the pair oldshape->theShape in the named shape
+ TopoDS_Shape anOldShape; // old shape in the pair old shape->theShape in the named shape
TopoDS_Shape aShapeContainer; // old shape of the shape that contains aShape as sub-element
Handle(TNaming_NamedShape) aCandidatInThis, aCandidatContainer;
- TDF_Label aBodyLab = aBodyData->label();
- // use childs and this label (the lowest priority)
+ TDF_Label aBodyLab = aBodyData->shapeLab();
+ // use child and this label (the lowest priority)
TDF_ChildIDIterator aNSIter(aBodyLab, TNaming_NamedShape::GetID(), Standard_True);
bool aUseThis = !aNSIter.More();
while(anOldShape.IsNull() && (aNSIter.More() || aUseThis)) {
/**\class Model_Document
* \ingroup DataModel
* \brief Document for internal data structure of any object storage.
- * Document contains all data that must be stored/retrived in the file.
- * Also it provides acces to this data: open/save, transactions management etc.
+ * Document contains all data that must be stored/retrieved in the file.
+ * Also it provides access to this data: open/save, transactions management etc.
*/
class Model_Document : public ModelAPI_Document
{
const char* theDirName, const char* theFileName, std::list<std::string>& theResults);
//! Removes document data
- //! \param theForever if it is false, document is just hiden
+ //! \param theForever if it is false, document is just hidden
//! (to keep possibility make it back on Undo/Redo)
MODEL_EXPORT virtual void close(const bool theForever = false);
- //! Starts a new operation (opens a tansaction)
+ //! Starts a new operation (opens a transaction)
MODEL_EXPORT virtual void startOperation();
//! Finishes the previously started operation (closes the transaction)
//! \returns true if transaction in this document is not empty and really was performed
//! Returns true if document was modified (since creation/opening)
MODEL_EXPORT virtual bool isModified();
- //! Returns True if there are available Undos
+ //! Returns True if there are available Undo-s
MODEL_EXPORT virtual bool canUndo();
//! Undoes last operation
MODEL_EXPORT virtual void undo();
- //! Returns True if there are available Redos
+ //! Returns True if there are available Redo-s
MODEL_EXPORT virtual bool canRedo();
//! Redoes last operation
MODEL_EXPORT virtual void redo();
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> internalFeature(const int theIndex);
//! Performs synchronization of transactions with the module document:
//! If some document is not active (by undo of activation) but in memory,
- //! on activation the transactions must be synchronised because all redos performed
- //! wihtout this participation
+ //! on activation the transactions must be synchronized because all redo-s performed
+ //! without this participation
MODEL_EXPORT virtual void synchronizeTransactions();
//! Returns feature by the id of the feature (produced by the Data "featureId" method)
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> featureById(const int theId);
- /// Creates a construction cresults
+ /// Creates construction results
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
/// Creates a body results
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Folder> findFolderBelow(
const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures);
//! Search a folder containing the given feature.
- //! Addtionally calculates a zero-based index of the feature in this folder.
+ //! Additionally calculates a zero-based index of the feature in this folder.
//! \param theFeature feature to search
//! \param theIndexInFolder zero-based index in the folder or -1 if the feature is top-level.
//! \return the folder containing the feature or empty pointer if the feature is top-level.
int& theIndexInFolder);
//! Add a list of features to the folder. The correctness of the adding is not performed
//! (such checks have been done in corresponding find.. method).
- //! \return \c true if the movement is successfull
+ //! \return \c true if the movement is successful
MODEL_EXPORT virtual bool moveToFolder(
const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
const std::shared_ptr<ModelAPI_Folder>& theFolder);
const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
const bool theBefore = true);
- ///! Returns true if parametric updater need to execute feature on recomputartion
+ ///! Returns true if parametric updater need to execute feature on recomputation
///! On abort, undo or redo it is not necessary: results in document are updated automatically
bool executeFeatures() {return myExecuteFeatures;}
}
//! performs compactification of all nested operations into one
- //! \returns true if resulting transaction is not empty and can be undoed
+ //! \returns true if resulting transaction is not empty and can be undone
void compactNested();
//! Returns all loaded sub documents
const std::set<int> subDocuments() const;
- //! The implementation of undo: with or without recoursive calls in the sub-documents
+ //! The implementation of undo: with or without recursive calls in the sub-documents
void undoInternal(const bool theWithSubs, const bool theSynchronize);
//! Stores the Id of the current operation (normally is called for the root document)
void operationId(const std::string& theId);
- //! Returns the list of Ids of the operations that can be undoed (called for the root document)
+ //! Returns the list of Ids of the operations that can be undone (called for the root document)
std::list<std::string> undoList() const;
- //! Returns the list of Ids of the operations that can be redoed (called for the root document)
+ //! Returns the list of Ids of the operations that can be redone (called for the root document)
std::list<std::string> redoList() const;
//! Internally makes document know that feature was removed or added in history after creation
/// Normally is called outside of the transaction, just before "save".
virtual void storeNodesState(const std::list<bool>& theStates);
- /// Returns the stored nodes states. Normally it is calles just after "open".
+ /// Returns the stored nodes states. Normally it is called just after "open".
/// Appends the values to theStates list.
virtual void restoreNodesState(std::list<bool>& theStates) const;
- /// Label that constains structures for selection of constructions of another document
+ /// Label that contains structures for selection of constructions of another document
TDF_Label extConstructionsLabel() const;
/// searches in this document feature that contains this label
FeaturePtr featureByLab(const TDF_Label& theLab);
+ /// searches in this document result that contains this label
+ ResultPtr resultByLab(const TDF_Label& theLab);
- /// returns true if theThis is later in the features trre and dependencies than theOther
+ /// returns true if theThis is later in the features tree and dependencies than theOther
bool isLaterByDep(FeaturePtr theThis, FeaturePtr theOther);
/// appends the latest transaction to the previous one (used for AutoUpdate enabling transaction)
void appendTransactionToPrevious();
- /// Sets the automatic recomutation flag: true means enabled
+ /// Sets the automatic recomputation flag: true means enabled
void setAutoRecomutationState(const bool theState);
- /// Returns the current automatic recomutation flag: true means enabled
+ /// Returns the current automatic recomputation flag: true means enabled
bool autoRecomutationState() const;
friend class Model_Application;
friend class Model_ResultBody;
friend class Model_ResultConstruction;
friend class Model_SelectionNaming;
+ friend class Model_BodyBuilder;
friend class DFBrowser;
private:
//! counter value of transaction on the last "save" call, used for "IsModified" method
int myTransactionSave;
- //! number of nested transactions performed (list becasue may be nested inside of nested)
+ //! number of nested transactions performed (list because may be nested inside of nested)
//! the list is empty if not nested transaction is performed
std::list<int> myNestedNum;
#include <TDF_ChildIDIterator.hxx>
#include <TDataStd_ReferenceArray.hxx>
#include <TDataStd_HLabelArray1.hxx>
-#include <TDataStd_Name.hxx>
#include <TDF_Reference.hxx>
#include <TDF_ChildIDIterator.hxx>
#include <TDF_LabelMapHasher.hxx>
#include <TDF_LabelMap.hxx>
#include <TDF_ListIteratorOfLabelList.hxx>
+int kUNDEFINED_FEATURE_INDEX = -1;
+
static const std::string& groupNameFoldering(const std::string& theGroupID,
const bool theAllowFolder)
{
} else { // extend array by one more element
Handle(TDataStd_HLabelArray1) aNewArray = new TDataStd_HLabelArray1(aRefs->Lower(),
aRefs->Upper() + 1);
- int aPassedPrev = 0; // prev feature is found and passed
+ int aPassedPrev = 0; // previous feature is found and passed
if (thePrevLab.IsNull()) { // null means that inserted feature must be the first
aNewArray->SetValue(aRefs->Lower(), theReferenced);
aPassedPrev = 1;
for(; aRefIter != aRefs.end(); aRefIter++) {
std::shared_ptr<ModelAPI_CompositeFeature> aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(*aRefIter);
- if (aComposite.get() && aComposite->isSub(theFeature)) {
+ if (aComposite.get() && aComposite->data()->isValid() && aComposite->isSub(theFeature)) {
aComposite->removeFeature(theFeature);
}
}
Handle(TDataStd_HLabelArray1) aNewArray =
new TDataStd_HLabelArray1(aRefs->Lower(), aRefs->Upper());
- int aPassedMovedFrom = 0; // the prev feature location is found and passed
+ int aPassedMovedFrom = 0; // the previous feature location is found and passed
int aPassedMovedTo = 0; // the feature is added and this location is passed
if (!theAfterThis.get()) { // null means that inserted feature must be the first
aNewArray->SetValue(aRefs->Lower(), aMovedLab);
createHistory(theGroupID);
if (theGroupID == ModelAPI_Feature::group()) { // searching among features (in history or not)
std::list<std::shared_ptr<ModelAPI_Feature> > allObjs = allFeatures();
- std::list<std::shared_ptr<ModelAPI_Feature> >::iterator anObjIter = allObjs.begin();
- for(; anObjIter != allObjs.end(); anObjIter++) {
+ // from the end to find the latest result with such name
+ std::list<std::shared_ptr<ModelAPI_Feature> >::reverse_iterator anObjIter = allObjs.rbegin();
+ for(; anObjIter != allObjs.rend(); anObjIter++) {
if ((*anObjIter)->data()->name() == theName)
return *anObjIter;
}
} else { // searching among results (concealed or not)
std::list<std::shared_ptr<ModelAPI_Feature> > allObjs = allFeatures();
- std::list<std::shared_ptr<ModelAPI_Feature> >::iterator anObjIter = allObjs.begin();
- for(; anObjIter != allObjs.end(); anObjIter++) {
+ // from the end to find the latest result with such name
+ std::list<std::shared_ptr<ModelAPI_Feature> >::reverse_iterator anObjIter = allObjs.rbegin();
+ for(; anObjIter != allObjs.rend(); anObjIter++) {
std::list<ResultPtr> allRes;
ModelAPI_Tools::allResults(*anObjIter, allRes);
for(std::list<ResultPtr>::iterator aRes = allRes.begin(); aRes != allRes.end(); aRes++) {
// first count all features of such kind to start with index = count + 1
int aNumObjects = -1; // this feature is already in this map
NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFIter(myFeatures);
+ std::set<std::string> allNames;
for (; aFIter.More(); aFIter.Next()) {
if (aFIter.Value()->getKind() == theFeature->getKind())
aNumObjects++;
+ allNames.insert(aFIter.Value()->data()->name());
}
// generate candidate name
aName = composeName(theFeature->getKind(), aNumObjects + 1);
// check this is unique, if not, increase index by 1
- for (aFIter.Initialize(myFeatures); aFIter.More();) {
- FeaturePtr aFeature = aFIter.Value();
- bool isSameName = aFeature->data()->name() == aName;
- if (!isSameName) { // check also results to avoid same results names (actual for Parts)
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
- for (; aRIter != aResults.cend(); aRIter++) {
- isSameName = (*aRIter)->data()->name() == aName;
- }
- }
-
- if (isSameName) {
- aNumObjects++;
- aName = composeName(theFeature->getKind(), aNumObjects + 1);
- // reinitialize iterator to make sure a new name is unique
- aFIter.Initialize(myFeatures);
- } else
- aFIter.Next();
+ for(aNumObjects++; allNames.find(aName) != allNames.end(); aNumObjects++) {
+ aName = composeName(theFeature->getKind(), aNumObjects + 1);
}
theFeature->data()->setName(aName);
}
ObjectPtr aFeature = isFolder ? ObjectPtr(new ModelAPI_Folder)
: ObjectPtr(aSession->createFeature(aFeatureID, anOwner));
if (!aFeature.get()) {
- // somethig is wrong, most probably, the opened document has invalid structure
+ // something is wrong, most probably, the opened document has invalid structure
Events_InfoMessage("Model_Objects", "Invalid type of object in the document").send();
aLabIter.Value()->Label().ForgetAllAttributes();
continue;
}
// update results of the features (after features created because
// they may be connected, like sketch and sub elements)
- // After synchronisation of back references because sketch
+ // After synchronization of back references because sketch
// must be set in sub-elements before "execute" by updateResults
std::set<FeaturePtr> aProcessed; // composites must be updated after their subs (issue 360)
TDF_ChildIDIterator aLabIter2(featuresLabel(), TDataStd_Comment::GetID());
anOwner->setExecuteFeatures(true);
}
-/// synchronises back references for the given object basing on the collected data
+/// synchronizes back references for the given object basing on the collected data
void Model_Objects::synchronizeBackRefsForObject(const std::set<AttributePtr>& theNewRefs,
ObjectPtr theObject)
{
if (!theObject.get() || !theObject->data()->isValid())
return; // invalid
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theObject->data());
- // iterate new list to compare with curent
+ // iterate new list to compare with current
std::set<AttributePtr>::iterator aNewIter = theNewRefs.begin();
for(; aNewIter != theNewRefs.end(); aNewIter++) {
if (aData->refsToMe().find(*aNewIter) == aData->refsToMe().end()) {
void Model_Objects::synchronizeBackRefs()
{
// collect all back references in the separated container: to update everything at once,
- // without additional Concealment switchin on and off: only the final modification
+ // without additional Concealment switching on and off: only the final modification
- // referenced (slave) objects to referencing attirbutes
+ // referenced (slave) objects to referencing attributes
std::map<ObjectPtr, std::set<AttributePtr> > allRefs;
NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFeatures(myFeatures);
for(; aFeatures.More(); aFeatures.Next()) {
FeaturePtr aFeature = aFeatures.Value();
std::list<ResultPtr> aResults;
ModelAPI_Tools::allResults(aFeature, aResults);
- // update the concealment status for disply in isConcealed of ResultBody
+ // update the concealment status for display in isConcealed of ResultBody
std::list<ResultPtr>::iterator aRIter = aResults.begin();
for(; aRIter != aResults.cend(); aRIter++) {
(*aRIter)->isConcealed();
std::shared_ptr<Model_Data> aPrevData =
std::dynamic_pointer_cast<Model_Data>(theBeforeThis->data());
if (aPrevData.get()) {
- aPrevFeatureLab = nextLabel(aPrevData->label().Father(), true);
+ int anIndex = kUNDEFINED_FEATURE_INDEX;
+ aPrevFeatureLab = nextLabel(aPrevData->label().Father(), anIndex, true);
}
} else { // find the label of the last feature
Handle(TDataStd_ReferenceArray) aRefs;
if (!aLastFeatureInFolder.IsNull()) {
if (IsEqual(aCurLabel, aLastFeatureInFolder))
- aLastFeatureInFolder.Nullify(); // the last feature in the folder is achived
+ aLastFeatureInFolder.Nullify(); // the last feature in the folder is achieved
continue;
}
const std::shared_ptr<ModelAPI_Result>& theResult)
{
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theResult->data());
- if (aData.get()) {
+ if (aData.get() && aData->isValid()) {
TDF_Label aFeatureLab = aData->label().Father().Father().Father();
FeaturePtr aFeature = feature(aFeatureLab);
while(!aFeature.get() && aFeatureLab.Depth() > 1) { // this may be sub-result of result
}
}
- // for not persistent is will be done by parametric updater automatically
- //if (!theFeature->isPersistentResult()) return;
// check the existing results and remove them if there is nothing on the label
std::list<ResultPtr>::const_iterator aResIter = theFeature->results().cbegin();
while(aResIter != theFeature->results().cend()) {
if (aGroup->Get() == ModelAPI_ResultBody::group().c_str()) {
aNewBody = createBody(theFeature->data(), aResIndex);
} else if (aGroup->Get() == ModelAPI_ResultPart::group().c_str()) {
- std::shared_ptr<ModelAPI_ResultPart> aNewP = createPart(theFeature->data(), aResIndex);
- theFeature->setResult(aNewP, aResIndex);
- if (!aNewP->partDoc().get())
- // create the part result: it is better to restore the previous result if it is possible
- theFeature->execute();
+ if (aResIndex <= theFeature->results().size()) { // to avoid crash if previous execute
+ // for index = 0 erases result
+ std::shared_ptr<ModelAPI_ResultPart> aNewP = createPart(theFeature->data(), aResIndex);
+ theFeature->setResult(aNewP, aResIndex);
+ if (!aNewP->partDoc().get())
+ // create the part result: it is better to restore the previous result if possible
+ theFeature->execute();
+ }
} else if (aGroup->Get() == ModelAPI_ResultConstruction::group().c_str()) {
- theFeature->execute(); // construction shapes are needed for sketch solver
- if (!theFeature->results().empty()) // to fix #2640 : update sketch, but not naming
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theFeature->firstResult())
- ->facesNum(false);
+ ResultConstructionPtr aConstr = createConstruction(theFeature->data(), aResIndex);
+ if (!aConstr->updateShape())
+ theFeature->execute(); // not stored shape in the data structure, execute to have it
+ else
+ theFeature->setResult(aConstr, aResIndex); // result is ready without execution
} else if (aGroup->Get() == ModelAPI_ResultGroup::group().c_str()) {
aNewBody = createGroup(theFeature->data(), aResIndex);
} else if (aGroup->Get() == ModelAPI_ResultField::group().c_str()) {
if (aResSize > 0) { // check there exist a body that must be updated
std::list<ResultPtr>::const_iterator aRes = theFeature->results().cbegin();
for (; aResSize && aRes != theFeature->results().cend(); aRes++, aResSize++) {
- if ((*aRes)->data()->isValid() && (*aRes)->groupName() == ModelAPI_ResultBody::group()) {
- ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRes);
- aBody->updateSubs(aBody->shape(), false);
+ if ((*aRes)->data()->isValid()) {
+ if ((*aRes)->groupName() == ModelAPI_ResultBody::group()) {
+ ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRes);
+ aBody->updateSubs(aBody->shape(), false);
+ } else if ((*aRes)->groupName() == ModelAPI_ResultConstruction::group()) {
+ // update the cashed myShape presented in construction
+ ResultConstructionPtr aConstr =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
+ aConstr->updateShape();
+ }
}
}
}
return aResult;
}
-TDF_Label Model_Objects::nextLabel(TDF_Label theCurrent, const bool theReverse)
+TDF_Label Model_Objects::nextLabel(TDF_Label theCurrent, int& theIndex, const bool theReverse)
{
Handle(TDataStd_ReferenceArray) aRefs;
if (featuresLabel().FindAttribute(TDataStd_ReferenceArray::GetID(), aRefs)) {
- for(int a = aRefs->Lower(); a <= aRefs->Upper(); a++) { // iterate all existing features
+ int aStart = theIndex == kUNDEFINED_FEATURE_INDEX ? aRefs->Lower() : theIndex;
+ for(int a = aStart; a <= aRefs->Upper(); a++) { // iterate all existing features
TDF_Label aCurLab = aRefs->Value(a);
if (aCurLab.IsEqual(theCurrent)) {
a += theReverse ? -1 : 1;
- if (a >= aRefs->Lower() && a <= aRefs->Upper())
+ if (a >= aRefs->Lower() && a <= aRefs->Upper()) {
+ theIndex = a;
return aRefs->Value(a);
- break; // finish iiteration: it's last feature
+ }
+ break; // finish iteration: it's last feature
}
}
}
return TDF_Label();
}
-FeaturePtr Model_Objects::nextFeature(FeaturePtr theCurrent, const bool theReverse)
+FeaturePtr Model_Objects::nextFeature(FeaturePtr theCurrent, int& theIndex, const bool theReverse)
{
std::shared_ptr<Model_Data> aData = std::static_pointer_cast<Model_Data>(theCurrent->data());
if (aData.get() && aData->isValid()) {
TDF_Label aFeatureLabel = aData->label().Father();
do {
- TDF_Label aNextLabel = nextLabel(aFeatureLabel, theReverse);
+ TDF_Label aNextLabel = nextLabel(aFeatureLabel, theIndex, theReverse);
if (aNextLabel.IsNull())
- break; // last or something is wrong
+ break; // the last or something is wrong
FeaturePtr aFound = feature(aNextLabel);
if (aFound)
return aFound; // the feature is found
static Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper);
static Standard_Boolean IsEqual(const TDF_Label& theLab1, const TDF_Label& theLab2);
+extern int kUNDEFINED_FEATURE_INDEX;
+
/**\class Model_Objects
* \ingroup DataModel
* \brief Manager of objects of the document. Normally one this class corresponds to
class Model_Objects
{
public:
- //! Registers the fieature in the data structure
+ //! Registers the feature in the data structure
//! \param theFeature feature that must be added to the data structure
//! \param theAfterThis the feature will be added after this feature;
//! if it is null, the added feature will be the first
const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
const bool theBelow);
//! Search a folder containing the given feature.
- //! Addtionally calculates a zero-based index of the feature in this folder.
+ //! Additionally calculates a zero-based index of the feature in this folder.
//! \param theFeature feature to search
//! \param theIndexInFolder zero-based index in the folder or -1 if the feature is top-level.
//! \return the folder containing the feature or empty pointer if the feature is top-level.
int& theIndexInFolder);
//! Add a list of features to the folder. The correctness of the adding is not performed
//! (such checks have been done in corresponding find.. method).
- //! \return \c true if the movement is successfull
+ //! \return \c true if the movement is successful
bool moveToFolder(const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
const std::shared_ptr<ModelAPI_Folder>& theFolder);
//! Remove features from the folder
//! Returns the owner of this manager
DocumentPtr owner() {return myDoc;}
- //! Deletes all managed features wit hemmitting of corresponded signal
+ //! Deletes all managed features with emitting of corresponded signal
~Model_Objects();
protected:
//! feature type + "_" + index
void setUniqueName(FeaturePtr theFeature);
- //! Initializes the foldet with an unique name ("Folder_" + index)
+ //! Initializes the folder with an unique name ("Folder_" + index)
void setUniqueName(FolderPtr theFolder);
//! Synchronizes myFeatures list with the updated document
- //! \param theUpdated list of labels that are marked as modified, so featrues must be also
+ //! \param theUpdated list of labels that are marked as modified, so features must be also
//! \param theUpdateReferences causes the update of back-references
//! \param theExecuteFeatures requires re-execute modified persistent features
//! (not needed on undo/redo/abort/open)
- //! \param theOpen - on open nothing must be reexecuted, except not persistent results
+ //! \param theOpen - on open nothing must be re-executed, except not persistent results
//! \param theFlush makes flush all events in the end of all modifications of this method
void synchronizeFeatures(const TDF_LabelList& theUpdated, const bool theUpdateReferences,
const bool theOpen, const bool theExecuteFeatures, const bool theFlush);
/// Returns the next (from the history point of view) feature, any: invisible or disabled
/// \param theCurrent previous to the resulting feature
- /// \param theReverse if it is true, iterates in reverced order (next becomes previous)
- FeaturePtr nextFeature(FeaturePtr theCurrent, const bool theReverse = false);
+ /// \param theReverse if it is true, iterates in reversed order (next becomes previous)
+ /// \param theIndex may be used for optimization: index of theCurrent in references array
+ FeaturePtr nextFeature(FeaturePtr theCurrent, int& theIndex, const bool theReverse = false);
/// Returns to the first (from the history point of view) feature, any: invisible or disabled
FeaturePtr firstFeature();
/// Returns to the last (from the history point of view) feature, any: invisible or disabled
/// Returns the next or previous label
/// \param theCurrent given label
- /// \param theReverse if it is true, iterates in reverced order (next becomes previous)
- TDF_Label nextLabel(TDF_Label theCurrent, const bool theReverse = false);
+ /// \param theReverse if it is true, iterates in reversed order (next becomes previous)
+ TDF_Label nextLabel(TDF_Label theCurrent, int& theIndex, const bool theReverse = false);
/// Returns the result group identifier of the given feature (for this at least one result must
/// be created before)
//! history. Not very fast method, for calling once, not in big cycles.
std::list<std::shared_ptr<ModelAPI_Object> > allObjects();
- //! synchronises back references for the given object basing on the collected data
+ //! synchronizes back references for the given object basing on the collected data
void synchronizeBackRefsForObject(
const std::set<std::shared_ptr<ModelAPI_Attribute>>& theNewRefs, ObjectPtr theObject);
/// Just removes all features without touching the document data (to be able undo)
virtual void eraseAllFeatures();
- // Check whether the pre-image of the result had user-defined name.
+ // Check whether the predefined-image of the result had user-defined name.
// If yes, return this name.
bool hasCustomName(DataPtr theFeatureData,
ResultPtr theResult,
private:
TDF_Label myMain; ///< main label of the data storage
- DocumentPtr myDoc; ///< doc,ument, owner of this objects manager: needed for events creation
+ DocumentPtr myDoc; ///< document, owner of this objects manager: needed for events creation
/// All managed features (not only in history of OB)
/// For optimization mapped by labels
NCollection_DataMap<TDF_Label, ObjectPtr> myFolders;
/// Map from group id to the array that contains all objects located in history.
- /// Each array is updated by demand from scratch, by browing all the features in the history.
+ /// Each array is updated by demand from scratch, by browsing all the features in the history.
std::map<std::string, std::vector<ObjectPtr> > myHistory;
friend class Model_Document;
delete myBuilder;
}
-void Model_ResultBody::loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape, const int theTag,
- const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
- const bool theIsStoreSeparate,
- const bool theIsStoreAsGenerated,
- const bool theSplitInSubs)
+bool Model_ResultBody::generated(const GeomShapePtr& theNewShape,
+ const std::string& theName, const bool theCheckIsInResult)
{
- if (theSplitInSubs && mySubs.size()) { // consists of subs
+ bool aResult = false;
+ if (mySubs.size()) { // consists of subs
+ for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
+ aSubIter != mySubs.cend();
+ ++aSubIter)
+ {
+ const ResultBodyPtr& aSub = *aSubIter;
+ if (aSub->generated(theNewShape, theName, theCheckIsInResult))
+ aResult = true;
+ }
+ } else { // do for this directly
+ if (myBuilder->generated(theNewShape, theName, theCheckIsInResult))
+ aResult = true;
+ }
+ return aResult;
+}
+
+void Model_ResultBody::loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName)
+{
+ if (mySubs.size()) { // consists of subs
+ for (std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
+ aSubIter != mySubs.cend();
+ ++aSubIter)
+ {
+ const ResultBodyPtr& aSub = *aSubIter;
+ aSub->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
+ }
+ } else { // do for this directly
+ myBuilder->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
+ }
+}
+
+void Model_ResultBody::loadModifiedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName)
+{
+ if (/*theSplitInSubs &&*/ mySubs.size()) { // consists of subs
// optimization of getting of new shapes for specific sub-result
- if (!theMS->newShapesCollected(theShapeIn, theKindOfShape))
- theMS->collectNewShapes(theShapeIn, theKindOfShape);
+ if (!theAlgo->isNewShapesCollected(theOldShape, theShapeTypeToExplore))
+ theAlgo->collectNewShapes(theOldShape, theShapeTypeToExplore);
std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
for(; aSubIter != mySubs.cend(); aSubIter++) {
// check that sub-shape was also created as modification of ShapeIn
}
}
}*/
- (*aSubIter)->loadAndOrientModifiedShapes(
- theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
- theIsStoreAsGenerated, theSplitInSubs);
+ (*aSubIter)->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
}
} else { // do for this directly
- myBuilder->loadAndOrientModifiedShapes(
- theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
- theIsStoreAsGenerated);
+ myBuilder->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
}
}
{
bool aChanged = ModelAPI_ResultBody::setDisabled(theThis, theFlag);
if (aChanged) { // state is changed, so modifications are needed
- myBuilder->evolutionToSelection(theFlag);
updateSubs(shape(), false); // to set disabled/enabled
}
return aChanged;
TDF_Label aDataLab = std::dynamic_pointer_cast<Model_Data>(data())->label();
if (!aDataLab.IsNull()) {
TDataStd_UAttribute::Set(aDataLab, kUpdateConnectedTopology);
+ isConnectedTopology(); // to store this flag in transaction, #2630
}
}
// iterate all sub-solids of compsolid to make sub-results synchronized with them
}
}
-bool Model_ResultBody::isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape)
-{
- if (myBuilder->isLatestEqual(theShape))
- return true;
- // also check that it is asked for sub-elements
- std::vector<ResultBodyPtr>::const_iterator aSubIter = mySubs.cbegin();
- for(; aSubIter != mySubs.cend(); aSubIter++) {
- if (aSubIter->get() && (*aSubIter)->isLatestEqual(theShape)) {
- return true;
- }
- }
- return false;
-}
-
bool Model_ResultBody::isConnectedTopology()
{
TDF_Label aDataLab = std::dynamic_pointer_cast<Model_Data>(data())->label();
* Provides a shape that may be displayed in the viewer.
* May provide really huge results, so, working with this kind
* of result must be optimized.
-* Also provides a conainer of sub-body result in case it is compound or compsolid.
+* Also provides a container of sub-body result in case it is compound or compsolid.
*/
class Model_ResultBody : public ModelAPI_ResultBody
{
/// Removes the stored builders
MODEL_EXPORT virtual ~Model_ResultBody();
- /// load and orient modified shapes for sub-objects
- MODEL_EXPORT virtual void loadAndOrientModifiedShapes (GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape, const int theTag,
- const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
- const bool theIsStoreSeparate = false, const bool theIsStoreAsGenerated = false,
- const bool theSplitInSubs = false);
+ /// Records the subshape newShape which was generated during a topological construction.
+ /// As an example, consider the case of a face generated in construction of a box.
+ MODEL_EXPORT virtual bool generated(const GeomShapePtr& theNewShape,
+ const std::string& theName, const bool theCheckIsInResult = true) override;
+
+ /// load generated shapes
+ MODEL_EXPORT
+ virtual void loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName = "") override;
+
+ /// load modified shapes for sub-objects
+ MODEL_EXPORT
+ virtual void loadModifiedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName = "") override;
/// Returns the number of sub-elements
MODEL_EXPORT virtual ResultBodyPtr subResult(const int theIndex,
bool forTree = false) const;
- /// Returns true if feature or reuslt belong to this composite feature as subs
+ /// Returns true if feature or result belong to this composite feature as subs
/// Returns theIndex - zero based index of sub if found
MODEL_EXPORT virtual bool isSub(ObjectPtr theObject, int& theIndex) const;
- /// Returns the parameters of color definition in the resources config manager
+ /// Returns the parameters of color definition in the resources configuration manager
MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
std::string& theDefault);
/// Sets all subs as concealed in the data tree (referenced by other objects)
MODEL_EXPORT virtual void setIsConcealed(const bool theValue);
- /// Returns true if the latest modification of this body in the naming history
- // is equal to the given shape
- MODEL_EXPORT virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape);
-
/// Returns true is the topology is connected.
MODEL_EXPORT virtual bool isConnectedTopology();
void updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisShape,
const bool theShapeChanged = true);
- // Checks the state of children and partents to send events of creation/erase when needed
+ // Checks the state of children and parents to send events of creation/erase when needed
void updateConcealment();
friend class Model_Objects;
#include <Model_Data.h>
#include <ModelAPI_CompositeFeature.h>
-#include <Model_SelectionNaming.h>
+#include <GeomAlgoAPI_SketchBuilder.h>
+#include <GeomAPI_Tools.h>
#include <ModelAPI_Events.h>
-#include <Config_PropManager.h>
+#include <Model_Document.h>
#include <GeomAPI_PlanarEdges.h>
#include <GeomAPI_Shape.h>
-#include <GeomAlgoAPI_SketchBuilder.h>
#include <Events_Loop.h>
+#include <GeomDataAPI_Point.h>
+#include <GeomDataAPI_Dir.h>
-#include <TDF_Reference.hxx>
-#include <TDF_ChildIterator.hxx>
+#include <TDF_ChildIDIterator.hxx>
#include <TNaming_NamedShape.hxx>
#include <TNaming_Builder.hxx>
-#include <TDataStd_Integer.hxx>
#include <TDataStd_IntPackedMap.hxx>
#include <TDataStd_Name.hxx>
#include <TDataStd_UAttribute.hxx>
-#include <TColStd_MapOfTransient.hxx>
-#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
-#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
+#include <TopoDS_ListOfShape.hxx>
#include <TopExp_Explorer.hxx>
-#include <TNaming_Tool.hxx>
-#include <Precision.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <NCollection_IndexedDataMap.hxx>
+
+#include <algorithm>
-// identifier that it is full result selected, but in external document (for internal index is 0)
-Standard_GUID kFULL_RESULT_ID("ee87e529-da6f-46af-be25-5e0fefde52f7");
+// identifier of the infinite result
+Standard_GUID kIS_INFINITE("dea8cc5a-53f2-49c1-94e8-a947bed20a9f");
+// identifier of the result not in history
+Standard_GUID kIS_IN_HISTORY("a9aec01c-805e-44d1-b5d2-a63f06522f8a");
void Model_ResultConstruction::colorConfigInfo(std::string& theSection, std::string& theName,
std::string& theDefault)
void Model_ResultConstruction::setShape(std::shared_ptr<GeomAPI_Shape> theShape)
{
if (myShape != theShape) {
+ storeShape(theShape);
if (!theShape.get() || !theShape->isEqual(myShape)) {
- static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
- ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent);
- if (theShape.get()) {
- myFacesUpToDate = false;
- myFaces.clear();
- }
+ static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+ ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent);
}
myShape = theShape;
}
return myShape;
}
-Model_ResultConstruction::Model_ResultConstruction()
-{
- myIsInHistory = true;
- myIsInfinite = false;
- myFacesUpToDate = false;
-}
-
-void Model_ResultConstruction::setIsInHistory(const bool isInHistory)
+static std::string shortName(
+ std::shared_ptr<ModelAPI_ResultConstruction>& theConstr)
{
- myIsInHistory = isInHistory;
+ std::string aName = theConstr->data()->name();
+ // remove "-", "/" and "&" command-symbols
+ aName.erase(std::remove(aName.begin(), aName.end(), '-'), aName.end());
+ aName.erase(std::remove(aName.begin(), aName.end(), '/'), aName.end());
+ aName.erase(std::remove(aName.begin(), aName.end(), '&'), aName.end());
+ // remove the last 's', 'e', 'f' and 'r' symbols:
+ // they are used as markers of start/end/forward/reversed indicators
+ static const std::string aSyms("sefr");
+ std::string::iterator aSuffix = aName.end() - 1;
+ while(aSyms.find(*aSuffix) != std::string::npos) {
+ --aSuffix;
+ }
+ aName.erase(aSuffix + 1, aName.end());
+ return aName;
}
-int Model_ResultConstruction::facesNum(const bool theUpdateNaming)
+bool Model_ResultConstruction::updateShape()
{
- if (!myFacesUpToDate) {
- std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr =
- std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(myShape);
- if (aWirePtr.get()) {
- std::list<std::shared_ptr<GeomAPI_Shape> > aFaces;
- GeomAlgoAPI_SketchBuilder::createFaces(aWirePtr->origin(), aWirePtr->dirX(),
- aWirePtr->norm(), aWirePtr, aFaces);
- std::list<std::shared_ptr<GeomAPI_Shape> >::iterator aFIter = aFaces.begin();
- for(; aFIter != aFaces.end(); aFIter++) {
- std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(*aFIter));
- if (aFace.get() && !aFace->isNull())
- myFaces.push_back(aFace);
- }
- }
- myFacesUpToDate = true;
-
- // update all the faces and sub-elements in the naming structure
- if (theUpdateNaming) {
- DocumentPtr anEmptyExt;
- bool aNotExt = false;
- TDF_Label aDataLab = startLabel(anEmptyExt, aNotExt);
- TDF_ChildIterator aSubsIter(aDataLab, Standard_False);
- for(; aSubsIter.More(); aSubsIter.Next()) {
- const TDF_Label aLab = aSubsIter.Value();
- if (aLab.Tag() == 1) // skip the root shape label
- continue;
- Handle(TNaming_NamedShape) aNS;
- if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- update(aLab.Tag() - 1, anEmptyExt, aNotExt);
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+ if (aData && aData->isValid()) {
+ TDF_Label aShapeLab = aData->shapeLab();
+ Handle(TNaming_NamedShape) aNS;
+ if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ TopoDS_Shape aShape = aNS->Get();
+ if (!aShape.IsNull()) {
+ if (aShape.ShapeType() == TopAbs_COMPOUND) {
+ // restore the sketch planar edges object
+ std::shared_ptr<GeomAPI_PlanarEdges> aBigWire(new GeomAPI_PlanarEdges);
+ aBigWire->setImpl<TopoDS_Shape>(new TopoDS_Shape(aShape));
+ FeaturePtr aSketch =
+ document()->feature(std::dynamic_pointer_cast<ModelAPI_Result>(data()->owner()));
+ std::shared_ptr<GeomDataAPI_Point> anOrigin =
+ std::dynamic_pointer_cast<GeomDataAPI_Point>(aSketch->data()->attribute("Origin"));
+ std::shared_ptr<GeomDataAPI_Dir> aDirX =
+ std::dynamic_pointer_cast<GeomDataAPI_Dir>(aSketch->data()->attribute("DirX"));
+ std::shared_ptr<GeomDataAPI_Dir> aNorm =
+ std::dynamic_pointer_cast<GeomDataAPI_Dir>(aSketch->data()->attribute("Norm"));
+ if (anOrigin.get() && aDirX.get() && aNorm.get()) {
+ aBigWire->setPlane(anOrigin->pnt(), aDirX->dir(), aNorm->dir());
+ myShape = aBigWire;
+ return true;
+ }
}
+ // just restore shape
+ GeomShapePtr aGShape(new GeomAPI_Shape);
+ aGShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(aShape));
+ myShape = GeomAPI_Tools::getTypedShape(aGShape); // restore the sketch sub-components
+ return true;
}
}
}
- return int(myFaces.size());
+ return false;
}
-std::shared_ptr<GeomAPI_Face> Model_ResultConstruction::face(const int theIndex)
+Model_ResultConstruction::Model_ResultConstruction()
{
- return myFaces[theIndex];
}
-bool Model_ResultConstruction::isInfinite()
+bool Model_ResultConstruction::isInHistory()
{
- return myIsInfinite;
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+ if (aData.get() && aData->isValid()) {
+ return !aData->label().IsAttribute(kIS_IN_HISTORY); // by default no attribute, but in history
+ }
+ return true; // unknown case
}
-void Model_ResultConstruction::setInfinite(const bool theInfinite)
+void Model_ResultConstruction::setIsInHistory(const bool isInHistory)
{
- myIsInfinite = theInfinite;
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+ if (aData.get() && aData->isValid()) {
+ if (!isInHistory)
+ TDataStd_UAttribute::Set(aData->label(), kIS_IN_HISTORY);
+ else
+ aData->label().ForgetAttribute(kIS_IN_HISTORY);
+ }
}
-void Model_ResultConstruction::setIsConcealed(const bool theValue)
+bool Model_ResultConstruction::isInfinite()
{
- // do nothing: the construction element is never concealed
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+ if (aData.get() && aData->isValid()) {
+ return aData->label().IsAttribute(kIS_INFINITE);
+ }
+ return false; // unknown case
}
-static const int kSTART_VERTEX_DELTA = 1000000;
-
-static void registerSubShape(TDF_Label theMainLabel, TopoDS_Shape theShape, std::string theFullName,
- const int theID, std::shared_ptr<Model_Document> theDoc,
- bool theSelectionMode)
+void Model_ResultConstruction::setInfinite(const bool theInfinite)
{
- TDF_Label aLab = theID == 0 ? theMainLabel : theMainLabel.FindChild(theID);
- TNaming_Builder aBuilder(aLab);
- // wire never happens as sub, it must be generated to be found
- // by SelectionNaming TNaming_Tool::NamedShape
- if (theSelectionMode && theShape.ShapeType() != TopAbs_WIRE)
- aBuilder.Select(theShape, theShape);
- else
- aBuilder.Generated(theShape);
-
- theDoc->addNamingName(aLab, theFullName);
- TDataStd_Name::Set(aLab, theFullName.c_str());
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+ if (aData.get() && aData->isValid()) {
+ if (theInfinite)
+ TDataStd_UAttribute::Set(aData->label(), kIS_INFINITE);
+ else
+ aData->label().ForgetAttribute(kIS_INFINITE);
+ }
}
-#include <TopTools_OrientedShapeMapHasher.hxx>
-
-// generates a full-name for sub-element of the composite feature (sketch)
-std::string fullName(CompositeFeaturePtr theComposite, const TopoDS_Shape& theSubShape,
- Handle(TDataStd_IntPackedMap) theRefs = Handle(TDataStd_IntPackedMap)())
+int Model_ResultConstruction::facesNum(const bool theUpdateNaming)
{
- TopAbs_ShapeEnum aShapeType = theSubShape.ShapeType();
- gp_Pnt aVertexPos;
- NCollection_Map<TopoDS_Edge> allExactEdges;
- NCollection_DataMap<TopoDS_Edge, TopoDS_Edge, Model_EdgesHasher> allEdges;
- NCollection_DataMap<Handle(Geom_Curve), TopoDS_Edge, Model_CurvesHasher> allCurves;
- /// map from edges from theSubShape to the found corresponded indices of the sub-components
- NCollection_DataMap<TopoDS_Edge, NCollection_List<int>, TopTools_OrientedShapeMapHasher>
- anEdgesCorrespondence;
- if (aShapeType == TopAbs_VERTEX) { // compare positions
- aVertexPos = BRep_Tool::Pnt(TopoDS::Vertex(theSubShape));
- } else {
- for(TopExp_Explorer anEdgeExp(theSubShape, TopAbs_EDGE); anEdgeExp.More(); anEdgeExp.Next()) {
- TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExp.Current());
- allExactEdges.Add(anEdge);
- allEdges.Bind(anEdge, anEdge);
- Standard_Real aFirst, aLast;
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
- allCurves.Bind(aCurve, anEdge);
- anEdgesCorrespondence.Bind(anEdge, NCollection_List<int>());
- }
- }
- std::map<int, int> anOrientations; //map from edges IDs to orientations of these edges in face
- std::map<int, std::string> aSubNames; //map from edges IDs to names of edges
- TColStd_PackedMapOfInteger aRefs; // indixes of sub-elements in composite
-
-
- const int aSubNum = theComposite->numberOfSubs();
- for(int a = 0; a < aSubNum; a++) {
- FeaturePtr aSub = theComposite->subFeature(a);
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
- // there may be many shapes (circle and center): register if at least one is in selection
- for(; aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
- if (!aConstr->shape()) {
- continue;
- }
- if (aShapeType == TopAbs_VERTEX) {
- if (aConstr->shape()->isVertex()) { // compare vertices positions
- const TopoDS_Shape& aVertex = aConstr->shape()->impl<TopoDS_Shape>();
- gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aVertex));
- if (aPnt.IsEqual(aVertexPos, Precision::Confusion())) {
- aRefs.Add(theComposite->subFeatureId(a));
- aSubNames[theComposite->subFeatureId(a)] = Model_SelectionNaming::shortName(aConstr);
- }
- } else { // get first or last vertex of the edge: last is stored with additional delta
- const TopoDS_Shape& anEdge = aConstr->shape()->impl<TopoDS_Shape>();
- int aDelta = kSTART_VERTEX_DELTA;
- for(TopExp_Explorer aVExp(anEdge, TopAbs_VERTEX); aVExp.More(); aVExp.Next()) {
- gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aVExp.Current()));
- if (aPnt.IsEqual(aVertexPos, Precision::Confusion())) {
- aRefs.Add(aDelta + theComposite->subFeatureId(a));
- aSubNames[aDelta + theComposite->subFeatureId(a)] =
- Model_SelectionNaming::shortName(aConstr, aDelta / kSTART_VERTEX_DELTA);
- break;
- }
- aDelta += kSTART_VERTEX_DELTA;
- }
- }
- } else {
- if (aConstr->shape()->isEdge()) {
- const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
- TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
- if (anEdge.IsNull())
- continue;
- if (allEdges.IsBound(anEdge)) {
- anEdgesCorrespondence.ChangeFind(allEdges.Find(anEdge)).Append(a);
- } else {
- Standard_Real aFirst, aLast;
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
- if (allCurves.IsBound(aCurve)) {
- anEdgesCorrespondence.ChangeFind(allCurves.Find(aCurve)).Append(a);
- }
- }
- }
- }
- }
- }
-
- if (aShapeType != TopAbs_VERTEX) { // get best candidates from the correspondances
- NCollection_DataMap<TopoDS_Edge, NCollection_List<int>, TopTools_OrientedShapeMapHasher>
- ::Iterator aCorIter(anEdgesCorrespondence);
- for(; aCorIter.More(); aCorIter.Next()) {
- TopoDS_Edge anOrig = aCorIter.Key();
- NCollection_List<int>::Iterator aCandidate(aCorIter.Value());
- int aBestScore = 0;
- int aBestIndex = -1;
- ResultConstructionPtr aBestConstr;
- for(; aCandidate.More(); aCandidate.Next()) {
- FeaturePtr aSub = theComposite->subFeature(aCandidate.Value());
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
- // there may be many shapes (circle and center): register if at least one is in selection
- for(; aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
- if (!aConstr->shape() || !aConstr->shape()->isEdge())
- continue;
- const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
- TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
- if (anEdge.IsNull())
- continue;
- // detect score of the candidate
- int aScore = 0;
- if (anEdge.IsEqual(anOrig))
- aScore = 10;
- else if (anEdge.IsSame(anOrig))
- aScore = 9;
- else {
- Standard_Real aFirst, aLast;
- Handle(Geom_Curve) anOrigCurve = BRep_Tool::Curve(anOrig, aFirst, aLast);
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
- if (anOrigCurve == aCurve) {
- if (Model_EdgesHasher::IsEqual(anEdge, anOrig)) {
- aScore = 8;
- } else {
- aScore = 6;
- }
- } else {
- if (Model_EdgesHasher::IsEqual(anEdge, anOrig)) {
- aScore = 7;
- } else if (Model_CurvesHasher::IsEqual(aCurve, anOrigCurve)) {
- aScore = 5;
- }
- }
- }
- if (aScore > aBestScore) {
- aBestIndex = aCandidate.Value();
- aBestScore = aScore;
- aBestConstr = aConstr;
- }
- }
- }
- if (aBestIndex >= 0) {
- int anID = theComposite->subFeatureId(aBestIndex);
- aRefs.Add(anID);
- aSubNames[anID] = Model_SelectionNaming::shortName(aBestConstr);
- if (aShapeType != TopAbs_EDGE) { // face needs the sub-edges on sub-labels
- // add edges to sub-label to support naming for edges selection
- int anOrient = Model_SelectionNaming::edgeOrientation(theSubShape, anOrig);
- anOrientations[anID] = anOrient;
- }
- }
- }
- }
- std::stringstream aName;
- // #1839 : do not store name of the feature in the tree, since this name could be changed
- if (theSubShape.ShapeType() != TopAbs_COMPOUND) { // compound means the whole construction result
- if (theSubShape.ShapeType() == TopAbs_FACE) aName<<"Face";
- else if (theSubShape.ShapeType() == TopAbs_WIRE) aName<<"Wire";
- else if (theSubShape.ShapeType() == TopAbs_EDGE) aName<<"Edge";
- else if (theSubShape.ShapeType() == TopAbs_VERTEX) aName<<"Vertex";
-
- // make a composite name from all sub-elements indexes: "1_2_3_4"
- TColStd_MapIteratorOfPackedMapOfInteger aRef(aRefs);
- for(; aRef.More(); aRef.Next()) {
- aName<<"-"<<aSubNames[aRef.Key()];
- if (anOrientations.find(aRef.Key()) != anOrientations.end()) {
- if (anOrientations[aRef.Key()] == 1)
- aName<<"f";
- else if (anOrientations[aRef.Key()] == -1)
- aName<<"r";
- }
+ int aResult = 0;
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+ if (aData.get() && aData->isValid()) {
+ TDF_Label aShapeLab = aData->shapeLab();
+ TDF_ChildIDIterator anOldIter(aShapeLab, TDataStd_IntPackedMap::GetID());
+ for (; anOldIter.More(); anOldIter.Next()) {
+ aResult++;
}
}
- if (!theRefs.IsNull()) {
- Handle(TColStd_HPackedMapOfInteger) aMap = new TColStd_HPackedMapOfInteger(aRefs);
- theRefs->ChangeMap(aMap);
- }
- return aName.str();
+ return aResult;
}
-// stores shape and name on sub-label of the main stored shape
-static void saveSubName(CompositeFeaturePtr theComposite,
- TDF_Label& theLab, const bool isSelectionMode, TopoDS_Shape aSub,
- std::shared_ptr<Model_Document> theDoc, std::string theFullName)
+std::shared_ptr<GeomAPI_Face> Model_ResultConstruction::face(const int theIndex)
{
- // trying to store the edge of composite result, not sketch sub as it is
- if (aSub.ShapeType() == TopAbs_EDGE) {
- ResultPtr aRes = theComposite->firstResult();
- ResultConstructionPtr aConstr = std::dynamic_pointer_cast<Model_ResultConstruction>(aRes);
- if (aConstr.get()) {
- Standard_Real aSubFirst, aSubLast;
- TopoDS_Edge aSubEdge = TopoDS::Edge(aSub);
- Handle(Geom_Curve) aSubCurve = BRep_Tool::Curve(aSubEdge, aSubFirst, aSubLast);
- for(int aFaceIndex = 0; aFaceIndex < aConstr->facesNum(); aFaceIndex++) {
- GeomShapePtr aGFace = aConstr->face(aFaceIndex);
- TopoDS_Shape aFace = aGFace->impl<TopoDS_Shape>();
- for(TopExp_Explorer anExp(aFace, TopAbs_EDGE); anExp.More(); anExp.Next()) {
- TopoDS_Edge anEdge = TopoDS::Edge(anExp.Current());
- Standard_Real aFirst, aLast;
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
- if (Model_CurvesHasher::IsEqual(aCurve, aSubCurve) &&
- ((fabs(aFirst - aSubFirst) < 1.e-9 && fabs(aLast - aSubLast) < 1.e-9)) ||
- (fabs(aFirst - aSubLast) < 1.e-9 && fabs(aLast - aSubFirst) < 1.e-9)) {
- aSub = anEdge;
- break;
- }
- }
+ std::shared_ptr<GeomAPI_Face> aResult;
+ int anIndex = 0;
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+ if (aData.get() && aData->isValid()) {
+ TDF_Label aShapeLab = aData->shapeLab();
+ TDF_ChildIDIterator anOldIter(aShapeLab, TDataStd_IntPackedMap::GetID());
+ for (; anOldIter.More(); anOldIter.Next()) {
+ if (anIndex == theIndex) {
+ Handle(TNaming_NamedShape) aNS;
+ anOldIter.Value()->Label().FindAttribute(TNaming_NamedShape::GetID(), aNS);
+ aResult.reset(new GeomAPI_Face);
+ aResult->setImpl(new TopoDS_Shape(aNS->Get()));
+ break;
}
+ anIndex++;
}
}
-
- TNaming_Builder aBuilder(theLab);
- if (isSelectionMode)
- aBuilder.Select(aSub, aSub);
- else
- aBuilder.Generated(aSub);
- theDoc->addNamingName(theLab, theFullName.c_str());
- TDataStd_Name::Set(theLab, theFullName.c_str());
+ return aResult;
}
-
-TDF_Label Model_ResultConstruction::startLabel(
- const std::shared_ptr<ModelAPI_Document> theExtDoc, bool& theExternal)
+void Model_ResultConstruction::setIsConcealed(const bool theValue)
{
- theExternal = theExtDoc.get() && theExtDoc != document();
- if (theExternal) { // external document is used
- std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(theExtDoc);
- return aDoc->extConstructionsLabel();
- }
- std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
- return aData->label();
+ // do nothing: the construction element is never concealed
}
-int Model_ResultConstruction::select(const std::shared_ptr<GeomAPI_Shape>& theSubShape,
- const std::shared_ptr<ModelAPI_Document> theExtDoc, const int theIndex)
+void Model_ResultConstruction::storeShape(std::shared_ptr<GeomAPI_Shape> theShape)
{
- int anIndex; // resulting index of the sub-label
- TopoDS_Shape aSubShape;
- if (theSubShape.get()) {
- aSubShape = theSubShape->impl<TopoDS_Shape>();
- } else if (shape().get()) {
- aSubShape = shape()->impl<TopoDS_Shape>();
- }
- // if external document requires this selection, put the naming structures to this doc
- // to support the naming mechanism in this document correctly
- bool anExternal;
- TDF_Label aDataLab = startLabel(theExtDoc, anExternal);
- if (theIndex == -1) {
- anIndex = anExternal ? 2 : 1; // for the external doc don't mind about the main shape
-
- if (theSubShape.get() || anExternal) { // searching for already selected sub (or whole for ext)
- // iterate all the already presented shapes to see the same
- TDF_ChildIterator aSubsIter(aDataLab, Standard_False);
- for(; aSubsIter.More(); aSubsIter.Next()) {
- const TDF_Label aLab = aSubsIter.Value();
- if (aLab.Tag() == 1) // skip the root shape label
- continue;
- Handle(TNaming_NamedShape) aNS;
- if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- if (aNS->Get().IsSame(aSubShape)) {
- return aLab.Tag() - 1; // found exactly the needed shape, nothing else to do
- }
- }
- anIndex = aLab.Tag(); // searching for the latest index
- }
- anIndex = (anIndex == 1) ? 2 : (anIndex + 1); // next after 1-root, or next after all
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+ if (aData && aData->isValid()) {
+ std::string aMyName = data()->name();
+ TDF_Label aShapeLab = aData->shapeLab();
+ if (!theShape.get() || theShape->isNull()) {
+ aShapeLab.ForgetAllAttributes();
+ TDataStd_Name::Set(aShapeLab, aMyName.c_str()); // restore name forgotten
+ return;
}
- } else {
- anIndex = theIndex + 1;
- }
-
- // set the naming structure at index
- TDF_Label aLab = aDataLab.FindChild(anIndex, Standard_True);
-
- // if the subshape is part of a result face, select the whole face (#1997)
- bool isSelectionMode = false; // and other don't set shapes - all the naming is in face label
- if (!aSubShape.IsNull() && aSubShape.ShapeType() > TopAbs_FACE) {
- // but before check that sub-vertex correctly detected as intersection of sketch edges (#2389)
- int anEdgesNum = 2;
- if (aSubShape.ShapeType() == TopAbs_VERTEX) {
- anEdgesNum = 0;
+ std::shared_ptr<Model_Document> aMyDoc =
+ std::dynamic_pointer_cast<Model_Document>(document());
+ const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
+ if (isInfinite() || aShape.ShapeType() == TopAbs_VERTEX) {
+ aShapeLab.ForgetAllAttributes(); // clear all previously stored
+ TNaming_Builder aBuilder(aShapeLab);
+ aBuilder.Generated(aShape);
+ TDataStd_Name::Set(aShapeLab, aMyName.c_str());
+ aMyDoc->addNamingName(aShapeLab, aMyName);
+ } else if (aShape.ShapeType() == TopAbs_EDGE) { // store sub-vertices on sub-labels
+ aShapeLab.ForgetAllAttributes(); // clear all previously stored
+ TNaming_Builder aBuilder(aShapeLab);
+ aBuilder.Generated(aShape);
+
+ TopExp_Explorer anExp(aShape, TopAbs_VERTEX);
+ for(int anIndex = 1; anExp.More(); anExp.Next(), anIndex++) {
+ TDF_Label aSubLab = aShapeLab.FindChild(anIndex);
+ TNaming_Builder aBuilder(aSubLab);
+ aBuilder.Generated(anExp.Current());
+ std::string aVertexName = aMyName + "_" + (anIndex == 1 ? "StartVertex" : "EndVertex");
+ TDataStd_Name::Set(aSubLab, aVertexName.c_str());
+ aMyDoc->addNamingName(aSubLab, aVertexName);
+ }
+ TDataStd_Name::Set(aShapeLab, aMyName.c_str());
+ aMyDoc->addNamingName(aShapeLab, aMyName);
+ } else { // this is probably sketch, so, work with it as with composite
+ std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr =
+ std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(theShape);
+ if (!aWirePtr.get())
+ return; // unknown case
ResultPtr aThisPtr = std::dynamic_pointer_cast<ModelAPI_Result>(data()->owner());
- FeaturePtr aThisFeature = document()->feature(aThisPtr);
+ FeaturePtr aThisFeature = aMyDoc->feature(aThisPtr);
CompositeFeaturePtr aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aThisFeature);
- if (aComposite.get()) {
- const int aSubNum = aComposite->numberOfSubs();
- for(int a = 0; a < aSubNum; a++) {
- int aSubID = aComposite->subFeatureId(a);
- FeaturePtr aSub = aComposite->subFeature(a);
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
- for(aRes = aResults.cbegin(); aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
- if (aConstr->shape() && aConstr->shape()->isEdge()) {
- TopoDS_Shape aResShape = aConstr->shape()->impl<TopoDS_Shape>();
- for(TopExp_Explorer anExp(aResShape, TopAbs_VERTEX); anExp.More(); anExp.Next()) {
- if (aSubShape.IsSame(anExp.Current())) {
- anEdgesNum++;
- break;
- }
- }
- }
- }
- }
- }
- }
- if (anEdgesNum > 1) {
- for(int aFaceIndex = 0; aFaceIndex < facesNum(); aFaceIndex++) {
- TopExp_Explorer anExp(face(aFaceIndex)->impl<TopoDS_Shape>(), aSubShape.ShapeType());
- for(; anExp.More(); anExp.Next()) {
- if (aSubShape.IsSame(anExp.Current())) { // this is the case: select the whole face
- // here just store the face index (to update face if update of edge is needed)
- TNaming_Builder aBuilder(aLab);
- aBuilder.Select(aSubShape, aSubShape);
- int aFaceSelID = select(face(aFaceIndex), theExtDoc, -1);
- TDF_Reference::Set(aLab, aLab.Father().FindChild(aFaceSelID));
- isSelectionMode = true;
- break;
+ if (!aComposite || aComposite->numberOfSubs() == 0)
+ return; // unknown case
+ // collect indices of curves of current composite
+ NCollection_DataMap<Handle(Geom_Curve), int> aCurvesIndices;
+ NCollection_DataMap<int, TopoDS_Edge> anEdgeIndices;
+ std::map<int, std::string> aComponentsNames; // names of components that lay on index
+ const int aSubNum = aComposite->numberOfSubs();
+ for (int a = 0; a < aSubNum; a++) {
+ FeaturePtr aSub = aComposite->subFeature(a);
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
+ for (; aRes != aResults.cend(); aRes++) {
+ ResultConstructionPtr aConstr =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
+ if (aConstr->shape() && aConstr->shape()->isEdge()) {
+ TopoDS_Edge anEdge = TopoDS::Edge(aConstr->shape()->impl<TopoDS_Shape>());
+ Standard_Real aFirst, aLast;
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
+ aCurvesIndices.Bind(aCurve, a);
+ anEdgeIndices.Bind(a, anEdge);
+ aComponentsNames[a] = shortName(aConstr);
}
}
}
- }
- }
-
- // external full result is not identified by index == 0, so, add here the ID
- if (!theSubShape.get()) {
- TDataStd_UAttribute::Set(aLab, kFULL_RESULT_ID);
- // empty NS
- TNaming_Builder aBuilder(aLab);
- // store all sub-faces naming since faces may be used for extrusion, where all edges are needed
- Handle(TDataStd_IntPackedMap) anIndices = TDataStd_IntPackedMap::Set(aLab);
- std::list<int> aFacesIndexes;
- for(int a = 0; a < facesNum(); a++) {
- anIndices->Add(select(face(a), theExtDoc, -1));
- }
- return anIndex - 1;
- }
-
- { // this to have erased Builder after the shape was generated (NS on this label may be changed)
- TNaming_Builder aBuilder(aLab);
- if (aSubShape.IsNull()) {
- return anIndex - 1; // just keep empty named shape
- }
- // wire never happens as sub, it must be generated to be found
- // by SelectionNaming TNaming_Tool::NamedShape
- if (isSelectionMode && aSubShape.ShapeType() != TopAbs_WIRE) {
- aBuilder.Select(aSubShape, aSubShape);
- } else {
- aBuilder.Generated(aSubShape);
- }
- }
-
- if (anIndex == 1 && isInfinite()) { // infinitive results has no sub-selection
- return anIndex - 1;
- }
- ResultPtr aThisPtr = std::dynamic_pointer_cast<ModelAPI_Result>(data()->owner());
- FeaturePtr aThisFeature = document()->feature(aThisPtr);
- CompositeFeaturePtr aComposite =
- std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aThisFeature);
- if (!aComposite || aComposite->numberOfSubs() == 0) {
- // saving of context is enough: result construction contains exactly the needed shape
- return anIndex - 1;
- }
-
- // identify the results of sub-object of the composite by edges
- // save type of the selected shape in integer attribute
- TopAbs_ShapeEnum aShapeType = aSubShape.ShapeType();
- TDataStd_Integer::Set(aLab, (int)aShapeType);
- gp_Pnt aVertexPos;
- // curves of the sketch sub-elements are used, so, edges are not equal
- TColStd_MapOfTransient allCurves;
- if (aShapeType == TopAbs_VERTEX) { // compare positions
- aVertexPos = BRep_Tool::Pnt(TopoDS::Vertex(aSubShape));
- } else {
- for(TopExp_Explorer anEdgeExp(aSubShape, TopAbs_EDGE); anEdgeExp.More(); anEdgeExp.Next()) {
- TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExp.Current());
- Standard_Real aFirst, aLast;
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
- allCurves.Add(aCurve);
- }
- }
- std::shared_ptr<Model_Document> aMyDoc =
- std::dynamic_pointer_cast<Model_Document>(document());
- // iterate and store the result ids of sub-elements and sub-elements to sub-labels
- Handle(TDataStd_IntPackedMap) aRefs = TDataStd_IntPackedMap::Set(aLab);
- const int aSubNum = aComposite->numberOfSubs();
- // subs are placed on unique labels because of #2248: sketch curve may produce several edges,
- // but #2401 - on stable labels
- NCollection_Map<int> aUsedIDMap; // already used lab tags for placement of shapes
- for(int a = 0; a < aSubNum; a++) {
- FeaturePtr aSub = aComposite->subFeature(a);
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
- // there may be many shapes (circle and center): register if at least one is in selection
- for(; aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
- if (!aConstr->shape()) {
- continue;
- }
- if (aShapeType != TopAbs_VERTEX) {
- if (aConstr->shape()->isEdge()) {
- const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
- TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
- if (!anEdge.IsNull()) {
+ std::list<std::shared_ptr<GeomAPI_Shape> > aFaces;
+ GeomAlgoAPI_SketchBuilder::createFaces(aWirePtr->origin(), aWirePtr->dirX(),
+ aWirePtr->norm(), aWirePtr, aFaces);
+ // order is important to store faces in the same order if sketch is created from scratch
+ NCollection_IndexedDataMap<TopoDS_Face, TColStd_ListOfInteger> aNewIndices; // edges indices
+ std::list<std::shared_ptr<GeomAPI_Shape> >::iterator aFIter = aFaces.begin();
+ for (; aFIter != aFaces.end(); aFIter++) {
+ std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(*aFIter));
+ // put them to a label, trying to keep the same faces on the same labels
+ if (aFace.get() && !aFace->isNull()) {
+ TopoDS_Face aTopoFace = TopoDS::Face(aFace->impl<TopoDS_Shape>());
+ aNewIndices.Add(aTopoFace, TColStd_ListOfInteger());
+ // keep new indices of sub-elements used in this face
+ for (TopExp_Explorer anEdges(aTopoFace, TopAbs_EDGE); anEdges.More(); anEdges.Next()) {
+ TopoDS_Edge anEdge = TopoDS::Edge(anEdges.Current());
Standard_Real aFirst, aLast;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
- if (allCurves.Contains(aCurve)) {
- int anID = aComposite->subFeatureId(a);
- if (aShapeType != TopAbs_EDGE) { // face needs the sub-edges on sub-labels
- // add edges to sub-label to support naming for edges selection
- TopExp_Explorer anEdgeExp(aSubShape, TopAbs_EDGE);
- for(; anEdgeExp.More(); anEdgeExp.Next()) {
- TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExp.Current());
- Standard_Real aFirst, aLast;
- Handle(Geom_Curve) aFaceCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
- if (Model_CurvesHasher::IsEqual(aFaceCurve, aCurve)) {
- while(aUsedIDMap.Contains(anID))
- anID += 100000;
- aUsedIDMap.Add(anID);
- TDF_Label aSubLab = aLab.FindChild(anID);
- std::string aFullNameSub = fullName(aComposite, anEdge);
- saveSubName(aComposite, aSubLab, isSelectionMode, anEdge, aMyDoc, aFullNameSub);
-
- int anOrient = Model_SelectionNaming::edgeOrientation(aSubShape, anEdge);
- if (anOrient != 0) {
- // store the orientation of edge relatively to face if needed
- TDataStd_Integer::Set(aSubLab, anOrient);
- }
- }
- }
- } else { // put vertices of the selected edge to sub-labels
- // add edges to sub-label to support naming for edges selection
- for(TopExp_Explorer anEdgeExp(aSubShape, TopAbs_VERTEX);
- anEdgeExp.More(); anEdgeExp.Next()) {
- TopoDS_Vertex aV = TopoDS::Vertex(anEdgeExp.Current());
- while(aUsedIDMap.Contains(anID))
- anID += 100000;
- aUsedIDMap.Add(anID);
- TDF_Label aSubLab = aLab.FindChild(anID);
- std::string aFullNameSub = fullName(aComposite, aV);
- saveSubName(aComposite, aSubLab, isSelectionMode, aV, aMyDoc, aFullNameSub);
- }
- }
+ if (aCurvesIndices.IsBound(aCurve)) {
+ int anIndex = aCurvesIndices.Find(aCurve);
+ if ((aFirst > aLast) != (anEdge.Orientation() == TopAbs_REVERSED))
+ anIndex = -anIndex;
+ aNewIndices.ChangeFromKey(aTopoFace).Append(anIndex);
}
}
}
}
- }
- }
- std::string aFullName = fullName(aComposite, aSubShape, aRefs);
- // store the selected as primitive
- registerSubShape(aLab, aSubShape, aFullName, 0, aMyDoc, isSelectionMode);
- return anIndex - 1;
-}
-
-std::shared_ptr<GeomAPI_Shape> Model_ResultConstruction::shape(const int theIndex,
- const std::shared_ptr<ModelAPI_Document> theExtDoc)
-{
- std::shared_ptr<GeomAPI_Shape> aResult;
- if (theIndex == 0)
- return aResult; // the whole shape, so, NULL
-
- bool isExt;
- TDF_Label aLab = startLabel(theExtDoc, isExt).FindChild(theIndex + 1);
- if (!aLab.IsNull()) { // index is not bad
- Handle(TNaming_NamedShape) aSelection;
- if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aSelection)) {
- TopoDS_Shape aSelShape = aSelection->Get();
- if (aSelShape.IsNull())
- return aResult; // shape equal to context => null
- aResult = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape);
- aResult->setImpl(new TopoDS_Shape(aSelShape));
- }
- }
-
- return aResult;
-}
-
-bool Model_ResultConstruction::update(const int theIndex,
- const std::shared_ptr<ModelAPI_Document> theExtDoc, bool& theModified)
-{
- theModified = false;
- bool anExt;
- TDF_Label aLab = startLabel(theExtDoc, anExt).FindChild(theIndex + 1, Standard_True);
- if (theIndex == 0 || aLab.IsAttribute(kFULL_RESULT_ID)) { // full for external same as index == 0
- // it is just reference to construction, not sub-shape
- // if there is a sketch, the sketch-naming must be updated
- if (!isInfinite()) {
- // update all faces named by the whole result
- bool aRes = true;
- Handle(TDataStd_IntPackedMap) anIndices;
- if (aLab.FindAttribute(TDataStd_IntPackedMap::GetID(), anIndices)) {
- NCollection_Map<TopoDS_Shape> aFaces; // collect faces, updated in the tree
- TColStd_MapIteratorOfPackedMapOfInteger anIndexIter(anIndices->GetMap());
- Handle(TColStd_HPackedMapOfInteger) aNewPackedMap =
- new TColStd_HPackedMapOfInteger; // with only faces that are ok
- // iterate to find existing faces, updated
- for(; anIndexIter.More(); anIndexIter.Next()) {
- if (update(anIndexIter.Key(), theExtDoc, theModified)) {
- GeomShapePtr aFace = shape(anIndexIter.Key(), theExtDoc);
- if (!aFaces.Contains(aFace->impl<TopoDS_Shape>())) {
- aNewPackedMap->ChangeMap().Add(anIndexIter.Key());
- aFaces.Add(aFace->impl<TopoDS_Shape>());
+ NCollection_DataMap<int, TopoDS_Face> aFacesOrder; // faces -> tag where they must be set
+ NCollection_List<TopoDS_Face> anUnorderedFaces; // faces that may be located at any index
+ // searching for the best new candidate to old location
+ NCollection_IndexedDataMap<TopoDS_Face, TColStd_ListOfInteger>::Iterator
+ aNewIter(aNewIndices);
+ for (; aNewIter.More(); aNewIter.Next()) {
+ double aBestFound = 0, aBestNotFound = 1.e+100;
+ int aBestTag = 0;
+ const TColStd_ListOfInteger& aNewInd = aNewIter.Value();
+ // old faces indices where they where located
+ TDF_ChildIDIterator anOldIter(aShapeLab, TDataStd_IntPackedMap::GetID());
+ for (; anOldIter.More(); anOldIter.Next()) {
+ int aTag = anOldIter.Value()->Label().Tag();
+ if (aFacesOrder.IsBound(aTag))
+ continue; // already found a best candidate
+ Handle(TDataStd_IntPackedMap) anOldIndices =
+ Handle(TDataStd_IntPackedMap)::DownCast(anOldIter.Value());
+ double aFound = 0, aNotFound = 0;
+ TColStd_ListOfInteger::Iterator aNewIndIter(aNewInd);
+ for (; aNewIndIter.More(); aNewIndIter.Next()) {
+ if (anOldIndices->Contains(aNewIndIter.Value())) {
+ aFound += 1.;
+ }
+ else if (anOldIndices->Contains(-aNewIndIter.Value())) { // different orientation
+ aFound += 0.001;
+ }
+ else {
+ aNotFound += 1.;
}
}
- }
- // then iterate all existing faces to find new faces
- int aCurrentFacesNum = facesNum();
- for(int a = 0; a < aCurrentFacesNum; a++) {
- GeomShapePtr aFace = face(a);
- if (!aFaces.Contains(aFace->impl<TopoDS_Shape>())) {
- // add this one
- int aNewFaceIndex = select(aFace, theExtDoc, -1);
- if (aNewFaceIndex > 0) {
- aNewPackedMap->ChangeMap().Add(aNewFaceIndex);
+ if (aNotFound < aBestNotFound) {
+ if (aFound > aBestFound) {
+ aBestNotFound = aNotFound;
+ aBestFound = aFound;
+ aBestTag = aTag;
}
}
}
- anIndices->ChangeMap(aNewPackedMap);
- }
- return aRes;
- } else {
- // check is this modified or not
- std::shared_ptr<GeomAPI_Shape> aNewShape = shape();
- TopoDS_Shape anOldSh;
- Handle(TNaming_NamedShape) aNS;
- if (aLab.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- anOldSh = aNS->Get();
- }
- if (aNewShape.get()) {
- if (anOldSh.IsNull())
- theModified = true;
- else {
- std::shared_ptr<GeomAPI_Shape> anOldShape(new GeomAPI_Shape);
- anOldShape->setImpl<TopoDS_Shape>(new TopoDS_Shape(anOldSh));
- theModified = !anOldShape->isEqual(aNewShape);
+ if (aBestTag != 0) { // found an appropriate face
+ aFacesOrder.Bind(aBestTag, aNewIter.Key());
+ } else {
+ anUnorderedFaces.Append(aNewIter.Key());
}
}
- else if (!anOldSh.IsNull()) {
- theModified = true;
- }
-
- // For correct naming selection, put the shape into the naming structure.
- // It seems sub-shapes are not needed: only this shape is (and can be ) selected.
- TNaming_Builder aBuilder(aLab);
- aBuilder.Generated(aNewShape->impl<TopoDS_Shape>());
- }
- return shape() && !shape()->isNull();
- }
- // construction: identification by the results indexes, recompute faces and
- // take the face that more close by the indexes
- ResultPtr aThisPtr = std::dynamic_pointer_cast<ModelAPI_Result>(data()->owner());
- FeaturePtr aContextFeature = document()->feature(aThisPtr);
+ aShapeLab.ForgetAllAttributes(); // clear all previously stored
+ TDataStd_Name::Set(aShapeLab, aMyName.c_str()); // restore name forgotten
+ TNaming_Builder aBuilder(aShapeLab); // store the compound to get it ready on open of document
+ aBuilder.Generated(aShape);
+ aMyDoc->addNamingName(aShapeLab, aMyName);
+ // set new faces to the labels
+ int aCurrentTag = 1;
+ NCollection_List<TopoDS_Face>::Iterator anUnordered(anUnorderedFaces);
+ for(int aCurrentTag = 1; !aFacesOrder.IsEmpty() || anUnordered.More(); aCurrentTag++) {
+ TopoDS_Face aFaceToPut;
+ if (aFacesOrder.IsBound(aCurrentTag)) {
+ aFaceToPut = aFacesOrder.Find(aCurrentTag);
+ aFacesOrder.UnBind(aCurrentTag);
+ } else if (anUnordered.More()){
+ aFaceToPut = anUnordered.Value();
+ anUnordered.Next();
+ }
- // sketch sub-element
- if (std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aContextFeature).get())
- {
- // update the referenced object if it is sub
- Handle(TDF_Reference) aRef;
- if (aLab.FindAttribute(TDF_Reference::GetID(), aRef)) {
- int aFaceIndex = aRef->Get().Tag();
- // don't check selection since face may disappear, but the shape stays correct
- Model_ResultConstruction::update(aFaceIndex, theExtDoc, theModified);
- }
- // getting a type of selected shape
- Handle(TDataStd_Integer) aTypeAttr;
- if (!aLab.FindAttribute(TDataStd_Integer::GetID(), aTypeAttr)) {
- return false;
- }
- TopAbs_ShapeEnum aShapeType = (TopAbs_ShapeEnum)(aTypeAttr->Get());
- // selected indexes will be needed in each "if"
- Handle(TDataStd_IntPackedMap) aSubIds;
- std::shared_ptr<GeomAPI_Shape> aNewSelected;
- bool aNoIndexes =
- !aLab.FindAttribute(TDataStd_IntPackedMap::GetID(), aSubIds) || aSubIds->Extent() == 0;
- // for now working only with composite features
- CompositeFeaturePtr aComposite =
- std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aContextFeature);
- if (!aComposite.get() || aComposite->numberOfSubs() == 0) {
- return false;
- }
+ if (!aFaceToPut.IsNull()) {
+ TopTools_MapOfShape aFaceEdges;
+ for(TopExp_Explorer anEdges(aFaceToPut, TopAbs_EDGE); anEdges.More(); anEdges.Next()) {
+ aFaceEdges.Add(anEdges.Current());
+ }
- if (aShapeType == TopAbs_FACE || aShapeType == TopAbs_WIRE) {
- // compound is for the whole sketch selection
- // If this is a wire with plane defined then it is a sketch-like object
- if (!facesNum()) // no faces, update can not work correctly
- return false;
- // if there is no edges indexes, any face can be used: take the first
- std::shared_ptr<GeomAPI_Shape> aNewSelected;
- if (aNoIndexes) {
- aNewSelected = face(0);
- } else { // searching for most looks-like initial face by the indexes
- // prepare edges of the current result for the fast searching
- // curves and orientations of edges
- NCollection_DataMap<Handle(Geom_Curve), int, Model_CurvesHasher> allCurves;
- const int aSubNum = aComposite->numberOfSubs();
- for(int a = 0; a < aSubNum; a++) {
- int aSubID = aComposite->subFeatureId(a);
- if (aSubIds->Contains(aSubID)) {
- FeaturePtr aSub = aComposite->subFeature(a);
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
- for(aRes = aResults.cbegin(); aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
- if (aConstr->shape() && aConstr->shape()->isEdge()) {
- const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
- TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
- if (!anEdge.IsNull()) {
- Standard_Real aFirst, aLast;
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
- // searching for orientation information
- int anOrient = 0;
- Handle(TDataStd_Integer) anInt;
- if (aLab.FindChild(aSubID).FindAttribute(TDataStd_Integer::GetID(), anInt)) {
- anOrient = anInt->Get();
- }
- allCurves.Bind(aCurve, anOrient);
- }
+ TDF_Label aLab = aShapeLab.FindChild(aCurrentTag);
+ TNaming_Builder aFaceBuilder(aLab);
+ aFaceBuilder.Generated(aFaceToPut);
+ // store also indices of the new face edges
+ Handle(TDataStd_IntPackedMap) aNewMap = TDataStd_IntPackedMap::Set(aLab);
+ const TColStd_ListOfInteger& aNewInd = aNewIndices.FindFromKey(aFaceToPut);
+ std::stringstream aName;
+ aName<<"Face";
+ TopExp_Explorer aPutEdges(aFaceToPut, TopAbs_EDGE);
+ TNaming_Builder *anEdgesBuilder = 0, *aVerticesBuilder = 0;
+ for(TColStd_ListOfInteger::Iterator anIter(aNewInd); anIter.More(); anIter.Next()) {
+ int anIndex = anIter.Value();
+ int aModIndex = anIndex > 0 ? anIndex : -anIndex;
+ aNewMap->Add(anIndex);
+ aName<<"-"<<aComponentsNames[aModIndex];
+ if (anIter.Value() > 0)
+ aName<<"f";
+ else
+ aName<<"r";
+ // collect all edges of the face which are modified in sub-label of the face
+ if (anEdgeIndices.IsBound(aModIndex) &&
+ !aFaceEdges.Contains(anEdgeIndices.Find(aModIndex))) {
+ if (!anEdgesBuilder) {
+ TDF_Label anEdgesLabel = aLab.FindChild(1);
+ anEdgesBuilder = new TNaming_Builder(anEdgesLabel);
+ std::ostringstream aSubName;
+ // tag is needed for Test1922 to distinguish sub-edges of different faces
+ aSubName<<"SubEdge_"<<aCurrentTag;
+ TDataStd_Name::Set(anEdgesLabel, aSubName.str().c_str());
}
+ anEdgesBuilder->Modify(anEdgeIndices.Find(aModIndex), aPutEdges.Current());
}
- }
- }
- aNewSelected = Model_SelectionNaming::findAppropriateFace(
- aThisPtr, allCurves, aShapeType == TopAbs_WIRE);
- }
- if (aNewSelected) { // store this new selection
- select(aNewSelected, theExtDoc, theIndex);
- theModified = true;
- return true;
- } else {
- // if the selection is not found, put the empty shape:
- // it's better to have disappeared shape, than the old, the lost one
- TNaming_Builder anEmptyBuilder(aLab);
- return false;
- }
- } else if (aShapeType == TopAbs_EDGE) {
- // just reselect the edge by the id
- const int aSubNum = aComposite->numberOfSubs();
- for(int a = 0; a < aSubNum; a++) {
- // if aSubIds take any, the first appropriate
- if (aSubIds->IsEmpty() || aSubIds->Contains(aComposite->subFeatureId(a))) {
- // found the appropriate feature
- FeaturePtr aFeature = aComposite->subFeature(a);
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
- aFeature->results().cbegin();
- for(;aResIter != aFeature->results().cend(); aResIter++) {
- ResultConstructionPtr aRes =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
- if (aRes && aRes->shape() && aRes->shape()->isEdge()) { // found!
- select(aRes->shape(), theExtDoc, theIndex);
- theModified = true;
- return true;
- }
- }
- }
- }
- } else if (aShapeType == TopAbs_VERTEX) {
- // just reselect the vertex by the id of edge
- const int aSubNum = aComposite->numberOfSubs();
- for(int a = 0; a < aSubNum; a++) {
- // if aSubIds take any, the first appropriate
- int aFeatureID = aComposite->subFeatureId(a);
- if (aSubIds->IsEmpty() || aSubIds->Contains(aFeatureID) ||
- aSubIds->Contains(aFeatureID + kSTART_VERTEX_DELTA) ||
- aSubIds->Contains(aFeatureID + kSTART_VERTEX_DELTA * 2)) {
- // searching for deltas
- int aVertexNum = 0;
- if (aSubIds->Contains(aFeatureID + kSTART_VERTEX_DELTA)) aVertexNum = 1;
- else if (aSubIds->Contains(aFeatureID + kSTART_VERTEX_DELTA * 2)) aVertexNum = 2;
- // found the feature with appropriate edge
- FeaturePtr aFeature = aComposite->subFeature(a);
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
- aFeature->results().cbegin();
- for(;aResIter != aFeature->results().cend(); aResIter++) {
- ResultConstructionPtr aRes =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
- if (aRes && aRes->shape()) {
- if (aRes->shape()->isVertex() && aVertexNum == 0) { // found!
- select(aRes->shape(), theExtDoc, theIndex);
- theModified = true;
- return true;
- } else if (aRes->shape()->isEdge() && aVertexNum > 0) {
- const TopoDS_Shape& anEdge = aRes->shape()->impl<TopoDS_Shape>();
- int aVIndex = 1;
- for(TopExp_Explorer aVExp(anEdge, TopAbs_VERTEX); aVExp.More(); aVExp.Next()) {
- if (aVIndex == aVertexNum) { // found!
- std::shared_ptr<GeomAPI_Shape> aVertex(new GeomAPI_Shape);
- aVertex->setImpl(new TopoDS_Shape(aVExp.Current()));
- select(aVertex, theExtDoc, theIndex);
- theModified = true;
- return true;
- }
- aVIndex++;
+ // put also modified vertices, otherwise vertex of original edge has no history
+ if (anEdgeIndices.IsBound(aModIndex)) {
+ TopExp_Explorer aVExpOld(anEdgeIndices.Find(aModIndex), TopAbs_VERTEX);
+ TopExp_Explorer aVExpNew(aPutEdges.Current(), TopAbs_VERTEX);
+ for(; aVExpNew.More() && aVExpOld.More(); aVExpNew.Next(), aVExpOld.Next()) {
+ if (!aVExpOld.Current().IsSame(aVExpNew.Current())) {
+ if (!aVerticesBuilder) {
+ TDF_Label aVertLabel = aLab.FindChild(2);
+ aVerticesBuilder = new TNaming_Builder(aVertLabel);
+ std::ostringstream aSubName;
+ // tag is needed for Test1922 to distinguish sub-edges of different faces
+ aSubName<<"SubVertex_"<<aCurrentTag;
+ TDataStd_Name::Set(aVertLabel, aSubName.str().c_str());
}
+ aVerticesBuilder->Modify(aVExpOld.Current(), aVExpNew.Current());
+
}
}
}
+ aPutEdges.Next();
+ }
+ if (anEdgesBuilder)
+ delete anEdgesBuilder;
+ if (aVerticesBuilder)
+ delete aVerticesBuilder;
+ TDataStd_Name::Set(aLab, TCollection_ExtendedString(aName.str().c_str()));
+ aMyDoc->addNamingName(aLab, aName.str());
+ // put also wires to sub-labels to correctly select them instead of collection by edges
+ int aWireTag = 3; // first tag is for SubEdge-s, second - for vertices
+ for(TopExp_Explorer aWires(aFaceToPut, TopAbs_WIRE); aWires.More(); aWires.Next()) {
+ TDF_Label aWireLab = aLab.FindChild(aWireTag);
+ TNaming_Builder aWireBuilder(aWireLab);
+ aWireBuilder.Generated(aWires.Current());
+ std::ostringstream aWireName;
+ aWireName<<aName.str()<<"_wire";
+ if (aWireTag > 3)
+ aWireName<<"_"<<aWireTag - 2;
+ TDataStd_Name::Set(aWireLab, aWireName.str().c_str());
+ aMyDoc->addNamingName(aWireLab, aWireName.str());
+ aWireTag++;
+ }
}
}
}
- } else { // simple construction element: the selected is that needed
- select(shape(), theExtDoc, theIndex);
- theModified = true;
- return true;
}
- return false; // unknown case
}
{
std::shared_ptr<ModelAPI_Feature> myOwner; ///< owner of this result
std::shared_ptr<GeomAPI_Shape> myShape; ///< shape of this result created "on the fly"
- bool myFacesUpToDate; ///< is true if faces in myuFaces are computed and up to date
- /// stores the up to date faces if they exist
- std::vector<std::shared_ptr<GeomAPI_Face> > myFaces;
- bool myIsInHistory;
- bool myIsInfinite;
public:
/// Retuns the parameters of color definition in the resources config manager
MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
std::string& theDefault);
/// By default object is displayed in the object browser.
- MODEL_EXPORT virtual bool isInHistory()
- {
- return myIsInHistory;
- }
-
+ MODEL_EXPORT virtual bool isInHistory();
/// Sets the result
MODEL_EXPORT virtual void setShape(std::shared_ptr<GeomAPI_Shape> theShape);
/// Returns the shape-result produced by this feature
/// The construction element is never concealed
MODEL_EXPORT virtual void setIsConcealed(const bool theValue);
- // methods related to selection of sub-shapes in construction, used by SelectionAttribute
-
- /// Selects theSubShape in the construction. Returns an index of the selected sub-shape.
- /// Puts the selected shape with a needed BRepNaming sub-structure to the data tree of result.
- /// If theSubShape is null, it selects the whole construction and returns zero index.
- /// If theIndex is not -1, it re-selects over the existing data (used for update selection).
- /// If theExtDoc is document where this selection is needed, if it differs from this,
- /// naming structures will be located there.
- int select(const std::shared_ptr<GeomAPI_Shape>& theSubShape,
- const std::shared_ptr<ModelAPI_Document> theExtDoc, const int theIndex = -1);
-
- /// Returns already selected shape by the given index. Zero index means the whole construction,
- /// so, the returned shape in this case is null.
- /// If theExtDoc is document where this selection is needed, if it differs from this,
- /// naming structures will be located there.
- std::shared_ptr<GeomAPI_Shape> shape(const int theIndex,
- const std::shared_ptr<ModelAPI_Document> theExtDoc);
-
- /// Updates the existing selection by the index.
- /// Returns false if update is failed. Returns theModified true if the selection was updated.
- /// If theExtDoc is document where this selection is needed, if it differs from this,
- /// naming structures will be updated there.
- bool update(const int theIndex, const std::shared_ptr<ModelAPI_Document> theExtDoc,
- bool& theModified);
+ /// Updates the shape taking the current value from the data structure, returns true
+ /// if update has been correctly done
+ MODEL_EXPORT virtual bool updateShape();
protected:
/// Makes a body on the given feature
Model_ResultConstruction();
- /// Searchies for the working label selection/update will start from
- /// Returns true if this is label of the external document.
- /// theExtDoc is document where this selection is required
- TDF_Label startLabel(const std::shared_ptr<ModelAPI_Document> theExtDoc, bool& theExternal);
+ /// Stores shape in the data structure to allow identification it by the naming
+ void storeShape(std::shared_ptr<GeomAPI_Shape> theShape);
friend class Model_Objects;
};
{
std::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape);
if (myShape.IsNull()) { // shape is not produced yet, create it
+ SessionPtr aMgr = ModelAPI_Session::get();
+ bool aToSendUpdate = aMgr->isOperation(); // inside of operation may send an update evnet
if (myTrsf.get()) { // get shape of the base result and apply the transformation
ResultPtr anOrigResult = baseRef();
std::shared_ptr<GeomAPI_Shape> anOrigShape = anOrigResult->shape();
aResult->setImpl(new TopoDS_Shape(aShape));
}
}
+ if (!myShape.IsNull() && aToSendUpdate) {
+ static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+ ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent);
+ }
return aResult;
} else {
DocumentPtr aDoc = Model_ResultPart::partDoc();
}
}
}
+ if (!myShape.IsNull() && aToSendUpdate) {
+ static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
+ ModelAPI_EventCreator::get()->sendUpdated(data()->owner(), anEvent);
+ }
}
- if (!myShape.IsNull())
+ if (!myShape.IsNull()) {
aResult->setImpl(new TopoDS_Shape(myShape));
+ }
return aResult;
}
return aResult;
}
+bool Model_ResultPart::combineGeometrical(const int theIndex, std::string& theNewName)
+{
+ std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(partDoc());
+ if (aDoc.get()) {
+ AttributeSelectionListPtr aSelAttr = aDoc->selectionInPartFeature();
+ AttributeSelectionPtr aThisAttr = aSelAttr->value(theIndex - 1);
+ if (aThisAttr.get()) {
+ aThisAttr->combineGeometrical();
+ if (aThisAttr->value().get()) {
+ int anIndex;
+ theNewName = nameInPart(aThisAttr->value(), anIndex);
+ return true;
+ }
+ }
+ }
+ return false; // something is wrong
+}
+
std::shared_ptr<GeomAPI_Shape> Model_ResultPart::shapeInPart(
const std::string& theName, const std::string& theType, int& theIndex)
{
/// Returns the shape by the name in the part
MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(
const std::string& theName, const std::string& theType, int& theIndex);
+ /// Updates the selection inside of the part as a geometrical selection
+ MODEL_EXPORT virtual bool combineGeometrical(const int theIndex, std::string& theNewName);
/// Updates the shape-result of the part (called on Part feature execution)
MODEL_EXPORT virtual void updateShape();
/// Applies the additional transformation of the part
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#include "Model_SelectionNaming.h"
-#include "Model_Document.h"
-#include "Model_Objects.h"
-#include "Model_Data.h"
-#include <ModelAPI_Feature.h>
-#include <Events_InfoMessage.h>
-#include <ModelAPI_Session.h>
-#include <ModelAPI_ResultPart.h>
-#include <ModelAPI_ResultConstruction.h>
-#include <ModelAPI_CompositeFeature.h>
-#include <ModelAPI_ResultBody.h>
-#include <GeomAPI_Wire.h>
-#include <GeomAPI_Edge.h>
-
-#include <TopoDS_Iterator.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_MapIteratorOfMapOfShape.hxx>
-#include <BRep_Builder.hxx>
-#include <TNaming_Iterator.hxx>
-#include <TNaming_Tool.hxx>
-#include <TNaming_NamedShape.hxx>
-#include <TNaming_Localizer.hxx>
-#include <TNaming_SameShapeIterator.hxx>
-#include <TDataStd_Name.hxx>
-#include <TColStd_MapOfTransient.hxx>
-#include <Precision.hxx>
-#include <algorithm>
-#include <stdexcept>
-
-#ifdef DEB_NAMING
-#include <BRepTools.hxx>
-#endif
-
-Model_SelectionNaming::Model_SelectionNaming(TDF_Label theSelectionLab)
-{
- myLab = theSelectionLab;
-}
-
-// searches named shape by the shape in the given document (identified by the label)
-// tries to find s shape nearest to the context-label
-static Handle(TNaming_NamedShape) shapeToNS(const TDF_Label theLabAccess,
- const TopoDS_Shape& theShape, const TDF_Label& theContextLab)
-{
- Handle(TNaming_NamedShape) aResult;
- if (!TNaming_Tool::HasLabel(theLabAccess, theShape)) // no shape in the document
- return aResult;
- int aContextLabDepth = theContextLab.IsNull() ? 100 : theContextLab.Depth();
- TNaming_SameShapeIterator aNSIter(theShape, theLabAccess);
- for(; aNSIter.More(); aNSIter.Next()) {
- TDF_Label aLabel = aNSIter.Label();
- Handle(TNaming_NamedShape) aNS;
- if (aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- if (aNS->Evolution() != TNaming_SELECTED && aNS->Evolution() != TNaming_DELETE) {
- // check this is new shape in this named shape
- bool aIsNew = false;
- for(TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next())
- if (!aNSIter.NewShape().IsNull() && aNSIter.NewShape().IsSame(theShape))
- aIsNew = true;
- if (!aIsNew)
- continue;
- // check this is the context-shape
- while(aLabel.Depth() > aContextLabDepth)
- aLabel = aLabel.Father();
- if (aLabel.IsEqual(theContextLab))
- return aNS;
- if (aResult.IsNull()) // take the first, otherwise it will get shapes from results, etc
- aResult = aNS; // keep some result anyway - if there are no context labels return any
- }
- }
- }
- return aResult;
-}
-
-std::string Model_SelectionNaming::getShapeName(
- std::shared_ptr<Model_Document> theDoc, const TopoDS_Shape& theShape,
- ResultPtr& theContext, const bool theAnotherDoc, const bool theWholeContext)
-{
- std::string aName;
- // add the result name to the name of the shape
- // (it was in BodyBuilder, but did not work on Result rename)
- bool isNeedContextName = theContext->shape().get() != NULL;
- // check if the subShape is already in DF
- std::shared_ptr<Model_Data> aData =
- std::dynamic_pointer_cast<Model_Data>(theContext->data());
- TDF_Label aContextDataLab(aData.get() && aData->isValid() ? aData->label() : TDF_Label());
- Handle(TNaming_NamedShape) aNS = shapeToNS(myLab, theShape, aContextDataLab);
- Handle(TDataStd_Name) anAttr;
- if(!aNS.IsNull() && !aNS->IsEmpty()) { // in the document
- if(aNS->Label().FindAttribute(TDataStd_Name::GetID(), anAttr)) {
- if (isNeedContextName && aData && aContextDataLab.IsEqual(aNS->Label())) {
- // do nothing because this context name will be added later in this method
- } else {
- aName = TCollection_AsciiString(anAttr->Get()).ToCString();
- // indexes are added to sub-shapes not primitives
- // (primitives must not be located at the same label)
- if(!aName.empty() && aNS->Evolution() != TNaming_PRIMITIVE && isNeedContextName) {
- const TDF_Label& aLabel = aNS->Label();
- static const std::string aPostFix("_");
- TNaming_Iterator anItL(aNS);
- for(int i = 1; anItL.More(); anItL.Next(), i++) {
- // in #1766 IsEqual produced no index of the face
- if(anItL.NewShape().IsSame(theShape)) {
- aName += aPostFix;
- aName += TCollection_AsciiString (i).ToCString();
- break;
- }
- }
- }
- // if a shape is under another context, use this name, not theContext
- std::shared_ptr<Model_Data> aContextData =
- std::dynamic_pointer_cast<Model_Data>(theContext->data());
- // for constructions the naming is in arguments and has no evolution, so, apply this only
- // for bodies
- if (isNeedContextName && theContext->groupName() == ModelAPI_ResultBody::group() &&
- !aNS->Label().IsDescendant(aContextData->label())) {
- isNeedContextName = false;
- TDF_Label aNSDataLab = aNS->Label();
- if (aNSDataLab.Depth() % 2 == 0)
- aNSDataLab = aNSDataLab.Father();
- ObjectPtr aNewContext = theDoc->objects()->object(aNSDataLab);
- while(!aNewContext.get() && aNSDataLab.Depth() > 5) {
- aNSDataLab = aNSDataLab.Father().Father();
- aNewContext = theDoc->objects()->object(aNSDataLab);
- }
- if (aNewContext.get()) {
- // this is to avoid duplicated names of results problem
- std::string aContextName = aNewContext->data()->name();
- // myLab corresponds to the current time
- TDF_Label aCurrentLab = myLab;
- while(aCurrentLab.Depth() > 3)
- aCurrentLab = aCurrentLab.Father();
-
- int aNumInHistoryNames =
- theDoc->numberOfNameInHistory(aNewContext, aCurrentLab);
- while(aNumInHistoryNames > 1) { // add "_" before name the needed number of times
- aContextName = "_" + aContextName;
- aNumInHistoryNames--;
- }
-
- aName = aContextName + "/" + aName;
- }
- }
- }
- }
- }
-
- // Name is empty and this is full context, it just add the whole context name that must be added
- bool isEmptyName = aName.empty();
- if (isNeedContextName && (!isEmptyName || theWholeContext)) {
- aName = theContext->data()->name() + (isEmptyName ? "" : ("/" + aName));
- if (theAnotherDoc)
- aName = theContext->document()->kind() + "/" + aName; // PartSet
- }
- return aName;
-}
-
-bool isTrivial (const TopTools_ListOfShape& theAncestors, TopTools_IndexedMapOfShape& theSMap)
-{
- // a trivial case: F1 & F2, aNumber = 1, i.e. intersection gives 1 edge.
- TopoDS_Compound aCmp;
- BRep_Builder BB;
- BB.MakeCompound(aCmp);
- TopTools_ListIteratorOfListOfShape it(theAncestors);
- for(;it.More();it.Next()) {
- if (theSMap.Contains(it.Value()))
- continue;
- BB.Add(aCmp, it.Value());
- theSMap.Add(it.Value());
- }
- int aNumber(0);
- TopTools_IndexedDataMapOfShapeListOfShape aMap2;
- TopExp::MapShapesAndAncestors(aCmp, TopAbs_EDGE, TopAbs_FACE, aMap2);
- for (int i = 1; i <= aMap2.Extent(); i++) {
- const TopoDS_Shape& aKey = aMap2.FindKey(i);
- const TopTools_ListOfShape& anAncestors = aMap2.FindFromIndex(i);
- if(anAncestors.Extent() > 1) aNumber++;
- }
- if(aNumber > 1) return false;
- return true;
-}
-
-const TopoDS_Shape findCommonShape(
- const TopAbs_ShapeEnum theType, const TopTools_ListOfShape& theList)
-{
- if(theList.Extent() < 1) {
- return TopoDS_Shape();
- } else if (theList.Extent() == 1) { // check that sub-shape is bounded by this alone shape
- TopTools_MapOfShape aSubsInShape;
- TopExp_Explorer anExp(theList.First(), theType);
- for(; anExp.More(); anExp.Next()) {
- if (aSubsInShape.Contains(anExp.Current())) { // found duplicate
- return anExp.Current();
- }
- aSubsInShape.Add(anExp.Current());
- }
- }
-
- // Store in maps sub-shapes from each face.
- std::vector<TopTools_MapOfShape> aVec;
- for(TopTools_ListIteratorOfListOfShape anIt(theList); anIt.More(); anIt.Next()) {
- const TopoDS_Shape aFace = anIt.Value();
- TopTools_MapOfShape aMap;
- for(TopExp_Explorer anExp(aFace, theType); anExp.More(); anExp.Next()) {
- const TopoDS_Shape& aSubShape = anExp.Current();
- aMap.Add(anExp.Current());
- }
- aVec.push_back(aMap);
- }
-
- // Find sub-shape shared between all faces.
- TopoDS_Shape aSharedShape;
- for(TopTools_MapIteratorOfMapOfShape anIt(aVec[0]); anIt.More(); anIt.Next()) {
- const TopoDS_Shape& aSubShape = anIt.Value();
- int aSharedNb = 1;
- for(int anIndex = 1; anIndex < aVec.size(); ++anIndex) {
- if(aVec[anIndex].Contains(aSubShape)) {
- ++aSharedNb;
- }
- }
- if(aSharedNb == theList.Extent()) {
- if(aSharedShape.IsNull()) {
- aSharedShape = aSubShape;
- } else {
- // More than one shape shared between all faces, return null shape in this case.
- return TopoDS_Shape();
- }
- }
- }
-
- return aSharedShape;
-}
-
-// searches theType shape that contains theConnectionType sub-shapes in each shape from the List,
-// so, implements the neighbours searching
-/*
-const TopoDS_Shape findCommonShapeByNB(const TopAbs_ShapeEnum theType,
- const TopAbs_ShapeEnum theConnectionType, const TopTools_ListOfShape& theList)
-{
-TopTools_MapOfShape aCheckedShapes; // already checked shapes of type theType
- TopoDS_Shape aResult; // theType result shape
- for(TopTools_ListIteratorOfListOfShape anIt(theList); anIt.More(); anIt.Next()) { // iterate all
- for(TopExp_Explorer anExp(anIt.ChangeValue(), theType); anExp.More(); anExp.Next()) {
- if (aCheckedShapes.Contains(anExp.Current()))
- continue; // already checked
- aCheckedShapes.Add(anExp.Current());
- TopTools_MapOfShape aConnectors; // all connectors of the checked theType shape
- for(TopExp_Explorer aCExp(anExp.Current(), theConnectionType); aCExp.More(); aCExp.Next()) {
- aConnectors.Add(aCExp.Current());
- }
- // check that all shapes from the List contain the connector sub-shapes
- bool aFound = true;
- for(TopTools_ListIteratorOfListOfShape anIt2(theList); anIt2.More() && aFound; anIt2.Next()) {
- if (anIt2.Value().IsSame(anIt.Value()))
- continue;
- aFound = false;
- for(TopExp_Explorer anE(anIt2.ChangeValue(), theConnectionType); anE.More(); anE.Next()) {
- if (aConnectors.Contains(anE.Current())) {
- aFound = true;
- break;
- }
- }
- }
- if (aFound) {
- if (!aResult.IsNull()) // more than one result
- return TopoDS_Shape();
- aResult = anExp.Current();
- }
- }
- }
- return aResult;
-}*/
-
-std::string Model_SelectionNaming::vertexNameByEdges(TopoDS_Shape theContext, TopoDS_Shape theSub,
- std::shared_ptr<Model_Document> theDoc, ResultPtr& theContextRes, const bool theAnotherDoc)
-{
- std::string aResult;
- TopTools_IndexedDataMapOfShapeListOfShape aMap;
- TopExp::MapShapesAndAncestors(theContext, TopAbs_VERTEX, TopAbs_EDGE, aMap);
- const TopTools_ListOfShape& aList22 = aMap.FindFromKey(theSub);
- if(aList22.Extent() >= 2) { // regular solution
- TopTools_MapOfShape aFMap;
- TopTools_ListOfShape aListE;
- TopTools_ListIteratorOfListOfShape itl2(aList22);
- for (int i = 1;itl2.More();itl2.Next(),i++) {
- if(aFMap.Add(itl2.Value()))
- aListE.Append(itl2.Value());
- }
- TopTools_ListIteratorOfListOfShape itl(aListE);
- for (int i = 1;itl.More();itl.Next(),i++) {
- const TopoDS_Shape& anEdge = itl.Value();
- std::string anEdgeName = getShapeName(theDoc, anEdge, theContextRes, theAnotherDoc, false);
- if (anEdgeName.empty()) { // edge is not in DS
- aResult.clear();
- return aResult;
- }
- if(i == 1)
- aResult = anEdgeName;
- else
- aResult += "&" + anEdgeName;
- }
- }
- return aResult;
-}
-
-std::string Model_SelectionNaming::namingName(ResultPtr& theContext,
- std::shared_ptr<GeomAPI_Shape> theSubSh, const std::string& theDefaultName,
- const bool theAnotherDoc)
-{
- std::string aName("Undefined name");
- if(!theContext.get()
- || !theContext->shape().get()
- || theContext->shape()->isNull()) {
- return !theDefaultName.empty() ? theDefaultName : aName;
- }
-
- // if it is in result of another part
- std::shared_ptr<Model_Document> aDoc =
- std::dynamic_pointer_cast<Model_Document>(theContext->document());
- if (theContext->groupName() == ModelAPI_ResultPart::group()) {
- ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(theContext);
- int anIndex;
- if (theSubSh.get())
- return aPart->data()->name() + "/" + aPart->nameInPart(theSubSh, anIndex);
- else
- return aPart->data()->name();
- }
-
- if (!theSubSh.get() || theSubSh->isNull()) { // no subshape, so just the whole feature name
- // but if it is in another Part, add this part name
- std::string aPartName;
- if (theAnotherDoc)
- aPartName = theContext->document()->kind() + "/"; // PartSet
- return aPartName + theContext->data()->name();
- }
- TopoDS_Shape aSubShape = theSubSh->impl<TopoDS_Shape>();
- TopoDS_Shape aContext = theContext->shape()->impl<TopoDS_Shape>();
-#ifdef DEB_NAMING
- if(aSubShape.ShapeType() == TopAbs_COMPOUND) {
- BRepTools::Write(aSubShape, "Selection.brep");
- BRepTools::Write(aContext, "Context.brep");
- }
-#endif
- aName = getShapeName(aDoc, aSubShape, theContext, theAnotherDoc,
- theContext->shape()->isEqual(theSubSh));
-
- if(aName.empty() ) { // not in the document!
- TopAbs_ShapeEnum aType = aSubShape.ShapeType();
- switch (aType) {
- case TopAbs_FACE:
- // the Face should be in DF. If it is not the case, it is an error ==> to be debugged
- break;
- case TopAbs_EDGE:
- {
- // name structure: F1 & F2 [& F3 & F4],
- // where F1 & F2 the faces which gives the Edge in trivial case
- // if it is not atrivial case we use localization by neighbours. F3 & F4 - neighbour faces
- if (BRep_Tool::Degenerated(TopoDS::Edge(aSubShape))) {
- aName = "Degenerated_Edge";
- break;
- }
- TopTools_IndexedDataMapOfShapeListOfShape aMap;
- TopExp::MapShapesAndAncestors(aContext, TopAbs_EDGE, TopAbs_FACE, aMap);
- TopTools_IndexedMapOfShape aSMap; // map for ancestors of the sub-shape
- bool isTrivialCase(true);
- if(aMap.Contains(aSubShape)) {
- const TopTools_ListOfShape& anAncestors = aMap.FindFromKey(aSubShape);
- // check that it is not a trivial case (F1 & F2: aNumber = 1)
- isTrivialCase = isTrivial(anAncestors, aSMap);
- if (!isTrivialCase) { // another try: check that common shape can be processed anyway
- isTrivialCase = !findCommonShape(TopAbs_EDGE, anAncestors).IsNull();
- }
- } else
- break;
- TopTools_MapOfShape aNbs;
- if(!isTrivialCase) { // find Neighbors
- TNaming_Localizer aLocalizer;
- TopTools_MapOfShape aMap3;
- aLocalizer.FindNeighbourg(aContext, aSubShape, aMap3);
- //int n = aMap3.Extent();
- TopTools_MapIteratorOfMapOfShape it(aMap3);
- for(;it.More();it.Next()) {
- const TopoDS_Shape& aNbShape = it.Key(); // neighbor edge
- //TopAbs_ShapeEnum aType = aNbShape.ShapeType();
- const TopTools_ListOfShape& aList = aMap.FindFromKey(aNbShape);
- TopTools_ListIteratorOfListOfShape it2(aList);
- for(;it2.More();it2.Next()) {
- if(aSMap.Contains(it2.Value())) continue; // skip this Face
- aNbs.Add(it2.Value());
- }
- }
- } // else a trivial case
-
- // build name of the sub-shape Edge
- // iterate faces of the context to get stable order, not map-order
- TopTools_MapOfShape aStoredFaces; // to avoid duplicates
- for(TopExp_Explorer aContExp(aContext, TopAbs_FACE); aContExp.More(); aContExp.Next()) {
- const TopoDS_Shape& aFace = aContExp.Current();
- if (aStoredFaces.Contains(aFace) || !(aSMap.Contains(aFace) || aNbs.Contains(aFace)))
- continue;
- aStoredFaces.Add(aFace);
- std::string aFaceName = getShapeName(aDoc, aFace, theContext, theAnotherDoc, false);
- if(aName.empty())
- aName = aFaceName;
- else
- aName += "&" + aFaceName;
- }
- }
- break;
-
- case TopAbs_VERTEX:
- // name structure (Monifold Topology):
- // 1) F1 | F2 | F3 - intersection of 3 faces defines a vertex - trivial case.
- // 2) F1 | F2 | F3 [|F4 [|Fn]] - redundant definition,
- // but it should be kept as is to obtain safe recomputation
- // 2) F1 | F2 - intersection of 2 faces definses a vertex - applicable for case
- // when 1 faces is cylindrical, conical, spherical or revolution and etc.
- // 3) E1 | E2 | E3 - intersection of 3 edges defines a vertex - when we have case of a shell
- // or compound of 2 open faces.
- // 4) E1 | E2 - intesection of 2 edges defines a vertex - when we have a case of
- // two independent edges (wire or compound)
- // implemented 2 first cases
- {
- TopTools_IndexedDataMapOfShapeListOfShape aMap;
- TopExp::MapShapesAndAncestors(aContext, TopAbs_VERTEX, TopAbs_FACE, aMap);
- TopTools_ListOfShape aList;
- TopTools_MapOfShape aFMap;
- // simetimes when group is moved in history, naming may be badly updated, so
- // avoid crash in FindFromKey (issue 1842)
- if (aMap.Contains(aSubShape)) {
- const TopTools_ListOfShape& aList2 = aMap.FindFromKey(aSubShape);
- // fix is below
- TopTools_ListIteratorOfListOfShape itl2(aList2);
- for (int i = 1;itl2.More();itl2.Next(),i++) {
- if(aFMap.Add(itl2.Value()))
- aList.Append(itl2.Value());
- }
- } else
- break;
- int n = aList.Extent();
- bool isByFaces = n >= 3;
- if (isByFaces) { // check that by faces vertex is identified uniquly (2317)
- TopoDS_Shape aVertex = findCommonShape(TopAbs_VERTEX, aList);
- isByFaces = !aVertex.IsNull() && aVertex.ShapeType() == TopAbs_VERTEX;
- }
-
- if(!isByFaces) { // open topology case or Compound case => via edges
- aName = vertexNameByEdges(aContext, aSubShape, aDoc, theContext, theAnotherDoc);
- isByFaces = aName.empty();
- if (isByFaces) { // try to find a vertex in sketch faces
- ResultConstructionPtr aConstr =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theContext);
- if (aConstr.get() && aConstr->facesNum()) {
- for(int aFace = aConstr->facesNum() - 1; isByFaces && aFace >= 0; aFace--) {
- std::shared_ptr<GeomAPI_Face> aGFace = aConstr->face(aFace);
- aName = vertexNameByEdges(aGFace->impl<TopoDS_Face>(), aSubShape,
- aDoc, theContext, theAnotherDoc);
- isByFaces = aName.empty();
- }
- }
- }
- }
-
- if (isByFaces) {
- TopTools_ListIteratorOfListOfShape itl(aList);
- for (int i = 1;itl.More();itl.Next(),i++) {
- const TopoDS_Shape& aFace = itl.Value();
- std::string aFaceName = getShapeName(aDoc, aFace, theContext, theAnotherDoc, false);
- if(i == 1)
- aName = aFaceName;
- else
- aName += "&" + aFaceName;
- }
- }
- }
- break;
- }
- }
- return aName;
-}
-
-TopAbs_ShapeEnum translateType (const std::string& theType)
-{
- // map from the textual shape types to OCCT enumeration
- static std::map<std::string, TopAbs_ShapeEnum> aShapeTypes;
-
- if(aShapeTypes.size() == 0) {
- aShapeTypes["compound"] = TopAbs_COMPOUND;
- aShapeTypes["compounds"] = TopAbs_COMPOUND;
- aShapeTypes["compsolid"] = TopAbs_COMPSOLID;
- aShapeTypes["compsolids"] = TopAbs_COMPSOLID;
- aShapeTypes["solid"] = TopAbs_SOLID;
- aShapeTypes["solids"] = TopAbs_SOLID;
- aShapeTypes["shell"] = TopAbs_SHELL;
- aShapeTypes["shells"] = TopAbs_SHELL;
- aShapeTypes["face"] = TopAbs_FACE;
- aShapeTypes["faces"] = TopAbs_FACE;
- aShapeTypes["wire"] = TopAbs_WIRE;
- aShapeTypes["wires"] = TopAbs_WIRE;
- aShapeTypes["edge"] = TopAbs_EDGE;
- aShapeTypes["edges"] = TopAbs_EDGE;
- aShapeTypes["vertex"] = TopAbs_VERTEX;
- aShapeTypes["vertices"] = TopAbs_VERTEX;
- aShapeTypes["COMPOUND"] = TopAbs_COMPOUND;
- aShapeTypes["COMPOUNDS"] = TopAbs_COMPOUND;
- aShapeTypes["COMPSOLID"] = TopAbs_COMPSOLID;
- aShapeTypes["COMPSOLIDS"] = TopAbs_COMPSOLID;
- aShapeTypes["SOLID"] = TopAbs_SOLID;
- aShapeTypes["SOLIDS"] = TopAbs_SOLID;
- aShapeTypes["SHELL"] = TopAbs_SHELL;
- aShapeTypes["SHELLS"] = TopAbs_SHELL;
- aShapeTypes["FACE"] = TopAbs_FACE;
- aShapeTypes["FACES"] = TopAbs_FACE;
- aShapeTypes["WIRE"] = TopAbs_WIRE;
- aShapeTypes["WIRES"] = TopAbs_WIRE;
- aShapeTypes["EDGE"] = TopAbs_EDGE;
- aShapeTypes["EDGES"] = TopAbs_EDGE;
- aShapeTypes["VERTEX"] = TopAbs_VERTEX;
- aShapeTypes["VERTICES"] = TopAbs_VERTEX;
- }
- if (aShapeTypes.find(theType) != aShapeTypes.end())
- return aShapeTypes[theType];
- Events_InfoMessage("Model_SelectionNaming",
- "Shape type defined in XML is not implemented!").send();
- return TopAbs_SHAPE;
-}
-
-const TopoDS_Shape getShapeFromNS(
- const std::string& theSubShapeName, Handle(TNaming_NamedShape) theNS)
-{
- TopoDS_Shape aSelection;
- std::string::size_type n = theSubShapeName.rfind('/');
- if (n == std::string::npos) n = -1;
- std::string aSubString = theSubShapeName.substr(n + 1);
- n = aSubString.rfind('_');
- int indx = 1;
- if (n != std::string::npos) {// for primitives this is a first
- // if we have here the same name as theSubShapeName, there is no index in compound, it is whole
- Handle(TDataStd_Name) aName;
- if (!theNS->Label().FindAttribute(TDataStd_Name::GetID(), aName) ||
- aName->Get() != aSubString.c_str()) {
- aSubString = aSubString.substr(n+1);
- indx = atoi(aSubString.c_str());
- }
- }
-
- TNaming_Iterator anItL(theNS);
- for(int i = 1; anItL.More(); anItL.Next(), i++) {
- if (i == indx) {
- return anItL.NewShape();
- }
- }
- return aSelection;
-}
-
-const TopoDS_Shape findFaceByName(
- const std::string& theSubShapeName, std::shared_ptr<Model_Document> theDoc,
- const ResultPtr theDetectedContext, bool theContextIsUnique)
-{
- TopoDS_Shape aFace;
- std::string aSubString = theSubShapeName;
-
- static const ResultPtr anEmpty;
- TDF_Label aLabel = theDoc->findNamingName(aSubString,
- theContextIsUnique ? theDetectedContext : anEmpty);
- if (aLabel.IsNull()) { // try to remove additional artificial suffix
- std::string::size_type n = aSubString.rfind('_');
- if (n != std::string::npos) {
- aSubString = aSubString.substr(0, n);
- aLabel = theDoc->findNamingName(aSubString,
- theContextIsUnique ? theDetectedContext : anEmpty);
- }
- }
- if(aLabel.IsNull()) return aFace;
- Handle(TNaming_NamedShape) aNS;
- if(aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- aFace = getShapeFromNS(theSubShapeName, aNS);
- }
- return aFace;
-}
-
-size_t ParseName(const std::string& theSubShapeName, std::list<std::string>& theList)
-{
- std::string aName = theSubShapeName;
- std::string aLastName = aName;
- size_t n1(0), n2(0); // n1 - start position, n2 - position of the delimiter
- while ((n2 = aName.find('&', n1)) != std::string::npos) {
- const std::string aName1 = aName.substr(n1, n2 - n1); //name of face
- theList.push_back(aName1);
- n1 = n2 + 1;
- aLastName = aName.substr(n1);
- }
- if(!aLastName.empty())
- theList.push_back(aLastName);
- return theList.size();
-}
-
-std::string getContextName(const std::string& theSubShapeName)
-{
- std::string aName;
- std::string::size_type n = theSubShapeName.find('/');
- if (n == std::string::npos) return theSubShapeName;
- aName = theSubShapeName.substr(0, n);
- return aName;
-}
-
-/// Parses naming name of sketch sub-elements: takes indices and orientation
-/// (if theOriented = true) from this name. Map theIDs constains indices ->
-/// orientations and start/end vertices: negative is reversed, 2 - start, 3 - end
-bool parseSubIndices(CompositeFeaturePtr theComp, //< to iterate names
- const std::string& theName, const char* theShapeType,
- std::map<int, int>& theIDs, const bool theOriented = false)
-{
- // collect all IDs in the name
- std::map<std::string, int> aNames; // short name of sub -> ID of sub of theComp
- const int aSubNum = theComp->numberOfSubs();
- for(int a = 0; a < aSubNum; a++) {
- FeaturePtr aSub = theComp->subFeature(a);
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
- // there may be many shapes (circle and center)
- for(; aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
- if (aConstr.get()) {
- aNames[Model_SelectionNaming::shortName(aConstr)] = theComp->subFeatureId(a);
- }
- }
- }
-
- size_t aPrevPos = theName.find("/") + 1, aLastNamePos;
- bool isShape = false; // anyway the first world must be 'Vertex'
- do {
- aLastNamePos = theName.find('-', aPrevPos);
- std::string anID = theName.substr(aPrevPos, aLastNamePos - aPrevPos);
- if (!isShape) {
- if (anID != theShapeType)
- return false;
- isShape = true;
- } else {
- int anOrientation = 1; // default
- if (theOriented) { // here must be a symbol in the end of digit 'f' or 'r'
- std::string::iterator aSymbol = anID.end() - 1;
- if (*aSymbol == 'r') anOrientation = -1;
- anID.erase(aSymbol); // remove last symbol
- }
- // check start/end symbols
- std::string::iterator aBack = anID.end() - 1;
- if (*aBack == 's') {
- anOrientation *= 2;
- anID.erase(aBack); // remove last symbol
- } else if (*aBack == 'e') {
- anOrientation *= 3;
- anID.erase(aBack); // remove last symbol
- }
-
- if (aNames.find(anID) != aNames.end()) {
- theIDs[aNames[anID]] = anOrientation;
- }
- }
- aPrevPos = aLastNamePos + 1;
- } while (aLastNamePos != std::string::npos);
- return true;
-}
-
-/// produces theEdge orientation relatively to theContext face
-int Model_SelectionNaming::edgeOrientation(const TopoDS_Shape& theContext, TopoDS_Edge& theEdge)
-{
- if (theContext.ShapeType() != TopAbs_FACE && theContext.ShapeType() != TopAbs_WIRE)
- return 0;
- if (theEdge.Orientation() == TopAbs_FORWARD)
- return 1;
- if (theEdge.Orientation() == TopAbs_REVERSED)
- return -1;
- return 0; // unknown
-}
-
-int Model_CurvesHasher::HashCode(const Handle(Geom_Curve)& theCurve, const Standard_Integer Upper)
-{
- double aFirstParam = theCurve->FirstParameter();
- if (aFirstParam < -1.e+100 || aFirstParam > 1.e+100)
- aFirstParam = 0;
- double aLastParam = theCurve->LastParameter();
- if (aLastParam < -1.e+100 || aLastParam > 1.e+100)
- aLastParam = 2;
- else aLastParam = (aLastParam + aFirstParam) / 2.; // to avoid in periodic same first and last
-
- gp_XYZ aCoordSum = theCurve->Value(aFirstParam).XYZ() + theCurve->Value(aLastParam).XYZ();
- return ::HashCode(aCoordSum.X() + aCoordSum.Y() / 123. + aCoordSum.Z() / 123456., Upper);
-}
-bool Model_CurvesHasher::IsEqual(const Handle(Geom_Curve)& theC1, const Handle(Geom_Curve)& theC2)
-{
- if (theC1->DynamicType() != theC2->DynamicType())
- return false;
- double aFirstParam1 = theC1->FirstParameter();
- if (aFirstParam1 < -1.e+100 || aFirstParam1 > 1.e+100)
- aFirstParam1 = 0;
- double aFirstParam2 = theC2->FirstParameter();
- if (aFirstParam2 < -1.e+100 || aFirstParam2 > 1.e+100)
- aFirstParam2 = 0;
- if (fabs(aFirstParam1 - aFirstParam2) > 1.e-9)
- return false;
-
- double aLastParam1 = theC1->LastParameter();
- if (aLastParam1 < -1.e+100 || aLastParam1 > 1.e+100)
- aLastParam1 = 2.;
- else aLastParam1 = (aLastParam1 + aFirstParam1) / 2.; // to avoid in periodic same first and last
- double aLastParam2 = theC2->LastParameter();
- if (aLastParam2 < -1.e+100 || aLastParam2 > 1.e+100)
- aLastParam2 = 2.;
- else aLastParam2 = (aLastParam2 + aFirstParam2) / 2.; // to avoid in periodic same first and last
-
- if (fabs(aLastParam1 - aLastParam2) > 1.e-9)
- return false;
-
- return theC1->Value(aFirstParam1).IsEqual(theC2->Value(aFirstParam2), Precision::Confusion()) &&
- theC1->Value(aLastParam1).IsEqual(theC2->Value(aLastParam2), Precision::Confusion());
-}
-
-int Model_EdgesHasher::HashCode(const TopoDS_Edge& theEdge, const Standard_Integer Upper)
-{
- Standard_Real aFirst, aLast;
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(theEdge, aFirst, aLast);
- return Model_CurvesHasher::HashCode(aCurve, Upper);
-}
-
-bool Model_EdgesHasher::IsEqual(const TopoDS_Edge& theE1, const TopoDS_Edge& theE2)
-{
- GeomEdgePtr aSh1(new GeomAPI_Edge);
- aSh1->setImpl(new TopoDS_Shape(theE1));
- GeomEdgePtr aSh2(new GeomAPI_Edge);
- aSh2->setImpl(new TopoDS_Shape(theE2));
- return aSh1->isEqual(aSh2);
-}
-
-std::shared_ptr<GeomAPI_Shape> Model_SelectionNaming::findAppropriateFace(
- std::shared_ptr<ModelAPI_Result>& theConstr,
- NCollection_DataMap<Handle(Geom_Curve), int, Model_CurvesHasher>& theCurves, const bool theIsWire)
-{
- int aBestFound = 0; // best number of found edges (not percentage: issue 1019)
- int aBestNotFound = 1000000; // best number of not found edges (must be minimum)
- int aBestOrient = 0; // for the equal "BestFound" additional parameter is orientation
- std::shared_ptr<GeomAPI_Shape> aResult;
- ResultConstructionPtr aConstructionContext =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theConstr);
- if (!aConstructionContext.get())
- return aResult;
- for(int aFaceIndex = 0; aFaceIndex < aConstructionContext->facesNum(); aFaceIndex++) {
- int aFound = 0, aNotFound = 0, aSameOrientation = 0;
- TopoDS_Face aFace =
- TopoDS::Face(aConstructionContext->face(aFaceIndex)->impl<TopoDS_Shape>());
- std::list<TopoDS_Shape> aFacesWires; // faces or wires to iterate
- if (theIsWire) {
- for(TopExp_Explorer aWires(aFace, TopAbs_WIRE); aWires.More(); aWires.Next()) {
- aFacesWires.push_back(aWires.Current());
- }
- } else {
- aFacesWires.push_back(aFace);
- }
- std::list<TopoDS_Shape>::iterator aFW = aFacesWires.begin();
- for(; aFW != aFacesWires.end(); aFW++) {
- TopExp_Explorer anEdgesExp(*aFW, TopAbs_EDGE);
- TColStd_MapOfTransient alreadyProcessed; // to avoid counting edges with same curves (841)
- for(; anEdgesExp.More(); anEdgesExp.Next()) {
- TopoDS_Edge anEdge = TopoDS::Edge(anEdgesExp.Current());
- if (!anEdge.IsNull()) {
- Standard_Real aFirst, aLast;
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
- if (alreadyProcessed.Contains(aCurve))
- continue;
- alreadyProcessed.Add(aCurve);
- if (theCurves.IsBound(aCurve)) {
- aFound++;
- int anOrient = theCurves.Find(aCurve);
- if (anOrient != 0) { // extra comparision score is orientation
- if (edgeOrientation(aFace, anEdge) == anOrient)
- aSameOrientation++;
- }
- } else {
- aNotFound++;
- }
- }
- }
- if (theIsWire && aFound + aNotFound != 0) {
- if (aBestNotFound > aNotFound || (aBestNotFound == aNotFound && aFound > aBestFound) ||
- (aBestNotFound == aNotFound && aFound == aBestFound && aSameOrientation > aBestOrient)) {
- aBestFound = aFound;
- aBestOrient = aSameOrientation;
- aBestNotFound = aNotFound;
- std::shared_ptr<GeomAPI_Wire> aWire(new GeomAPI_Wire);
- aWire->setImpl(new TopoDS_Shape(*aFW));
- aResult = aWire;
- }
- aFound = 0;
- aNotFound = 0;
- aSameOrientation = 0;
- }
- }
- if (!theIsWire) {
- if (aFound + aNotFound != 0) {
- if (aBestNotFound > aNotFound || (aBestNotFound == aNotFound && aFound > aBestFound) ||
- (aBestNotFound == aNotFound && aFound == aBestFound && aSameOrientation > aBestOrient)) {
- aBestFound = aFound;
- aBestOrient = aSameOrientation;
- aBestNotFound = aNotFound;
- aResult = aConstructionContext->face(aFaceIndex);
- }
- }
- }
- }
- return aResult;
-}
-
-std::string Model_SelectionNaming::shortName(
- std::shared_ptr<ModelAPI_ResultConstruction>& theConstr, const int theEdgeVertexPos)
-{
- std::string aName = theConstr->data()->name();
- // remove "-", "/" and "&" command-symbols
- aName.erase(std::remove(aName.begin(), aName.end(), '-'), aName.end());
- aName.erase(std::remove(aName.begin(), aName.end(), '/'), aName.end());
- aName.erase(std::remove(aName.begin(), aName.end(), '&'), aName.end());
- // remove the last 's', 'e', 'f' and 'r' symbols:
- // they are used as markers of start/end/forward/rewersed indicators
- static const std::string aSyms("sefr");
- std::string::iterator aSuffix = aName.end() - 1;
- while(aSyms.find(*aSuffix) != std::string::npos) {
- --aSuffix;
- }
- aName.erase(aSuffix + 1, aName.end());
-
- if (theEdgeVertexPos == 1) {
- aName += "s"; // start
- } else if (theEdgeVertexPos == 2) {
- aName += "e"; // end
- }
- return aName;
-}
-
-// type ::= COMP | COMS | SOLD | SHEL | FACE | WIRE | EDGE | VERT
-bool Model_SelectionNaming::selectSubShape(const std::string& theType,
- const std::string& theSubShapeName, std::shared_ptr<Model_Document> theDoc,
- std::shared_ptr<GeomAPI_Shape>& theShapeToBeSelected, std::shared_ptr<ModelAPI_Result>& theCont)
-{
- if(theSubShapeName.empty() || theType.empty()) return false;
- TopAbs_ShapeEnum aType = translateType(theType);
-
- // check that it was selected in another document
- size_t aSlash = theSubShapeName.find("/");
- std::string aSubShapeName = theSubShapeName;
- std::shared_ptr<Model_Document> aDoc = theDoc;
- if (aSlash != std::string::npos) {
- std::string aDocName = theSubShapeName.substr(0, aSlash);
- ResultPartPtr aFoundPart;
- DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
- if (aDocName == aRootDoc->kind()) {
- aDoc = std::dynamic_pointer_cast<Model_Document>(aRootDoc);
- } else {
- for (int a = aRootDoc->size(ModelAPI_ResultPart::group()) - 1; a >= 0; a--) {
- ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(
- aRootDoc->object(ModelAPI_ResultPart::group(), a));
- if (aPart.get() && aPart->isActivated() && aPart->data()->name() == aDocName) {
- aDoc = std::dynamic_pointer_cast<Model_Document>(aPart->partDoc());
- aFoundPart = aPart;
- break;
- }
- }
- }
- if (aDoc != theDoc) {
- // so, the first word is the document name => reduce the string for the next manips
- aSubShapeName = theSubShapeName.substr(aSlash + 1);
- if (aSubShapeName.empty() && aFoundPart.get()) { // the whole Part result
- theCont = aFoundPart;
- return true;
- }
- }
- }
-
- std::string aContName = getContextName(aSubShapeName);
- if(aContName.empty()) return false;
- bool anUniqueContext = false;
- ResultPtr aCont = aDoc->findByName(aContName, aSubShapeName, anUniqueContext);
- // possible this is body where postfix is added to distinguish several shapes on the same label
- int aSubShapeId = -1; // -1 means sub shape not found
- // for result body the name wihtout "_" has higher priority than with it: it is always added
- if ((!aCont.get()/* || (aCont->groupName() == ModelAPI_ResultBody::group())*/) &&
- aContName == aSubShapeName) {
- size_t aPostIndex = aContName.rfind('_');
- if (aPostIndex != std::string::npos) {
- std::string anEmpty, aSubContName = aContName.substr(0, aPostIndex);
- ResultPtr aSubCont = aDoc->findByName(aSubContName, anEmpty, anUniqueContext);
- if (aSubCont.get()) {
- try {
- std::string aNum = aContName.substr(aPostIndex + 1);
- aSubShapeId = std::stoi(aNum);
- } catch (std::invalid_argument&) {
- aSubShapeId = -1;
- }
- if (aSubShapeId > 0) {
- aContName = aSubContName;
- aCont = aSubCont;
- }
- }
- }
- }
-
-
- static const ResultPtr anEmpty;
- TopoDS_Shape aSelection;
- switch (aType)
- {
- case TopAbs_FACE:
- case TopAbs_WIRE:
- {
- aSelection = findFaceByName(aSubShapeName, aDoc, aCont, anUniqueContext);
- }
- break;
- case TopAbs_EDGE:
- {
- const TDF_Label& aLabel =
- aDoc->findNamingName(aSubShapeName, anUniqueContext ? aCont : anEmpty);
- if(!aLabel.IsNull()) {
- Handle(TNaming_NamedShape) aNS;
- if(aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- aSelection = getShapeFromNS(aSubShapeName, aNS);
- }
- }
- }
- break;
- case TopAbs_VERTEX:
- {
- const TDF_Label& aLabel =
- aDoc->findNamingName(aSubShapeName, anUniqueContext ? aCont : anEmpty);
- if(!aLabel.IsNull()) {
- Handle(TNaming_NamedShape) aNS;
- if(aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
- aSelection = getShapeFromNS(aSubShapeName, aNS);
- }
- }
- }
- break;
- case TopAbs_COMPOUND:
- case TopAbs_COMPSOLID:
- case TopAbs_SOLID:
- case TopAbs_SHELL:
- default: {//TopAbs_SHAPE
- /// case when the whole sketch is selected, so,
- /// selection type is compound, but there is no value
- if (aCont.get() && aCont->shape().get()) {
- if (aCont->shape()->impl<TopoDS_Shape>().ShapeType() == aType) {
- theCont = aCont;
- return true;
- } else if (aSubShapeId > 0) { // try to find sub-shape by the index
- TopExp_Explorer anExp(aCont->shape()->impl<TopoDS_Shape>(), aType);
- for(; aSubShapeId > 1 && anExp.More(); aSubShapeId--) {
- anExp.Next();
- }
- if (anExp.More()) {
- std::shared_ptr<GeomAPI_Shape> aShapeToBeSelected(new GeomAPI_Shape());
- aShapeToBeSelected->setImpl(new TopoDS_Shape(anExp.Current()));
- theShapeToBeSelected = aShapeToBeSelected;
- theCont = aCont;
- return true;
- }
- }
- }
- return false;
- }
- }
- if (!aSelection.IsNull() &&
- aSelection.ShapeType() != aType && aSelection.ShapeType() != TopAbs_COMPOUND)
- aSelection.Nullify(); // to avoid selection of face instead of edge that is described by face
- // another try to find edge or vertex by faces
- std::list<std::string> aListofNames;
- size_t aN = aSelection.IsNull() ? ParseName(aSubShapeName, aListofNames) : 0;
- if ((aSelection.IsNull() && (aType == TopAbs_EDGE || aType == TopAbs_VERTEX)) ||
- (!aSelection.IsNull() && aSelection.ShapeType() != aType)) { // edge by one face as example
- if(aN >= 1) {
- TopTools_ListOfShape aList;
- std::list<std::string>::iterator it = aListofNames.begin();
- for(; it != aListofNames.end(); it++) {
- ResultPtr aFaceContext = aCont;
- if (it != aListofNames.begin()) { // there may be other context for different sub-faces
- std::string aContName = getContextName(*it);
- if(!aContName.empty()) {
- aFaceContext = aDoc->findByName(aContName, *it, anUniqueContext);
- }
- }
- TopoDS_Shape aFace = findFaceByName(*it, aDoc, aFaceContext, anUniqueContext);
- if (aFace.IsNull() && aFaceContext.get() &&
- aFaceContext->groupName() == ModelAPI_ResultConstruction::group() ) {
- // search the construction sub-elements for the intersection if they are in the tree
- size_t aSlash = it->find("/");
- if (aSlash != std::string::npos) {
- std::string aSubShapeName = it->substr(aSlash + 1);
- aFace = findFaceByName(aSubShapeName, aDoc, aFaceContext, true);
- }
- }
- if(!aFace.IsNull())
- aList.Append(aFace);
- }
- aSelection = findCommonShape(aType, aList);
- //if (aSelection.IsNull() && aType == TopAbs_EDGE) { // try to find selection by neighbours
- // aSelection = findCommonShapeByNB(aType, TopAbs_VERTEX, aList);
- //}
- }
- }
- // in case of construction, there is no registered names for all sub-elements,
- // even for the main element; so, trying to find them by name (without "&" intersections)
- if (aSelection.IsNull() && aN < 2) {
- size_t aConstrNamePos = aSubShapeName.find("/");
- bool isFullName = aConstrNamePos == std::string::npos;
- std::string anEmpty, aContrName = aContName;
- ResultPtr aConstr = aDoc->findByName(aContrName, anEmpty, anUniqueContext);
- if (aConstr.get() && aConstr->groupName() == ModelAPI_ResultConstruction::group()) {
- theCont = aConstr;
- if (isFullName) {
- // For the full construction selection shape must be empty.
- //theShapeToBeSelected = aConstr->shape();
- return true;
- }
- // for sketch sub-elements selected
- CompositeFeaturePtr aComposite =
- std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aDoc->feature(aConstr));
- if (aComposite.get()) {
- if (aType == TopAbs_VERTEX || aType == TopAbs_EDGE) {
- // collect all IDs in the name
- bool isVertexByEdge = false;
- std::map<int, int> anIDs;
- if (!parseSubIndices(aComposite, aSubShapeName,
- aType == TopAbs_EDGE ? "Edge" : "Vertex", anIDs)) {
- // there is a case when vertex is identified by one circle-edge (2253)
- if (aType == TopAbs_VERTEX &&
- parseSubIndices(aComposite, aSubShapeName, "Edge", anIDs))
- isVertexByEdge = true;
- else
- return false;
- }
-
- const int aSubNum = aComposite->numberOfSubs();
- for(int a = 0; a < aSubNum; a++) {
- int aCompID = aComposite->subFeatureId(a);
- if (anIDs.find(aCompID) != anIDs.end()) { // found the vertex/edge shape
- FeaturePtr aSub = aComposite->subFeature(a);
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIt = aResults.cbegin();
- // there may be many shapes (circle and center)
- for(; aRIt != aResults.cend(); aRIt++) {
- ResultConstructionPtr aRes =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRIt);
- if (aRes) {
- int anOrientation = abs(anIDs[aCompID]);
- TopoDS_Shape aShape = aRes->shape()->impl<TopoDS_Shape>();
- if (anOrientation == 1) {
- if (!isVertexByEdge && aType == aShape.ShapeType()) {
- theShapeToBeSelected = aRes->shape();
- return true;
- } else if (isVertexByEdge && aType != aShape.ShapeType()) {
- // check that there is only one vertex produces by and circular edge
- TopoDS_Shape aShape = aRes->shape()->impl<TopoDS_Shape>();
- TopExp_Explorer anExp(aShape, TopAbs_VERTEX);
- if (anExp.More())
- aShape = anExp.Current();
- anExp.Next();
- if (!anExp.More() || anExp.Current().IsSame(aShape)) {
- std::shared_ptr<GeomAPI_Shape> aShapeToBeSelected(new GeomAPI_Shape());
- aShapeToBeSelected->setImpl(new TopoDS_Shape(aShape));
- theShapeToBeSelected = aShapeToBeSelected;
- return true;
- }
- }
- } else { // take first or second vertex of the edge
- TopoDS_Shape aShape = aRes->shape()->impl<TopoDS_Shape>();
- if (aShape.ShapeType() == TopAbs_VERTEX) continue;
- TopExp_Explorer anExp(aShape, aType);
- for(; anExp.More() && anOrientation != 2; anOrientation--)
- anExp.Next();
- if (anExp.More()) {
- std::shared_ptr<GeomAPI_Shape> aShapeToBeSelected(new GeomAPI_Shape());
- aShapeToBeSelected->setImpl(new TopoDS_Shape(anExp.Current()));
- theShapeToBeSelected = aShapeToBeSelected;
- return true;
- }
- }
- }
- }
- }
- }
- // sketch faces is identified by format "Sketch_1/Face-2f-8f-11r"
- } else if (aType == TopAbs_FACE || aType == TopAbs_WIRE) {
- std::map<int, int> anIDs;
- if (!parseSubIndices(aComposite, aSubShapeName,
- aType == TopAbs_FACE ? "Face" : "Wire", anIDs, true))
- return false;
-
- // curves and orientations of edges
- NCollection_DataMap<Handle(Geom_Curve), int, Model_CurvesHasher> allCurves;
- const int aSubNum = aComposite->numberOfSubs();
- for(int a = 0; a < aSubNum; a++) {
- int aSubID = aComposite->subFeatureId(a);
- if (anIDs.find(aSubID) != anIDs.end()) {
- FeaturePtr aSub = aComposite->subFeature(a);
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
- for(aRes = aResults.cbegin(); aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
- if (aConstr->shape() && aConstr->shape()->isEdge()) {
- const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
- TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
- if (!anEdge.IsNull()) {
- Standard_Real aFirst, aLast;
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
- allCurves.Bind(aCurve, anIDs[aSubID] > 0 ? 1 : -1);
- }
- }
- }
- }
- }
- std::shared_ptr<GeomAPI_Shape> aFoundFW =
- findAppropriateFace(aConstr, allCurves, aType == TopAbs_WIRE);
- if (aFoundFW.get()) {
- theShapeToBeSelected = aFoundFW;
- return true;
- }
- } else if (aType == TopAbs_WIRE) {
- // sketch faces is identified by format "Sketch_1/Face-2f-8f-11r"
- std::map<int, int> anIDs;
- if (!parseSubIndices(aComposite, aSubShapeName, "Wire", anIDs))
- return false;
-
- // curves and orientations of edges
- NCollection_DataMap<Handle(Geom_Curve), int, Model_CurvesHasher> allCurves;
- const int aSubNum = aComposite->numberOfSubs();
- for(int a = 0; a < aSubNum; a++) {
- int aSubID = aComposite->subFeatureId(a);
- if (anIDs.find(aSubID) != anIDs.end()) {
- FeaturePtr aSub = aComposite->subFeature(a);
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
- for(aRes = aResults.cbegin(); aRes != aResults.cend(); aRes++) {
- ResultConstructionPtr aConstr =
- std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
- if (aConstr->shape() && aConstr->shape()->isEdge()) {
- const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
- TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
- if (!anEdge.IsNull()) {
- Standard_Real aFirst, aLast;
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirst, aLast);
- allCurves.Bind(aCurve, anIDs[aSubID] > 0 ? 1 : -1);
- }
- }
- }
- }
- }
- std::shared_ptr<GeomAPI_Shape> aFoundFW =
- findAppropriateFace(aConstr, allCurves, aType == TopAbs_WIRE);
- if (aFoundFW.get()) {
- theShapeToBeSelected = aFoundFW;
- return true;
- }
- }
- }
- }
- } else if (aSelection.IsNull() && aN >= 2 && aType == TopAbs_VERTEX) {
- // support of shape name as intersection separated by "&"
- static std::string anEdgeType = "edge"; // for now it works only with su-edges
- std::list<std::string>::iterator aSubNames = aListofNames.begin();
- TopTools_ListOfShape aSubsList;
- for(; aSubNames != aListofNames.end(); aSubNames++) {
- std::string aSubName = *aSubNames;
- std::shared_ptr<GeomAPI_Shape> aSubShapeFound;
- std::shared_ptr<ModelAPI_Result> aContextFound;
- if (selectSubShape(anEdgeType, aSubName, theDoc, aSubShapeFound, aContextFound)) {
- if (aSubShapeFound.get())
- aSubsList.Append(aSubShapeFound->impl<TopoDS_Shape>());
- }
- }
- aSelection = findCommonShape(TopAbs_VERTEX, aSubsList);
- }
- if (!aSelection.IsNull()) {
- // Select it (must be after N=0 checking,
- // since for simple constructions the shape must be null)
- std::shared_ptr<GeomAPI_Shape> aShapeToBeSelected(new GeomAPI_Shape());
- aShapeToBeSelected->setImpl(new TopoDS_Shape(aSelection));
- theShapeToBeSelected = aShapeToBeSelected;
- theCont = aCont;
- return true;
- }
-
- return false;
-}
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#ifndef Model_SelectionNaming_H_
-#define Model_SelectionNaming_H_
-
-#include <ModelAPI_Result.h>
-#include <GeomAPI_Shape.h>
-#include <Model_Document.h>
-#include <TDF_Label.hxx>
-#include <TopoDS_Shape.hxx>
-#include <NCollection_DataMap.hxx>
-#include <Geom_Curve.hxx>
-#include <TopoDS_Edge.hxx>
-
-// class to compare curves in the same way as in GeomAPI_Edge
-class Model_CurvesHasher
-{
-public:
- DEFINE_STANDARD_ALLOC
- /// standard hash code
- static int HashCode (const Handle(Geom_Curve)& theCurve, const Standard_Integer Upper);
- /// comapre curves by parameters and points on them
- static bool IsEqual (const Handle(Geom_Curve)& theC1, const Handle(Geom_Curve)& theC2);
-};
-
-// class to compare edges in the same way as in GeomAPI_Edge
-class Model_EdgesHasher
-{
-public:
- DEFINE_STANDARD_ALLOC
- /// standard hash code
- static int HashCode (const TopoDS_Edge& theEdge, const Standard_Integer Upper);
- /// comapre curves by parameters and points on them
- static bool IsEqual (const TopoDS_Edge& theE1, const TopoDS_Edge& theE2);
-};
-
-
-/**\class Model_SelectionNaming
- * \ingroup DataModel
- * \brief The set of methods that allow to generate a string-name for the selection attribute.
- */
-class Model_SelectionNaming
-{
- TDF_Label myLab; ///< Selection label of the selection attribute
-public:
- /// Constructor for the selection attribute by the selection label
- Model_SelectionNaming(TDF_Label theSelectionLab);
-
- /// Produces the string-name for the selected shape
- std::string namingName(ResultPtr& theContext, std::shared_ptr<GeomAPI_Shape> theSubSh,
- const std::string& theDefaultName, const bool theAnotherDoc);
-
- /// Makes a selection by the string-name
- /// \param theType string of the type of the shape
- /// \param theSubShapeName string-identifier of the selected shape
- /// \param theDoc document where the selected shape is searched
- /// \param theShapeToBeSelected resulting selected shape
- /// \param theCont the selection context of the resulting selected shape
- bool selectSubShape(const std::string& theType, const std::string& theSubShapeName,
- std::shared_ptr<Model_Document> theDoc, std::shared_ptr<GeomAPI_Shape>& theShapeToBeSelected,
- std::shared_ptr<ModelAPI_Result>& theCont);
-
- /// Searches the face more appropriate to the given curves
- /// (with higher level of matched parameters)
- /// \param theConstr construction result that contains one or several faces
- /// \param theCurves map from the face edges curves to orientation
- /// (-1 reversed, 0 unknown, 1 forward)
- /// \param theIsWire for wire algorithm isquite the same,
- /// but if in face several wires, it returns the needed wire
- /// \returns faces fron this construction if found
- static std::shared_ptr<GeomAPI_Shape> findAppropriateFace(
- std::shared_ptr<ModelAPI_Result>& theConstr,
- NCollection_DataMap<Handle(Geom_Curve), int, Model_CurvesHasher>& theCurves,
- const bool theIsWire);
-
- /// Returns orientation of the edge in the context shape
- static int edgeOrientation(const TopoDS_Shape& theContext, TopoDS_Edge& theEdge);
-
- /// Returns the name of sketch sub-element, shortened by exclusion of some symbols and with added
- /// the vertex position (if needed)
- /// \param theConstr result with name - basis for the name
- /// \param theEdgeVertexPos position of the vertex on edge: 1 - first , 2 - second
- /// \returns the generated name
- static std::string shortName(std::shared_ptr<ModelAPI_ResultConstruction>& theConstr,
- const int theEdgeVertexPos = 0);
-
-protected:
- /// Gets the stored name from the document
- std::string getShapeName(std::shared_ptr<Model_Document> theDoc, const TopoDS_Shape& theShape,
- ResultPtr& theContext, const bool theAnotherDoc, const bool theWholeContext);
-
- /// Tries to find the name of the context sub-shape as combination of edges in context
- std::string vertexNameByEdges(TopoDS_Shape theContext, TopoDS_Shape theSub,
- std::shared_ptr<Model_Document> theDoc, ResultPtr& theContextRes, const bool theAnotherDoc);
-};
-
-#endif
static Model_Session* myImpl = new Model_Session();
-// t oredirect all calls to the root document
+// to redirect all calls to the root document
#define ROOT_DOC std::dynamic_pointer_cast<Model_Document>(moduleDocument())
bool Model_Session::load(const char* theFileName)
myOperationAttachedToNext = false;
}
setCheckTransactions(true);
- // here the update mechanism may work after abort, so, supress the warnings about
+ // here the update mechanism may work after abort, so, suppress the warnings about
// modifications outside of the transactions
bool aWasCheck = myCheckTransactions;
myCheckTransactions = false;
std::shared_ptr<ModelAPI_Document> aPrevious = myCurrentDoc;
myCurrentDoc = theDoc;
if (theDoc.get() && theSendSignal) {
- // this must be before the synchronisation call because features in PartSet lower than this
+ // this must be before the synchronization call because features in PartSet lower than this
// part feature must be disabled and don't recomputed anymore (issue 1156,
// translation feature is failed on activation of Part 2)
if (isOperation()) { // do it only in transaction, not on opening of document
}
}
}
- // syncronize the document: it may be just opened or opened but removed before
+ // synchronize the document: it may be just opened or opened but removed before
std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(theDoc);
if (aDoc.get()) {
bool aWasChecked = myCheckTransactions;
new Events_Message(Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED)));
Events_Loop::loop()->send(aMsg);
}
- // make the current state correct and synchronised in the module and sub-documents
+ // make the current state correct and synchronized in the module and sub-documents
if (isOperation()) { // do it only in transaction, not on opening of document
if (myCurrentDoc == moduleDocument()) {
// make the current feature the latest in root, in previous root current become also last
if (!aCases.empty()) {
validators()->registerCase(aMsgAttr->featureId(), aMsgAttr->attributeId(), aCases);
}
+ if (aMsgAttr->isGeometricalSelection()) {
+ validators()->registerGeometricalSelection(aMsgAttr->featureId(),
+ aMsgAttr->attributeId());
+ }
}
}
// plugins information was started to load, so, it will be loaded
}
if (!isOperation) {
finishOperation();
- // append this transaction to the previous one: ne don't need this separated operation in list
+ // append this transaction to the previous one: don't need this separated operation in list
ROOT_DOC->appendTransactionToPrevious();
}
}
#include <ModelAPI_Tools.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_ResultConstruction.h>
#include <GeomAPI_Shape.h>
#include <GeomDataAPI_Point.h>
#include <GeomDataAPI_Point2D.h>
aLoop->registerListener(this, kReorderEvent);
static const Events_ID kUpdatedSel = aLoop->eventByName(EVENT_UPDATE_SELECTION);
aLoop->registerListener(this, kUpdatedSel);
- static const Events_ID kAutomaticOff = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE);
- aLoop->registerListener(this, kAutomaticOff);
- static const Events_ID kAutomaticOn = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE);
- aLoop->registerListener(this, kAutomaticOn);
// Config_PropManager::findProp("Model update", "automatic_rebuild")->value() == "true";
myIsParamUpdated = false;
}
}
}
- // proccess also results
+ // process also results
std::list<ResultPtr> allResults; // list of this feature and results
ModelAPI_Tools::allResults(theFeature, allResults);
std::list<ResultPtr>::iterator aRes = allResults.begin();
static const Events_ID kReorderEvent = aLoop->eventByName(EVENT_ORDER_UPDATED);
static const Events_ID kRedisplayEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
static const Events_ID kUpdatedSel = aLoop->eventByName(EVENT_UPDATE_SELECTION);
- static const Events_ID kAutomaticOff = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE);
- static const Events_ID kAutomaticOn = aLoop->eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE);
#ifdef DEB_UPDATE
std::cout<<"****** Event "<<theMessage->eventID().eventText()<<std::endl;
if (!myUpdateBlocked) { // process all modified features, even if preview is blocked
bool aPreviewBlockedState = myIsPreviewBlocked; // to update the selected arguments
myIsPreviewBlocked = false;
- // iterate everything and add efatures in state "MustBeUpdated" into modified
+ // iterate everything and add features in state "MustBeUpdated" into modified
std::list<std::shared_ptr<ModelAPI_Document> > allDocs =
ModelAPI_Session::get()->allOpenedDocuments();
std::list<std::shared_ptr<ModelAPI_Document> >::iterator aDoc = allDocs.begin();
if ((*anObjIter)->groupName() == ModelAPI_ResultParameter::group()) {
myIsParamUpdated = true;
}
- // on undo/redo, abort do not update persisten features
+ // on undo/redo, abort do not update persistent features
FeaturePtr anUpdated = std::dynamic_pointer_cast<ModelAPI_Feature>(*anObjIter);
if (anUpdated.get()) {
if (addModified(anUpdated, FeaturePtr()))
}
myIsFinish = false;
}
- // processed features must be only on finish, so clear anyway (to avoid reimport on load)
+ // processed features must be only on finish, so clear anyway (to avoid re-import on load)
myProcessOnFinish.clear();
// #2156: current must be sketch, left after the macro execution
}
if (anActiveDoc.get() && aCurrent.get() && aCurrent->data()->isValid()) {
- if (anActiveDoc->currentFeature(false) != aCurrent)
+ if (anActiveDoc->currentFeature(false) != aCurrent &&
+ ModelAPI_Tools::compositeOwner(anActiveDoc->currentFeature(false)) == aCurrent)
anActiveDoc->setCurrentFeature(aCurrent, false); // #2156 make the current feature back
}
}
}
-// collects all the feautres this feature depends on: reasons
+// collects all the features this feature depends on: reasons
static void allReasons(FeaturePtr theFeature, std::set<FeaturePtr>& theReasons) {
std::list<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object> > > > aDeps;
theFeature->data()->referencesToObjects(aDeps);
theFeature->data()->execState(ModelAPI_StateDone);
// this checking must be after the composite feature sub-elements processing:
- // composite feature status may depend on it's subelements
+ // composite feature status may depend on it's sub-elements
if ((theFeature->data()->execState() == ModelAPI_StateInvalidArgument || isReferencedInvalid) &&
theFeature->getKind() != "Part") {
// don't disable Part because it will make disabled all the features
aDoExecute = true;
} else if (theFeature->results().size()) { // execute only not-results features
aDoExecute = !(theFeature->firstResult()->groupName() == ModelAPI_ResultBody::group() ||
- theFeature->firstResult()->groupName() == ModelAPI_ResultPart::group());
+ theFeature->firstResult()->groupName() == ModelAPI_ResultPart::group() ||
+ theFeature->getKind() == "Sketch");
} else {
aDoExecute = aState != ModelAPI_StateInvalidArgument;
}
std::map<std::string, std::string>::iterator aFound = myMainArgument.find(theFeature);
return aFound != myMainArgument.end() && aFound->second == theAttribute;
}
+
+void Model_ValidatorsFactory::registerGeometricalSelection(std::string theFeature,
+ std::string theAttribute)
+{
+ std::map<std::string, std::set<std::string> >::iterator aFind =
+ myGeometricalSelection.find(theFeature);
+ if (aFind == myGeometricalSelection.end()) {
+ std::set<std::string> aNewSet;
+ aNewSet.insert(theAttribute);
+ myGeometricalSelection[theFeature] = aNewSet;
+ }
+ else {
+ aFind->second.insert(theAttribute);
+ }
+}
+
+bool Model_ValidatorsFactory::isGeometricalSelection(std::string theFeature,
+ std::string theAttribute)
+{
+ std::map<std::string, std::set<std::string> >::iterator aFind =
+ myGeometricalSelection.find(theFeature);
+ return aFind != myGeometricalSelection.end()
+ && aFind->second.find(theAttribute) != aFind->second.end();
+}
std::map<std::string, std::set<std::string> > > > myCases;
/// Stores main attribute for each feature
std::map<std::string, std::string> myMainArgument;
+ std::map<std::string, std::set<std::string> > myGeometricalSelection;
public:
/// Registers the instance of the validator by the ID
/// Returns true is the attribute is a main argument of the feature
virtual bool isMainArgument(std::string theFeature, std::string theAttribute);
+ /// Register the selection attribute as geometrical selection
+ virtual void registerGeometricalSelection(std::string theFeature, std::string theAttribute);
+
+ /// Returns true if the attribute is a geometrical selection
+ virtual bool isGeometricalSelection(std::string theFeature, std::string theAttribute);
+
protected:
/// Adds the defualt validators that are usefull for all features.
TestResults.py
TestIntArray.py
Test1512.py
+ Test1562.py
TestDoubleArray.py
Test1757.py
Test1998.py
Test2607.py
TestBlockRecalculation.py
TestSelectionScope.py
+ TestSelectorShell.py
TestWeakNaming2125.py
TestWeakNaming2222.py
TestWeakNaming2245.py
TestWeakNaming2445.py
TestWeakNaming2446.py
TestWeakNaming2452.py
+ Test2685.py
+ TestGeomNamingPlacement.py
+ TestGeomNamingRevolution.py
+ TestGeomNamingEdgeByFilter.py
+ TestGeomNamingSketchPlane.py
+ TestGeomNamingBoxWithFillet.py
+ TestContainerSelector.py
+ TestSaveOpen.py
)
// Geometry casts
%template(shapeToEdge) shared_ptr_cast<GeomAPI_Edge, GeomAPI_Shape>;
+
+template<class T1, class T2> std::shared_ptr<T1> shared_ptr_cast(std::shared_ptr<T2> theObject);
+%template(featureToPresentation) shared_ptr_cast<GeomAPI_IPresentable, ModelAPI_Feature>;
/// Returns the referenced object by the zero-based index
///\param theIndex zero-based index in the list
///\param theWithEmpty if it is false, counts the not-empty referenced objects only
- virtual ObjectPtr object(const int theIndex, const bool theWithEmpty = true) const = 0;
+ virtual ObjectPtr object(const int theIndex, const bool theWithEmpty = true) = 0;
/// Substitutes the object by another one. Does nothing if such object is not found.
virtual void substitute(const ObjectPtr& theCurrent, const ObjectPtr& theNew) = 0;
/// \param theContext object where the sub-shape was selected
/// \param theSubShape selected sub-shape (if null, the whole context is selected)
/// \param theTemporarily if it is true, do not store and name the added in the data framework
- /// (used to remove immideately, without the following updates)
+ /// (used to remove immediately, without the following updates)
/// \returns true if attribute was updated
virtual bool setValue(
const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
/// Returns the context of the selection : result or feature
virtual std::shared_ptr<ModelAPI_Object> contextObject() = 0;
- /// Updates the underlied selection due to the changes in the referenced objects
+ /// Updates the selection due to the changes in the referenced objects
/// \returns false if update is failed
virtual bool update() = 0;
/// Returns true if recompute of selection become impossible
virtual bool isInvalid() = 0;
- /// Returns true if the name was stored using weak naming principle
- MODELAPI_EXPORT virtual bool isWeakNaming() = 0;
+ /// Returns true if is geometrical selection.
+ virtual bool isGeometricalSelection() const = 0;
/// To virtually destroy the fields of successors
MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection();
+ /// Returns the name by context. Adds the part name if the context is located in other document
+ MODELAPI_EXPORT virtual std::string contextName(const ResultPtr& theContext) const = 0;
+
+ /// Makes the current local selection becomes all sub-shapes with same base geometry.
+ MODELAPI_EXPORT virtual void combineGeometrical() = 0;
protected:
/// Objects are created for features automatically
/// \param theContext object where the sub-shape was selected
/// \param theSubShape selected sub-shape (if null, the whole context is selected)
/// \param theTemporarily if it is true, it checks also the temporary added item
- /// \returns true if the pair is found in the attirbute
+ /// \returns true if the pair is found in the attribute
virtual bool isInList(
const ObjectPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape,
const bool theTemporarily = false) = 0;
/// during non-modification operations with this attribute)
virtual void cashValues(const bool theEnabled) = 0;
+ virtual void setGeometricalSelection(const bool theIsGeometricalSelection) = 0;
+
+ /// Returns true if is geometrical selection.
+ virtual bool isGeometricalSelection() const = 0;
+
/// Returns the type of this class of attributes
static std::string typeId()
{
MODELAPI_EXPORT virtual ~ModelAPI_BodyBuilder() {};
/// Stores the shape (called by the execution method).
- virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape,
+ virtual void store(const GeomShapePtr& theShape,
const bool theIsStoreSameShapes = true) = 0;
/// Stores the generated shape (called by the execution method).
- virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
- const std::shared_ptr<GeomAPI_Shape>& theToShape) = 0;
+ virtual void storeGenerated(const GeomShapePtr& theFromShape,
+ const GeomShapePtr& theToShape) = 0;
/// Stores the modified shape (called by the execution method).
- virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape,
- const int theDecomposeSolidsTag = 0) = 0;
-
- /// Stores the shape without naming support
- virtual void storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
+ virtual void storeModified(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const bool theIsCleanStored = true) = 0;
/// Returns the shape-result produced by this feature
- virtual std::shared_ptr<GeomAPI_Shape> shape() = 0;
+ virtual GeomShapePtr shape() = 0;
/// Records the subshape newShape which was generated during a topological construction.
/// As an example, consider the case of a face generated in construction of a box.
- virtual void generated(
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
- const int theTag = 1) = 0;
+ /// Returns true if it is stored correctly (the final shape contains this new sub-shape)
+ virtual bool generated(const GeomShapePtr& theNewShape,
+ const std::string& theName, const bool theCheckIsInResult = true) = 0;
/// Records the shape newShape which was generated from the shape oldShape during a topological
/// construction. As an example, consider the case of a face generated from an edge in
/// construction of a prism.
- virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
- const int theTag = 1) = 0;
+ virtual void generated(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const std::string& theName = "") = 0;
/// Records the shape newShape which is a modification of the shape oldShape.
/// As an example, consider the case of a face split or merged in a Boolean operation.
- virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
- const int theTag = 1) = 0;
-
- /// Records the shape oldShape which was deleted from the current label.
- /// As an example, consider the case of a face removed by a Boolean operation.
- virtual void deleted(
- const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1) = 0;
+ virtual void modified(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const std::string& theName = "") = 0;
/// load deleted shapes
- virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn,
- const int theKindOfShape,
- const int theTag,
- const GeomShapePtr theShapes = GeomShapePtr()) = 0;
+ virtual void loadDeletedShapes(const GeomMakeShapePtr& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const GeomShapePtr& theShapesToAvoid = GeomShapePtr()) = 0;
+
/// load and orient modified shapes
- virtual void loadAndOrientModifiedShapes (
- GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn,
- const int theKindOfShape,
- const int theTag,
- const std::string& theName,
- GeomAPI_DataMapOfShapeShape& theSubShapes,
- const bool theIsStoreSeparate = false,
- const bool theIsStoreAsGenerated = false) = 0;
+ virtual void loadModifiedShapes(const GeomMakeShapePtr& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName = "") = 0;
+
/// load and orient generated shapes
- virtual void loadAndOrientGeneratedShapes (
- GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn,
- const int theKindOfShape,
- const int theTag,
- const std::string& theName,
- GeomAPI_DataMapOfShapeShape& theSubShapes) = 0;
+ virtual void loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName = "") = 0;
/// load shapes of the first level (to be used during shape import)
- virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag) = 0;
-
- /// load disconnected edges
- virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag) = 0;
-
- /// load disconnected vetexes
- virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName,int& theTag) = 0;
-
- /// Converts evolution of sub-shapes stored in naming structure to selection
- /// (theFlag = true) and back (theFlag = false)
- virtual void evolutionToSelection(const bool theFlag) = 0;
-
- /// Returns true if the latest modification of this body in the naming history
- // is equal to the given shape
- virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
+ virtual void loadFirstLevel(GeomShapePtr theShape,
+ const std::string& theName) = 0;
protected:
/// Returns the data manager of this object: attributes
MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> document() const;
protected:
- /// Deafult constructor accessible only from Model_Object
+ /// Default constructor accessible only from Model_Object
MODELAPI_EXPORT ModelAPI_BodyBuilder(ModelAPI_Object* theOwner);
ModelAPI_Object* myOwner; ///< the owner object this builder belongs to
}
-void ModelAPI_CompositeFeature::exchangeIDs(
- std::shared_ptr<ModelAPI_Feature> theFeature1, std::shared_ptr<ModelAPI_Feature> theFeature2)
-{
- // by default nothing is in the implementation
-}
-
void ModelAPI_CompositeFeature::erase()
{
// erase all sub-features
/// structures of the owner (the remove from the document will be done outside just after)
virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature) = 0;
- /// Exchanges IDs of two given features: needed for more correct naming in some cases (issue 769)
- MODELAPI_EXPORT virtual void exchangeIDs(std::shared_ptr<ModelAPI_Feature> theFeature1,
- std::shared_ptr<ModelAPI_Feature> theFeature2);
-
/// in addition removes all subs
MODELAPI_EXPORT virtual void erase();
};
{
if (theString.empty())
return false;
- std::string::const_iterator it = theString.begin();
- if (!(isalpha(*it) || (*it) == '_') || it == theString.end())
- return false;
- it++;
- for ( ; it != theString.end(); ++it ) {
- if(!(isalnum(*it) || (*it) == '_')) {
+ try {
+ std::string::const_iterator it = theString.begin();
+ if (!(isalpha(*it) || (*it) == '_') || it == theString.end())
return false;
+ it++;
+ for ( ; it != theString.end(); ++it ) {
+ if(!(isalnum(*it) || (*it) == '_')) {
+ return false;
+ }
}
+ } catch(...) {
+ return false;
}
return true;
}
void ModelAPI_Feature::removeResult(const std::shared_ptr<ModelAPI_Result>& theResult)
{
theResult->setDisabled(theResult, true);
- // flush visualisation changes
+ // flush visualization changes
static Events_Loop* aLoop = Events_Loop::loop();
static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
aLoop->flush(aRedispEvent);
}
}
if (!aGroup.empty() && theFlush) {
- // flush visualisation changes
+ // flush visualization changes
static Events_Loop* aLoop = Events_Loop::loop();
static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
aLoop->flush(aRedispEvent);
while (!myResults.empty()) { // remove one by one with messages
std::shared_ptr<ModelAPI_Result> aRes = *(myResults.begin());
aRes->setDisabled(aRes, true); // to avoid activation of the Part result
- if (!myResults.empty()) // disabling result may erase the list (on undo of Part, issue 665)
+ if (!myResults.empty()) {// disabling result may erase the list (on undo of Part, issue 665)
myResults.erase(myResults.begin());
+ aRes->erase();
+ }
}
ModelAPI_Object::erase();
}
class ModelAPI_Data;
class ModelAPI_Document;
-// sometimes it is usefull for debug to see name of each object (bad for memory and performance)
+// sometimes it is useful for debug to see name of each object (bad for memory and performance)
//#define DEBUG_NAMES
/**\class ModelAPI_Object
MODELAPI_EXPORT virtual void erase();
friend class Model_Objects;
+ friend class ModelAPI_Feature;
friend class Model_Document;
};
{
// append the color attribute. It is empty, the attribute will be filled by a request
DataPtr aData = data();
- aData->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::typeId());
- aData->addAttribute(DEFLECTION_ID(), ModelAPI_AttributeDouble::typeId());
- aData->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeDouble::typeId());
+ aData->addAttribute(COLOR_ID(), ModelAPI_AttributeIntArray::typeId())->setIsArgument(false);
+ aData->addAttribute(DEFLECTION_ID(), ModelAPI_AttributeDouble::typeId())->setIsArgument(false);
+ aData->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeDouble::typeId())->setIsArgument(false);
}
bool ModelAPI_Result::setDisabled(std::shared_ptr<ModelAPI_Result> theThis, const bool theFlag)
return group();
}
-void ModelAPI_ResultBody::store(const std::shared_ptr<GeomAPI_Shape>& theShape,
- const bool theIsStoreSameShapes)
+void ModelAPI_ResultBody::store(const GeomShapePtr& theShape,
+ const bool theIsStoreSameShapes)
{
myBuilder->store(theShape, theIsStoreSameShapes);
myConnect = ConnectionNotComputed;
updateSubs(theShape);
}
-void ModelAPI_ResultBody::storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
- const std::shared_ptr<GeomAPI_Shape>& theToShape)
+void ModelAPI_ResultBody::storeGenerated(const GeomShapePtr& theFromShape,
+ const GeomShapePtr& theToShape)
{
myBuilder->storeGenerated(theFromShape, theToShape);
myConnect = ConnectionNotComputed;
updateSubs(theToShape);
}
-void ModelAPI_ResultBody::storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape,
- const int theDecomposeSolidsTag)
+void ModelAPI_ResultBody::storeModified(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const bool theIsCleanStored)
{
- myBuilder->storeModified(theOldShape, theNewShape, theDecomposeSolidsTag);
+ myBuilder->storeModified(theOldShape, theNewShape, theIsCleanStored);
myConnect = ConnectionNotComputed;
static Events_Loop* aLoop = Events_Loop::loop();
updateSubs(theNewShape);
}
-void ModelAPI_ResultBody::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
-{
- myBuilder->storeWithoutNaming(theShape);
- myConnect = ConnectionNotComputed;
-
- static Events_Loop* aLoop = Events_Loop::loop();
- static Events_ID aRedispEvent = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
- static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
- aECreator->sendUpdated(data()->owner(), aRedispEvent);
-}
-
-std::shared_ptr<GeomAPI_Shape> ModelAPI_ResultBody::shape()
+GeomShapePtr ModelAPI_ResultBody::shape()
{
return myBuilder->shape();
}
-void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
- const std::string& theName, const int theTag)
+bool ModelAPI_ResultBody::generated(const GeomShapePtr& theNewShape,
+ const std::string& theName, const bool theCheckIsInResult)
{
- myBuilder->generated(theNewShape, theName, theTag);
+ return myBuilder->generated(theNewShape, theName, theCheckIsInResult);
}
-void ModelAPI_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
- const int theTag)
+void ModelAPI_ResultBody::generated(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const std::string& theName)
{
- myBuilder->generated(theOldShape, theNewShape, theName, theTag);
+ myBuilder->generated(theOldShape, theNewShape, theName);
}
-void ModelAPI_ResultBody::modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
- const int theTag)
+void ModelAPI_ResultBody::modified(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const std::string& theName)
{
- myBuilder->modified(theOldShape, theNewShape, theName, theTag);
+ myBuilder->modified(theOldShape, theNewShape, theName);
}
-void ModelAPI_ResultBody::deleted(
- const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag)
-{
- myBuilder->deleted(theOldShape, theTag);
-}
-
-void ModelAPI_ResultBody::loadDeletedShapes(GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn,
- const int theKindOfShape,
- const int theTag,
- const GeomShapePtr theShapes)
-{
- myBuilder->loadDeletedShapes(theMS, theShapeIn, theKindOfShape, theTag, theShapes);
-}
-
-void ModelAPI_ResultBody::loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape, const int theTag,
- const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
- const bool theIsStoreSeparate,
- const bool theIsStoreAsGenerated,
- const bool /*theSplitInSubs*/)
-{
- myBuilder->loadAndOrientModifiedShapes(
- theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
- theIsStoreAsGenerated);
-}
-
-void ModelAPI_ResultBody::loadAndOrientGeneratedShapes(GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape,
- const int theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes)
+void ModelAPI_ResultBody::loadDeletedShapes(const GeomMakeShapePtr& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const GeomShapePtr& theShapesToExclude)
{
- myBuilder->loadAndOrientGeneratedShapes(
- theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes);
+ myBuilder->loadDeletedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theShapesToExclude);
}
-void ModelAPI_ResultBody::loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag)
+void ModelAPI_ResultBody::loadModifiedShapes(const GeomMakeShapePtr& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName)
{
- myBuilder->loadFirstLevel(theShape, theName, theTag);
+ myBuilder->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
}
-void ModelAPI_ResultBody::loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag)
+void ModelAPI_ResultBody::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName)
{
- myBuilder->loadDisconnectedEdges(theShape, theName, theTag);
+ myBuilder->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
}
-void ModelAPI_ResultBody::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag)
+void ModelAPI_ResultBody::loadFirstLevel(GeomShapePtr theShape,
+ const std::string& theName)
{
- myBuilder->loadDisconnectedVertexes(theShape, theName, theTag);
+ myBuilder->loadFirstLevel(theShape, theName);
}
bool ModelAPI_ResultBody::isConnectedTopology()
* Provides a shape that may be displayed in the viewer.
* May provide really huge results, so, working with this kind
* of result must be optimized.
-* Also provides a conainer of sub-body result in case it is compound or compsolid.
+* Also provides a container of sub-body result in case it is compound or compsolid.
*/
class ModelAPI_ResultBody : public ModelAPI_Result
{
public:
- /// Iternal enumeration for storage the information of connected topology flag
+ /// Internal enumeration for storage the information of connected topology flag
enum ConnectedTopologyFlag {
ConnectionNotComputed, ///< not yet computed
IsConnected, ///< the topology is connected
MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_ResultBody> subResult(
const int theIndex, bool forTree = false) const = 0;
- /// Returns true if feature or reuslt belong to this composite feature as subs
+ /// Returns true if feature or result belong to this composite feature as subs
/// Returns theIndex - zero based index of sub if found
MODELAPI_EXPORT virtual bool isSub(ObjectPtr theObject, int& theIndex) const = 0;
/// param[in] theShape shape to store.
/// param[in] theIsStoreSameShapes if false stores reference to the same shape
/// if it is already in document.
- MODELAPI_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape,
- const bool theIsStoreSameShapes = true);
+ MODELAPI_EXPORT virtual void store(const GeomShapePtr& theShape,
+ const bool theIsStoreSameShapes = true);
/// Stores the generated shape (called by the execution method).
- MODELAPI_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
- const std::shared_ptr<GeomAPI_Shape>& theToShape);
+ MODELAPI_EXPORT virtual void storeGenerated(const GeomShapePtr& theFromShape,
+ const GeomShapePtr& theToShape);
/// Stores the modified shape (called by the execution method).
- MODELAPI_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theDecomposeSolidsTag = 0);
-
- /// Stores the shape without naming support
- MODELAPI_EXPORT virtual void storeWithoutNaming(
- const std::shared_ptr<GeomAPI_Shape>& theShape);
+ MODELAPI_EXPORT virtual void storeModified(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const bool theIsCleanStored = true);
/// Returns the shape-result produced by this feature
- MODELAPI_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
+ MODELAPI_EXPORT virtual GeomShapePtr shape();
/// Records the subshape newShape which was generated during a topological construction.
/// As an example, consider the case of a face generated in construction of a box.
- MODELAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
- const std::string& theName, const int theTag = 1);
+ /// Returns true if it is stored correctly (the final shape contains this new sub-shape)
+ MODELAPI_EXPORT virtual bool generated(const GeomShapePtr& theNewShape,
+ const std::string& theName, const bool theCheckIsInResult = true);
/// Records the shape newShape which was generated from the shape oldShape during a topological
/// construction. As an example, consider the case of a face generated from an edge in
/// construction of a prism.
- MODELAPI_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
- const int theTag = 1);
+ MODELAPI_EXPORT virtual void generated(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const std::string& theName = "");
/// Records the shape newShape which is a modification of the shape oldShape.
/// As an example, consider the case of a face split or merged in a Boolean operation.
- MODELAPI_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
- const std::shared_ptr<GeomAPI_Shape>& theNewShape, const std::string& theName,
- const int theTag = 1);
-
- /// Records the shape oldShape which was deleted from the current label.
- /// As an example, consider the case of a face removed by a Boolean operation.
- MODELAPI_EXPORT virtual void deleted(
- const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1);
+ MODELAPI_EXPORT virtual void modified(const GeomShapePtr& theOldShape,
+ const GeomShapePtr& theNewShape,
+ const std::string& theName = "");
/// load deleted shapes
- MODELAPI_EXPORT virtual void loadDeletedShapes(GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn,
- const int theKindOfShape,
- const int theTag,
- const GeomShapePtr theShapes = GeomShapePtr());
+ MODELAPI_EXPORT
+ virtual void loadDeletedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const GeomShapePtr& theShapesToExclude = GeomShapePtr());
/// load and orient modified shapes
- MODELAPI_EXPORT virtual void loadAndOrientModifiedShapes(GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape, const int theTag,
- const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes,
- const bool theIsStoreSeparate = false, const bool theIsStoreAsGenerated = false,
- const bool theSplitInSubs = false);
+ MODELAPI_EXPORT
+ virtual void loadModifiedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName = "");
/// load and orient generated shapes
- MODELAPI_EXPORT virtual void loadAndOrientGeneratedShapes(GeomAlgoAPI_MakeShape* theMS,
- std::shared_ptr<GeomAPI_Shape> theShapeIn, const int theKindOfShape,
- const int theTag, const std::string& theName, GeomAPI_DataMapOfShapeShape& theSubShapes);
+ MODELAPI_EXPORT
+ virtual void loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
+ const GeomShapePtr& theOldShape,
+ const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
+ const std::string& theName = "");
/// load shapes of the first level (to be used during shape import)
- MODELAPI_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag);
-
- /// load disconnected edges
- MODELAPI_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag);
-
- /// load disconnected vetexes
- MODELAPI_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape,
- const std::string& theName, int& theTag);
-
- /// Returns true if the latest modification of this body in the naming history
- // is equal to the given shape
- MODELAPI_EXPORT virtual bool isLatestEqual(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
+ MODELAPI_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape,
+ const std::string& theName);
/// Returns true is the topology is connected.
MODELAPI_EXPORT virtual bool isConnectedTopology() = 0;
MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay);
/// Updates the sub-bodies if shape of this object is compsolid or compound
- MODELAPI_EXPORT virtual void updateSubs(const std::shared_ptr<GeomAPI_Shape>& theThisShape,
+ MODELAPI_EXPORT virtual void updateSubs(const GeomShapePtr& theThisShape,
const bool theShapeChanged = true) = 0;
protected:
/// Sets the result
virtual void setShape(std::shared_ptr<GeomAPI_Shape> theShape) = 0;
+ /// Updates the shape taking the current value from the data structure, returns true
+ /// if update has been correctly done
+ virtual bool updateShape() = 0;
+
/// Sets the flag that it must be displayed in history (default is true)
virtual void setIsInHistory(const bool isInHistory) = 0;
/// Returns the part-document of this result
virtual std::shared_ptr<ModelAPI_Document> partDoc() = 0;
- /// Returns the original part result: for transfomration features results this is
+ /// Returns the original part result: for transformation features results this is
/// the original Part feature result
virtual std::shared_ptr<ModelAPI_ResultPart> original() = 0;
virtual std::shared_ptr<GeomAPI_Shape> shapeInPart(
const std::string& theName, const std::string& theType, int& theIndex) = 0;
+ /// Updates the selection inside of the part as a geometrical selection
+ virtual bool combineGeometrical(const int theIndex, std::string& theNewName) = 0;
+
/// Returns the shape selected in the selection index
virtual std::shared_ptr<GeomAPI_Shape> selectionValue(const int theIndex) = 0;
/// Returns true if the attribute must be checked (the case is selected)
virtual bool isCase(FeaturePtr theFeature, std::string theAttribute) = 0;
+ /// Register the selection attribute as geometrical selection
+ virtual void registerGeometricalSelection(std::string theFeature, std::string theAttribute) = 0;
+
+ /// Returns true if the attribute is a geometrical selection
+ virtual bool isGeometricalSelection(std::string theFeature, std::string theAttribute) = 0;
+
protected:
/// Get instance from Session
ModelAPI_ValidatorsFactory()
#=========================================================================
# Make extrusion on triangle
#=========================================================================
-aSketchResult = aSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin.pnt(), dirx.dir(), norm.dir(), aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
aPlane = aPartSet.addFeature("Plane")
aPlane.string("creation_method").setValue("by_other_plane")
aPlane.string("by_other_plane_option").setValue("by_distance_from_other")
-aPlane.selection("plane").selectSubShape("face", "Part_1/Extrusion_1_1/Generated_Face_2")
+aPlane.selection("plane").selectSubShape("face", "Part_1/_weak_name_5_Extrusion_1_1")
aPlane.real("distance").setValue(0.001)
aPlane.boolean("reverse").setValue(False)
aSession.finishOperation()
aSession.abortOperation()
# check faces
-check_owner("Extrusion_1_1/Generated_Face_1", "face", aBox)
-check_owner("Fuse_1_1/Modified_Face_2", "face", aBox)
-check_owner("Cut_1_1/Modified_Face_1", "face", aHoleExt)
-check_owner("Fuse_1_1/Modified_Face_1", "face", aTower)
+check_owner("Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4", "face", aBox)
+check_owner("Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face", "face", aBox)
+check_owner("Cut_1_1/Modified_Face&Sketch_2/SketchCircle_1_2", "face", aHoleExt)
+check_owner("Fuse_1_1/Modified_Face&Sketch_3/SketchCircle_2_2", "face", aTower)
# check edges without ambiguity
-check_owner("Fuse_1_1/Modified_Face_2&Extrusion_1_1/Generated_Face_2", "edge", aBox)
-check_owner("Fuse_1_1/Modified_Face_1&Extrusion_3_1/To_Face_1", "edge", aTower)
+check_owner("[Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]", "edge", aBox)
+check_owner("[Fuse_1_1/Modified_Face&Sketch_3/SketchCircle_2_2][Extrusion_3_1/To_Face]", "edge", aTower)
# check the connected topology method: solid is not a compound of connected topology
assert(aFuse.firstResult().shape().isConnectedTopology() == False)
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+lenParam = model.addParameter(Part_1_doc, "len", "45")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(63.23267137124048, -31.30105453337777, -32.56343706523536, -31.30105453337777)
+SketchLine_2 = Sketch_1.addLine(-32.56343706523536, -31.30105453337777, -32.56343706523536, -163.6364723017416)
+SketchLine_3 = Sketch_1.addLine(-32.56343706523536, -163.6364723017416, 63.23267137124048, -163.6364723017416)
+SketchLine_4 = Sketch_1.addLine(63.23267137124048, -163.6364723017416, 63.23267137124048, -31.30105453337777)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 50, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"))
+SketchLine_5 = Sketch_2.addLine(43.23267137124047, 69.97394590606471, -1.767328628759523, 69.97394590606471)
+SketchLine_6 = Sketch_2.addLine(-1.767328628759523, 69.97394590606471, -1.767328628759523, 20.8583125692591)
+SketchLine_7 = Sketch_2.addLine(-1.767328628759523, 20.8583125692591, 43.23267137124047, 20.8583125692591)
+SketchLine_8 = Sketch_2.addLine(43.23267137124047, 20.8583125692591, 43.23267137124047, 69.97394590606471)
+SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
+SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"), False)
+SketchLine_9 = SketchProjection_1.createdFeature()
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_9.result(), SketchLine_7.endPoint(), 20, True)
+SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_7.result(), "len")
+model.do()
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"), 0, model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_8"), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_8"))
+SketchCircle_1 = Sketch_3.addCircle(-89.76476373103716, -34.76230113958862, 5.223553090716001)
+ExtrusionCut_2.setNestedSketch(Sketch_3)
+model.do()
+# on increase of parameter selected part of extrusion is increased and selected face is removed (U becomes L)
+# so, check that selection is still correct and cut from not existing part produces correct shape anyway
+lenParam.setValue(100)
+model.do()
+
+# check the result validity
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(ExtrusionCut_2.feature()))
+
+# set the value back to avoid changed the name text in selection of "to_object" in check python dump
+lenParam.setValue(45)
+
+model.end()
+
+assert(model.checkPythonDump())
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 300, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 300, 0)
#=========================================================================
# Cut another rectangle to make a groove
#=========================================================================
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/To_Face_1"), 0, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1"))
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/To_Face"), 0, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face"))
SketchLine_5 = Sketch_2.addLine(-47.794137712106, -188.943752610533, 90.842718875892, -188.943752610533)
SketchLine_6 = Sketch_2.addLine(90.842718875892, -188.943752610533, 90.842718875892, -51.567231082425)
SketchLine_7 = Sketch_2.addLine(90.842718875892, -51.567231082425, -47.794137712106, -51.567231082425)
#=========================================================================
# Make a cylindrical hole using one of the produced faces
#=========================================================================
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_3"))
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "(ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4)"))
SketchCircle_1 = Sketch_3.addCircle(143.412751420315, -228.52745656314, 32.158435160764)
ExtrusionCut_2.setNestedSketch(Sketch_3)
#=========================================================================
# Modify the cylindrical hole base face by another groove in the history before the hole is created
#=========================================================================
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), -50, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"))
SketchLine_9 = Sketch_4.addLine(-176.701443076057, -151.212050129331, -91.83965287802501, -151.212050129331)
SketchLine_10 = Sketch_4.addLine(-91.83965287802501, -151.212050129331, -91.83965287802501, -84.473709256573)
SketchLine_11 = Sketch_4.addLine(-91.83965287802501, -84.473709256573, -176.701443076057, -84.473709256573)
assert(ModelAPI.ModelAPI_Session.get().validators().validate(Sketch_4.feature()))
assert(ModelAPI.ModelAPI_Session.get().validators().validate(ExtrusionCut_2.feature()))
-assert(Sketch_3.feature().selection("External").namingName() == "ExtrusionCut_3_1/Modfied_5")
+assert(Sketch_3.feature().selection("External").namingName() == "(ExtrusionCut_3_1/Modified_Face&Sketch_2/SketchLine_6)(ExtrusionCut_3_1/Modified_Face&Sketch_1/SketchLine_4)(ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face)")
assert(model.checkPythonDump())
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
model.do()
-Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"))
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 50, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_2"))
+Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f"), model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 50, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"))
SketchCircle_1 = Sketch_2.addCircle(12.88847795756506, 28.93359954982685, 11.55225986344597)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchLine_1 = Sketch_1.addLine(-106.3464837049742, -78.0445969125214, -108.0617495711835, 165.5231560891939)
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex")])
+model.do()
model.end()
assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6")
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 200)
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 200)
-SketchArc_2 = Sketch_1.addArc(250, 0, 1.232595164407831e-032, 0, 500, 0, False)
+SketchArc_2 = Sketch_1.addArc(250, 0, 1.232595164407831e-32, 0, 500, 0, False)
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchArc_2.center())
SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7")
SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchArc_2.startPoint())
model.do()
Sketch_1.setName("toto")
Sketch_1.result().setName("tutu")
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "tutu/Face-SketchLine_1f-SketchLine_3f-SketchArc_1_2f-SketchArc_2_2f")], model.selection(), 10, 0)
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "tutu/Edge-SketchLine_2")])
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "tutu/Face-SketchLine_1r-SketchArc_2_2f-SketchLine_3f-SketchArc_1_2f")], model.selection(), 10, 0)
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "tutu/SketchLine_2")])
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OZ"), 100, 0)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Extrusion_2_1/Generated_Edge_2&Extrusion_2_1/To_Edge_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Edge_1&Extrusion_2_1/To_Edge_1")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Extrusion_2_1/Generated_Edge&tutu/SketchLine_2_StartVertex]e[Extrusion_2_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_2_1/Generated_Edge&tutu/SketchLine_2_EndVertex]e[Extrusion_2_1/To_Edge]e")])
+model.do()
model.end()
# check that resulting group selection is valid
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
model.do()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2r-SketchCircle_2_2f")], model.selection(), 5, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/YOZ"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_2_2f-SketchCircle_1_2r")], model.selection(), 5, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
SketchCircle_3 = Sketch_2.addCircle(-0.01730125245914903, 1.175069067120482, 0.2787321880802174)
SketchCircle_4 = Sketch_2.addCircle(-0.01730125245914903, 1.175069067120482, 0.3197841740766353)
SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchCircle_4.center())
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r-SketchCircle_2_2f")], model.selection(), 0, 3)
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2f")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face_1"), 0, model.selection(), 0)
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/XOZ"))
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_1_2r")], model.selection(), 0, 3)
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1/Face-SketchCircle_1_2f")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face"), 0, model.selection(), 0)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
SketchLine_1 = Sketch_3.addLine(-3.362323990279312, -0.5188129046480872, 0.8318943090987101, -0.5188129046480872)
SketchLine_2 = Sketch_3.addLine(0.8318943090987101, -0.5188129046480872, 0.8318943090987101, 7.155729512171993)
SketchLine_3 = Sketch_3.addLine(0.8318943090987101, 7.155729512171993, -3.362323990279312, 7.155729512171993)
SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_3.setVertical(SketchLine_4.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_1")])
-Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_2_2f")], model.selection(), model.selection("FACE", "Extrusion_2_1/From_Face_1"), 0, model.selection(), 0)
-Boolean_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_4_1")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cut_1_1"), model.selection("SOLID", "Cut_2_1"), model.selection("FACE", "Face_1_1")])
-Remove_SubShapes_1_objects = [model.selection("SOLID", "Partition_1_1_1_1"), model.selection("SOLID", "Partition_1_1_1_2"), model.selection("SOLID", "Partition_1_1_1_3"), model.selection("SOLID", "Partition_1_1_1_4")]
+Face_1_objects = [model.selection("EDGE", "Sketch_2/SketchLine_2"), model.selection("EDGE", "Sketch_2/SketchLine_3"), model.selection("EDGE", "Sketch_2/SketchLine_4"), model.selection("EDGE", "Sketch_2/SketchLine_1")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
+Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_2_2f-SketchCircle_1_2r_wire")], model.selection(), model.selection("FACE", "Extrusion_2_1/From_Face"), 0, model.selection(), 0)
+Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_4_1")])
+Partition_1_objects = [model.selection("SOLID", "Cut_1_1"), model.selection("SOLID", "Cut_2_1"), model.selection("FACE", "Face_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+Remove_SubShapes_1_objects_1 = [model.selection("SOLID", "Partition_1_1_1_1"), model.selection("SOLID", "Partition_1_1_1_2"), model.selection("SOLID", "Partition_1_1_1_3"), model.selection("SOLID", "Partition_1_1_1_4")]
Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "Partition_1_1"))
-Remove_SubShapes_1.setSubShapesToKeep(Remove_SubShapes_1_objects)
-
-
+Remove_SubShapes_1.setSubShapesToKeep(Remove_SubShapes_1_objects_1)
+model.do()
model.end()
# check that remove sub-shapes contains correct selection
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_6.result())
SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result())
-SketchArc_1 = Sketch_1.addArc(4.151438510550382e-034, -3.089278765476956e-034, 81.26217508737108, 0, 0, 81.26217508737108, False)
+SketchArc_1 = Sketch_1.addArc(4.151438510550382e-34, -3.089278765476956e-34, 81.26217508737108, 0, 0, 81.26217508737108, False)
SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_1.center())
SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchLine_9.endPoint(), SketchArc_1.startPoint())
SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_2.result(), SketchArc_1.endPoint())
SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchLine_10.endPoint(), SketchArc_1.endPoint())
SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_7.result())
-SketchArc_2 = Sketch_1.addArc(4.151438510550382e-034, -3.089278765476956e-034, 76.26217508737108, 0, 0, 76.26217508737108, False)
+SketchArc_2 = Sketch_1.addArc(4.151438510550382e-34, -3.089278765476956e-34, 76.26217508737108, 0, 0, 76.26217508737108, False)
SketchConstraintCoincidence_16 = Sketch_1.setCoincident(SketchLine_2.startPoint(), SketchArc_2.center())
SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_23")
SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchLine_9.result(), SketchArc_2.startPoint())
SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_24")
SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_10.result(), SketchArc_2.endPoint())
SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_25")
-SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchArc_2.endPoint(), 5)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.endPoint(), SketchArc_2.endPoint(), 5, False)
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), "2*l")
SketchConstraintLength_1.setName("SketchConstraintLength_2")
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_6.result(), "l")
SketchCircle_11 = Sketch_2.addCircle(66.22695092615982, 10.77677442495125, 4.536925074373645)
SketchCircle_12 = Sketch_2.addCircle(50.98852111849166, 6.165144351577979, 3.547307159201085)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_9f-SketchLine_10r-SketchArc_1_2f-SketchArc_2_2r")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2")])
-Face_4 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/Edge-SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchLine_10r-SketchArc_2_2f")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/XOY"))
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_9f-SketchArc_1_2f-SketchLine_10r-SketchArc_2_2r_wire")])
+Face_3_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2")]
+Face_3 = model.addFace(Part_1_doc, Face_3_objects)
+Face_4_objects = [model.selection("EDGE", "Sketch_2/SketchCircle_1_2"), model.selection("EDGE", "Sketch_2/SketchCircle_2_2"), model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_2/SketchCircle_5_2"), model.selection("EDGE", "Sketch_2/SketchCircle_7_2"), model.selection("EDGE", "Sketch_2/SketchCircle_6_2"), model.selection("EDGE", "Sketch_2/SketchCircle_9_2"), model.selection("EDGE", "Sketch_2/SketchCircle_8_2"), model.selection("EDGE", "Sketch_2/SketchCircle_10_2"), model.selection("EDGE", "Sketch_2/SketchCircle_12_2"), model.selection("EDGE", "Sketch_2/SketchCircle_11_2"), model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_9f-SketchArc_2_2f-SketchLine_10r_wire")]
+Face_4 = model.addFace(Part_1_doc, Face_4_objects)
+Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchLine_11 = Sketch_3.addLine(40, 0, 30, 0)
-SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "Face_1_1/Edge_6&Face_1_1/Edge_7"))
+SketchPoint_1 = Sketch_3.addPoint(model.selection("VERTEX", "[Face_1_1/Edge_6]e[Face_1_1/Edge_7]e"))
SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_1.result())
+SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_19")
SketchLine_12 = Sketch_3.addLine(30, 0, 30, 10)
SketchLine_13 = Sketch_3.addLine(30, 10, 40, 10)
SketchLine_14 = Sketch_3.addLine(40, 10, 40, 0)
SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_14.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_20")
SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_21")
SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_12.endPoint(), SketchLine_13.startPoint())
+SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_22")
SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_26")
SketchConstraintHorizontal_4 = Sketch_3.setHorizontal(SketchLine_11.result())
SketchConstraintLength_3 = Sketch_3.setLength(SketchLine_13.result(), "l")
SketchConstraintLength_3.setName("SketchConstraintLength_4")
model.do()
-Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")])
-MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "PartSet/OX"), "l", 4, model.selection("EDGE", "PartSet/OY"), "l", 2)
-Recover_1 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "Face_4_1/Edge_6&Face_4_1/Edge_7"), model.selection("VERTEX", "Face_4_1/Edge_4&Face_4_1/Edge_5"))
-MultiTranslation_2 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), "l", 4, model.selection("EDGE", "PartSet/OY"), "l", 2)
-Recover_2 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "Face_4_1/Edge_6&Face_4_1/Edge_7"), model.selection("VERTEX", "Face_4_1/Edge_2&Face_4_1/Edge_3"))
-MultiTranslation_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "l", 4)
-Recover_3 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "Face_4_1/Edge_6&Face_4_1/Edge_7"), model.selection("VERTEX", "LinearCopy_3_1/Translated_Edge_1_4&LinearCopy_3_1/Translated_Edge_1_3"))
-MultiTranslation_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "l", 3)
-Recover_4 = model.addRecover(Part_1_doc, MultiTranslation_1, [Face_5.result()])
-Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "Face_4_1/Edge_6&Face_4_1/Edge_7"), model.selection("VERTEX", "Face_4_1/Edge_1&Face_4_1/Edge_9"))
-MultiTranslation_5 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_4_1")], model.selection("EDGE", "PartSet/OX"), "l", 2)
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "LinearCopy_4_1_2"), model.selection("FACE", "LinearCopy_1_1_8"), model.selection("FACE", "LinearCopy_1_1_4"), model.selection("FACE", "LinearCopy_1_1_3"), model.selection("FACE", "LinearCopy_1_1_6"), model.selection("FACE", "LinearCopy_1_1_2"), model.selection("FACE", "LinearCopy_1_1_7"), model.selection("FACE", "LinearCopy_2_1_3"), model.selection("FACE", "LinearCopy_3_1_4"), model.selection("FACE", "LinearCopy_2_1_8"), model.selection("FACE", "LinearCopy_2_1_4"), model.selection("FACE", "LinearCopy_2_1_7"), model.selection("FACE", "LinearCopy_4_1_3"), model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_5_1_2"), model.selection("FACE", "LinearCopy_4_1_1"), model.selection("FACE", "LinearCopy_5_1_1"), model.selection("FACE", "LinearCopy_3_1_3"), model.selection("FACE", "LinearCopy_3_1_2"), model.selection("FACE", "LinearCopy_3_1_1"), model.selection("FACE", "LinearCopy_2_1_6"), model.selection("FACE", "LinearCopy_2_1_2"), model.selection("FACE", "LinearCopy_2_1_5"), model.selection("FACE", "LinearCopy_2_1_1"), model.selection("FACE", "LinearCopy_1_1_5")])
+Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r_wire")])
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "PartSet/OX"), "l", 4, model.selection("EDGE", "PartSet/OY"), "l", 2)
+Recover_1 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_1")], model.selection("VERTEX", "[Face_4_1/Edge_6]e[Face_4_1/Edge_7]e"), model.selection("VERTEX", "[Face_4_1/Edge_4]e[Face_4_1/Edge_5]e"))
+LinearCopy_2 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_1_1")], model.selection("EDGE", "PartSet/OX"), "l", 4, model.selection("EDGE", "PartSet/OY"), "l", 2)
+Recover_2 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_2_1")], model.selection("VERTEX", "[Face_4_1/Edge_6]e[Face_4_1/Edge_7]e"), model.selection("VERTEX", "[Face_4_1/Edge_2]e[Face_4_1/Edge_3]e"))
+LinearCopy_3 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_2_1")], model.selection("EDGE", "PartSet/OX"), "l", 4)
+Recover_3 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_3 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_3_1")], model.selection("VERTEX", "[Face_4_1/Edge_6]e[Face_4_1/Edge_7]e"), model.selection("VERTEX", "[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_1]e[LinearCopy_3_1_1/ME:Translated_Edge&Face_5_1/Edge_2]e"))
+LinearCopy_4 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_3_1")], model.selection("EDGE", "PartSet/OX"), "l", 3)
+Recover_4 = model.addRecover(Part_1_doc, LinearCopy_1, [Face_5.result()])
+Translation_4 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_4_1")], model.selection("VERTEX", "[Face_4_1/Edge_6]e[Face_4_1/Edge_7]e"), model.selection("VERTEX", "[Face_4_1/Edge_1]e[Face_4_1/Edge_9]e"))
+LinearCopy_5 = model.addMultiTranslation(Part_1_doc, [model.selection("FACE", "Translation_4_1")], model.selection("EDGE", "PartSet/OX"), "l", 2)
+Group_1_objects = [model.selection("FACE", "LinearCopy_4_1_2"), model.selection("FACE", "LinearCopy_1_1_8"), model.selection("FACE", "LinearCopy_1_1_4"), model.selection("FACE", "LinearCopy_1_1_3"), model.selection("FACE", "LinearCopy_1_1_6"), model.selection("FACE", "LinearCopy_1_1_2"), model.selection("FACE", "LinearCopy_1_1_7"), model.selection("FACE", "LinearCopy_2_1_3"), model.selection("FACE", "LinearCopy_3_1_4"), model.selection("FACE", "LinearCopy_2_1_8"), model.selection("FACE", "LinearCopy_2_1_4"), model.selection("FACE", "LinearCopy_2_1_7"), model.selection("FACE", "LinearCopy_4_1_3"), model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_5_1_2"), model.selection("FACE", "LinearCopy_4_1_1"), model.selection("FACE", "LinearCopy_5_1_1"), model.selection("FACE", "LinearCopy_3_1_3"), model.selection("FACE", "LinearCopy_3_1_2"), model.selection("FACE", "LinearCopy_3_1_1"), model.selection("FACE", "LinearCopy_2_1_6"), model.selection("FACE", "LinearCopy_2_1_2"), model.selection("FACE", "LinearCopy_2_1_5"), model.selection("FACE", "LinearCopy_2_1_1"), model.selection("FACE", "LinearCopy_1_1_5")]
+Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
Group_1.setName("Group_3")
Group_1.result().setName("assemblages")
-Group_2 = model.addGroup(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_12")])
+Group_2_objects = [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_12")]
+Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
Group_2.setName("Group_1")
Group_2.result().setName("eau")
Group_2.result().setColor(0, 170, 255)
Group_3.setName("Group_2")
Group_3.result().setName("acier")
Group_3.result().setColor(170, 85, 0)
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_1_1_2"), model.selection("FACE", "LinearCopy_1_1_3"), model.selection("FACE", "LinearCopy_1_1_4"), model.selection("FACE", "LinearCopy_1_1_5"), model.selection("FACE", "LinearCopy_1_1_6"), model.selection("FACE", "LinearCopy_1_1_7"), model.selection("FACE", "LinearCopy_2_1_4"), model.selection("FACE", "LinearCopy_2_1_5"), model.selection("FACE", "LinearCopy_2_1_6"), model.selection("FACE", "LinearCopy_2_1_7"), model.selection("FACE", "LinearCopy_2_1_8"), model.selection("FACE", "LinearCopy_2_1_1"), model.selection("FACE", "LinearCopy_2_1_2"), model.selection("FACE", "LinearCopy_2_1_3"), model.selection("FACE", "LinearCopy_3_1_4"), model.selection("FACE", "LinearCopy_3_1_3"), model.selection("FACE", "LinearCopy_3_1_2"), model.selection("FACE", "LinearCopy_3_1_1"), model.selection("FACE", "LinearCopy_4_1_1"), model.selection("FACE", "LinearCopy_4_1_2"), model.selection("FACE", "LinearCopy_4_1_3"), model.selection("FACE", "LinearCopy_5_1_1"), model.selection("FACE", "LinearCopy_5_1_2"), model.selection("FACE", "LinearCopy_1_1_8")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_4_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("SHELL", "Shell_1_1")])
+Shell_1_objects = [model.selection("FACE", "LinearCopy_1_1_1"), model.selection("FACE", "LinearCopy_1_1_2"), model.selection("FACE", "LinearCopy_1_1_3"), model.selection("FACE", "LinearCopy_1_1_4"), model.selection("FACE", "LinearCopy_1_1_5"), model.selection("FACE", "LinearCopy_1_1_6"), model.selection("FACE", "LinearCopy_1_1_7"), model.selection("FACE", "LinearCopy_2_1_4"), model.selection("FACE", "LinearCopy_2_1_5"), model.selection("FACE", "LinearCopy_2_1_6"), model.selection("FACE", "LinearCopy_2_1_7"), model.selection("FACE", "LinearCopy_2_1_8"), model.selection("FACE", "LinearCopy_2_1_1"), model.selection("FACE", "LinearCopy_2_1_2"), model.selection("FACE", "LinearCopy_2_1_3"), model.selection("FACE", "LinearCopy_3_1_4"), model.selection("FACE", "LinearCopy_3_1_3"), model.selection("FACE", "LinearCopy_3_1_2"), model.selection("FACE", "LinearCopy_3_1_1"), model.selection("FACE", "LinearCopy_4_1_1"), model.selection("FACE", "LinearCopy_4_1_2"), model.selection("FACE", "LinearCopy_4_1_3"), model.selection("FACE", "LinearCopy_5_1_1"), model.selection("FACE", "LinearCopy_5_1_2"), model.selection("FACE", "LinearCopy_1_1_8")]
+Shell_1 = model.addShell(Part_1_doc, Shell_1_objects)
+Partition_1_objects = [model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_3_2"), model.selection("FACE", "Face_4_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_3_5"), model.selection("FACE", "Face_3_3"), model.selection("FACE", "Face_3_4"), model.selection("FACE", "Face_3_7"), model.selection("FACE", "Face_3_6"), model.selection("FACE", "Face_3_8"), model.selection("FACE", "Face_3_9"), model.selection("FACE", "Face_3_10"), model.selection("FACE", "Face_3_11"), model.selection("FACE", "Face_3_12"), model.selection("SHELL", "Shell_1_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+model.do()
model.end()
# move groups
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from ModelAPI import *
from GeomAlgoAPI import *
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 60)
SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 90, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 90, 0)
model.do()
aSession = ModelAPI_Session.get()
aSession.setActiveDocument(partSet, False)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchCircle_1 = Sketch_1.addCircle(-9.954190485756755, -75.16051465706819, 60.31858435553394)
+SketchCircle_1 = Sketch_1.addCircle(-9.954190485756754, -75.16051465706819, 60.31858435553394)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1__cc"), False)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]__cc"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchCircle_2 = Sketch_2.addCircle(-9.954190485756755, -75.16051465706819, 33.11263086848982)
+SketchCircle_2 = Sketch_2.addCircle(-9.954190485756754, -75.16051465706819, 33.11263086848982)
SketchConstraintCoincidence_1 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchCircle_2.center())
+model.do()
+model.do()
model.end()
assert(model.checkPythonDump())
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result())
SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 50, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 50, 0)
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchCircle_1 = Sketch_2.addCircle(26.06240015364781, 18.07716886601709, 12.23427461205297)
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face_1"), 0, model.selection(), 0)
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face"), 0, model.selection(), 0)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
model.do()
Folder_1 = model.addFolder(Part_1_doc, Sketch_1, Extrusion_1)
from GeomAPI import GeomAPI_Shape
# check result shape
-model.testNbResults(Boolean_1, 1)
-model.testNbSubResults(Boolean_1, [0])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.SOLID, [1])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.FACE, [7])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.EDGE, [30])
-model.testNbSubShapes(Boolean_1, GeomAPI_Shape.VERTEX, [60])
-model.testResultsVolumes(Boolean_1, [101488.717162133529200218617916107])
+model.testNbResults(Cut_1, 1)
+model.testNbSubResults(Cut_1, [0])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.FACE, [7])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.EDGE, [30])
+model.testNbSubShapes(Cut_1, GeomAPI_Shape.VERTEX, [60])
+model.testResultsVolumes(Cut_1, [101488.717162133529200218617916107])
model.end()
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result())
SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 50, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 50, 0)
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
SketchLine_5 = Sketch_2.addLine(10, 21.9014765990379, 0, 21.9014765990379)
SketchLine_5.setName("SketchLine_9")
model.do()
Sketch_2.setName("Sketch_3")
Sketch_2.result().setName("Sketch_3")
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_9r-SketchLine_11r-SketchLine_12r-SketchLine_13r")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_9r_wire")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchLine_10 = Sketch_3.addLine(29.60939424565112, 0, 19.60939424565112, 0)
SketchLine_10.setName("SketchLine_14")
Sketch_3.setName("Sketch_4")
Sketch_3.result().setName("Sketch_4")
ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), "h", 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Fillet_1_objects = [model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_divided_5_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&Extrusion_1_1/Generated_Face_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_6&ExtrusionCut_2_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_divided_4_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_1_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_1_1/Modfied_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_1&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_6&ExtrusionCut_1_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_divided_4_1&ExtrusionCut_1_1/Modfied_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_1&ExtrusionCut_2_1/Modfied_divided_5_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_divided_5_1&ExtrusionCut_2_1/Modfied_7"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_9")]
+Fillet_1_objects = [model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)]"), model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2]"), model.selection("EDGE", "[(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face]"), model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)]"), model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)]"), model.selection("EDGE", "[(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3]"), model.selection("EDGE", "[(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_9)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)]"), model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)][ExtrusionCut_2_1/Generated_Face&Sketch_4/SketchLine_16&weak_name_2]"), model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)(ExtrusionCut_2_1/Modified_Face&Sketch_3/SketchLine_12)(ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face)][ExtrusionCut_2_1/Generated_Face&Sketch_4/SketchLine_18&weak_name_2]")]
Fillet_1 = model.addFillet(Part_1_doc, Fillet_1_objects, 2)
-Group_1_objects = [model.selection("FACE", "Fillet_1_1/Modified_Face_3"), model.selection("FACE", "Fillet_1_1/Modified_Face_5"), model.selection("FACE", "Fillet_1_1/Modified_Face_9"), model.selection("FACE", "Fillet_1_1/Modified_Face_15")]
+Group_1_objects = [model.selection("FACE", "Fillet_1_1/Modified_Face&Sketch_1/SketchLine_4&weak_name_1"), model.selection("FACE", "Fillet_1_1/Modified_Face&Sketch_1/SketchLine_4&weak_name_4"), model.selection("FACE", "Fillet_1_1/Modified_Face&Sketch_1/SketchLine_4&weak_name_2"), model.selection("FACE", "Fillet_1_1/Modified_Face&Sketch_1/SketchLine_4&weak_name_3")]
Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
-Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "Fillet_1_1/Fillet_Face_13&Fillet_1_1/Modified_Face_4"), model.selection("EDGE", "Fillet_1_1/Modified_Face_11&Fillet_1_1/Fillet_Face_13")])
-Group_3 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "Fillet_1_1/Modified_Face_12&ExtrusionCut_1_1/Generated_Face_4&Fillet_1_1/Modified_Face_11"), model.selection("VERTEX", "ExtrusionCut_1_1/Generated_Face_4&Fillet_1_1/Modified_Face_11&Fillet_1_1/Modified_Face_6")])
+Group_2 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[(Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3)(Fillet_1_1/Modified_Face&Extrusion_1_1/To_Face)][Fillet_1_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "[Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3][(Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3)(Fillet_1_1/Modified_Face&Extrusion_1_1/To_Face)]")])
+Group_3 = model.addGroup(Part_1_doc, [model.selection("VERTEX", "[Fillet_1_1/Modified_Face&Sketch_3/SketchLine_9][ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchLine_13][Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3]"), model.selection("VERTEX", "[ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchLine_13][Fillet_1_1/Modified_Face&Sketch_1/SketchLine_3][Fillet_1_1/Modified_Face&Sketch_3/SketchLine_12]")])
model.do()
Folder_1 = model.addFolder(Part_1_doc, Sketch_3, ExtrusionCut_2)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
model.addParameter(Part_1_doc, "Drill2_DepthMin", "6.5")
model.addParameter(Part_1_doc, "Drill2_DepthMax", "7.5")
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchLine_1 = Sketch_1.addLine(64., 0, 0, 0)
+SketchLine_1 = Sketch_1.addLine(64, 0, 0, 0)
SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.result())
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 36)
SketchLine_5 = Sketch_1.addLine(22, 36, 22, 0)
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_3.result())
-SketchLine_6 = Sketch_1.addLine(32., 36., 32., 0)
+SketchLine_6 = Sketch_1.addLine(32, 36, 32, 0)
SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_6.startPoint(), SketchLine_3.result())
SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_1.result())
SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_1.result())
SketchConstraintDistanceHorizontal_3 = Sketch_1.setHorizontalDistance(SketchLine_6.startPoint(), SketchLine_3.endPoint(), "Width/2")
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s"), True)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_5_StartVertex"), True)
SketchPoint_2 = SketchProjection_2.createdFeature()
+model.do()
+model.do()
model.end()
assert(SketchProjection_2.external().namingName() != "")
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
+
from salome.shaper import model
model.begin()
SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_6.result())
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], "Fillet1")
SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_7.endPoint(), SketchLine_35.result(), "D1_in/2", True)
-SketchConstraintAngle_4 = Sketch_1.setAngleComplementary(SketchLine_23.result(), SketchLine_22.result(), 44.99999999999992)
+SketchConstraintAngle_4 = Sketch_1.setAngleComplementary(SketchLine_23.result(), SketchLine_22.result(), 44.99999999999991)
SketchConstraintCollinear_4 = Sketch_1.setCollinear(SketchLine_14.result(), SketchLine_9.result())
SketchConstraintDistanceHorizontal_4 = Sketch_1.setHorizontalDistance(SketchLine_34.startPoint(), SketchLine_23.startPoint(), "Width/32*11")
SketchConstraintDistanceHorizontal_5 = Sketch_1.setHorizontalDistance(SketchLine_23.startPoint(), SketchLine_22.startPoint(), "Chamfer")
SketchConstraintDistance_11 = Sketch_1.setDistance(SketchLine_23.startPoint(), SketchLine_35.result(), "(D4_out+D2_in)/2", True)
model.do()
Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OX"), 360, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), True)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Sketch_1/SketchPoint_2"), True)
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchPoint_2"), False)
SketchPoint_3 = SketchProjection_3.createdFeature()
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Revolution_1_1/Generated_Face_28"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8])"), False)
SketchLine_36 = SketchProjection_4.createdFeature()
SketchCircle_1 = Sketch_2.addCircle(14.5, 0, 2.25)
SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchPoint_3.result(), SketchCircle_1.center())
SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_1.results()[1], "Drill1_Radius")
model.do()
ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection(), model.selection("FACE", "PartSet/XOZ"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
-Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Generated_Face_14&Revolution_1_1/Generated_Face_15")], "Fillet1")
-Fillet_2_objects = [model.selection("FACE", "Revolution_1_1/Generated_Face_4"), model.selection("FACE", "Revolution_1_1/Generated_Face_6"), model.selection("FACE", "Revolution_1_1/Generated_Face_8"), model.selection("FACE", "Revolution_1_1/Generated_Face_10")]
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20]")], "Fillet1")
+Fillet_2_objects = [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_31"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_29"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_27"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25")]
Fillet_2 = model.addFillet(Part_1_doc, Fillet_2_objects, "Fillet2")
model.do()
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
-from GeomAPI import *
+# -*- coding: utf-8 -*-
from salome.shaper import model
+from GeomAPI import GeomAPI_Shape
model.begin()
partSet = model.moduleDocument()
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
model.do()
-
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 100, 0)
Extrusion_1.result().setName("Cube")
-
-Edge_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"),
- model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"),
- model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"),
- model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"),
- model.selection("EDGE", "Cube/Generated_Face_2&Cube/Generated_Face_1"),
- model.selection("EDGE", "Cube/Generated_Face_2&Cube/From_Face_1"),
- model.selection("EDGE", "Cube/Generated_Face_2&Cube/To_Face_1"),
- model.selection("EDGE", "Cube/Generated_Face_3&Cube/Generated_Face_2"),
- model.selection("EDGE", "Cube/Generated_Face_1&Cube/From_Face_1"),
- model.selection("EDGE", "Cube/Generated_Face_3&Cube/To_Face_1"),
- model.selection("EDGE", "Cube/Generated_Face_3&Cube/From_Face_1"),
- model.selection("EDGE", "Cube/Generated_Face_1&Cube/To_Face_1"),
- model.selection("EDGE", "Cube/Generated_Face_4&Cube/Generated_Face_1"),
- model.selection("EDGE", "Cube/Generated_Face_4&Cube/From_Face_1"),
- model.selection("EDGE", "Cube/Generated_Face_4&Cube/To_Face_1"),
- model.selection("EDGE", "Cube/Generated_Face_4&Cube/Generated_Face_3")]
+Edge_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_2][Cube/Generated_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_2][Cube/From_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_2][Cube/To_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_3][Cube/Generated_Face&Sketch_1/SketchLine_2]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_1][Cube/From_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_3][Cube/To_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_3][Cube/From_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_1][Cube/To_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_4][Cube/Generated_Face&Sketch_1/SketchLine_1]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_4][Cube/From_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_4][Cube/To_Face]"), model.selection("EDGE", "[Cube/Generated_Face&Sketch_1/SketchLine_4][Cube/Generated_Face&Sketch_1/SketchLine_3]")]
Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
# check all the names of Edge_1 results are different
names = set()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchCircle_1 = Sketch_2.addCircle(200, 0, 50)
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection("EDGE", "Cube"), 10, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection("EDGE", "Cube"), 10, 0)
model.do()
# check Extrusion_2
model.testNbResults(Extrusion_2, 1)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 3)
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_7.result(), 8)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_7r")], model.selection(), 5, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), 5, True)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection(), 5, 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"), 5, True)
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_8 = Sketch_2.addLine(7.560741003605092, 9.43062705614625, -1.095841663628257, 9.43062705614625)
SketchLine_9 = Sketch_2.addLine(-1.095841663628257, 9.43062705614625, -1.095841663628257, -5.449377136847041)
SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_10.result())
SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_11.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchLine_11f")])
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("FACE", "Face_1_1")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f-SketchLine_11f")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("FACE", "Face_1_1")])
model.do()
# now add an additional edge to the first sketch as it is described in the issue
SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_8.startPoint())
SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_8.endPoint())
model.do()
-Part_1_doc.setCurrentFeature(Boolean_1.feature(), True)
+Part_1_doc.setCurrentFeature(Fill_1.feature(), True)
model.end()
# check that the plane is located as previously
-model.testNbSubResults(Boolean_1, [2])
-model.testResultsVolumes(Boolean_1, [120])
+model.testNbSubResults(Fill_1, [2])
+model.testResultsVolumes(Fill_1, [120])
assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_8")
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 50)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchLine_3f")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3f-SketchArc_1_2f-SketchLine_1r")], model.selection(), 100, 0)
model.do()
-Solid_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face_3")]
+Solid_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3")]
Solid_1 = model.addSolid(Part_1_doc, Solid_1_objects)
# check that resulting build-solid feature is invalid: only one not-closed face is used
from ModelAPI import *
ModelAPI_Session.get().abortOperation()
# another try: to make a solid with a face inside
model.begin()
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"), 70, True)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"), 70, True)
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_5 = Sketch_2.addLine(14.9039069695087, 8.923908092675951, 26.86805702948195, 11.13714035991706)
SketchLine_6 = Sketch_2.addLine(26.86805702948195, 11.13714035991706, 18.50962242738747, 32.13572332177004)
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_7.endPoint())
SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11")
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5f-SketchLine_6f-SketchLine_7f")])
-Solid_2_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face_2"), model.selection("FACE", "Extrusion_1_1/To_Face_1"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Face_1_1")]
-Solid_2 = model.addSolid(Part_1_doc, Solid_2_objects)
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f")])
+Solid_1_objects = [model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2"), model.selection("FACE", "Extrusion_1_1/To_Face"), model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), model.selection("FACE", "Face_1_1")]
+Solid_1 = model.addSolid(Part_1_doc, Solid_1_objects)
+model.do()
model.end()
-assert(aFactory.validate(Solid_2.feature()) == False)
-
assert(model.checkPythonDump())
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"))
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")])
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"))
SketchCircle_1 = Sketch_2.addCircle(0, -10, 25)
model.do()
-Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")])
Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_1_1")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Face_2_1/Face_2_1"), model.selection("FACE", "Partition_1_1_1")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("COMPOUND", "Partition_1_1")])
model.do()
assert(Group_1.feature().error() == "")
-## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Lesser General Public
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
from salome.shaper import model
SketchLine_7.setAuxiliary(True)
SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_7.startPoint())
SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_7.endPoint())
-SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_7.result(), SketchLine_3.result(), 93.56999999999999)
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_7.result(), SketchLine_3.result(), 93.56999999998719)
SketchArc_2 = Sketch_1.addArc(2.349985665002739, 1.087256027998574, 2.499428733897898, 3.48259875277915, 3.77688682869805, 3.017010693505298, True)
SketchConstraintCoincidence_9 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchArc_2.startPoint())
SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchArc_2.results()[1])
SketchLine_8.result().setName("SketchLine_9")
SketchLine_8.setAuxiliary(True)
SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchArc_2.endPoint(), SketchLine_8.endPoint())
-SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_8.result(), SketchLine_7.result(), 32.91)
+SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_8.result(), SketchLine_7.result(), 32.91000000001281)
SketchConstraintCoincidence_12 = Sketch_1.setCoincident(SketchLine_8.startPoint(), SketchArc_2.center())
SketchLine_9 = Sketch_1.addLine(1.546759218272496, 0.000964964207000808, 4.166514953924199, 2.685528408329715)
SketchLine_9.setName("SketchLine_10")
SketchLine_9.result().setName("SketchLine_10")
SketchLine_9.setAuxiliary(True)
SketchConstraintCoincidence_13 = Sketch_1.setCoincident(SketchArc_3.endPoint(), SketchLine_9.endPoint())
-SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_8.result(), 7.82)
+SketchConstraintAngle_3 = Sketch_1.setAngle(SketchLine_9.result(), SketchLine_8.result(), 7.820000000000003)
SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_9.startPoint(), SketchArc_3.center())
SketchLine_10 = Sketch_1.addLine(4.166514953924199, 2.685528408329715, 4.411514953924289, 2.446442922550623)
SketchLine_10.setName("SketchLine_11")
SketchLine_12.setAuxiliary(True)
SketchConstraintCoincidence_19 = Sketch_1.setCoincident(SketchArc_4.center(), SketchLine_12.startPoint())
SketchConstraintCoincidence_20 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchLine_12.endPoint())
-SketchConstraintAngle_4 = Sketch_1.setAngleBackward(SketchLine_11.result(), SketchLine_12.result(), 8.018000000000001)
+SketchConstraintAngle_4 = Sketch_1.setAngleBackward(SketchLine_11.result(), SketchLine_12.result(), 8.018000000993595)
SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_4.results()[1], 1.32)
SketchArc_5 = Sketch_1.addArc(1.545335047953034, 0, 4.534275383417573, 2.308616054576027, 3.791202568545627, -3.03637143583555, True)
SketchConstraintCoincidence_21 = Sketch_1.setCoincident(SketchArc_4.endPoint(), SketchArc_5.startPoint())
SketchArc_11.setName("SketchArc_14")
SketchArc_11.result().setName("SketchArc_14")
SketchArc_11.results()[1].setName("SketchArc_14_2")
+SketchArc_10.setName("SketchArc_10")
+SketchArc_10.result().setName("SketchArc_10")
+SketchArc_10.results()[1].setName("SketchArc_10_2")
+SketchArc_9.setName("SketchArc_9")
+SketchArc_9.result().setName("SketchArc_9")
+SketchArc_9.results()[1].setName("SketchArc_9_2")
+SketchLine_16.setName("SketchLine_16")
+SketchLine_16.result().setName("SketchLine_16")
+SketchLine_15.setName("SketchLine_15")
+SketchLine_15.result().setName("SketchLine_15")
+SketchLine_14.setName("SketchLine_14")
+SketchLine_14.result().setName("SketchLine_14")
SketchConstraintCoincidence_30 = Sketch_1.setCoincident(SketchArc_7.endPoint(), SketchArc_8.startPoint())
SketchConstraintTangent_9 = Sketch_1.setTangent(SketchArc_7.results()[1], SketchArc_8.results()[1])
SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchLine_5.result(), SketchArc_8.endPoint())
SketchArc_15.result().setName("SketchArc_18")
SketchArc_15.results()[1].setName("SketchArc_18_2")
SketchConstraintCoincidence_42 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchArc_15.startPoint())
-SketchConstraintTangent_12 = Sketch_1.setTangent(SketchArc_14.results()[1], SketchArc_15.results()[1])
+SketchConstraintTangent_11 = Sketch_1.setTangent(SketchArc_14.results()[1], SketchArc_15.results()[1])
SketchArc_16 = Sketch_1.addArc(1.552616124088898, 0, 3.904833906055851, 3.190047534283911, 5.51611606287941, 0, True)
SketchArc_16.setName("SketchArc_19")
SketchArc_16.result().setName("SketchArc_19")
SketchArc_16.results()[1].setName("SketchArc_19_2")
SketchConstraintCoincidence_43 = Sketch_1.setCoincident(SketchArc_15.endPoint(), SketchArc_16.startPoint())
-SketchConstraintTangent_13 = Sketch_1.setTangent(SketchArc_15.results()[1], SketchArc_16.results()[1])
+SketchConstraintTangent_12 = Sketch_1.setTangent(SketchArc_15.results()[1], SketchArc_16.results()[1])
SketchConstraintCoincidence_44 = Sketch_1.setCoincident(SketchLine_5.result(), SketchArc_16.endPoint())
SketchConstraintCoincidence_45 = Sketch_1.setCoincident(SketchArc_14.endPoint(), SketchLine_13.result())
SketchConstraintCoincidence_46 = Sketch_1.setCoincident(SketchArc_14.center(), SketchArc_6.center())
SketchConstraintCoincidence_51 = Sketch_1.setCoincident(SketchLine_21.endPoint(), SketchLine_3.result())
SketchConstraintVertical_5 = Sketch_1.setVertical(SketchLine_20.result())
SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_21.endPoint(), SketchLine_20.result(), 0.03, True)
-SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_20.result(), SketchLine_21.result(), 170)
+SketchConstraintAngle_5 = Sketch_1.setAngle(SketchLine_20.result(), SketchLine_21.result(), 169.9999999984344)
SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_21.endPoint(), SketchLine_19.result(), 0.045, True)
SketchArc_17 = Sketch_1.addArc(2.429999974807022, 2.369762445224826, 1.08, 2.370000000000011, 2.429999974807022, 3.719762440932702, True)
SketchArc_17.setName("SketchArc_23")
SketchArc_23.results()[1].setName("SketchArc_26_2")
SketchLine_23.setName("SketchLine_24")
SketchLine_23.result().setName("SketchLine_24")
+SketchArc_22.setName("SketchArc_22")
+SketchArc_22.result().setName("SketchArc_22")
+SketchArc_22.results()[1].setName("SketchArc_22_2")
+SketchArc_21.setName("SketchArc_21")
+SketchArc_21.result().setName("SketchArc_21")
+SketchArc_21.results()[1].setName("SketchArc_21_2")
+SketchArc_20.setName("SketchArc_20")
+SketchArc_20.result().setName("SketchArc_20")
+SketchArc_20.results()[1].setName("SketchArc_20_2")
SketchLine_22.setName("SketchLine_21")
SketchLine_22.result().setName("SketchLine_21")
SketchConstraintCoincidence_58 = Sketch_1.setCoincident(SketchArc_18.endPoint(), SketchArc_19.startPoint())
SketchLine_31.setAuxiliary(True)
SketchConstraintCoincidence_75 = Sketch_1.setCoincident(SketchArc_1.center(), SketchLine_31.startPoint())
SketchConstraintCoincidence_76 = Sketch_1.setCoincident(SketchLine_31.endPoint(), SketchArc_1.results()[1])
-SketchConstraintAngle_6 = Sketch_1.setAngle(SketchLine_31.result(), SketchLine_3.result(), 59.94)
+SketchConstraintAngle_6 = Sketch_1.setAngle(SketchLine_31.result(), SketchLine_3.result(), 59.93999999988066)
SketchLine_32 = Sketch_1.addLine(1.871489087529827, 3.334796428456965, 1.871489087529827, 3.598813126524882)
SketchLine_32.setName("SketchLine_33")
SketchLine_32.result().setName("SketchLine_33")
SketchConstraintCoincidence_81 = Sketch_1.setCoincident(SketchLine_33.startPoint(), SketchLine_32.result())
SketchConstraintVertical_7 = Sketch_1.setVertical(SketchLine_33.result())
model.do()
-Extrusion_1_objects = [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2f-SketchArc_1_2r-SketchLine_5f-SketchArc_11_2f-SketchLine_14r-SketchLine_15f-SketchLine_16r-SketchArc_9_2f-SketchArc_15_2r-SketchLine_33f-SketchLine_34r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_12_2f-SketchArc_13_2f-SketchArc_10_2f-SketchArc_14_2f-SketchArc_16_2r-SketchLine_29f-SketchLine_30r"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_20f-SketchArc_17_2r-SketchLine_21r-SketchArc_20_2r-SketchLine_22r-SketchLine_23r-SketchArc_23_2f-SketchLine_24f-SketchArc_27_2f-SketchLine_25f-SketchLine_33f-SketchLine_34r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_18_2r-SketchArc_19_2r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_24_2f-SketchArc_25_2f-SketchArc_26_2f-SketchArc_28_2f-SketchLine_28f-SketchLine_31f"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_17_2r-SketchArc_23_2f-SketchLine_28r-SketchLine_33r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_11_2f-SketchLine_29r-SketchLine_33r"), model.selection("FACE", "Sketch_1/Face-SketchArc_9_2f-SketchArc_15_2r-SketchLine_30f-SketchLine_34f"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_20_2r-SketchArc_27_2f-SketchLine_31r-SketchLine_34f")]
+Extrusion_1_objects = [model.selection("WIRE", "Sketch_1/Face-SketchLine_5f-SketchArc_1_2r-SketchLine_33f-SketchArc_11_2f-SketchLine_2f-SketchLine_14r-SketchArc_9_2f-SketchLine_34r-SketchArc_15_2r-SketchLine_16r-SketchLine_15f-SketchLine_1r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_16_2r-SketchLine_30r-SketchArc_10_2f-SketchArc_14_2f-SketchArc_13_2f-SketchArc_12_2f-SketchLine_29f-SketchArc_1_2r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchLine_20f-SketchArc_17_2r-SketchLine_33f-SketchArc_23_2f-SketchLine_23r-SketchLine_22r-SketchLine_24f-SketchLine_25f-SketchArc_27_2f-SketchLine_34r-SketchArc_20_2r-SketchLine_21r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchArc_19_2r-SketchArc_22_2r-SketchArc_21_2r-SketchLine_31f-SketchArc_28_2f-SketchArc_26_2f-SketchArc_25_2f-SketchArc_24_2f-SketchLine_28f-SketchArc_18_2r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchLine_28r-SketchArc_23_2f-SketchLine_33r-SketchArc_17_2r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchLine_29r-SketchArc_11_2f-SketchLine_33r-SketchArc_1_2r_wire"), model.selection("FACE", "Sketch_1/Face-SketchArc_9_2f-SketchLine_30f-SketchArc_15_2r-SketchLine_34f"), model.selection("WIRE", "Sketch_1/Face-SketchLine_34f-SketchArc_27_2f-SketchLine_31r-SketchArc_20_2r_wire")]
Extrusion_1 = model.addExtrusion(Part_1_doc, Extrusion_1_objects, model.selection(), 0.1785, 0.1785)
-Extrusion_2_objects = [model.selection("WIRE", "Sketch_1/Wire-SketchArc_12_2r-SketchArc_13_2r-SketchArc_10_2r-SketchArc_14_2r-SketchArc_18_2f-SketchArc_19_2f-SketchArc_21_2f-SketchArc_22_2f-SketchLine_26f-SketchLine_27r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_12_2f-SketchArc_13_2f-SketchArc_10_2f-SketchArc_14_2f-SketchArc_16_2r-SketchLine_29f-SketchLine_30r"), model.selection("FACE", "Sketch_1/Face-SketchArc_18_2r-SketchArc_19_2r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_24_2f-SketchArc_25_2f-SketchArc_26_2f-SketchArc_28_2f-SketchLine_28f-SketchLine_31f")]
-Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection(), model.selection("FACE", "Extrusion_1_2/From_Face_2"), -0.05, model.selection("FACE", "Extrusion_1_2/From_Face_2"), 0)
-Extrusion_3_objects = [model.selection("FACE", "Sketch_1/Face-SketchArc_12_2r-SketchArc_13_2r-SketchArc_10_2r-SketchArc_14_2r-SketchArc_18_2f-SketchArc_19_2f-SketchArc_21_2f-SketchArc_22_2f-SketchLine_26f-SketchLine_27r"), model.selection("FACE", "Sketch_1/Face-SketchArc_18_2r-SketchArc_19_2r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_24_2f-SketchArc_25_2f-SketchArc_26_2f-SketchArc_28_2f-SketchLine_28f-SketchLine_31f"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_12_2f-SketchArc_13_2f-SketchArc_10_2f-SketchArc_14_2f-SketchArc_16_2r-SketchLine_29f-SketchLine_30r")]
-Extrusion_3 = model.addExtrusion(Part_1_doc, Extrusion_3_objects, model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face_1"), 0.05, model.selection("FACE", "Extrusion_1_2/To_Face_1"), 0)
-Extrusion_4_objects = [model.selection("FACE", "Sketch_1/Face-SketchArc_17_2r-SketchArc_23_2f-SketchLine_28r-SketchLine_33r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2r-SketchArc_11_2f-SketchLine_29r-SketchLine_33r"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_11_2r-SketchArc_17_2f-SketchLine_27f-SketchLine_33r"), model.selection("FACE", "Sketch_1/Face-SketchArc_20_2r-SketchArc_27_2f-SketchLine_31r-SketchLine_34f"), model.selection("FACE", "Sketch_1/Face-SketchArc_9_2r-SketchArc_20_2f-SketchLine_26r-SketchLine_34f"), model.selection("WIRE", "Sketch_1/Wire-SketchArc_9_2f-SketchArc_15_2r-SketchLine_30f-SketchLine_34f")]
-Extrusion_4 = model.addExtrusion(Part_1_doc, Extrusion_4_objects, model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face_2"), 0.15, model.selection("FACE", "Extrusion_1_1/To_Face_2"), 0)
+Extrusion_2_objects = [model.selection("WIRE", "Sketch_1/Face-SketchArc_13_2r-SketchArc_14_2r-SketchArc_10_2r-SketchLine_26f-SketchArc_21_2f-SketchArc_22_2f-SketchArc_19_2f-SketchArc_18_2f-SketchLine_27r-SketchArc_12_2r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_16_2r-SketchLine_30r-SketchArc_10_2f-SketchArc_14_2f-SketchArc_13_2f-SketchArc_12_2f-SketchLine_29f-SketchArc_1_2r_wire"), model.selection("FACE", "Sketch_1/Face-SketchArc_19_2r-SketchArc_22_2r-SketchArc_21_2r-SketchLine_31f-SketchArc_28_2f-SketchArc_26_2f-SketchArc_25_2f-SketchArc_24_2f-SketchLine_28f-SketchArc_18_2r")]
+Extrusion_2 = model.addExtrusion(Part_1_doc, Extrusion_2_objects, model.selection(), model.selection("FACE", "Extrusion_1_2_2/From_Face"), -0.05, model.selection("FACE", "Extrusion_1_2_2/From_Face"), 0)
+Extrusion_3_objects = [model.selection("FACE", "Sketch_1/Face-SketchArc_13_2r-SketchArc_14_2r-SketchArc_10_2r-SketchLine_26f-SketchArc_21_2f-SketchArc_22_2f-SketchArc_19_2f-SketchArc_18_2f-SketchLine_27r-SketchArc_12_2r"), model.selection("FACE", "Sketch_1/Face-SketchArc_19_2r-SketchArc_22_2r-SketchArc_21_2r-SketchLine_31f-SketchArc_28_2f-SketchArc_26_2f-SketchArc_25_2f-SketchArc_24_2f-SketchLine_28f-SketchArc_18_2r"), model.selection("WIRE", "Sketch_1/Face-SketchArc_2_2r-SketchArc_3_2r-SketchLine_11f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_16_2r-SketchLine_30r-SketchArc_10_2f-SketchArc_14_2f-SketchArc_13_2f-SketchArc_12_2f-SketchLine_29f-SketchArc_1_2r_wire")]
+Extrusion_3 = model.addExtrusion(Part_1_doc, Extrusion_3_objects, model.selection(), model.selection("FACE", "Extrusion_1_1_1/To_Face"), 0.05, model.selection("FACE", "Extrusion_1_2_1/To_Face"), 0)
+Extrusion_4_objects = [model.selection("FACE", "Sketch_1/Face-SketchLine_28r-SketchArc_23_2f-SketchLine_33r-SketchArc_17_2r"), model.selection("WIRE", "Sketch_1/Face-SketchLine_29r-SketchArc_11_2f-SketchLine_33r-SketchArc_1_2r_wire"), model.selection("WIRE", "Sketch_1/Face-SketchLine_27f-SketchArc_17_2f-SketchLine_33r-SketchArc_11_2r_wire"), model.selection("FACE", "Sketch_1/Face-SketchLine_34f-SketchArc_27_2f-SketchLine_31r-SketchArc_20_2r"), model.selection("FACE", "Sketch_1/Face-SketchLine_34f-SketchArc_20_2f-SketchLine_26r-SketchArc_9_2r"), model.selection("WIRE", "Sketch_1/Face-SketchArc_9_2f-SketchLine_30f-SketchArc_15_2r-SketchLine_34f_wire")]
+Extrusion_4 = model.addExtrusion(Part_1_doc, Extrusion_4_objects, model.selection(), model.selection("FACE", "Extrusion_1_1_2/To_Face"), 0.15, model.selection("FACE", "Extrusion_1_1_2/To_Face"), 0)
Extrusion_4.setName("Extrusion_6")
Extrusion_4.result().setName("Extrusion_6_1")
Extrusion_4.result().subResult(0).setName("Extrusion_6_1_1")
Extrusion_4.results()[1].subResult(0).setName("Extrusion_6_2_1")
Extrusion_4.results()[1].subResult(1).setName("Extrusion_6_2_2")
Extrusion_4.results()[1].subResult(2).setName("Extrusion_6_2_3")
-Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Extrusion_3_1/To_Face_3&Extrusion_3_1/Generated_Face_10&Extrusion_3_1/Generated_Face_11"), model.selection("VERTEX", "Extrusion_6_1/To_Face_1&Extrusion_6_1/Generated_Face_9&Extrusion_6_1/Generated_Face_8"))
-Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Extrusion_6_1/Generated_Face_3&Extrusion_6_1/To_Face_3&Extrusion_6_1/Generated_Face_4"), False)
+Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "[Extrusion_3_1_3/To_Face][Extrusion_3_1_3/Generated_Face&Sketch_1/SketchLine_28][Extrusion_3_1_3/Generated_Face&Sketch_1/SketchArc_24_2]"), model.selection("VERTEX", "[Extrusion_6_1_1/To_Face][Extrusion_6_1_1/Generated_Face&Sketch_1/SketchArc_23_2][Extrusion_6_1_1/Generated_Face&Sketch_1/SketchLine_33]"))
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "[Extrusion_6_1_3/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_6_1_3/To_Face][Extrusion_6_1_3/Generated_Face&Sketch_1/SketchLine_33]"), False)
Partition_1_objects = [model.selection("COMPSOLID", "Extrusion_6_1"), model.selection("FACE", "Plane_1"), model.selection("COMPSOLID", "Extrusion_6_2")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+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"))
+SketchCircle_1 = Sketch_1.addCircle(22, 5, 10)
+SketchCircle_2 = Sketch_1.addCircle(0, 0, 7.5)
+SketchCircle_3 = Sketch_1.addCircle(29, -20, 7.5)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin", 1), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchAPI_Point(SketchPoint_1).coordinates())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_1 = SketchProjection_2.createdFeature()
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_1.result(), 22, True)
+SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_2 = SketchProjection_3.createdFeature()
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchCircle_1.center(), SketchLine_2.result(), 5, True)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10)
+SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_2.results()[1], 7.5)
+SketchConstraintRadius_3 = Sketch_1.setRadius(SketchCircle_3.results()[1], 7.5)
+SketchLine_3 = Sketch_1.addLine(22, 5, 22, 41.96787958115183)
+SketchLine_3.setAuxiliary(True)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_3.startPoint())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchCircle_3.center(), SketchLine_3.result(), 7, True)
+SketchConstraintDistance_4 = Sketch_1.setDistance(SketchCircle_3.center(), SketchLine_2.result(), 20, True)
+SketchArc_1 = Sketch_1.addArc(22, 5, 19.39053135678072, 27.42761377547613, 44.57891020979248, 5, True)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchArc_1.center())
+SketchLine_4 = Sketch_1.addLine(22, 5, 85.59353403141361, 5)
+SketchLine_4.setAuxiliary(True)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchCircle_1.center(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result())
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_4.result())
+SketchLine_5 = Sketch_1.addLine(44.57891020979248, 5, 44.57891020979248, -20)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_5.startPoint())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_5.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_5.result(), 25)
+model.end()
+
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_WEAK))
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+# a wire selection: container of intersections (edges are intesection of faces)
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "[[Box_1_1/Left][Box_1_1/Bottom]][[Box_1_1/Front][Box_1_1/Left]][[Box_1_1/Left][Box_1_1/Top]][[Box_1_1/Back][Box_1_1/Left]]")])
+model.end()
+
+assert(model.checkPythonDump())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
from salome.shaper import model
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 70)
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 50)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0)
Extrusion_1.result().setName("box")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r"))
SketchLine_5 = Sketch_2.addLine(10, 55, 50, 55)
SketchLine_6 = Sketch_2.addLine(50, 55, 50, -5)
SketchLine_7 = Sketch_2.addLine(50, -5, 10, -5)
SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_8.result(), 60)
SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_7.result(), 40)
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")], model.selection(), 15, 5)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r")], model.selection(), 15, 5)
Extrusion_2.result().setName("tool")
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "box")], [model.selection("SOLID", "tool")])
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "box")], [model.selection("SOLID", "tool")])
model.do()
-assert(Boolean_1.result().name() == Extrusion_1.result().name()), "Boolean CUT name '{}' != '{}'".format(Boolean_1.result().name(), Extrusion_1.result().name())
+assert(Cut_1.result().name() == Extrusion_1.result().name()), "Boolean CUT name '{}' != '{}'".format(Cut_1.result().name(), Extrusion_1.result().name())
model.end()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Box_1.result().setName("plate")
Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "plate/Front"), 50, True)
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "plate/Left"), 50, True)
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "plate"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")])
-#Partition_1.result().setName("plate")
+Partition_1_objects = [model.selection("SOLID", "plate"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
Partition_1.result().subResult(0).setName("Partition_1_1_1")
Partition_1.result().subResult(1).setName("top_left")
Partition_1.result().subResult(2).setName("bottom_right")
Partition_1.result().subResult(3).setName("Partition_1_1_4")
-Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Partition_1_1_1/Modified_Face_3_3"))
-SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "Partition_1_1_1/Modified_Face_3_3&top_left/Modified_Face_3_1&bottom_right/Modified_Face_3_2"), False)
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Partition_1_1_1/Modified_Face&_plate/Top"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Partition_1_1_1/Modified_Face&_plate/Top][Partition_1_1_1/Modified_Face&Plane_2/Plane_2][Partition_1_1_1/Modified_Face&Plane_1/Plane_1]"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchCircle_1 = Sketch_1.addCircle(50, 50, 40)
SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 40)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection(), 10, model.selection("FACE", "Partition_1_1_1/Modified_Face_3_4"), 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection(), 10, model.selection("FACE", "Partition_1_1_1/Modified_Face&_plate/Bottom"), 10)
Extrusion_1.result().setName("cylinder")
-Boolean_1 = model.addCommon(Part_1_doc, [model.selection("COMPSOLID", "plate")], [model.selection("SOLID", "cylinder")])
+Common_1 = model.addCommon(Part_1_doc, [model.selection("COMPSOLID", "plate")], [model.selection("SOLID", "cylinder")])
model.do()
# check the name of result is kept
-CommonResult = Boolean_1.result()
+CommonResult = Common_1.result()
CommonResultName = CommonResult.name()
assert(CommonResultName == Partition_1.result().name()), "Name of Boolean COMMON result '{}' != '{}'".format(CommonResultName, Partition_1.result().name())
# check sub-result names are lost
-BooleanName = Boolean_1.name() + "_1"
+BooleanName = Common_1.name() + "_1"
for i in range(0, CommonResult.numberOfSubs()):
refName = BooleanName + '_' + str(i + 1)
subResult = CommonResult.subResult(i)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
from salome.shaper import model
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(80, 0, 0, 0)
SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 0)
Extrusion_1.result().setName("compsolid")
-
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "compsolid/Generated_Face_5"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_5"))
SketchCircle_1 = Sketch_2.addCircle(65, -30, 10)
SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "compsolid/Generated_Face_5&compsolid/Generated_Face_4&compsolid/To_Face_3"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1_3/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1_3/To_Face]"), False)
SketchPoint_2 = SketchProjection_2.createdFeature()
SketchConstraintDistanceVertical_3 = Sketch_2.setVerticalDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_1.center(), 20)
SketchConstraintDistanceHorizontal_2 = Sketch_2.setHorizontalDistance(SketchCircle_1.center(), SketchAPI_Point(SketchPoint_2).coordinates(), 15)
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection(), model.selection(), 10, model.selection("FACE", "compsolid/Generated_Face_1"), 10)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), model.selection(), 10, model.selection("FACE", "Extrusion_1_1_4/Generated_Face&Sketch_1/SketchLine_3"), 10)
Extrusion_2.result().setName("cyl")
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3")], [model.selection("SOLID", "cyl")])
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1_3")], [model.selection("SOLID", "cyl")])
model.do()
# check the name of Extrusion_1 is kept
-CutResult = Boolean_1.result()
+CutResult = Cut_1.result()
CutResultName = CutResult.name()
assert(CutResultName == Extrusion_1.result().name()), "Name of Boolean CUT result '{}' != '{}'".format(CutResultName, Extrusion_1.result().name())
# check sub-result names are lost
-BooleanName = Boolean_1.name() + "_1"
+BooleanName = Cut_1.name() + "_1"
for i in range(0, CutResult.numberOfSubs()):
refName = BooleanName + '_' + str(i + 1)
subResult = CutResult.subResult(i)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
from salome.shaper import model
SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_5.endPoint(), SketchLine_2.startPoint(), 30)
SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_5.endPoint(), SketchLine_2.startPoint(), 15)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0)
Extrusion_1.result().setName("box")
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r")], model.selection(), 20, 20)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_6r-SketchLine_5r")], model.selection(), 20, 20)
Extrusion_2.result().setName("prism")
Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0)
Extrusion_3.result().setName("cylinder")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "box/From_Face_1"))
-SketchLine_8 = Sketch_2.addLine(45, 30, 25, 30)
-SketchLine_9 = Sketch_2.addLine(25, 30, 25, -100)
-SketchLine_10 = Sketch_2.addLine(25, -100, 45, -100)
-SketchLine_11 = Sketch_2.addLine(45, -100, 45, 30)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "box/From_Face"))
+SketchLine_8 = Sketch_2.addLine(45, -10, 25, -10)
+SketchLine_9 = Sketch_2.addLine(25, -10, 25, -140)
+SketchLine_10 = Sketch_2.addLine(25, -140, 45, -140)
+SketchLine_11 = Sketch_2.addLine(45, -140, 45, -10)
SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_8.startPoint())
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_11.result())
SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_10.result(), 20)
SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_9.result(), 130)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "box/Generated_Face_3&box/Generated_Face_2&box/From_Face_1"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[box/Generated_Face&Sketch_1/SketchLine_3][box/Generated_Face&Sketch_1/SketchLine_2][box/From_Face]"), False)
SketchPoint_2 = SketchProjection_2.createdFeature()
SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchLine_8.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), 30)
SketchConstraintDistanceHorizontal_3 = Sketch_2.setHorizontalDistance(SketchLine_8.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates(), 25)
model.do()
-Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchLine_11f")], model.selection(), 5, 15)
+Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f-SketchLine_11f")], model.selection(), 5, 15)
Extrusion_4.result().setName("cut_tool")
-Boolean_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "box"), model.selection("SOLID", "prism"), model.selection("SOLID", "cylinder")], [model.selection("SOLID", "cut_tool")])
+Cut_1_objects_1 = [model.selection("SOLID", "box"), model.selection("SOLID", "prism"), model.selection("SOLID", "cylinder")]
+Cut_1 = model.addCut(Part_1_doc, Cut_1_objects_1, [model.selection("SOLID", "cut_tool")])
model.do()
Extrusions = [Extrusion_1, Extrusion_2, Extrusion_3]
-BooleanResults = Boolean_1.results()
+BooleanResults = Cut_1.results()
for i in range(len(BooleanResults)):
assert(BooleanResults[i].name() == Extrusions[i].result().name()), "Name of result {} of Boolean CUT '{}' != '{}'".format(i, BooleanResults[i].name(), Extrusions[i].result().name())
- BooleanName = Boolean_1.name() + "_" + str(i + 1)
+ BooleanName = Cut_1.name() + "_" + str(i + 1)
for sub in range(0, BooleanResults[i].numberOfSubs()):
refName = BooleanName + '_' + str(sub + 1)
subResult = BooleanResults[i].subResult(sub)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_3.result())
SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_3.result(), SketchLine_1.result())
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")])
+Face_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_3")]
+Face_1 = model.addFace(Part_1_doc, Face_1_objects)
Face_1.result().setName("triangle")
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "triangle")], model.selection(), 10, 0)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 50)
SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_2.result(), SketchLine_1.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 20, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 20, 0)
Extrusion_1.result().setName("plate")
ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, [model.selection("SOLID", "plate")])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "plate/To_Face_1"))
-SketchCircle_1 = Sketch_2.addCircle(30, 35, 10)
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "plate/Generated_Face_4&plate/To_Face_1"), False)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "plate/To_Face"))
+SketchCircle_1 = Sketch_2.addCircle(30.00000000000001, 15, 10)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[plate/Generated_Face&Sketch_1/SketchLine_4][plate/To_Face]"), False)
SketchLine_5 = SketchProjection_2.createdFeature()
SketchConstraintDistance_1 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_5.result(), 20, True)
-SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "plate/Generated_Face_1&plate/To_Face_1"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("EDGE", "[plate/Generated_Face&Sketch_1/SketchLine_1][plate/To_Face]"), False)
SketchLine_6 = SketchProjection_3.createdFeature()
SketchConstraintDistance_2 = Sketch_2.setDistance(SketchCircle_1.center(), SketchLine_6.result(), 15, True)
SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_1.results()[1], 10)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "box/Front"))
SketchCircle_1 = Sketch_1.addCircle(7, 6, 2)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
Face_1.result().setName("circle")
ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "circle")], model.selection(), 0, 3, [model.selection("SOLID", "box")])
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
from ModelAPI import *
Part_1_doc = Part_1.document()
Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
Cylinder_1.result().setName("cylinder")
-MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "cylinder")], model.selection("EDGE", "cylinder/Face_1"), 10, NB_COPIES)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "cylinder")], model.selection("EDGE", "([cylinder/Face_1][cylinder/Face_2])([cylinder/Face_1][cylinder/Face_3])"), 10, NB_COPIES)
model.do()
-TransResult = MultiTranslation_1.result()
+TransResult = LinearCopy_1.result()
TransResultName = TransResult.name()
assert(TransResultName == Cylinder_1.result().name()), "MultiTranslation name '{}' != '{}'".format(TransResultName, Cylinder_1.result().name())
# check sub-result names
assert(NB_COPIES == TransResult.numberOfSubs()), "Number of results {} is not equal to reference {}".format(TransResult.numberOfSubs(), NB_COPIES)
-MultiTranslationName = MultiTranslation_1.name() + "_1"
+MultiTranslationName = LinearCopy_1.name() + "_1"
for i in range(0, NB_COPIES):
refName = MultiTranslationName + '_' + str(i + 1)
subResult = TransResult.subResult(i)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_3.endPoint())
SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_1.result())
SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_2.result(), SketchLine_3.result())
-SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_3.result(), 30)
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_3.result(), 30.00000000000014)
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 60)
SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
SketchLine_4 = SketchProjection_1.createdFeature()
[SketchLine_5, SketchLine_6, SketchLine_7] = SketchConstraintMirror_1.mirrored()
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_4.result(), 30, True)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f")], model.selection(), 20, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f")], model.selection(), 20, 0)
Extrusion_1.result().setName("prism")
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_7r-SketchLine_5r")], model.selection("EDGE", "Sketch_1/SketchLine_6"), 360, 0)
Revolution_1.result().setName("spinner")
-Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "spinner")], model.selection("VERTEX", "spinner/Lateral_6&spinner/Base_Edge_10"), model.selection("FACE", "prism/Generated_Face_2"), False, True)
+Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "spinner")], model.selection("VERTEX", "[spinner/Generated_Face&Sketch_1/SketchLine_7][spinner/Generated_Face&Sketch_1/SketchLine_5]"), model.selection("FACE", "prism/Generated_Face&Sketch_1/SketchLine_2"), False, True)
model.do()
assert(Placement_1.result().name() == Revolution_1.result().name()), "Placement name '{}' != '{}'".format(Placement_1.result().name(), Revolution_1.result().name())
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 5)
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_1.endPoint(), 8, True)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchArc_2_2f")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchArc_2_2f")], model.selection(), 10, 0)
Extrusion_1.result().setName("prism")
Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "prism"), model.selection("SOLID", "cylinder")], model.selection("EDGE", "PartSet/OX"), 30)
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from salome.shaper import model
model.begin()
Part_1_doc = Part_1.document()
Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
Cylinder_1.result().setName("cylinder")
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "cylinder")], model.selection("EDGE", "cylinder/Face_1"), 20)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "cylinder")], model.selection("EDGE", "([cylinder/Face_1][cylinder/Face_2])([cylinder/Face_1][cylinder/Face_3])"), 20)
model.do()
assert(Translation_1.result().name() == Cylinder_1.result().name()), "Translation name '{}' != '{}'".format(Translation_1.result().name(), Cylinder_1.result().name())
SketchConstraintDistance_2 = Sketch_2.setDistance(SketchLine_2.result(), SketchCircle_4.center(), 5, True)
SketchConstraintDistanceHorizontal_1 = Sketch_2.setHorizontalDistance(SketchAPI_Line(SketchLine_2).startPoint(), SketchCircle_4.center(), 25)
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
Cut_1 = model.addCut(Part_1_doc, [model.selection("COMPOUND", "all-in-Extrusion_1")], [model.selection("COMPOUND", "all-in-Revolution_1")])
model.do()
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
-__updated__ = "2018-01-16"
+# -*- coding: utf-8 -*-
from salome.shaper import model
SketchConstraintParallel_2 = Sketch_1.setParallel(SketchLine_2.result(), SketchLine_4.result())
SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 50, 0)
-Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1")], 2)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 50, 0)
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]")], 2)
model.do()
Folder_1 = model.addFolder(Part_1_doc, Sketch_1, Extrusion_1)
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+param_p = model.addParameter(Part_1_doc, "p", "5")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(0, 0, 0, 30.0000000000845)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OY"), False)
+SketchLine_2 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.result())
+SketchLine_3 = Sketch_1.addLine(0, 30.0000000000845, 30.00000000002328, 30.00000000002326)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(30.00000000002328, 30.00000000002326, 29.99999999996195, 0)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "PartSet/OX"), False)
+SketchLine_5 = SketchProjection_3.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.result())
+SketchLine_6 = Sketch_1.addLine(29.99999999996195, 0, 0, 0)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_6.endPoint())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_3.result(), 30)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), 30)
+SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_4.result(), SketchLine_3.result())
+SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_4.result(), SketchLine_1.result())
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection(), 30, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_4r-SketchLine_3r-SketchLine_1r"))
+SketchLine_7 = Sketch_2.addLine(20, 7, 10, 7)
+SketchLine_8 = Sketch_2.addLine(10, 7, 10, 0)
+SketchLine_9 = Sketch_2.addLine(10, 0, 20, 0)
+SketchLine_10 = Sketch_2.addLine(20, 0, 20, 7)
+SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_1 = Sketch_2.setVertical(SketchLine_8.result())
+SketchConstraintHorizontal_2 = Sketch_2.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_2 = Sketch_2.setVertical(SketchLine_10.result())
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_6"), False)
+SketchLine_11 = SketchProjection_4.createdFeature()
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_11.result())
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_11).endPoint(), SketchLine_8.endPoint(), 10, True)
+SketchConstraintLength_3 = Sketch_2.setLength(SketchLine_9.result(), 10)
+SketchConstraintLength_4 = Sketch_2.setLength(SketchLine_8.result(), 7)
+model.do()
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_7r-SketchLine_8f-SketchLine_9f-SketchLine_10f_wire")], model.selection(), "p", 0, [model.selection("SOLID", "Extrusion_1_1")])
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]")], 3)
+model.do()
+# increase the extrusion-cut heigh to make face of a box divided into two
+param_p.setValue(30);
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Fillet_1.feature()))
+model.do()
+# set the value back and check again
+param_p.setValue(5);
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Fillet_1.feature()))
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 15, 15, 15)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), 5, True)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Bottom"), 10, True)
+Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), 5, True)
+Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Back"), 10, True)
+Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), 5, True)
+Plane_9 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), 10, True)
+Partition_1_objects = [model.selection("SOLID", "Box_1_1"), model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_5"), model.selection("FACE", "Plane_6"), model.selection("FACE", "Plane_3"), model.selection("FACE", "Plane_4")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
+Box_2 = model.addBox(Part_1_doc, 2, 2, 10)
+Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("FACE", "Box_2_1/Bottom"), model.selection("FACE", "_weak_name_4_Partition_1_1_14"), False, True)
+model.do()
+# update the selection of the placement
+Placement_1.setEndShape(model.selection("EDGE", "Partition_1_1_5/Generated_Edge&Plane_3/Plane_3&Plane_2/Plane_2"))
+model.end()
+
+# check that placement is valid
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Placement_1.feature()))
+
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+param = model.addParameter(Part_1_doc, "p", "60")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_1.addLine(30, 30, -20, 30)
+SketchLine_2 = Sketch_1.addLine(-20, 30, -20, -20)
+SketchLine_3 = Sketch_1.addLine(-20, -20, 30, -20)
+SketchLine_4 = Sketch_1.addLine(30, -20, 30, 30)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_1.startPoint(), SketchLine_2.startPoint(), 50)
+SketchConstraintDistanceVertical_1 = Sketch_1.setVerticalDistance(SketchLine_4.endPoint(), SketchLine_3.endPoint(), 50)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintDistanceHorizontal_2 = Sketch_1.setHorizontalDistance(SketchLine_2.startPoint(), SketchAPI_Point(SketchPoint_1).coordinates(), 20)
+SketchConstraintDistanceVertical_2 = Sketch_1.setVerticalDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_3.endPoint(), 20)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchLine_5 = Sketch_2.addLine(19.58333333333334, 17.27351642784226, -0.4166666666666646, 17.27351642784226)
+SketchLine_6 = Sketch_2.addLine(-0.4166666666666646, 17.27351642784226, -0.4166666666794808, -42.72648357216971)
+SketchLine_7 = Sketch_2.addLine(-0.4166666666794808, -42.72648357216971, 19.58333333332052, -42.72648357216971)
+SketchLine_8 = Sketch_2.addLine(19.58333333332052, -42.72648357216971, 19.58333333333334, 17.27351642784226)
+SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintHorizontal_3 = Sketch_2.setHorizontal(SketchLine_5.result())
+SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_6.result())
+SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
+SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False)
+SketchPoint_2 = SketchProjection_2.createdFeature()
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_7.startPoint(), 30, True)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), False)
+SketchPoint_3 = SketchProjection_3.createdFeature()
+SketchConstraintDistance_2 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_3).coordinates(), SketchLine_7.endPoint(), 25, True)
+SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_7.result(), 20)
+SketchConstraintLength_2 = Sketch_2.setLength(SketchLine_8.result(), "p")
+model.do()
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), -5, -2)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
+Box_1 = model.addBox(Part_1_doc, 50, 50, 30)
+Placement_1 = model.addPlacement(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("FACE", "Box_1_1/Left"), model.selection("FACE", "Cut_1_1/Modified_Face&Extrusion_1_1/To_Face"), False, True)
+model.do()
+# change parameter to split extrusion top face to two
+param.setValue(100)
+model.end()
+
+# check that placement is valid
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Placement_1.feature()))
+
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+param = model.addParameter(Part_1_doc, "p", "10")
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
+SketchLine_1 = Sketch_1.addLine(6.82842712474619, 7.171572875253809, 2.82842712474619, 7.171572875253809)
+SketchLine_2 = Sketch_1.addLine(2.82842712474619, 7.171572875253809, 2.82842712474619, 3.171572875253809)
+SketchLine_3 = Sketch_1.addLine(2.82842712474619, 3.171572875253809, 6.82842712474619, 3.171572875253809)
+SketchLine_4 = Sketch_1.addLine(6.82842712474619, 3.171572875253809, 6.82842712474619, 7.171572875253809)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchCircle_1 = Sketch_1.addCircle(4.440892098500626e-16, 0, 1)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 4)
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_4.result(), 4)
+SketchLine_5 = Sketch_1.addLine(0, 10, 10, 0)
+SketchLine_5.setAuxiliary(True)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Back][Box_1_1/Right][Box_1_1/Top]"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchPoint_1.result())
+SketchProjection_2 = Sketch_1.addProjection(model.selection("VERTEX", "[Box_1_1/Front][Box_1_1/Left][Box_1_1/Top]"), False)
+SketchPoint_2 = SketchProjection_2.createdFeature()
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchPoint_2.result())
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_5.result(), SketchLine_2.startPoint())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_5.startPoint(), 4, True)
+SketchProjection_3 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), False)
+SketchLine_6 = SketchProjection_3.createdFeature()
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_6.result(), SketchCircle_1.center())
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 1)
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchAPI_Line(SketchLine_6).endPoint(), SketchCircle_1.center(), "p", True)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 1, 1)
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f_wire")], model.selection("EDGE", "[Cut_1_1/Modified_Face&Box_1_1/Left][Cut_1_1/Modified_Face&Box_1_1/Top]"), 45, 0)
+model.do()
+# relocate circle to split the edge - axis of revolution
+param.setValue(5)
+model.end()
+
+# check that revolution is valid
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(Revolution_1.feature()))
+
+assert(model.checkPythonDump(model.ModelHighAPI.CHECK_NAMING))
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+lenParam = model.addParameter(Part_1_doc, "len", "500")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-302.4220649391276, 58.25973730731688, -52.42206493912754, 58.25973730731688)
+SketchLine_2 = Sketch_1.addLine(-52.42206493912754, 58.25973730731688, -52.42206493912754, -61.38418346467283)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(-52.42206493912754, -61.38418346467283, 147.5779350608725, -61.38418346467283)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchLine_4 = Sketch_1.addLine(147.5779350608725, -61.38418346467283, 147.5779350608725, 58.25973730731685)
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchLine_5 = Sketch_1.addLine(147.5779350608725, 58.25973730731685, 297.5779350608724, 58.25973730731685)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchLine_6 = Sketch_1.addLine(297.5779350608724, 58.25973730731685, 297.5779350608724, -192.2459441196271)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchLine_7 = Sketch_1.addLine(297.5779350608724, -192.2459441196271, -302.4220649391276, -192.2459441196271)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchLine_8 = Sketch_1.addLine(-302.4220649391276, -192.2459441196271, -302.4220649391276, 58.25973730731688)
+SketchConstraintCoincidence_7 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
+SketchConstraintCoincidence_8 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_8.endPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_7.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_8.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintVertical_3 = Sketch_1.setVertical(SketchLine_4.result())
+SketchConstraintVertical_4 = Sketch_1.setVertical(SketchLine_6.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_7.result(), 600)
+SketchConstraintHorizontal_3 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_5.result(), SketchLine_1.result())
+SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 250)
+SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 200)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 600, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"))
+SketchLine_9 = Sketch_2.addLine(236.9930310780426, -200, -144.601680073095, -200)
+SketchLine_10 = Sketch_2.addLine(-144.601680073095, -200, -144.601680073095, -500)
+SketchLine_11 = Sketch_2.addLine(-144.601680073095, -500, 236.9930310780426, -500)
+SketchLine_12 = Sketch_2.addLine(236.9930310780426, -500, 236.9930310780426, -200)
+SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_9.startPoint())
+SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
+SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
+SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_11.endPoint(), SketchLine_12.startPoint())
+SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_9.result())
+SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_10.result())
+SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_11.result())
+SketchConstraintVertical_6 = Sketch_2.setVertical(SketchLine_12.result())
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
+SketchLine_13 = SketchProjection_1.createdFeature()
+SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_13.result(), SketchLine_9.endPoint(), 200, True)
+SketchConstraintDistance_2 = Sketch_2.setDistance(SketchLine_10.endPoint(), SketchLine_13.result(), "len", True)
+model.do()
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_10f-SketchLine_11f-SketchLine_12f")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3&weak_name_1"))
+SketchCircle_1 = Sketch_3.addCircle(27.57793506087247, -80, 42.03963933117138)
+SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3&weak_name_1]"), False)
+SketchProjection_2.setName("SketchProjection_3")
+SketchProjection_2.result().setName("SketchProjection_3")
+SketchLine_14 = SketchProjection_2.createdFeature()
+SketchLine_14.setName("SketchLine_15")
+SketchLine_14.result().setName("SketchLine_15")
+SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_14.result(), SketchCircle_1.center(), 80, True)
+SketchConstraintDistance_4.setName("SketchConstraintDistance_4")
+SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "[(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/From_Face)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_9)][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3&weak_name_1]"), False)
+SketchProjection_3.setName("SketchProjection_4")
+SketchProjection_3.result().setName("SketchProjection_4")
+SketchLine_15 = SketchProjection_3.createdFeature()
+SketchLine_15.setName("SketchLine_16")
+SketchLine_15.result().setName("SketchLine_16")
+SketchConstraintDistance_3 = Sketch_3.setDistance(SketchLine_15.result(), SketchCircle_1.center(), 80, True)
+SketchConstraintDistance_3.setName("SketchConstraintDistance_3")
+model.do()
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchCircle_1_2r_wire")], model.selection(), model.selection(), 0, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_7"), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+model.do()
+# update the sketch 2 to make split of a size of a box
+lenParam.setValue(700)
+model.end()
+
+# check that sketch_3 and extrusion are updated well
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(ExtrusionCut_2.feature()))
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from ModelAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Point_2 = model.addPoint(partSet, 1, 2, 3)
+Point_name = Point_2.name()
+model.end()
+
+# check save document in a current folder
+aSession = ModelAPI_Session.get()
+aFiles = StringList()
+aSession.save(".", aFiles)
+assert(len(aFiles) == 1)
+
+# check open of the same document
+assert(aSession.load(".") == False) # error because this document is already opened
+
+# close the current document
+aSession.closeAll()
+
+# open again: it must be correct now
+assert(aSession.load("."))
+
+# check the created point is opened
+partSet = model.moduleDocument()
+assert(partSet.size("Features") == 1)
+assert(partSet.object("Features", 0).data().name() == Point_name)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from GeomAPI import *
from salome.shaper import model
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0)
ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 5, 5, [model.selection("SOLID", "Extrusion_1_1")])
Sketch_2_origin = GeomAPI_Pnt(0, -10, 0)
Sketch_2_norm = GeomAPI_Dir(0, -1, 0)
SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
SketchConstraintLength_1 = Sketch_2.setLength(SketchLine_8.result(), "len")
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), False)
SketchLine_9 = SketchProjection_1.createdFeature()
SketchConstraintDistance_1 = Sketch_2.setDistance(SketchLine_5.startPoint(), SketchLine_9.result(), 20, True)
ExtrusionCut_1.setNestedSketch(Sketch_2)
-Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_1_1/Modfied_1&Extrusion_1_1/Generated_Face_1"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
-Cylinder_2 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_2&Extrusion_1_1/Generated_Face_3&ExtrusionCut_1_1/Modfied_1"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
+Cylinder_2 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face]"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
model.do()
# make sketch_2 cut the whole top face of the initial extrusion, so, one of the cylinder becomes invalid
lenParam.setValue(100)
Part_1_doc.setCurrentFeature(Cylinder_2.feature(), True)
model.do()
# update selection of cylinder base points
-model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_3&Extrusion_1_1/Generated_Face_3&ExtrusionCut_1_1/Modfied_1").fillAttribute(Cylinder_1.basePoint())
-model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_divided_1_1&Extrusion_1_1/Generated_Face_1").fillAttribute(Cylinder_2.basePoint())
+model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_6)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_3)]").fillAttribute(Cylinder_1.basePoint())
+model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face&weak_name_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]").fillAttribute(Cylinder_2.basePoint())
model.end()
# check that both cylinders are valid and have correct results
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+model.do()
+# select a shell of a box : this test checks selection of a shell
+aBoxResult = Box_1.feature().results()[0]
+aShell = GeomAPI_ShapeExplorer(aBoxResult.shape(), GeomAPI_Shape.SHELL)
+aGroup = Part_1_doc.addFeature("Group")
+aGroup.selectionList("group_list").append(aBoxResult, aShell.current())
+model.end()
+
+# check that the resulting group is correct
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+assert(aFactory.validate(aGroup))
+
+assert(model.checkPythonDump())
SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchCircle_2.center())
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_2_2r")], model.selection(), 410, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchCircle_3 = Sketch_2.addCircle(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"))
-SketchCircle_4 = Sketch_2.addCircle(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchCircle_3 = Sketch_2.addCircle(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_2_2][Extrusion_1_1/To_Face]"))
+SketchCircle_4 = Sketch_2.addCircle(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchCircle_1_2][Extrusion_1_1/To_Face]"))
SketchArc_1 = Sketch_2.addArc(-76.31943784014528, 69.61892179185162, 22.73963059863011, 100.7688447087372, -98.26117835861398, -31.87776170424145, False)
SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchCircle_3.results()[1], SketchArc_1.startPoint())
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchCircle_3.results()[1], SketchArc_1.endPoint())
SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchArc_1.results()[1], SketchArc_2.endPoint())
model.do()
ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_1_2f-SketchArc_2_2r")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f-SketchCircle_2_2r"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_1"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face"))
SketchLine_1 = Sketch_3.addLine(72.49453964599654, -117.643151959956, 76.08424302289386, 111.5797586569786)
SketchArc_3 = Sketch_3.addArc(23.82028040531734, -147.9761102212422, 72.49453964599654, -117.643151959956, 29.20403695178628, -205.0750334594096, False)
SketchConstraintCoincidence_9 = Sketch_3.setCoincident(SketchLine_1.startPoint(), SketchArc_3.startPoint())
-SketchProjection_1 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1", 13), False)
+SketchProjection_1 = Sketch_3.addProjection(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchCircle_1_2&weak_name_2]"), False)
SketchArc_4 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_10 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchArc_4.results()[1])
+model.do()
+model.do()
model.end()
from ModelAPI import *
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), 3.65)
SketchConstraintLength_3 = Sketch_1.setLength(SketchLine_3.result(), 4.65)
SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_4.result(), 1.65)
-SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_3.result(), "ep_base")
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_7.startPoint(), SketchLine_3.result(), "ep_base", False)
SketchLine_9 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OX"))
-SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_9.result(), "0.275+ep_voiles/2")
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_9.result(), "0.275+ep_voiles/2", False)
SketchLine_10 = Sketch_1.addLine(model.selection("EDGE", "PartSet/OY"))
-SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_10.result(), "0.325+ep_voiles/2")
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_10.result(), "0.325+ep_voiles/2", False)
SketchConstraintEqual_1 = Sketch_1.setEqual(SketchLine_5.result(), SketchLine_1.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 0, 0.3)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 0, 0.3)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face"))
SketchLine_11 = Sketch_2.addLine(2.26, -2.31, 1.64, -2.31)
SketchLine_12 = Sketch_2.addLine(1.64, -2.31, 1.64, -1.69)
SketchLine_13 = Sketch_2.addLine(1.64, -1.69, 2.26, -1.69)
SketchConstraintLength_5 = Sketch_2.setLength(SketchLine_11.result(), 0.62)
SketchConstraintLength_5.setName("SketchConstraintLength_10")
SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_11.result(), SketchLine_12.result())
-SketchConstraintDistance_4 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_13.result(), "0.11+ep_poteau/2")
+SketchConstraintDistance_4 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_13.result(), "0.11+ep_poteau/2", False)
SketchConstraintDistance_4.setName("SketchConstraintDistance_6")
-SketchConstraintDistance_5 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "0.21+ep_poteau/2")
+SketchConstraintDistance_5 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_12.result(), "0.21+ep_poteau/2", False)
SketchConstraintDistance_5.setName("SketchConstraintDistance_7")
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OX"), False)
SketchLine_15 = SketchProjection_1.createdFeature()
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"))
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "PartSet/OY"), False)
SketchLine_16 = SketchProjection_2.createdFeature()
-SketchConstraintDistance_6 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_15.result(), "1.75+ep_poteau/2+ep_voiles/2")
+SketchConstraintDistance_6 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_15.result(), "1.75+ep_poteau/2+ep_voiles/2", False)
SketchConstraintDistance_6.setName("SketchConstraintDistance_8")
-SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_16.result(), "1.8+ep_poteau/2+ep_voiles/2")
+SketchConstraintDistance_7 = Sketch_2.setDistance(SketchPoint_1.coordinates(), SketchLine_16.result(), "1.8+ep_poteau/2+ep_voiles/2", False)
SketchConstraintDistance_7.setName("SketchConstraintDistance_9")
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11r-SketchLine_12r-SketchLine_13r-SketchLine_14r")], model.selection(), 0, 0.02)
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f"))
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_14r-SketchLine_13r-SketchLine_12r-SketchLine_11r")], model.selection(), 0, 0.02)
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f"))
SketchLine_17 = Sketch_3.addLine(0, 2.950000000000001, 0, 1.700000000000001)
SketchLine_17.setName("SketchLine_15")
SketchLine_17.result().setName("SketchLine_15")
SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OX"))
SketchLine_21.setName("SketchLine_19")
SketchLine_21.result().setName("SketchLine_19")
-#SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_21.result())
-#SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_20.endPoint(), SketchLine_21.result())
SketchLine_22 = Sketch_3.addLine(2.525000000000001, 0, 3.975000000000001, 0)
SketchLine_22.setName("SketchLine_20")
SketchLine_22.result().setName("SketchLine_20")
-SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result())
-SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_21.result())
+SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchLine_21.result())
+SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_21.result())
SketchLine_23 = Sketch_3.addLine(3.975000000000001, 0, 3.975000000000001, 0.95)
SketchLine_23.setName("SketchLine_21")
SketchLine_23.result().setName("SketchLine_21")
-SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
-SketchLine_24 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"))
+SketchConstraintCoincidence_19 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
+SketchLine_24 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"))
SketchLine_24.setName("SketchLine_22")
SketchLine_24.result().setName("SketchLine_22")
SketchConstraintLength_6 = Sketch_3.setLength(SketchLine_17.result(), 1.25)
SketchConstraintLength_6.setName("SketchConstraintLength_5")
-SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.startPoint())
-SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_19.endPoint())
+SketchConstraintCoincidence_20 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchLine_18.startPoint())
+SketchConstraintCoincidence_21 = Sketch_3.setCoincident(SketchLine_20.startPoint(), SketchLine_19.endPoint())
SketchConstraintLength_7 = Sketch_3.setLength(SketchLine_19.result(), "1.25-ep_voiles/2")
SketchConstraintLength_7.setName("SketchConstraintLength_6")
SketchConstraintLength_8 = Sketch_3.setLength(SketchLine_20.result(), "1-ep_voiles/2")
SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_22.result(), "1.5-ep_voiles/2")
SketchConstraintLength_9.setName("SketchConstraintLength_8")
SketchConstraintVertical_7 = Sketch_3.setVertical(SketchLine_23.result())
-SketchLine_25 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"))
+SketchLine_25 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/SketchLine_4"))
SketchLine_25.setName("SketchLine_23")
SketchLine_25.result().setName("SketchLine_23")
-SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_22.endPoint(), SketchLine_25.result(), "0.25+ep_voiles/2")
+SketchConstraintDistance_8 = Sketch_3.setDistance(SketchLine_22.endPoint(), SketchLine_25.result(), "0.25+ep_voiles/2", False)
SketchConstraintDistance_8.setName("SketchConstraintDistance_5")
SketchConstraintLength_10 = Sketch_3.setLength(SketchLine_23.result(), "1-ep_voiles/2")
SketchConstraintLength_10.setName("SketchConstraintLength_9")
-SketchLine_26 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/To_Face_1"))
+SketchLine_26 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"))
SketchLine_26.setName("SketchLine_35")
SketchLine_26.result().setName("SketchLine_35")
-SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_17.startPoint(), SketchLine_26.result(), 0.375)
+SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_17.startPoint(), SketchLine_26.result(), 0.375, False)
SketchConstraintDistance_9.setName("SketchConstraintDistance_12")
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_15"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_17"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_18"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_20"), model.selection("EDGE", "Sketch_3/Edge-SketchLine_21")])
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4"), model.selection("EDGE", "Edge_1_5")], model.selection("EDGE", "PartSet/OZ"), "h_ouverture", 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_3_1/Generated_Edge_2&Extrusion_3_1/To_Edge_1"), model.selection("VERTEX", "Extrusion_3_3/Generated_Edge_2&Extrusion_3_3/To_Edge_1"), model.selection("VERTEX", "Extrusion_3_4/Generated_Edge_1&Extrusion_3_4/To_Edge_1"))
+Edge_1_objects = [model.selection("EDGE", "Sketch_3/SketchLine_15"), model.selection("EDGE", "Sketch_3/SketchLine_17"), model.selection("EDGE", "Sketch_3/SketchLine_18"), model.selection("EDGE", "Sketch_3/SketchLine_20"), model.selection("EDGE", "Sketch_3/SketchLine_21")]
+Edge_1 = model.addEdge(Part_1_doc, Edge_1_objects)
+Extrusion_3_objects = [model.selection("EDGE", "Edge_1_1"), model.selection("EDGE", "Edge_1_2"), model.selection("EDGE", "Edge_1_3"), model.selection("EDGE", "Edge_1_4"), model.selection("EDGE", "Edge_1_5")]
+Extrusion_3 = model.addExtrusion(Part_1_doc, Extrusion_3_objects, model.selection("EDGE", "PartSet/OZ"), "h_ouverture", 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_3_1/Generated_Edge&Sketch_3/SketchLine_15_StartVertex]e[Extrusion_3_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_3_3/Generated_Edge&Sketch_3/SketchLine_18_StartVertex]e[Extrusion_3_3/To_Edge]e"), model.selection("VERTEX", "[Extrusion_3_4/Generated_Edge&Sketch_3/SketchLine_20_EndVertex]e[Extrusion_3_4/To_Edge]e"))
Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_27 = Sketch_4.addLine(0, 2.950000000000001, 0, 0)
SketchLine_27.setName("SketchLine_26")
SketchLine_27.result().setName("SketchLine_26")
-SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "Extrusion_3_1/Generated_Edge_2&Extrusion_3_1/To_Edge_1"))
-SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_27.startPoint(), SketchPoint_2.result())
-SketchPoint_3 = Sketch_4.addPoint(model.selection("VERTEX", "Extrusion_3_3/Generated_Edge_2&Extrusion_3_3/To_Edge_1"))
-SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchPoint_3.result())
+SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "[Extrusion_3_1/Generated_Edge&Sketch_3/SketchLine_15_StartVertex]e[Extrusion_3_1/To_Edge]e"))
+SketchConstraintCoincidence_22 = Sketch_4.setCoincident(SketchLine_27.startPoint(), SketchPoint_2.result())
+SketchPoint_3 = Sketch_4.addPoint(model.selection("VERTEX", "[Extrusion_3_3/Generated_Edge&Sketch_3/SketchLine_18_StartVertex]e[Extrusion_3_3/To_Edge]e"))
+SketchConstraintCoincidence_23 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchPoint_3.result())
SketchLine_28 = Sketch_4.addLine(0, 0, 3.975000000000001, 0)
SketchLine_28.setName("SketchLine_27")
SketchLine_28.result().setName("SketchLine_27")
-SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint())
-SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "Extrusion_3_4/Generated_Edge_1&Extrusion_3_4/To_Edge_1"))
-SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchPoint_4.result())
+SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_27.endPoint(), SketchLine_28.startPoint())
+SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "[Extrusion_3_4/Generated_Edge&Sketch_3/SketchLine_20_EndVertex]e[Extrusion_3_4/To_Edge]e"))
+SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchPoint_4.result())
SketchLine_29 = Sketch_4.addLine(3.975000000000001, 0, 3.975000000000001, 0.95)
SketchLine_29.setName("SketchLine_28")
SketchLine_29.result().setName("SketchLine_28")
-SketchConstraintCoincidence_28 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint())
-SketchPoint_5 = Sketch_4.addPoint(model.selection("VERTEX", "Extrusion_3_5/Generated_Edge_1&Extrusion_3_5/To_Edge_1"))
-SketchConstraintCoincidence_29 = Sketch_4.setCoincident(SketchLine_29.endPoint(), SketchPoint_5.result())
+SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchLine_28.endPoint(), SketchLine_29.startPoint())
+SketchPoint_5 = Sketch_4.addPoint(model.selection("VERTEX", "[Extrusion_3_5/Generated_Edge&Sketch_3/SketchLine_21_EndVertex]e[Extrusion_3_5/To_Edge]e"))
+SketchConstraintCoincidence_27 = Sketch_4.setCoincident(SketchLine_29.endPoint(), SketchPoint_5.result())
model.do()
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/Edge-SketchLine_26"), model.selection("EDGE", "Sketch_4/Edge-SketchLine_27"), model.selection("EDGE", "Sketch_4/Edge-SketchLine_28")])
-Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2"), model.selection("EDGE", "Edge_2_3")], model.selection("EDGE", "PartSet/OZ"), "h_apres_ouverture-ep_dalles/2", 0)
-Plane_5 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_4_1/Generated_Edge_2&Extrusion_4_1/To_Edge_1"), model.selection("VERTEX", "Extrusion_4_1/Generated_Edge_1&Extrusion_4_1/To_Edge_1"), model.selection("VERTEX", "Extrusion_4_2/Generated_Edge_1&Extrusion_4_2/To_Edge_1"))
+Edge_2_objects = [model.selection("EDGE", "Sketch_4/SketchLine_26"), model.selection("EDGE", "Sketch_4/SketchLine_27"), model.selection("EDGE", "Sketch_4/SketchLine_28")]
+Edge_2 = model.addEdge(Part_1_doc, Edge_2_objects)
+Extrusion_4_objects = [model.selection("EDGE", "Edge_2_1"), model.selection("EDGE", "Edge_2_2"), model.selection("EDGE", "Edge_2_3")]
+Extrusion_4 = model.addExtrusion(Part_1_doc, Extrusion_4_objects, model.selection("EDGE", "PartSet/OZ"), "h_apres_ouverture-ep_dalles/2", 0)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[Extrusion_4_1/Generated_Edge&Sketch_4/SketchLine_26_StartVertex]e[Extrusion_4_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_4_1/Generated_Edge&Sketch_4/SketchLine_26_EndVertex]e[Extrusion_4_1/To_Edge]e"), model.selection("VERTEX", "[Extrusion_4_2/Generated_Edge&Sketch_4/SketchLine_27_EndVertex]e[Extrusion_4_2/To_Edge]e"))
Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2"))
SketchLine_30 = Sketch_5.addLine(0, 2.950000000000001, 0, 0)
SketchLine_30.setName("SketchLine_29")
SketchLine_30.result().setName("SketchLine_29")
-SketchPoint_6 = Sketch_5.addPoint(model.selection("VERTEX", "Extrusion_4_1/Generated_Edge_2&Extrusion_4_1/To_Edge_1"))
-SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchPoint_6.result())
-SketchPoint_7 = Sketch_5.addPoint(model.selection("VERTEX", "Extrusion_4_1/Generated_Edge_1&Extrusion_4_1/To_Edge_1"))
-SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchPoint_7.result())
+SketchPoint_6 = Sketch_5.addPoint(model.selection("VERTEX", "[Extrusion_4_1/Generated_Edge&Sketch_4/SketchLine_26_StartVertex]e[Extrusion_4_1/To_Edge]e"))
+SketchConstraintCoincidence_28 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchPoint_6.result())
+SketchPoint_7 = Sketch_5.addPoint(model.selection("VERTEX", "[Extrusion_4_1/Generated_Edge&Sketch_4/SketchLine_26_EndVertex]e[Extrusion_4_1/To_Edge]e"))
+SketchConstraintCoincidence_29 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchPoint_7.result())
SketchLine_31 = Sketch_5.addLine(0, 0, 3.975000000000001, 0)
SketchLine_31.setName("SketchLine_30")
SketchLine_31.result().setName("SketchLine_30")
-SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint())
-SketchPoint_8 = Sketch_5.addPoint(model.selection("VERTEX", "Extrusion_4_2/Generated_Edge_1&Extrusion_4_2/To_Edge_1"))
-SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchPoint_8.result())
+SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchLine_31.startPoint())
+SketchPoint_8 = Sketch_5.addPoint(model.selection("VERTEX", "[Extrusion_4_2/Generated_Edge&Sketch_4/SketchLine_27_EndVertex]e[Extrusion_4_2/To_Edge]e"))
+SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchPoint_8.result())
SketchLine_32 = Sketch_5.addLine(3.975000000000001, 0, 3.975000000000001, 0.95)
SketchLine_32.setName("SketchLine_31")
SketchLine_32.result().setName("SketchLine_31")
-SketchConstraintCoincidence_34 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint())
-SketchPoint_9 = Sketch_5.addPoint(model.selection("VERTEX", "Extrusion_4_3/Generated_Edge_1&Extrusion_4_3/To_Edge_1"))
-SketchConstraintCoincidence_35 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchPoint_9.result())
+SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchLine_31.endPoint(), SketchLine_32.startPoint())
+SketchPoint_9 = Sketch_5.addPoint(model.selection("VERTEX", "[Extrusion_4_3/Generated_Edge&Sketch_4/SketchLine_28_EndVertex]e[Extrusion_4_3/To_Edge]e"))
+SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchPoint_9.result())
SketchLine_33 = Sketch_5.addLine(3.975000000000001, 0.95, 0, 2.950000000000001)
SketchLine_33.setName("SketchLine_32")
SketchLine_33.result().setName("SketchLine_32")
-SketchConstraintCoincidence_36 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint())
-SketchConstraintCoincidence_37 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchLine_33.endPoint())
-SketchConstraintCoincidence_38 = Sketch_5.setCoincident(SketchPoint_6.coordinates(), SketchLine_33.endPoint())
+SketchConstraintCoincidence_34 = Sketch_5.setCoincident(SketchLine_32.endPoint(), SketchLine_33.startPoint())
+SketchConstraintCoincidence_35 = Sketch_5.setCoincident(SketchLine_30.startPoint(), SketchLine_33.endPoint())
+SketchConstraintCoincidence_36 = Sketch_5.setCoincident(SketchPoint_6.coordinates(), SketchLine_33.endPoint())
SketchLine_34 = Sketch_5.addLine(1.85, 2.019182389937107, 1.85, 0)
SketchLine_34.setName("SketchLine_33")
SketchLine_34.result().setName("SketchLine_33")
-SketchConstraintCoincidence_39 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_33.result())
+SketchConstraintCoincidence_37 = Sketch_5.setCoincident(SketchLine_34.startPoint(), SketchLine_33.result())
SketchLine_35 = Sketch_5.addLine(2.075000000000001, 1.905974842767296, 2.075000000000001, 0)
SketchLine_35.setName("SketchLine_34")
SketchLine_35.result().setName("SketchLine_34")
-SketchConstraintCoincidence_40 = Sketch_5.setCoincident(SketchLine_35.startPoint(), SketchLine_33.result())
-SketchConstraintCoincidence_41 = Sketch_5.setCoincident(SketchLine_35.endPoint(), SketchLine_31.result())
-SketchConstraintCoincidence_42 = Sketch_5.setCoincident(SketchLine_34.endPoint(), SketchLine_31.result())
+SketchConstraintCoincidence_38 = Sketch_5.setCoincident(SketchLine_35.startPoint(), SketchLine_33.result())
+SketchConstraintCoincidence_39 = Sketch_5.setCoincident(SketchLine_35.endPoint(), SketchLine_31.result())
+SketchConstraintCoincidence_40 = Sketch_5.setCoincident(SketchLine_34.endPoint(), SketchLine_31.result())
SketchConstraintVertical_8 = Sketch_5.setVertical(SketchLine_34.result())
SketchConstraintVertical_9 = Sketch_5.setVertical(SketchLine_35.result())
-SketchConstraintDistance_10 = Sketch_5.setDistance(SketchLine_34.startPoint(), SketchLine_30.result(), "1.8+ep_voiles/2")
-SketchConstraintDistance_11 = Sketch_5.setDistance(SketchLine_35.startPoint(), SketchLine_32.result(), "1.85+ep_voiles/2")
+SketchConstraintDistance_10 = Sketch_5.setDistance(SketchLine_34.startPoint(), SketchLine_30.result(), "1.8+ep_voiles/2", False)
+SketchConstraintDistance_10.setName("SketchConstraintDistance_10")
+SketchConstraintDistance_11 = Sketch_5.setDistance(SketchLine_35.startPoint(), SketchLine_32.result(), "1.85+ep_voiles/2", False)
+SketchConstraintDistance_11.setName("SketchConstraintDistance_11")
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_29f-SketchLine_30f-SketchLine_32f-SketchLine_33r")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_34f")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_30f-SketchLine_32f-SketchLine_33f-SketchLine_34r")])
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Extrusion_4_3"), model.selection("FACE", "Extrusion_3_3"), model.selection("FACE", "Extrusion_4_2"), model.selection("FACE", "Extrusion_3_5"), model.selection("FACE", "Extrusion_3_4"), model.selection("FACE", "Extrusion_3_2"), model.selection("FACE", "Extrusion_4_1"), model.selection("FACE", "Extrusion_3_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OZ"), "h_ouverture+h_apres_ouverture-ep_dalles/2")
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_29r-SketchLine_30f-SketchLine_33r-SketchLine_32f_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_34f_wire")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_30f-SketchLine_34r-SketchLine_32f-SketchLine_33f_wire")])
+Translation_1_objects = [model.selection("FACE", "Extrusion_4_3"), model.selection("FACE", "Extrusion_3_3"), model.selection("FACE", "Extrusion_4_2"), model.selection("FACE", "Extrusion_3_5"), model.selection("FACE", "Extrusion_3_4"), model.selection("FACE", "Extrusion_3_2"), model.selection("FACE", "Extrusion_4_1"), model.selection("FACE", "Extrusion_3_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_3_1"), model.selection("FACE", "Face_2_1")]
+Translation_1 = model.addTranslation(Part_1_doc, Translation_1_objects, model.selection("EDGE", "PartSet/OZ"), "h_ouverture+h_apres_ouverture-ep_dalles/2")
Recover_1_objects = [Face_2.result(), Face_3.result(), Face_1.result(), Extrusion_3.result(), Extrusion_4.result(), Extrusion_3.results()[1], Extrusion_3.results()[3], Extrusion_3.results()[4], Extrusion_4.results()[1], Extrusion_3.results()[2], Extrusion_4.results()[2]]
Recover_1 = model.addRecover(Part_1_doc, Translation_1, Recover_1_objects)
-Translation_2 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Recover_1_2"), model.selection("FACE", "Recover_1_5"), model.selection("FACE", "Recover_1_3"), model.selection("FACE", "Recover_1_4"), model.selection("FACE", "Recover_1_1"), model.selection("FACE", "Recover_1_6"), model.selection("FACE", "Recover_1_8"), model.selection("FACE", "Recover_1_7"), model.selection("FACE", "Recover_1_11"), model.selection("FACE", "Recover_1_10"), model.selection("FACE", "Recover_1_9")], model.selection("EDGE", "PartSet/OZ"), "2*(h_ouverture+h_apres_ouverture-ep_dalles/2)")
+Translation_2_objects = [model.selection("FACE", "Recover_1_2"), model.selection("FACE", "Recover_1_5"), model.selection("FACE", "Recover_1_3"), model.selection("FACE", "Recover_1_4"), model.selection("FACE", "Recover_1_1"), model.selection("FACE", "Recover_1_6"), model.selection("FACE", "Recover_1_8"), model.selection("FACE", "Recover_1_7"), model.selection("FACE", "Recover_1_11"), model.selection("FACE", "Recover_1_10"), model.selection("FACE", "Recover_1_9")]
+Translation_2 = model.addTranslation(Part_1_doc, Translation_2_objects, model.selection("EDGE", "PartSet/OZ"), "2*(h_ouverture+h_apres_ouverture-ep_dalles/2)")
Recover_2_objects = [Recover_1.results()[8], Recover_1.results()[9], Recover_1.results()[10], Recover_1.results()[6], Recover_1.results()[7], Recover_1.results()[5], Recover_1.result(), Recover_1.results()[3], Recover_1.results()[2], Recover_1.results()[4], Recover_1.results()[1]]
Recover_2 = model.addRecover(Part_1_doc, Translation_2, Recover_2_objects)
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/Vertex-SketchPoint_1")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/SketchPoint_1")])
Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("VERTEX", "Vertex_1_1")], model.selection("EDGE", "PartSet/OZ"), model.selection("FACE", "Translation_2_11"), 0, model.selection(), 0)
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("FACE", "Translation_1_1"), model.selection("FACE", "Translation_1_2"), model.selection("FACE", "Translation_1_3"), model.selection("FACE", "Translation_1_4"), model.selection("FACE", "Translation_1_5"), model.selection("FACE", "Translation_1_6"), model.selection("FACE", "Translation_1_7"), model.selection("FACE", "Translation_1_8"), model.selection("FACE", "Translation_1_9"), model.selection("FACE", "Translation_1_10"), model.selection("FACE", "Translation_1_11"), model.selection("FACE", "Translation_2_1"), model.selection("FACE", "Translation_2_2"), model.selection("FACE", "Translation_2_3"), model.selection("FACE", "Translation_2_4"), model.selection("FACE", "Translation_2_5"), model.selection("FACE", "Translation_2_6"), model.selection("FACE", "Translation_2_7"), model.selection("FACE", "Translation_2_8"), model.selection("FACE", "Translation_2_9"), model.selection("FACE", "Translation_2_10"), model.selection("FACE", "Translation_2_11"), model.selection("FACE", "Recover_2_1"), model.selection("FACE", "Recover_2_2"), model.selection("FACE", "Recover_2_3"), model.selection("FACE", "Recover_2_4"), model.selection("FACE", "Recover_2_5"), model.selection("FACE", "Recover_2_6"), model.selection("FACE", "Recover_2_7"), model.selection("FACE", "Recover_2_8"), model.selection("FACE", "Recover_2_9"), model.selection("FACE", "Recover_2_10"), model.selection("FACE", "Recover_2_11"), model.selection("EDGE", "Extrusion_5_1")])
+Partition_1_objects = [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("FACE", "Translation_1_1"), model.selection("FACE", "Translation_1_2"), model.selection("FACE", "Translation_1_3"), model.selection("FACE", "Translation_1_4"), model.selection("FACE", "Translation_1_5"), model.selection("FACE", "Translation_1_6"), model.selection("FACE", "Translation_1_7"), model.selection("FACE", "Translation_1_8"), model.selection("FACE", "Translation_1_9"), model.selection("FACE", "Translation_1_10"), model.selection("FACE", "Translation_1_11"), model.selection("FACE", "Translation_2_1"), model.selection("FACE", "Translation_2_2"), model.selection("FACE", "Translation_2_3"), model.selection("FACE", "Translation_2_4"), model.selection("FACE", "Translation_2_5"), model.selection("FACE", "Translation_2_6"), model.selection("FACE", "Translation_2_7"), model.selection("FACE", "Translation_2_8"), model.selection("FACE", "Translation_2_9"), model.selection("FACE", "Translation_2_10"), model.selection("FACE", "Translation_2_11"), model.selection("FACE", "Recover_2_1"), model.selection("FACE", "Recover_2_2"), model.selection("FACE", "Recover_2_3"), model.selection("FACE", "Recover_2_4"), model.selection("FACE", "Recover_2_5"), model.selection("FACE", "Recover_2_6"), model.selection("FACE", "Recover_2_7"), model.selection("FACE", "Recover_2_8"), model.selection("FACE", "Recover_2_9"), model.selection("FACE", "Recover_2_10"), model.selection("FACE", "Recover_2_11"), model.selection("EDGE", "Extrusion_5_1")]
+Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
model.do()
model.testHaveNamingSubshapes(Partition_1, model, Part_1_doc)
model.end()
SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f")], model.selection(), 10, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f"))
SketchLine_5 = Sketch_2.addLine(-3.660618520812283, -7.666051414039341, -9.927240775274454, -7.666051414039341)
SketchLine_6 = Sketch_2.addLine(-9.927240775274454, -7.666051414039341, -9.927240775274454, 7.885614342469023)
SketchLine_7 = Sketch_2.addLine(-9.927240775274454, 7.885614342469023, -3.660618520812283, 7.885614342469023)
SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_7.result())
SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_8.result())
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r")], model.selection(), 10, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r")], model.selection(), 10, 0)
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1")])
model.do()
model.testHaveNamingSubshapes(Fuse_1, model, Part_1_doc)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
+# -*- coding: utf-8 -*-
+
from SketchAPI import *
from salome.shaper import model
SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_3.result(), 1.5)
SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_8.result(), 4)
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_7r-SketchLine_8f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_1"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Revolution_1_1/Generated_Face_1__cc"), False)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"))
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]__cc"), False)
SketchPoint_1 = SketchProjection_3.createdFeature()
SketchCircle_1 = Sketch_2.addCircle(0, 0, 4.75)
SketchCircle_1.setAuxiliary(True)
SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_2.center())
SketchCircle_3 = Sketch_2.addCircle(-4.113620667974014, 2.375000000003604, 1.1)
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_3.center())
-SketchCircle_4 = Sketch_2.addCircle(4.163806340121522e-012, -4.75000000000001, 1.1)
+SketchCircle_4 = Sketch_2.addCircle(4.163806340121522e-12, -4.75000000000001, 1.1)
SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchCircle_1.results()[1], SketchCircle_4.center())
SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_2.results()[1], SketchCircle_3.results()[1])
SketchConstraintEqual_2 = Sketch_2.setEqual(SketchCircle_3.results()[1], SketchCircle_4.results()[1])
SketchLine_10.setAuxiliary(True)
SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchCircle_3.center(), SketchLine_10.startPoint())
SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_10.endPoint())
-SketchLine_11 = Sketch_2.addLine(4.163806340121522e-012, -4.75000000000001, 0, 0)
+SketchLine_11 = Sketch_2.addLine(4.163806340121522e-12, -4.75000000000001, 0, 0)
SketchLine_11.setAuxiliary(True)
SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchCircle_4.center(), SketchLine_11.startPoint())
SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_11.endPoint())
SketchConstraintRadius_1 = Sketch_2.setRadius(SketchCircle_2.results()[1], 1.1)
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
SketchLine_12 = SketchProjection_4.createdFeature()
SketchConstraintAngle_1 = Sketch_2.setAngleBackward(SketchLine_9.result(), SketchLine_12.result(), 30.00000000000006)
SketchConstraintAngle_2 = Sketch_2.setAngle(SketchLine_9.result(), SketchLine_10.result(), 119.9999999999498)
SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Line(SketchLine_19).startPoint(), SketchCircle_17.center(), 5.2, True)
model.do()
ExtrusionCut_1_objects_1 = [model.selection("FACE", "Sketch_2/Face-SketchCircle_9_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_10_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_7_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_17_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_16_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")]
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
-ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_11_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_12_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_6_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_8_2f")]
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
+ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Face-SketchCircle_11_2f-SketchCircle_9_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_12_2f-SketchCircle_10_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_6_2f-SketchCircle_5_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_8_2f-SketchCircle_7_2r_wire")]
ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_1_1")])
Axis_4 = model.addAxis(Part_1_doc, 0, -1, -10)
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f")], model.selection("EDGE", "Axis_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-ExtrusionCut_3.result().setDeflection(1e-005)
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f")], model.selection("EDGE", "Axis_1"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+ExtrusionCut_3.result().setDeflection(1e-05)
Sketch_3 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
SketchLine_21 = Sketch_3.addLine(3.5, 2.508501119175777, 3.5, 4.934853156880259)
SketchLine_22 = Sketch_3.addLine(3.5, 4.934853156880259, 6.2, 4.934853156880259)
SketchConstraintCoincidence_49 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_22.startPoint())
SketchLine_23 = Sketch_3.addLine(6.2, 4.934853156880259, 6.2, 3.008501119175777)
SketchConstraintCoincidence_50 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.startPoint())
-SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), False)
+SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_3"), False)
SketchLine_24 = SketchProjection_6.createdFeature()
SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_24.result())
SketchLine_25 = Sketch_3.addLine(6.2, 3.008501119175777, 3.5, 2.508501119175777)
SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchLine_23.endPoint(), SketchLine_25.startPoint())
SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_25.endPoint())
-SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), False)
+SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_5"), False)
SketchLine_26 = SketchProjection_7.createdFeature()
SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_26.result())
SketchConstraintCoincidence_55 = Sketch_3.setCoincident(SketchLine_21.endPoint(), SketchLine_26.result())
SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_22.result())
SketchConstraintCoincidence_56 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_24.result())
-SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False)
+SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), False)
SketchLine_27 = SketchProjection_8.createdFeature()
SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_25.result(), SketchLine_27.result())
-SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), False)
+SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_4"), False)
SketchLine_28 = SketchProjection_9.createdFeature()
SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_21.startPoint(), SketchLine_28.result(), 0.5, True)
model.do()
Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_13_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_14_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_13_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_14_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0)
Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_3_1")], [model.selection("SOLID", "Common_1_1"), model.selection("SOLID", "Common_1_2")])
model.do()
SketchConstraintDistance_9 = Sketch_2.setDistance(SketchLine_19.startPoint(), SketchLine_22.result(), "(TL/2-3)-20", True)
SketchConstraintDistance_10 = Sketch_2.setDistance(SketchLine_19.endPoint(), SketchLine_22.result(), "(TL/2-3)-20", True)
model.do()
-Wire_1_objects = [model.selection("EDGE", "Sketch_1/Edge-SketchLine_11"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_10"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_4_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_12"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_14"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_13"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_15"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_5_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_16"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_7"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_5"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_3_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")]
+Wire_1_objects = [model.selection("EDGE", "Sketch_1/SketchLine_11"), model.selection("EDGE", "Sketch_1/SketchLine_10"), model.selection("EDGE", "Sketch_1/SketchArc_4_2"), model.selection("EDGE", "Sketch_1/SketchLine_12"), model.selection("EDGE", "Sketch_1/SketchLine_14"), model.selection("EDGE", "Sketch_1/SketchLine_13"), model.selection("EDGE", "Sketch_1/SketchLine_15"), model.selection("EDGE", "Sketch_1/SketchArc_5_2"), model.selection("EDGE", "Sketch_1/SketchLine_16"), model.selection("EDGE", "Sketch_1/SketchLine_9"), model.selection("EDGE", "Sketch_1/SketchArc_1_2"), model.selection("EDGE", "Sketch_1/SketchLine_8"), model.selection("EDGE", "Sketch_1/SketchLine_7"), model.selection("EDGE", "Sketch_1/SketchLine_5"), model.selection("EDGE", "Sketch_1/SketchLine_4"), model.selection("EDGE", "Sketch_1/SketchArc_3_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchLine_1")]
Wire_1 = model.addWire(Part_1_doc, Wire_1_objects)
-Wire_2_objects = [model.selection("EDGE", "Sketch_2/Edge-SketchLine_17"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_7_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_20"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_19"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_18"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_6_2")]
+Wire_2_objects = [model.selection("EDGE", "Sketch_2/SketchLine_17"), model.selection("EDGE", "Sketch_2/SketchArc_7_2"), model.selection("EDGE", "Sketch_2/SketchLine_20"), model.selection("EDGE", "Sketch_2/SketchLine_19"), model.selection("EDGE", "Sketch_2/SketchLine_18"), model.selection("EDGE", "Sketch_2/SketchArc_6_2")]
Wire_2 = model.addWire(Part_1_doc, Wire_2_objects)
Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_1_1")])
Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Wire_2_1")])
SketchConstraintVertical_10 = Sketch_1.setVertical(SketchLine_20.result())
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 100, 100)
-Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1")], model.selection("EDGE", "Extrusion_1_1/Generated_Face_24&Extrusion_1_1/To_Face_2"), 200)
+Translation_1 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_1_1")], model.selection("EDGE", "[Extrusion_1_1_2/Generated_Face&Sketch_1/SketchLine_20][Extrusion_1_1_2/To_Face]"), 200)
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 50, 50)
-Translation_2 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_1")], model.selection("EDGE", "Extrusion_2_1/Generated_Face_24&Extrusion_2_1/To_Face_2"), 150)
+Translation_2 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Extrusion_2_1")], model.selection("EDGE", "[Extrusion_2_1_2/Generated_Face&Sketch_1/SketchLine_20][Extrusion_2_1_2/To_Face]"), 150)
Boolean_1 = model.addCut(Part_1_doc, [model.selection("COMPSOLID", "Translation_1_1")], [model.selection("COMPSOLID", "Translation_2_1")])
model.do()
model.testHaveNamingSubshapes(Boolean_1, model, Part_1_doc)
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Dir.h>
#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAlgoAPI_NExplode.h>
#include <GeomDataAPI_Dir.h>
isDumpByGeom = aSelectedFeature && aSelectedFeature->isInHistory();
}
+ if (theAttrSelect->isGeometricalSelection() && aShape->shapeType() == GeomAPI_Shape::COMPOUND
+ && theAttrSelect->context().get() && !aShape->isEqual(theAttrSelect->context()->shape())
+ && theAttrSelect->context()->groupName() != ModelAPI_ResultPart::group()) {
+ GeomAPI_ShapeIterator anIt(aShape);
+ aShape = anIt.current();
+ }
+
myDumpBuffer << "\"" << aShape->shapeTypeStr();
bool aStandardDump = true;
if (isDumpByGeom) {
<< aMiddlePoint->y() << ", "
<< aMiddlePoint->z() << ")";
aStandardDump = false;
- } else if (theAttrSelect->isWeakNaming() ||
- (myWeakNamingSelection && aShape.get() && theAttrSelect->context().get() &&
- aShape != theAttrSelect->context()->shape())) { // weak naming for local selection only
+ } else if (myWeakNamingSelection && aShape.get() && theAttrSelect->context().get() &&
+ aShape != theAttrSelect->context()->shape()) { // weak naming for local selection only
GeomAlgoAPI_NExplode aNExplode(theAttrSelect->context()->shape(), aShape->shapeType());
int anIndex = aNExplode.index(aShape);
if (anIndex != 0) { // found a week-naming index, so, export it
- myDumpBuffer<<"\", \""<<theAttrSelect->context()->data()->name()<<"\", "<<anIndex;
+ myDumpBuffer<<"\", \""<<
+ theAttrSelect->contextName(theAttrSelect->context())<<"\", "<<anIndex;
aStandardDump = false;
}
}
return ""; // bad case
}
-/// stores the features information, recoursively stores sub-documetns features
+/// stores the features information, recursively stores sub-documents features
std::string storeFeatures(const std::string& theDocName, DocumentPtr theDoc,
std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> >& theStore,
const bool theCompare) // if false => store
}
}
// store the model features information: iterate all features
- int anObjectsCount = 0; // stores the number of compared features for this document to compate
+ int anObjectsCount = 0; // stores the number of compared features for this document to compare
std::set<std::string> aProcessed; // processed features names (that are in the current document)
// process all objects (features and folders)
ModelAPI_Tools::allResults(aFeature, allResults);
std::list<ResultPtr>::iterator aRes = allResults.begin();
for(; aRes != allResults.end(); aRes++) {
- // recoursively store features of sub-documents
+ // recursively store features of sub-documents
if ((*aRes)->groupName() == ModelAPI_ResultPart::group()) {
DocumentPtr aDoc = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aRes)->partDoc();
if (aDoc.get()) {
return true;
}
-bool checkPythonDump()
+bool checkPythonDump(const checkDumpType theCheckType)
{
static const std::string anErrorByNaming("checkPythonDump by naming");
static const std::string anErrorByGeometry("checkPythonDump by geometry");
+ static const std::string anErrorByWeak("checkPythonDump by weak naming");
static char aFileForNamingDump[] = "./check_dump_byname.py";
static char aFileForGeometryDump[] = "./check_dump_bygeom.py";
+ static char aFileForWeakDump[] = "./check_dump_weak.py";
SessionPtr aSession = ModelAPI_Session::get();
- // dump with the selection by names
- if (!dumpToPython(aSession, aFileForNamingDump, "topological_naming", anErrorByNaming))
- return false;
- // dump with the selection by geometry
- if (!dumpToPython(aSession, aFileForGeometryDump, "geometric_selection", anErrorByGeometry))
- return false;
+ if (theCheckType & CHECK_NAMING) {
+ // dump with the selection by names
+ if (!dumpToPython(aSession, aFileForNamingDump, "topological_naming", anErrorByNaming))
+ return false;
+ }
+ if (theCheckType & CHECK_GEOMETRICAL) {
+ // dump with the selection by geometry
+ if (!dumpToPython(aSession, aFileForGeometryDump, "geometric_selection", anErrorByGeometry))
+ return false;
+ }
+ if (theCheckType & CHECK_WEAK) {
+ // dump with the selection by weak naming
+ if (!dumpToPython(aSession, aFileForWeakDump, "weak_naming", anErrorByWeak))
+ return false;
+ }
// map from document name to feature name to feature data
std::map<std::string, std::map<std::string, ModelHighAPI_FeatureStore> > aStore;
return false;
}
- // check dump with the selection by names
- bool isOk = checkDump(aSession, aFileForNamingDump, aStore, anErrorByNaming);
- // check dump with the selection by geometry
- isOk = isOk && checkDump(aSession, aFileForGeometryDump, aStore, anErrorByGeometry);
+ bool isOk = true;
+ if (theCheckType & CHECK_NAMING) {
+ // check dump with the selection by names
+ isOk = checkDump(aSession, aFileForNamingDump, aStore, anErrorByNaming);
+ }
+ if (theCheckType & CHECK_GEOMETRICAL) {
+ // check dump with the selection by geometry
+ isOk = isOk && checkDump(aSession, aFileForGeometryDump, aStore, anErrorByGeometry);
+ }
+ if (theCheckType & CHECK_WEAK) {
+ isOk = isOk && checkDump(aSession, aFileForWeakDump, aStore, anErrorByWeak);
+ }
return isOk;
}
MODELHIGHAPI_EXPORT
std::string strByValueType(const ModelAPI_AttributeTables::ValueType theType);
+/// Enumeration to manage the check python dump modes.
+enum checkDumpType {
+ CHECK_NAMING = 1, ///< check topological naming only
+ CHECK_GEOMETRICAL = 2, ///< check geometrical naming only
+ CHECK_NAMING_AND_GEOMETRICAL = 3, ///< default option, check topological and geometrical dumps
+ CHECK_WEAK = 4, ///< check weak naming only
+};
+
/// Performs the high level API dump, then closes all and executes the script:
/// model must be recreated fully, with all attributes
/// \returns true if check is well done
MODELHIGHAPI_EXPORT
-bool checkPythonDump();
+bool checkPythonDump(const checkDumpType theCheckType = CHECK_NAMING_AND_GEOMETRICAL);
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
SketchConstraintLength_4 = Sketch_1.setLength(SketchLine_8.result(), 4)
SketchConstraintLength_5 = Sketch_1.setLength(SketchLine_5.result(), 2)
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_7r-SketchLine_8f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_1"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Revolution_1_1/Generated_Face_1__cc"), False)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8f-SketchLine_7r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"))
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_3][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]__cc"), False)
SketchPoint_1 = SketchProjection_3.createdFeature()
SketchCircle_1 = Sketch_2.addCircle(0, 0, 4.75)
SketchCircle_1.setAuxiliary(True)
SketchLine_9.setAuxiliary(True)
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_9.startPoint())
SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchCircle_2.center(), SketchLine_9.endPoint())
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), False)
SketchLine_10 = SketchProjection_4.createdFeature()
SketchConstraintAngle_1 = Sketch_2.setAngleBackward(SketchLine_9.result(), SketchLine_10.result(), 30)
SketchMultiRotation_1 = Sketch_2.addRotation([SketchCircle_2.results()[1]], SketchCircle_1.center(), 120, 3)
SketchLine_15 = SketchProjection_5.createdFeature()
SketchConstraintCoincidence_28 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_15.result())
model.do()
-ExtrusionCut_1_objects_1 = [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_3_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_9_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_6_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_18_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_17_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_14_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")]
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
-ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_11_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_10_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_8_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_7_2f")]
+ExtrusionCut_1_objects_1 = [model.selection("WIRE", "Sketch_2/Face-SketchCircle_3_2f_wire"), model.selection("FACE", "Sketch_2/Face-SketchCircle_9_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_6_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_18_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_17_2f"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_14_2f_wire"), model.selection("FACE", "Sketch_2/Face-SketchCircle_15_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")]
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
+ExtrusionCut_2_objects_1 = [model.selection("WIRE", "Sketch_2/Face-SketchCircle_11_2f-SketchCircle_15_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_10_2f-SketchCircle_14_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_8_2f-SketchCircle_9_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_7_2f-SketchCircle_6_2r_wire")]
ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_1_1")])
model.do()
model.end()
SketchCircle_1 = Sketch_1.addCircle(-325.90051457976, -18.010291595197, 258.003584159371)
model.do()
Sketch_1.result().setDeflection(5e-006)
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0)
Extrusion_1.result().setDeflection(0.5)
model.end()
{
// collect the objects from the viewer
QObjectPtrList anExistedObjects;
- QList<ModuleBase_ViewerPrsPtr>::const_iterator aPrsIt = theValuesTo.begin(),
- aPrsLast = theValuesTo.end();
- for (; aPrsIt != aPrsLast; aPrsIt++) {
- if ((*aPrsIt)->owner() && (*aPrsIt)->object())
- anExistedObjects.push_back((*aPrsIt)->object());
+ foreach(ModuleBase_ViewerPrsPtr aPrs, theValuesTo) {
+ if (aPrs->owner() && aPrs->object())
+ anExistedObjects.append(aPrs->object());
}
-
- QList<ModuleBase_ViewerPrsPtr>::const_iterator anIt = theValues.begin(),
- aLast = theValues.end();
- for (; anIt != aLast; anIt++) {
- ObjectPtr anObject = (*anIt)->object();
+ ObjectPtr anObject;
+ foreach(ModuleBase_ViewerPrsPtr aPrs, theValues) {
+ anObject = aPrs->object();
if (anObject.get() != NULL && !anExistedObjects.contains(anObject)) {
theValuesTo.append(std::shared_ptr<ModuleBase_ViewerPrs>(
new ModuleBase_ViewerPrs(anObject, GeomShapePtr(), NULL)));
}
}
-
}
//********************************************************************
int aIdx;
int aCount = 0;
int aSize = myChildren.size();
+ int aMaxCount = aSize * aSize;
int aShift = 0;
while (i < aSize) {
aCount++;
+ // To avoid unlimited cycling
+ if (aCount > aMaxCount)
+ break;
+
aNode = myChildren.at(i);
aObject = aNode->object();
if (aObject.get()) {
else
aShift++;
i++;
- // To avoid unlimited cycling
- if (aCount > aSize * aSize)
- break;
}
}
}
#include <QClipboard>
#include <QTimer>
#include <QMainWindow>
+#include <QCheckBox>
#include <memory>
#include <string>
aMainLay->addWidget(myListView->getControl(), 2, 0, 1, -1);
aMainLay->setRowStretch(2, 1);
- //aMainLay->addWidget(new QLabel(this)); //FIXME(sbh)???
- //aMainLay->setRowMinimumHeight(3, 20);
- //this->setLayout(aMainLay);
connect(myTypeCtrl, SIGNAL(valueChanged(int)), this, SLOT(onSelectionTypeChanged()));
+ bool aSameTop = theData->getBooleanAttribute("same_topology", false);
+ if (aSameTop) {
+ myGeomCheck = new QCheckBox(tr("Add elements that share the same topology"), this);
+ aMainLay->addWidget(myGeomCheck);
+ connect(myGeomCheck, SIGNAL(toggled(bool)), SLOT(onSameTopology(bool)));
+ }
+ else
+ myGeomCheck = 0;
+
myIsNeutralPointClear = theData->getBooleanAttribute("clear_in_neutral_point", true);
if (myShapeTypes.size() > 1 || myIsUseChoice) {
if (defaultValues.contains(myFeatureId + attributeID())) {
return false;
AttributePtr anAttribute = myFeature->data()->attribute(attributeID());
+ AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
std::string aType = anAttribute->attributeType();
if (aType == ModelAPI_AttributeSelectionList::typeId()) {
- AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
// Restore shape type
std::string aSelectionType = aSelectionListAttr->selectionType().c_str();
if (!aSelectionType.empty()) {
myIsFirst = false;
}
}
+ if (myGeomCheck)
+ myGeomCheck->setChecked(aSelectionListAttr->isGeometricalSelection());
updateSelectionList();
return true;
}
{
//focusTo();
emitFocusInWidget();
-}
\ No newline at end of file
+}
+
+void ModuleBase_WidgetMultiSelector::onSameTopology(bool theOn)
+{
+ AttributePtr anAttribute = myFeature->data()->attribute(attributeID());
+ std::string aType = anAttribute->attributeType();
+ if (aType == ModelAPI_AttributeSelectionList::typeId()) {
+ AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
+ aSelectionListAttr->setGeometricalSelection(theOn);
+ updateObject(myFeature);
+ }
+}
#include <QMap>
class QWidget;
+class QCheckBox;
//class QComboBox;
class ModuleBase_ListView;
class ModuleBase_IWorkshop;
void onListActivated();
+ void onSameTopology(bool theOn);
+
protected:
/// Returns true if the event is processed. The default implementation is empty, returns false.
virtual bool processDelete();
bool myIsFirst;
std::string myDefMode;
+
+ QCheckBox* myGeomCheck;
};
#endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */
//********************************************************************
bool ModuleBase_WidgetPointInput
-::setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs)
+::setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
+ const bool theToValidate)
{
- GeomShapePtr aShape = thePrs->shape();
- if (aShape->isVertex()) {
- GeomVertexPtr aVertex(new GeomAPI_Vertex(aShape));
- GeomPointPtr aPnt = aVertex->point();
- myXSpin->setValue(aPnt->x());
- myYSpin->setValue(aPnt->y());
- myZSpin->setValue(aPnt->z());
- return true;
+ if (theValues.size() == 1) {
+ GeomShapePtr aShape = theValues.first()->shape();
+ if (aShape.get() && aShape->isVertex()) {
+ GeomVertexPtr aVertex(new GeomAPI_Vertex(aShape));
+ GeomPointPtr aPnt = aVertex->point();
+ myXSpin->setValue(aPnt->x());
+ myYSpin->setValue(aPnt->y());
+ myZSpin->setValue(aPnt->z());
+ return true;
+ }
}
return false;
}
/// Fills the attribute with the value of the selected owner
/// \param thePrs a selected owner
- virtual bool setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
+ virtual bool setSelection(QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues,
+ const bool theToValidate);
protected:
/// Retunrs a list of possible shape types
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(anAttr);
aSelectAttr->setValue(myPresentedObject, GeomShapePtr(), true);
GeomShapePtr aShape = aSelectAttr->value();
- if (!aShape.get() && aSelectAttr->contextFeature()->firstResult().get()) {
+ if (!aShape.get() && aSelectAttr->contextFeature().get() &&
+ aSelectAttr->contextFeature()->firstResult().get()) {
aShape = aSelectAttr->contextFeature()->firstResult()->shape();
}
if (aShape.get()) {
#include <ModelHighAPI_Dumper.h>
#include <ModelHighAPI_Tools.h>
#include <ModelAPI_ResultParameter.h>
+#include <ModelAPI_Events.h>
//--------------------------------------------------------------------------------------
ParametersAPI_Parameter::ParametersAPI_Parameter(
const std::shared_ptr<ModelAPI_Feature> & theFeature)
std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ParametersAPI_Parameter::ID());
return ParameterPtr(new ParametersAPI_Parameter(aFeature, theName, theExpression, theComment));
}
+
+//--------------------------------------------------------------------------------------
+void removeParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ParameterPtr & theParameter)
+{
+ FeaturePtr aParam = theParameter->feature();
+ if (aParam) {
+ ModelAPI_ReplaceParameterMessage::send(aParam, 0);
+ thePart->removeFeature(aParam);
+ }
+}
const std::string & theExpression,
const std::string & theComment = std::string());
+/**\ingroup CPPHighAPI
+ * \brief Remove Parameter feature and substitute it by the value in referred features
+ */
+PARAMETERSAPI_EXPORT
+void removeParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const ParameterPtr & theParameter);
+
//--------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------
#endif /* SRC_PARAMETERSAPI_PARAMETERSAPI_PARAMETER_H_ */
ADD_UNIT_TESTS(TestParameterCreation.py
TestParameterRename.py
TestParameterChangeValue.py
+ TestParameterDelete.py
+ TestParameterErrorMsg.py
+ TestParametersMgr.py
Test1806.py
Test2392.py
Test2474.py
//------------------------------------------------------------------------------
// Tools
-std::string toStdString(double theValue)
+static std::string toStdString(double theValue)
{
std::ostringstream sstream;
sstream << theValue;
return sstream.str() + aPnt;
}
-std::set<std::string> toSet(const std::list<std::string>& theContainer)
+static std::set<std::string> toSet(const std::list<std::string>& theContainer)
{
return std::set<std::string>(theContainer.begin(), theContainer.end());
}
Events_InfoMessage& theError) const
{
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
- ResultParameterPtr aParam =
- std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aFeature->firstResult());
AttributeStringPtr aStrAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
return false;
}
- if (!aParam.get()) {
- theError = "Result is empty.";
- return false;
- }
-
theError = aFeature->string(ParametersPlugin_Parameter::EXPRESSION_ERROR_ID())->value();
return theError.empty();
}
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+from ModelAPI import *
+import math
+
+def assertLineLength(theLine, theLength):
+ dx = theLine.startPoint().x() - theLine.endPoint().x()
+ dy = theLine.startPoint().y() - theLine.endPoint().y()
+ assert(math.fabs(dx**2 + dy**2 - theLength**2) < 1.e-8), "Line length {} is not equal to expected {}".format(math.sqrt(dx**2 + dy**2), theLength)
+
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+ParamLen = model.addParameter(Part_1_doc, "Len", "100")
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(0, -30, 100, -30)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "Len")
+model.do()
+
+aLength = ParamLen.value()
+assertLineLength(SketchLine_1, aLength)
+
+# delete parameter
+model.removeParameter(Part_1_doc, ParamLen)
+model.do()
+
+# move line and check the constraint is still here
+SketchLine_1.startPoint().setValue(SketchLine_1.startPoint().x() + 10., SketchLine_1.startPoint().y())
+model.do()
+assertLineLength(SketchLine_1, aLength)
+
+model.end()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+model.begin()
+partSet = model.moduleDocument()
+# check error on empty name
+Param1 = model.addParameter(partSet, "", "100")
+assert(Param1.feature().error() != "")
+# check error on empty value
+Param2 = model.addParameter(partSet, "L", "")
+assert(Param2.feature().error() != "")
+# check error if name is not variable
+Param3 = model.addParameter(partSet, "100", "100")
+assert(Param3.feature().error() != "")
+# check error on wrong value expression
+Param4 = model.addParameter(partSet, "N", "+-.so&@")
+assert(Param4.feature().error() != "")
+model.end()
class TestParameterRename(unittest.TestCase):
def setUp(self):
self.aSession = ModelAPI_Session.get()
- self.aDocument = self.aSession.moduleDocument()
+ model.begin()
+ partSet = self.aSession.moduleDocument()
+ Part = model.addPart(partSet)
+ model.end()
+ self.aDocument = Part.document()
self.createParameters()
self.createFeature()
pass
def createParameters(self):
- ltNames = ["x1", "y1", "x2"]
- ltExpressions = ["150.", "200.", "x1 + y1 + 100.0"]
+ ltNames = ["x1", "y1", "x2", "n", "px"]
+ ltExpressions = ["150.", "200.", "x1 + y1 + 100.0", "5", "50"]
self.dtParams = {}
for name, expr in zip(ltNames, ltExpressions):
self.aSession.startOperation()
anEndPoint = geomDataAPI_Point2D(anOY.attribute("EndPoint"))
aStartPoint.setValue(0., 0.)
anEndPoint.setValue(0., 100.)
- anOYRes = modelAPI_Result(self.aDocument.objectByName("Construction", "OY"))
- anOY.selection("External").setValue(anOYRes, anOYRes.shape())
+ anOY.selection("External").selectSubShape("EDGE", "PartSet/OY")
anOY.execute()
refattrB.setObject(modelAPI_ResultConstruction(anOY.firstResult()))
valueX = aDistanceConstraint1.real("ConstraintValue")
anEndPoint = geomDataAPI_Point2D(anOX.attribute("EndPoint"))
aStartPoint.setValue(0., 0.)
anEndPoint.setValue(100., 0.)
- anOXRes = modelAPI_Result(self.aDocument.objectByName("Construction", "OX"))
- anOX.selection("External").setValue(anOXRes, anOXRes.shape())
+ anOX.selection("External").selectSubShape("EDGE", "PartSet/OX")
anOX.execute()
refattrB.setObject(modelAPI_ResultConstruction(anOX.firstResult()))
valueY = aDistanceConstraint2.real("ConstraintValue")
self.assertEqual(self.anCircleCentr.y(), 170.)
self.assertEqual(aRadiusAttr.value(), 150.)
+ # add a line and rotate it around origin
+ self.aSession.startOperation()
+ aSketchLine = aSketchFeature.addFeature("SketchLine")
+ aStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint"))
+ aEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint"))
+ aStartPoint.setText("px", "0")
+ aEndPoint.setValue(0., 0.)
+ self.aSession.finishOperation()
+ self.aSession.startOperation()
+ aEndPoint.move(100., 0.)
+ self.aSession.finishOperation()
+
+ self.aSession.startOperation()
+ aMultiRotation = aSketchFeature.addFeature("SketchMultiRotation")
+ aMultiRotation.reflist("MultiRotationList").append(aSketchLine.lastResult())
+ aMultiRotation.refattr("MultiRotationCenter").setAttr(anCircleCentr)
+ aMultiRotation.real("MultiRotationAngle").setValue(60.0)
+ aMultiRotation.string("AngleType").setValue("SingleAngle")
+ aMultiRotation.boolean("MultiRotationReversed").setValue(False)
+ aMultiRotation.integer("MultiRotationObjects").setText("n")
+ self.aSession.finishOperation()
+
+ self.aMultiRotCopies = aMultiRotation.integer("MultiRotationObjects")
+
+ # create 3D point
+ self.aSession.startOperation()
+ aPoint3D = self.aDocument.addFeature("Point")
+ aPoint3D.string("creation_method").setValue("by_xyz")
+ aCoords = geomDataAPI_Point(aPoint3D.attribute("point3d"))
+ aCoords.setText("px", "0", "0")
+ self.aSession.finishOperation()
+
+ self.aPoint2D = aStartPoint
+ self.aPoint3D = aCoords
+
def test_rename(self):
# Rename
aParam = self.dtParams["x1"]
self.assertEqual(self.anCircleCentr.y(), 170.)
self.assertEqual(self.aRadiusAttr.value(), 150.)
+ def test_rename_integer(self):
+ # rename integer parameter
+ aParam = self.dtParams["n"]
+ aResultAttr = modelAPI_ResultParameter(aParam.firstResult())
+ self.aSession.startOperation()
+ aResultAttr.data().setName("m")
+ self.aSession.finishOperation()
+
+ # Check rename in the parameter
+ self.assertEqual(aParam.name(), "m")
+ self.assertEqual(aParam.string("variable").value(), "m")
+ self.assertEqual(aResultAttr.data().name(), "m")
+
+ # Check rename in feature
+ self.assertEqual(self.aMultiRotCopies.text(), "m")
+ # Check corresponding value
+ self.assertEqual(self.aMultiRotCopies.value(), 5)
+
+ def test_rename_point(self):
+ # rename parameter in point coordinates
+ aParam = self.dtParams["px"]
+ aResultAttr = modelAPI_ResultParameter(aParam.firstResult())
+ self.aSession.startOperation()
+ aResultAttr.data().setName("p")
+ self.aSession.finishOperation()
+
+ # Check rename in the parameter
+ self.assertEqual(aParam.name(), "p")
+ self.assertEqual(aParam.string("variable").value(), "p")
+ self.assertEqual(aResultAttr.data().name(), "p")
+
+ # Check rename in feature
+ self.assertEqual(self.aPoint2D.textX(), "p")
+ self.assertEqual(self.aPoint3D.textX(), "p")
+ # Check corresponding value
+ self.assertEqual(self.aPoint2D.x(), 50.)
+ self.assertEqual(self.aPoint3D.x(), 50.)
+
def test_rename_not_unique(self):
# Rename to not unique name
aParam = self.dtParams["x1"]
self.assertEqual(self.anCircleCentr.y(), 170.)
self.assertEqual(self.aRadiusAttr.value(), 150.)
+
if __name__ == "__main__":
test_program = unittest.main(exit=False)
assert test_program.result.wasSuccessful(), "Test failed"
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+ TestParametersMgr.py
+
+ class ParametersPlugin_ParametersMgr
+"""
+
+#=========================================================================
+# Initialization of the test
+#=========================================================================
+from ModelAPI import *
+
+__updated__ = "2018-12-05"
+
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+aSession.startOperation()
+aKind = "ParametersMgr"
+aParamMgr = aDocument.addFeature(aKind)
+assert(aParamMgr is not None)
+assert(aParamMgr.getKind() == aKind)
+aSession.finishOperation()
std::set<ObjectPtr> aModifiedObjects;
PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
CompositeFeaturePtr aSketch = aModule->sketchMgr()->activeSketch();
+
+ // check the sketch in the message and the active sketch are the same
+ std::shared_ptr<ModelAPI_SolverFailedMessage> anErrorMsg =
+ std::dynamic_pointer_cast<ModelAPI_SolverFailedMessage>(theMessage);
+ if (aSketch && anErrorMsg && !anErrorMsg->objects().empty()) {
+ ObjectPtr anObject = *anErrorMsg->objects().begin();
+ CompositeFeaturePtr aSketchFromMsg =
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(anObject);
+ if (!aSketchFromMsg || aSketchFromMsg != aSketch)
+ aSketch = CompositeFeaturePtr();
+ }
+
if (aSketch.get()) {
- for (int i = 0; i < aSketch->numberOfSubs(); i++) {
+ int aNumberOfSubs = aSketch->numberOfSubs();
+ for (int i = 0; i < aNumberOfSubs; i++) {
FeaturePtr aFeature = aSketch->subFeature(i);
aModifiedObjects.insert(aFeature); // is necessary to redisplay presentations
std::list<ResultPtr> aResults = aFeature->results();
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_ResultPart.h>
#include <XGUI_Tools.h>
#include <XGUI_Displayer.h>
foreach (ObjectPtr anObj, aDisplayed) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObj);
// result constructions should not be taken as a body
- if (aResult.get() != NULL && aResult->groupName() == ModelAPI_ResultBody::group()) {
+ if (aResult.get() != NULL &&
+ ((aResult->groupName() == ModelAPI_ResultBody::group()) ||
+ ((aResult->groupName() == ModelAPI_ResultPart::group()))) ) {
GeomShapePtr aShape = aResult->shape();
if (aShape.get()) {
// vertices, edges should not be taken as a body
return false;
Bnd_Box aBox;
- for (int aSubFeatureId = 0; aSubFeatureId < theSketch->numberOfSubs(); aSubFeatureId++) {
+ int aNumberOfSubs = theSketch->numberOfSubs();
+ for (int aSubFeatureId = 0; aSubFeatureId < aNumberOfSubs; aSubFeatureId++) {
FeaturePtr aFeature = theSketch->subFeature(aSubFeatureId);
if (!aFeature.get())
continue;
CompositeFeaturePtr aSketchFeature = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>
(aResultFeature);
std::list<ResultPtr> anAuxiliaryResults;
- for (int i = 0; i < aSketchFeature->numberOfSubs(); i++) {
+ int aNumberOfSubs = aSketchFeature->numberOfSubs();
+ for (int i = 0; i < aNumberOfSubs; i++) {
FeaturePtr aFeature = aSketchFeature->subFeature(i);
if (PartSet_Tools::isAuxiliarySketchEntity(aFeature)) {
std::list<ResultPtr> aResults = aFeature->results();
PartSet_SketcherMgr::~PartSet_SketcherMgr()
{
+ delete mySketchPlane;
}
void PartSet_SketcherMgr::onEnterViewPort()
// Remove invalid sketch entities
std::set<FeaturePtr> anInvalidFeatures;
ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators();
- for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
+ int aNumberOfSubs = myCurrentSketch->numberOfSubs();
+ for (int i = 0; i < aNumberOfSubs; i++) {
FeaturePtr aFeature = myCurrentSketch->subFeature(i);
if (aFeature.get()) {
if (!aFactory->validate(aFeature))
QStringList anInfo;
Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
- for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
+ aNumberOfSubs = myCurrentSketch->numberOfSubs();
+ for (int i = 0; i < aNumberOfSubs; i++) {
FeaturePtr aFeature = myCurrentSketch->subFeature(i);
#ifdef DEBUG_SKETCHER_ENTITIES
anInfo.append(ModuleBase_Tools::objectInfo(aFeature));
}
else {
// Hide all sketcher sub-Objects
- for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
+ int aNumberOfSubs = myCurrentSketch->numberOfSubs();
+ for (int i = 0; i < aNumberOfSubs; i++) {
FeaturePtr aFeature = myCurrentSketch->subFeature(i);
std::list<ResultPtr> aResults = aFeature->results();
std::list<ResultPtr>::const_iterator aIt;
FeaturePtr anObjectFeature = ModelAPI_Feature::feature(theObject);
if (anObjectFeature.get()) {
int aSize = myCurrentSketch->numberOfSubs();
- for (int i = 0; i < myCurrentSketch->numberOfSubs() && !isFoundObject; i++) {
+ for (int i = 0; i < aSize && !isFoundObject; i++) {
FeaturePtr aCurrentFeature = myCurrentSketch->subFeature(i);
isFoundObject = myCurrentSketch->subFeature(i) == anObjectFeature;
}
if (aPrevState != theState) {
ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
- for (int i = 0; i < myCurrentSketch->numberOfSubs(); i++) {
+ int aNumberOfSubs = myCurrentSketch->numberOfSubs();
+ for (int i = 0; i < aNumberOfSubs; i++) {
FeaturePtr aSubFeature = myCurrentSketch->subFeature(i);
bool aProcessed = false;
bool aConstraintDisplayed = canDisplayConstraint(aSubFeature, theType, aProcessed);
return;
static Events_Loop* aLoop = Events_Loop::loop();
- for (int i = 0; i < theComposite->numberOfSubs(); i++) {
+ int aNumberOfSubs = theComposite->numberOfSubs();
+ for (int i = 0; i < aNumberOfSubs; i++) {
FeaturePtr aSubFeature = theComposite->subFeature(i);
static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
aECreator->sendUpdated(aSubFeature, theEventId);
void PartSet_Tools::getFirstAndLastIndexInFolder(const ObjectPtr& theFolder,
int& theFirst, int& theLast)
{
+ theFirst = -1;
+ theLast = -1;
+
DocumentPtr aDoc = theFolder->document();
FolderPtr aFolder = std::dynamic_pointer_cast<ModelAPI_Folder>(theFolder);
if (!aFolder.get())
AttributeReferencePtr aFirstFeatAttr =
aFolder->data()->reference(ModelAPI_Folder::FIRST_FEATURE_ID());
+ if (!aFirstFeatAttr.get())
+ return;
FeaturePtr aFirstFeatureInFolder = ModelAPI_Feature::feature(aFirstFeatAttr->value());
- if (!aFirstFeatureInFolder.get()) {
- theFirst = -1;
+ if (!aFirstFeatureInFolder.get())
return;
- }
+
AttributeReferencePtr aLastFeatAttr =
aFolder->data()->reference(ModelAPI_Folder::LAST_FEATURE_ID());
+ if (!aLastFeatAttr.get())
+ return;
FeaturePtr aLastFeatureInFolder = ModelAPI_Feature::feature(aLastFeatAttr->value());
- if (!aLastFeatureInFolder.get()) {
- theLast = -1;
+ if (!aLastFeatureInFolder.get())
return;
- }
theFirst = aDoc->index(aFirstFeatureInFolder);
theLast = aDoc->index(aLastFeatureInFolder);
else {
aNode = new PartSet_ObjectNode(aBody, this);
myChildren.append(aNode);
+ aNode->update();
}
}
else if (aFieldRes.get()) {
//ResultCompSolidPtr aCompRes = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theObj);
//if (aCompRes.get())
// return new PartSet_CompsolidNode(theObj, this);
- return new PartSet_ObjectNode(theObj, this);
+ ModuleBase_ITreeNode* aNode = new PartSet_ObjectNode(theObj, this);
+ aNode->update();
+ return aNode;
}
void PartSet_FolderNode::update()
if (aFeature->getKind() == PartSetPlugin_Part::ID())
return new PartSet_PartRootNode(theObj, this);
- return new PartSet_ObjectNode(theObj, this);
+ PartSet_ObjectNode* aNode = new PartSet_ObjectNode(theObj, this);
+ aNode->update();
+ return aNode;
}
//////////////////////////////////////////////////////////////////////////////////
bool aHasFields = myFieldsFolder->childrenCount() > 0;
bool aHasGroups = myGroupsFolder->childrenCount() > 0;
- if (aHasFields && (!myChildren.contains(myFieldsFolder))) {
- myChildren.insert(3, myFieldsFolder);
+ if (aHasFields) {
+ if (!myChildren.contains(myFieldsFolder)) {
+ myChildren.insert(3, myFieldsFolder);
+ }
+ } else if (myChildren.contains(myFieldsFolder)) {
+ myChildren.removeAll(myFieldsFolder);
}
- if (aHasGroups && (!myChildren.contains(myGroupsFolder))) {
- myChildren.insert(aHasFields ? 4 : 3, myGroupsFolder);
+ if (aHasGroups) {
+ if (!myChildren.contains(myGroupsFolder)) {
+ myChildren.insert(aHasFields ? 4 : 3, myGroupsFolder);
+ }
+ } else if (myChildren.contains(myGroupsFolder)) {
+ myChildren.removeAll(myGroupsFolder);
}
// Update features content
Qt::ItemFlags PartSet_PartRootNode::flags(int theColumn) const
{
if (myObject->isDisabled())
- return (theColumn == 2) ? Qt::ItemIsSelectable : aDefaultFlag;
+ return (theColumn == 2) ? Qt::ItemIsSelectable : aNullFlag;
SessionPtr aSession = ModelAPI_Session::get();
DocumentPtr aActiveDoc = aSession->activeDocument();
{
if (theObj->groupName() == ModelAPI_Folder::group())
return new PartSet_ObjectFolderNode(theObj, this);
- return new PartSet_ObjectNode(theObj, this);
+ PartSet_ObjectNode* aNode = new PartSet_ObjectNode(theObj, this);
+ aNode->update();
+ return aNode;
}
int PartSet_PartRootNode::numberOfFolders() const
if (aObj != myChildren.at(i)->object()) {
aNode = new PartSet_ObjectNode(aObj, this);
myChildren.insert(i, aNode);
+ aNode->update();
}
}
else {
aNode = new PartSet_ObjectNode(aObj, this);
myChildren.append(aNode);
+ aNode->update();
}
}
}
aNode = new PartSet_ObjectNode(aObj, this);
myChildren.insert(i, aNode);
aResult.append(aNode);
+ aNode->update();
}
} else {
aNode = new PartSet_ObjectNode(aObj, this);
myChildren.append(aNode);
aResult.append(aNode);
+ aNode->update();
}
}
return aResult;
}
else {
myChildren.removeAll(aNode);
+ aResult.removeAll(aNode);
delete aNode;
aRemoved = true;
continue;
else {
aSelAttr->setValue(aFeature, GeomShapePtr());
GeomShapePtr aShape = aSelAttr->value();
- if (!aShape.get() && aSelAttr->contextFeature()->firstResult().get()) {
+ if (!aShape.get() && aSelAttr->contextFeature().get() &&
+ aSelAttr->contextFeature()->firstResult().get()) {
aShape = aSelAttr->contextFeature()->firstResult()->shape();
}
- if (aShape.get()) {
+ if (aShape.get() && aShape->isPlanar()) {
const TopoDS_Shape& aTDShape = aShape->impl<TopoDS_Shape>();
setSketchPlane(aTDShape);
isOwnerSet = true;
int num = 1;
std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
theBoxAlgo->getCreatedFaces();
- for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
- it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
- std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
- theResultBox->generated(aFace, (*it).first, num++);
+ for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+ it != listOfFaces.end();
+ ++it)
+ {
+ theResultBox->generated((*it).second, (*it).first);
}
}
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAlgoAPI_PointBuilder.h>
}
// Getting axis.
- std::shared_ptr<GeomAPI_Ax2> anAxis;
+ static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+ std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef = selection(AXIS_ID());
+ GeomShapePtr aShape = anEdgeRef->value();
+ if (!aShape.get()) {
+ if (anEdgeRef->context().get()) {
+ aShape = anEdgeRef->context()->shape();
+ }
+ }
+ if (!aShape.get()) {
+ setError(aSelectionError);
+ return;
+ }
std::shared_ptr<GeomAPI_Edge> anEdge;
- std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef =
- selection(PrimitivesPlugin_Cone::AXIS_ID());
- if(anEdgeRef && anEdgeRef->value() && anEdgeRef->value()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->value()));
- } else if (anEdgeRef && !anEdgeRef->value() && anEdgeRef->context() &&
- anEdgeRef->context()->shape() && anEdgeRef->context()->shape()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->context()->shape()));
+ if (aShape->isEdge())
+ {
+ anEdge = aShape->edge();
+ }
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ anEdge = anIt.current()->edge();
}
- if(anEdge) {
- anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
- anEdge->line()->direction()));
+ else
+ {
+ setError(aSelectionError);
+ return;
}
+ if (!anEdge.get())
+ {
+ setError(aSelectionError);
+ return;
+ }
+
+ std::shared_ptr<GeomAPI_Ax2> anAxis(new GeomAPI_Ax2(aBasePoint,
+ anEdge->line()->direction()));
+
// Getting base radius, top radius and height
double aBaseRadius = real(PrimitivesPlugin_Cone::BASE_RADIUS_ID())->value();
double aTopRadius = real(PrimitivesPlugin_Cone::TOP_RADIUS_ID())->value();
theConeAlgo->prepareNamingFaces();
// Insert to faces
- int num = 1;
std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
theConeAlgo->getCreatedFaces();
int nbFaces = 0;
for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
- std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
- theResultCone->generated(aFace, (*it).first, num++);
+ theResultCone->generated((*it).second, (*it).first);
nbFaces++;
}
if (nbFaces == 2) {
// Naming vertices
GeomAPI_DataMapOfShapeShape aVertices;
- GeomAPI_ShapeExplorer aVertExp(theConeAlgo->shape(), GeomAPI_Shape::VERTEX);
- for(int anIndex = 1; aVertExp.more(); aVertExp.next()) {
+ int anIndex = 1;
+ for (GeomAPI_ShapeExplorer aVertExp(theConeAlgo->shape(), GeomAPI_Shape::VERTEX);
+ aVertExp.more();
+ aVertExp.next())
+ {
if (!aVertices.isBound(aVertExp.current())) {
std::ostringstream aStream;
aStream<<"Vertex_"<<anIndex++;
- theResultCone->generated(aVertExp.current(), aStream.str(), num++);
+ theResultCone->generated(aVertExp.current(), aStream.str());
aVertices.bind(aVertExp.current(), aVertExp.current());
}
}
#include <GeomAPI_Dir.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAlgoAPI_PointBuilder.h>
}
// Getting axis.
- std::shared_ptr<GeomAPI_Ax2> anAxis;
+ static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+ std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef = selection(AXIS_ID());
+ GeomShapePtr aShape = anEdgeRef->value();
+ if (!aShape.get()) {
+ if (anEdgeRef->context().get()) {
+ aShape = anEdgeRef->context()->shape();
+ }
+ }
+ if (!aShape.get()) {
+ setError(aSelectionError);
+ return;
+ }
std::shared_ptr<GeomAPI_Edge> anEdge;
- std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef =
- selection(PrimitivesPlugin_Cylinder::AXIS_ID());
- if(anEdgeRef && anEdgeRef->value() && anEdgeRef->value()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->value()));
- } else if (anEdgeRef && !anEdgeRef->value() && anEdgeRef->context() &&
- anEdgeRef->context()->shape() && anEdgeRef->context()->shape()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->context()->shape()));
+ if (aShape->isEdge())
+ {
+ anEdge = aShape->edge();
+ }
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ anEdge = anIt.current()->edge();
}
- if(anEdge) {
- anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
- anEdge->line()->direction()));
+ else
+ {
+ setError(aSelectionError);
+ return;
}
+ if (!anEdge.get())
+ {
+ setError(aSelectionError);
+ return;
+ }
+
+ std::shared_ptr<GeomAPI_Ax2> anAxis(new GeomAPI_Ax2(aBasePoint,
+ anEdge->line()->direction()));
+
+
// Getting radius and height
double aRadius = real(PrimitivesPlugin_Cylinder::RADIUS_ID())->value();
double aHeight = real(PrimitivesPlugin_Cylinder::HEIGHT_ID())->value();
theCylinderAlgo->prepareNamingFaces();
// Insert to faces
- int num = 1;
std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
theCylinderAlgo->getCreatedFaces();
- for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
- it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
- std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
- theResultCylinder->generated(aFace, (*it).first, num++);
+ for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+ it != listOfFaces.end();
+ ++it)
+ {
+ theResultCylinder->generated((*it).second, (*it).first);
}
}
// Insert to faces
// Naming for faces and edges
- int num = 1;
std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
theSphereAlgo->getCreatedFaces();
- for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
- it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
- std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
- theResultSphere->generated(aFace, (*it).first, num++);
+ for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+ it != listOfFaces.end();
+ ++it)
+ {
+ theResultSphere->generated((*it).second, (*it).first);
}
// Naming vertices
GeomAPI_DataMapOfShapeShape aVertices;
- GeomAPI_ShapeExplorer aVertExp(theSphereAlgo->shape(), GeomAPI_Shape::VERTEX);
- for(int anIndex = 1; aVertExp.more(); aVertExp.next()) {
+ int anIndex = 1;
+ for (GeomAPI_ShapeExplorer aVertExp(theSphereAlgo->shape(), GeomAPI_Shape::VERTEX);
+ aVertExp.more();
+ aVertExp.next())
+ {
if (!aVertices.isBound(aVertExp.current())) {
std::ostringstream aStream;
aStream<<"Vertex_"<<anIndex++;
- theResultSphere->generated(aVertExp.current(), aStream.str(), num++);
+ theResultSphere->generated(aVertExp.current(), aStream.str());
aVertices.bind(aVertExp.current(), aVertExp.current());
}
}
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAlgoAPI_PointBuilder.h>
}
// Getting axis.
- std::shared_ptr<GeomAPI_Ax2> anAxis;
+ static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+ std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef = selection(AXIS_ID());
+ GeomShapePtr aShape = anEdgeRef->value();
+ if (!aShape.get()) {
+ if (anEdgeRef->context().get()) {
+ aShape = anEdgeRef->context()->shape();
+ }
+ }
+ if (!aShape.get()) {
+ setError(aSelectionError);
+ return;
+ }
std::shared_ptr<GeomAPI_Edge> anEdge;
- std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef =
- selection(PrimitivesPlugin_Torus::AXIS_ID());
- if(anEdgeRef && anEdgeRef->value() && anEdgeRef->value()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->value()));
- } else if (anEdgeRef && !anEdgeRef->value() && anEdgeRef->context() &&
- anEdgeRef->context()->shape() && anEdgeRef->context()->shape()->isEdge()) {
- anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->context()->shape()));
+ if (aShape->isEdge())
+ {
+ anEdge = aShape->edge();
+ }
+ else if (aShape->isCompound())
+ {
+ GeomAPI_ShapeIterator anIt(aShape);
+ anEdge = anIt.current()->edge();
}
- if(anEdge) {
- anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
- anEdge->line()->direction()));
+ else
+ {
+ setError(aSelectionError);
+ return;
}
+ if (!anEdge.get())
+ {
+ setError(aSelectionError);
+ return;
+ }
+
+ std::shared_ptr<GeomAPI_Ax2> anAxis(new GeomAPI_Ax2(aBasePoint,
+ anEdge->line()->direction()));
+
// Getting radius and ring radius
double aRadius = real(PrimitivesPlugin_Torus::RADIUS_ID())->value();
double aRingRadius = real(PrimitivesPlugin_Torus::RING_RADIUS_ID())->value();
int num = 1;
std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
theTorusAlgo->getCreatedFaces();
- for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
- it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
- std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
- theResultTorus->generated(aFace, (*it).first, num++);
+ for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+ it != listOfFaces.end();
+ ++it)
+ {
+ theResultTorus->generated((*it).second, (*it).first);
}
// Naming of edges
GeomAPI_DataMapOfShapeShape anEdges;
- GeomAPI_ShapeExplorer anEdgeExp(theTorusAlgo->shape(), GeomAPI_Shape::EDGE);
- for(int anIndex = 1; anEdgeExp.more(); anEdgeExp.next()) {
+ int anIndex = 1;
+ for (GeomAPI_ShapeExplorer anEdgeExp(theTorusAlgo->shape(), GeomAPI_Shape::EDGE);
+ anEdgeExp.more();
+ anEdgeExp.next())
+ {
if (!anEdges.isBound(anEdgeExp.current())) {
std::ostringstream aStream;
aStream<<"Edge_"<<anIndex++;
- theResultTorus->generated(anEdgeExp.current(), aStream.str(), num++);
+ theResultTorus->generated(anEdgeExp.current(), aStream.str());
anEdges.bind(anEdgeExp.current(), anEdgeExp.current());
}
}
label="axis"
default=""
shape_types="edge"
+ geometrical_selection="true"
icon="icons/Primitives/axis.png"
tooltip="Select the axis of the cone">
<validator id="GeomValidators_ConstructionComposite"/>
label="axis"
default=""
shape_types="edge"
+ geometrical_selection="true"
icon="icons/Primitives/axis.png"
tooltip="Select the axis of the cylinder">
<validator id="GeomValidators_ConstructionComposite"/>
label="axis"
default=""
shape_types="edge"
+ geometrical_selection="true"
icon="icons/Primitives/axis.png"
tooltip="Select the axis of the cylinder">
<validator id="GeomValidators_ConstructionComposite"/>
label="axis"
default=""
shape_types="edge"
+ geometrical_selection="true"
icon="icons/Primitives/axis.png"
tooltip="Select the axis of the torus">
<validator id="GeomValidators_ConstructionComposite"/>
# Creating a cylinder on a face of the box
-thisface = "Extrusion_1_1/Generated_Face_2"
-thisxmax = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1"
-thiszmax = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1"
+thisface = "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"
+thisxmax = "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"
+thiszmax = "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"
mystand = model.addSketch(mypart, thisface)
# Creating a cylinder on a face of the box
-thisface = "Extrusion_1_1/Generated_Face_2"
-thisxmin = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1"
-thiszmax = "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1"
+thisface = "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"
+thisxmin = "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"
+thiszmax = "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"
mystand = model.addSketch(mypart, thisface)
circle = mystand.addCircle(0, 25, 5)
def bottom_body():
# Create XOY sketch
- sketch = model.addSketch(part, "Extrusion_1_1/Generated_Face_5")
+ sketch = model.addSketch(part, "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4")
# Create base polygon
points = [(0, 0), (0, L), (P, L), (P, 16 + 16), (P - 20, 16 + 16), (P - 20, 16), (P, 16), (P, 0)]
sketch.setCoincident(arc.endPoint(), h1.startPoint())
# Binding
- left_e = sketch.addLine("Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1_1")
+ left_e = sketch.addLine("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]")
sketch.setCoincident(left_e.startPoint(), left.endPoint())
sketch.setCoincident(left_e.endPoint(), left.startPoint())
def body_3():
# Create XOZ sketch
- sketch = model.addSketch(part, "Boolean_1_1/Modified_Face_3")
+ sketch = model.addSketch(part, "Boolean_1_1/Modified_Face&Sketch_1/SketchLine_3")
# Create base polygon
H, L, l, r = 28, 40, 8, 12
sketch.setRadius(arc, r)
# Binding
- bottom_e = sketch.addLine("Boolean_1_1/Modified_Face_7&Extrusion_2_1/To_Face_1")
+ bottom_e = sketch.addLine("[Boolean_1_1/Modified_Face&Sketch_2/SketchLine_6][Extrusion_2_1/To_Face]")
sketch.setCoincident(bottom_e, bottom.startPoint())
sketch.setCoincident(bottom_e.startPoint(), bottom.endPoint())
def body_4():
# Create XOZ 2nd sketch
- sketch = model.addSketch(part, "Boolean_2_1/Modified_Face_4")
+ sketch = model.addSketch(part, "Boolean_2_1/Modified_Face&Sketch_2/SketchLine_6")
# Create base polygon
points = [(0, 0), (0, 1), (1, 0)]
left, diagonal, bottom = model.addPolygon(sketch, *geom_points)
# Binding
- bottom_e = sketch.addLine("Boolean_2_1/Modified_Face_2&Boolean_2_1/Modified_Face_4")
+ bottom_e = sketch.addLine("[Boolean_2_1/Modified_Face&Extrusion_2_1/To_Face][Boolean_2_1/Modified_Face&Sketch_2/SketchLine_6]")
sketch.setCoincident(bottom_e.endPoint(), bottom.startPoint())
sketch.setCoincident(bottom_e.startPoint(), left.startPoint())
- left_e = sketch.addLine("Boolean_2_1/Modified_Face_5&Extrusion_3_1/Generated_Face_2")
+ left_e = sketch.addLine("[Boolean_2_1/Modified_Face&Extrusion_3_1/From_Face][Extrusion_3_1/Generated_Face&Sketch_3/SketchLine_18]")
sketch.setCoincident(left_e.startPoint(), left.endPoint())
model.do() #!!!
"""Package for Parameter plugin for the Parametric Geometry API of the Modeler.
"""
-from ParametersAPI import addParameter
\ No newline at end of file
+from ParametersAPI import addParameter, removeParameter
\ No newline at end of file
aResultVolumeStr = "{:0.27f}".format(aResultVolume).lstrip("0").lstrip(".").lstrip("0")
anExpectedResultVolume = theExpectedResultsVolumes[anIndex]
anExpectedResultVolumeStr = "{:0.27f}".format(anExpectedResultVolume).lstrip("0").lstrip(".").lstrip("0")
- assert math.fabs(aResultVolume - anExpectedResultVolume) < aTolerance * anExpectedResultVolume, "Volume of result[{}]: {:0.27f}. Expected: {:0.27f}. The first {} significant digits not equal.".format(anIndex, aResultVolume, anExpectedResultVolume, theNbSignificantDigits)
+ assert math.fabs(aResultVolume - anExpectedResultVolume) < aTolerance * math.fabs(anExpectedResultVolume), "Volume of result[{}]: {:0.27f}. Expected: {:0.27f}. The first {} significant digits not equal.".format(anIndex, aResultVolume, anExpectedResultVolume, theNbSignificantDigits)
def testHaveNamingFaces(theFeature, theModel, thePartDoc) :
""" Tests if all faces of result have a name
""" Tests if all vertices/edges/faces of result have a unique name
:param theFeature: feature to test.
"""
+ assert(len(theFeature.results()) > 0)
testHaveNamingByType(theFeature, theModel, thePartDoc, GeomAPI_Shape.VERTEX)
testHaveNamingByType(theFeature, theModel, thePartDoc, GeomAPI_Shape.EDGE)
testHaveNamingByType(theFeature, theModel, thePartDoc, GeomAPI_Shape.FACE)
QString aCurrentFile = SUIT_Tools::addSlash(aTmpDir) + aFileName;
XGUI_Workshop* aWorkShop = myModule->workshop();
aWorkShop->openFile(aCurrentFile);
- //QString aNewFile = SUIT_Tools::addSlash(aNewTmpDir) + aFileName;
- //if (!QFile::copy(aCurrentFile, aNewFile))
- // isDone = false;
}
- //if (isDone) {
- // myTmpDirectory = aNewTmpDir;
- //}
- //else {
- // removeDirectory(aNewTmpDir);
- // myTmpDirectory = "";
- //}
-
- //SessionPtr aMgr = ModelAPI_Session::get();
- //aMgr->load(qPrintable(aNewTmpDir));
myModule->setIsOpened(true);
return true;
bool isMultiFile = aResMgr ? aResMgr->booleanValue("Study", "multi_file", false) : false;
std::string aTmpDir = aStudy->GetTmpDir(qPrintable(myStudyPath), isMultiFile);
- //std::string aTmpDir = aStudy->GetTmpDir("", false);//true );
QString aTmp = QString(aTmpDir.c_str());
theFiles.append(aTmp);
aMgr->blockAutoUpdate(false);
//aWorkShop->saveDocument(QString(aTmpDir.c_str()), aFileNames);
- aWorkShop->setCurrentDataFile(aTmp + "shaper.opp");
+ aWorkShop->setCurrentDataFile(aTmp + "shaper.shaper");
aWorkShop->onSave();
QString aName = aWorkShop->currentDataFile();
- std::string aa = aName.toStdString();
aName.replace(QChar('\\'), QChar('/'));
int aN = aName.lastIndexOf('/');
theFiles.append(aName.right(aName.length() - aN - 1));
- //std::list<std::string>::iterator aIt;
- //for (aIt = aFileNames.begin(); aIt != aFileNames.end(); ++aIt) {
- // QString aName((*aIt).c_str());
- // aName.replace(QChar('\\'), QChar('/'));
- // int aN = aName.lastIndexOf('/');
- // theFiles.append(aName.right(aName.length() - aN - 1));
- //}
return true;
}
bool SHAPERGUI_DataModel::close()
{
myModule->workshop()->closeDocument();
- //removeDirectory(myTmpDirectory);
- //myTmpDirectory = "";
return LightApp_DataModel::close();
}
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ Selector.h
+ Selector_Selector.h
+ Selector_Algo.h
+ Selector_Primitive.h
+ Selector_AlgoWithSubs.h
+ Selector_Intersect.h
+ Selector_Container.h
+ Selector_Modify.h
+ Selector_FilterByNeighbors.h
+ Selector_WeakName.h
+ Selector_NameGenerator.h
+ Selector_NExplode.h
+)
+
+SET(PROJECT_SOURCES
+ Selector_Selector.cpp
+ Selector_Algo.cpp
+ Selector_Primitive.cpp
+ Selector_AlgoWithSubs.cpp
+ Selector_Intersect.cpp
+ Selector_Container.cpp
+ Selector_Modify.cpp
+ Selector_FilterByNeighbors.cpp
+ Selector_WeakName.cpp
+ Selector_NameGenerator.cpp
+ Selector_NExplode.cpp
+)
+
+SET(PROJECT_LIBRARIES
+ ${OpenCASCADE_ApplicationFramework_LIBRARIES}
+)
+SET(PROJECT_INCLUDES
+ ${OpenCASCADE_INCLUDE_DIR}
+)
+
+
+ADD_DEFINITIONS(-DSELECTOR_EXPORTS ${OpenCASCADE_DEFINITIONS})
+ADD_LIBRARY(Selector SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(Selector ${PROJECT_LIBRARIES})
+
+INCLUDE_DIRECTORIES(${PROJECT_INCLUDES})
+
+INSTALL(TARGETS Selector DESTINATION ${SHAPER_INSTALL_BIN})
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef SELECTOR_H
+#define SELECTOR_H
+
+#if defined SELECTOR_EXPORTS
+#if defined WIN32
+#define SELECTOR_EXPORT __declspec( dllexport )
+#else
+#define SELECTOR_EXPORT
+#endif
+#else
+#if defined WIN32
+#define SELECTOR_EXPORT __declspec( dllimport )
+#else
+#define SELECTOR_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_Algo.h>
+
+#include <Selector_Primitive.h>
+#include <Selector_Intersect.h>
+#include <Selector_Modify.h>
+#include <Selector_Container.h>
+#include <Selector_FilterByNeighbors.h>
+#include <Selector_WeakName.h>
+
+#include <TDF_Tool.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <Geom_Surface.hxx>
+#include <BRep_Tool.hxx>
+#include <TNaming_Builder.hxx>
+#include <TNaming_Tool.hxx>
+#include <TNaming_SameShapeIterator.hxx>
+#include <TNaming_Iterator.hxx>
+#include <TNaming_NewShapeIterator.hxx>
+#include <TDataStd_ReferenceArray.hxx>
+#include <TDataStd_ExtStringList.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDataStd_UAttribute.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopExp_Explorer.hxx>
+#include <BRep_Builder.hxx>
+
+
+/// type of the selection, integer keeps the Selector_Type value
+static const Standard_GUID kSEL_TYPE("db174d59-c2e3-4a90-955e-55544df090d6");
+// geometrical naming indicator
+static const Standard_GUID kGEOMETRICAL_NAMING("a5322d02-50fb-43ed-9255-75c7b93f6657");
+
+
+// reference attribute that contains the reference to labels where the "from" or "base" shapes
+// of selection are located
+static const Standard_GUID kBASE_ARRAY("7c515b1a-9549-493d-9946-a4933a22f45f");
+// if the base array contains reference to the root label, this means that it refers to an
+// external document and this list contains a tag in the document
+static const Standard_GUID kBASE_LIST("7c515b1a-9549-493d-9946-a4933a22f45a");
+
+Selector_Algo::Selector_Algo()
+{
+ myGeometricalNaming = false; // default values
+ myAlwaysGeometricalNaming = false;
+}
+
+#define SET_ALGO_FLAGS(algo) \
+ algo->myLab = theAccess; \
+ algo->myBaseDocumentLab = theBaseDocument; \
+ algo->myGeometricalNaming = theGeometricalNaming; \
+ algo->myUseNeighbors = theUseNeighbors; \
+ algo->myUseIntersections = theUseIntersections; \
+ algo->myAlwaysGeometricalNaming = theAlwaysGeometricalNaming;
+
+Selector_Algo* Selector_Algo::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue,
+ const TDF_Label theAccess, const TDF_Label theBaseDocument,
+ const bool theGeometricalNaming, const bool theUseNeighbors, const bool theUseIntersections,
+ const bool theAlwaysGeometricalNaming)
+{
+ Selector_Algo* aResult = NULL;
+ if (theValue.IsNull() || theContext.IsNull())
+ return aResult;
+
+ // check the value shape can be named as it is, or it is needed to construct it from the
+ // higher level shapes (like a box vertex by faces that form this vertex)
+ bool aIsFound = TNaming_Tool::HasLabel(theAccess, theValue);
+ if (aIsFound) { // additional check for selection and delete evolution only: also could not use
+ aIsFound = false;
+ for(TNaming_SameShapeIterator aShapes(theValue, theAccess); aShapes.More(); aShapes.Next())
+ {
+ Handle(TNaming_NamedShape) aNS;
+ if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ if (aNS->Evolution() == TNaming_MODIFY || aNS->Evolution() == TNaming_GENERATED ||
+ aNS->Evolution() == TNaming_PRIMITIVE) {
+ aIsFound = true;
+ break;
+ }
+ }
+ }
+ }
+ // searching in the base document
+ if (!aIsFound && !theBaseDocument.IsNull() && TNaming_Tool::HasLabel(theBaseDocument, theValue))
+ {
+ TNaming_SameShapeIterator aShapes(theValue, theBaseDocument);
+ for(; aShapes.More(); aShapes.Next())
+ {
+ Handle(TNaming_NamedShape) aNS;
+ if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ if (aNS->Evolution() == TNaming_MODIFY || aNS->Evolution() == TNaming_GENERATED ||
+ aNS->Evolution() == TNaming_PRIMITIVE) {
+ aIsFound = true;
+ break;
+ }
+ }
+ }
+ }
+ if (!aIsFound) {
+ TopAbs_ShapeEnum aSelectionType = theValue.ShapeType();
+ if (aSelectionType == TopAbs_COMPOUND || aSelectionType == TopAbs_COMPSOLID ||
+ aSelectionType == TopAbs_SHELL || aSelectionType == TopAbs_WIRE)
+ {
+ Selector_Container* aContainer = new Selector_Container;
+ SET_ALGO_FLAGS(aContainer);
+ if (aContainer->select(theContext, theValue))
+ return aContainer;
+ delete aContainer;
+ return NULL;
+ }
+
+ Selector_Intersect* anIntersect = new Selector_Intersect;
+ SET_ALGO_FLAGS(anIntersect);
+ bool aGoodIntersector = anIntersect->select(theContext, theValue);
+ // weak intersector is bad for not use neighbors and has lower priority than neighbors
+ if (aGoodIntersector && anIntersect->myWeakIndex == -1) {
+ return anIntersect;
+ }
+ if (!theUseNeighbors) {
+ delete anIntersect;
+ return NULL;
+ }
+ // searching by neighbors
+ Selector_FilterByNeighbors* aNBs = new Selector_FilterByNeighbors;
+ SET_ALGO_FLAGS(aNBs);
+ if (aNBs->select(theContext, theValue)) {
+ delete anIntersect;
+ return aNBs;
+ }
+ delete aNBs;
+ if (aGoodIntersector) { // if neighbors are bad, use intersector with weak index
+ return anIntersect;
+ }
+ delete anIntersect;
+
+ // pure weak naming: there is no sense to use pure weak naming for neighbors selection
+ if (theUseNeighbors) {
+ Selector_WeakName* aWeak = new Selector_WeakName;
+ SET_ALGO_FLAGS(aWeak);
+ if (aWeak->select(theContext, theValue)) {
+ return aWeak;
+ }
+ delete aWeak;
+ }
+ return NULL; // not found value in the tree, not found context shape in the tree also
+ }
+ // searching for the base shapes of the value
+ Handle(TNaming_NamedShape) aPrimitiveNS;
+ NCollection_List<Handle(TNaming_NamedShape)> aModifList;
+ for(int aUseExternal = 0; aUseExternal < 2; aUseExternal++) {
+ TDF_Label aLab = aUseExternal == 0 ? theAccess : theBaseDocument;
+ if (aLab.IsNull() || !TNaming_Tool::HasLabel(aLab, theValue))
+ continue;
+ for(TNaming_SameShapeIterator aShapes(theValue, aLab); aShapes.More(); aShapes.Next())
+ {
+ Handle(TNaming_NamedShape) aNS;
+ if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ TNaming_Evolution anEvolution = aNS->Evolution();
+ if (anEvolution == TNaming_PRIMITIVE) { // the value shape is declared as PRIMITIVE
+ aPrimitiveNS = aNS;
+ break;
+ } else if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) {
+ // check this is a new shape
+ TNaming_Iterator aNSIter(aNS);
+ for(; aNSIter.More(); aNSIter.Next())
+ if (aNSIter.NewShape().IsSame(theValue))
+ break;
+ if (aNSIter.More()) // new was found
+ aModifList.Append(aNS);
+ }
+ }
+ }
+ }
+
+ if (!aPrimitiveNS.IsNull()) {
+ Selector_Primitive* aPrimitive = new Selector_Primitive;
+ SET_ALGO_FLAGS(aPrimitive);
+ aPrimitive->select(aPrimitiveNS->Label());
+ return aPrimitive;
+ } else {
+ Selector_Modify* aModify = new Selector_Modify;
+ SET_ALGO_FLAGS(aModify);
+ bool aGoodModify = aModify->select(aModifList, theContext, theValue);
+ // weak intersector is bad for not use neighbors and has lower priority than neighbors
+ if (aGoodModify && aModify->myWeakIndex == -1) {
+ return aModify;
+ }
+ if (!theUseNeighbors) {
+ delete aModify;
+ return NULL;
+ }
+ // searching by neighbors
+ Selector_FilterByNeighbors* aNBs = new Selector_FilterByNeighbors;
+ SET_ALGO_FLAGS(aNBs);
+ if (aNBs->select(theContext, theValue)) {
+ delete aModify;
+ return aNBs;
+ }
+ delete aNBs;
+
+ if (aGoodModify) { // if neighbors are bad, use modify algo with weak index
+ return aModify;
+ }
+ delete aModify;
+ }
+
+ return NULL; // invalid case
+}
+
+Selector_Algo* Selector_Algo::relesectWithAllGeometry(
+ Selector_Algo* theOldAlgo, const TopoDS_Shape theContext)
+{
+ return select(theContext, theOldAlgo->value(),
+ theOldAlgo->myLab, theOldAlgo->myBaseDocumentLab, true, true, true, true);
+}
+
+void Selector_Algo::storeBaseArray(const TDF_LabelList& theRef, const TDF_Label& theLast)
+{
+ Handle(TDataStd_ReferenceArray) anArray =
+ TDataStd_ReferenceArray::Set(myLab, kBASE_ARRAY, 0, theRef.Extent());
+ Handle(TDataStd_ExtStringList) anEntries; // entries of references to external document
+ const TDF_Label aThisDocRoot = myLab.Root();
+ TDF_LabelList::Iterator aBIter(theRef);
+ for(int anIndex = 0; true; aBIter.Next(), anIndex++) {
+ const TDF_Label& aLab = aBIter.More() ? aBIter.Value() : theLast;
+ // check this is a label of this document
+ if (aLab.Root().IsEqual(aThisDocRoot)) {
+ anArray->SetValue(anIndex, aLab);
+ } else { // store reference to external document as an entry-string
+ if (anEntries.IsNull()) {
+ anEntries = TDataStd_ExtStringList::Set(myLab, kBASE_LIST);
+ }
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(aLab, anEntry);
+ anEntries->Append(anEntry);
+ anArray->SetValue(anIndex, aThisDocRoot); // stored root means it is external reference
+ }
+ if (!aBIter.More())
+ break;
+ }
+}
+
+bool Selector_Algo::restoreBaseArray(TDF_LabelList& theRef, TDF_Label& theLast)
+{
+ const TDF_Label aThisDocRoot = myLab.Root();
+ Handle(TDataStd_ExtStringList) anEntries; // entries of references to external document
+ TDataStd_ListOfExtendedString::Iterator anIter;
+ Handle(TDataStd_ReferenceArray) anArray;
+ if (myLab.FindAttribute(kBASE_ARRAY, anArray)) {
+ int anUpper = anArray->Upper();
+ for(int anIndex = anArray->Lower(); anIndex <= anUpper; anIndex++) {
+ TDF_Label aLab = anArray->Value(anIndex);
+ if (aLab.IsEqual(aThisDocRoot)) { // external document reference
+ if (myBaseDocumentLab.IsNull())
+ return false;
+ if (anEntries.IsNull()) {
+ if (!myLab.FindAttribute(kBASE_LIST, anEntries))
+ return false;
+ anIter.Initialize(anEntries->List());
+ }
+ if (!anIter.More())
+ return false;
+ TDF_Tool::Label(myBaseDocumentLab.Data(), anIter.Value(), aLab);
+ anIter.Next();
+ }
+ if (anIndex == anUpper) {
+ theLast = aLab;
+ } else {
+ theRef.Append(aLab);
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+void Selector_Algo::store(const TopoDS_Shape theShape)
+{
+ TNaming_Builder aBuilder(myLab);
+ aBuilder.Select(theShape, theShape);
+}
+
+bool Selector_Algo::sameGeometry(const TopoDS_Shape theShape1, const TopoDS_Shape theShape2) {
+ if (!theShape1.IsNull() && !theShape2.IsNull() && theShape1.ShapeType() == theShape2.ShapeType())
+ {
+ if (theShape1.ShapeType() == TopAbs_FACE) { // check surfaces
+ TopLoc_Location aLoc1, aLoc2;
+ TopoDS_Face aFace1 = TopoDS::Face(theShape1);
+ Handle(Geom_Surface) aSurf1 = BRep_Tool::Surface(aFace1, aLoc1);
+ TopoDS_Face aFace2 = TopoDS::Face(theShape2);
+ Handle(Geom_Surface) aSurf2 = BRep_Tool::Surface(aFace2, aLoc2);
+ return aSurf1 == aSurf2 && aLoc1.IsEqual(aLoc2);
+ } else if (theShape1.ShapeType() == TopAbs_EDGE) { // check curves
+ TopLoc_Location aLoc1, aLoc2;
+ Standard_Real aFirst, aLast;
+ TopoDS_Edge anEdge1 = TopoDS::Edge(theShape1);
+ Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(anEdge1, aLoc1, aFirst, aLast);
+ TopoDS_Edge anEdge2 = TopoDS::Edge(theShape2);
+ Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(anEdge2, aLoc2, aFirst, aLast);
+ return aCurve1 == aCurve2 && aLoc1.IsEqual(aLoc2);
+ }
+ }
+ return false;
+}
+
+TopoDS_Shape Selector_Algo::value()
+{
+ Handle(TNaming_NamedShape) aNS;
+ if (myLab.FindAttribute(TNaming_NamedShape::GetID(), aNS))
+ return aNS->Get();
+ return TopoDS_Shape(); // empty, error shape
+}
+
+Selector_Algo* Selector_Algo::restoreByLab(TDF_Label theLab, TDF_Label theBaseDocLab)
+{
+ Handle(TDataStd_Integer) aTypeAttr;
+ if (!theLab.FindAttribute(kSEL_TYPE, aTypeAttr))
+ return NULL;
+ Selector_Type aType = Selector_Type(aTypeAttr->Get());
+ Selector_Algo* aResult = NULL;
+ switch (aType) {
+ case SELTYPE_CONTAINER: {
+ aResult = new Selector_Container;
+ break;
+ }
+ case SELTYPE_INTERSECT: {
+ aResult = new Selector_Intersect;
+ break;
+ }
+ case SELTYPE_MODIFICATION: {
+ aResult = new Selector_Modify;
+ break;
+ }
+ case SELTYPE_PRIMITIVE: {
+ aResult = new Selector_Primitive;
+ break;
+ }
+ case SELTYPE_FILTER_BY_NEIGHBOR: {
+ aResult = new Selector_FilterByNeighbors;
+ break;
+ }
+ case SELTYPE_WEAK_NAMING: {
+ aResult = new Selector_WeakName;
+ break;
+ }
+ default: { // unknown case
+ }
+ }
+ if (aResult) {
+ aResult->myLab = theLab;
+ aResult->myBaseDocumentLab = theBaseDocLab;
+ aResult->myGeometricalNaming = theLab.IsAttribute(kGEOMETRICAL_NAMING);
+ if (!aResult->restore()) {
+ delete aResult;
+ aResult = NULL;
+ }
+ }
+ return aResult;
+}
+
+Selector_Algo* Selector_Algo::restoreByName(TDF_Label theLab, TDF_Label theBaseDocLab,
+ std::string theName, const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming,
+ Selector_NameGenerator* theNameGenerator, TDF_Label& theContextLab)
+{
+ Selector_Algo* aResult = NULL;
+ if (theName[0] == '[') { // intersection or container
+ switch(theShapeType) {
+ case TopAbs_COMPOUND:
+ case TopAbs_COMPSOLID:
+ case TopAbs_SHELL:
+ case TopAbs_WIRE:
+ aResult = new Selector_Container;
+ break;
+ case TopAbs_VERTEX:
+ case TopAbs_EDGE:
+ case TopAbs_FACE:
+ aResult = new Selector_Intersect;
+ break;
+ default:;
+ }
+ } else if (theName[0] == '(') { // filter by neighbors
+ aResult = new Selector_FilterByNeighbors;
+ } else if (theName.find(pureWeakNameID()) == 0) { // weak naming identifier
+ aResult = new Selector_WeakName;
+ } else if (theName.find('&') != std::string::npos) { // modification
+ aResult = new Selector_Modify;
+ } else { // primitive
+ aResult = new Selector_Primitive;
+ }
+ if (aResult) {
+ aResult->myLab = theLab;
+ aResult->myBaseDocumentLab = theBaseDocLab;
+ aResult->myGeometricalNaming = theGeomNaming;
+ theContextLab = aResult->restoreByName(theName, theShapeType, theNameGenerator);
+ if (theContextLab.IsNull()) {
+ delete aResult;
+ aResult = NULL;
+ }
+ }
+ return aResult;
+}
+
+void Selector_Algo::storeType(const Selector_Type theType)
+{
+ myLab.ForgetAllAttributes(true);
+ TDataStd_Integer::Set(myLab, kSEL_TYPE, (int)(theType));
+ if (myGeometricalNaming)
+ TDataStd_UAttribute::Set(myLab, kGEOMETRICAL_NAMING);
+}
+
+/// Returns true if theSub is in theContext shape
+static bool isInContext(const TopoDS_Shape& theContext, const TopoDS_Shape& theSub) {
+ for(TopExp_Explorer anExp(theContext, theSub.ShapeType()); anExp.More(); anExp.Next()) {
+ if (anExp.Current().IsSame(theSub))
+ return true;
+ }
+ return false;
+}
+
+bool Selector_Algo::findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& theResult) const
+{
+ if (theResult.IsNull())
+ return false;
+ if (!TNaming_Tool::HasLabel(myLab, theResult)) {
+ if (theResult.ShapeType() == TopAbs_COMPOUND) { // do it for all elements of compound
+ BRep_Builder aBuilder;
+ TopoDS_Compound aResultingCompound;
+ aBuilder.MakeCompound(aResultingCompound);
+ bool aWasChanged = false;
+ for (TopoDS_Iterator anIter(theResult); anIter.More(); anIter.Next()) {
+ TopoDS_Shape aSub = anIter.Value();
+ if (findNewVersion(theContext, aSub))
+ aWasChanged = true;
+ aBuilder.Add(aResultingCompound, aSub);
+ }
+ if (aWasChanged)
+ theResult = aResultingCompound;
+ return aWasChanged;
+ }
+ } else {
+ // check theResult is in theContext
+ if (isInContext(theContext, theResult))
+ return false;
+ // searching the next modifications of the result shape in document
+ TopTools_MapOfShape aResultShapes;
+ for(TNaming_NewShapeIterator aBaseIter(theResult, myLab); aBaseIter.More(); aBaseIter.Next())
+ {
+ TNaming_Evolution anEvolution = aBaseIter.NamedShape()->Evolution();
+ if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) {
+ TopoDS_Shape aNextModification = aBaseIter.Shape();
+ if (aNextModification.IsNull())
+ continue;
+ if (isInContext(theContext, aNextModification))
+ aResultShapes.Add(aNextModification);
+ else if (findNewVersion(theContext, aNextModification))
+ aResultShapes.Add(aNextModification);
+ }
+ }
+ if (aResultShapes.IsEmpty())
+ return false;
+ if (aResultShapes.Size() == 1) {
+ theResult = TopTools_MapIteratorOfMapOfShape(aResultShapes).Value();
+ } else { // make a compound of all results
+ BRep_Builder aBuilder;
+ TopoDS_Compound aResultingCompound;
+ aBuilder.MakeCompound(aResultingCompound);
+ for(TopTools_MapIteratorOfMapOfShape anIter(aResultShapes); anIter.More(); anIter.Next())
+ aBuilder.Add(aResultingCompound, anIter.Value());
+ theResult = aResultingCompound;
+ }
+ return true;
+ }
+ return false;
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_Algo_H_
+#define Selector_Algo_H_
+
+#include "Selector.h"
+
+#include <Standard_GUID.hxx>
+#include <TDF_Label.hxx>
+#include <TDF_LabelList.hxx>
+#include <TopoDS_Shape.hxx>
+
+class Selector_NameGenerator;
+
+/**\class Selector_Selector
+ * \ingroup DataModel
+ * \brief Base class for all kinds of selection algorithms.
+ */
+class Selector_Algo
+{
+ TopAbs_ShapeEnum myShapeType; ///< type of this shape
+
+ TDF_Label myLab; ///< label where this also may be located
+ TDF_Label myBaseDocumentLab; ///< an access-label of the document that may contain initial shapes
+ bool myGeometricalNaming; ///< flag that indicates that geometrical naming selection is enabled
+ bool myAlwaysGeometricalNaming; ///< to enable geometrical naming from beginning, at select
+ bool myUseNeighbors; ///< to use neighbors algorithms
+ bool myUseIntersections; ///< to use intersections algorithms
+
+public:
+ /// Type of a selector algorithm: on this type depends what is stored in this label and how to
+ /// restore it on update.
+ enum Selector_Type {
+ SELTYPE_CONTAINER, ///< just a container of sub-elements, keeps the shape type of container
+ SELTYPE_INTERSECT, ///< sub-shape is intersection of higher level objects
+ SELTYPE_PRIMITIVE, ///< sub-shape found as a primitive on some label
+ SELTYPE_MODIFICATION, ///< modification of base shapes to the final label
+ SELTYPE_FILTER_BY_NEIGHBOR, ///< identification by neighbor shapes in context
+ SELTYPE_WEAK_NAMING, ///< pure weak naming by weak index in context
+ };
+
+ /// Initializes the algorithm
+ SELECTOR_EXPORT Selector_Algo();
+
+ /// Initializes the selector structure on the label.
+ /// Stores the name data to restore after modification.
+ /// \param theContext whole shape that contains the selected sub-shape
+ /// \param theValue selected subshape
+ /// \param theGeometricalNaming treats selection with equal surfaces as one
+ /// \param theUseNeighbors enables searching algorithm by neighbors
+ /// \param theUseIntersections enables searching algorithm by intersection of higher level shapes
+ SELECTOR_EXPORT static Selector_Algo* select(
+ const TopoDS_Shape theContext, const TopoDS_Shape theValue,
+ const TDF_Label theAccess, const TDF_Label theBaseDocument,
+ const bool theGeometricalNaming = false,
+ const bool theUseNeighbors = true, const bool theUseIntersections = true,
+ const bool theAlwaysGeometricalNaming = false);
+
+ /// Stores the name to the label and sub-labels tree
+ SELECTOR_EXPORT virtual void store() = 0;
+
+ /// Restores the selected shape by the topological naming kept in the data structure
+ /// Returns true if it can restore structure correctly
+ SELECTOR_EXPORT virtual bool restore() = 0;
+
+ /// Restores the selected shape by the topological name string.
+ /// Returns not empty label of the context.
+ SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) = 0;
+
+ /// Updates the current shape by the stored topological name
+ SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) = 0;
+
+ /// Returns the naming name of the selection
+ SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) = 0;
+ /// Returns the current sub-shape value (null if can not resolve)
+ SELECTOR_EXPORT TopoDS_Shape value();
+ /// Restores sub-algorithm of a given type by the storage-label
+ SELECTOR_EXPORT static Selector_Algo* restoreByLab(TDF_Label theLab, TDF_Label theBaseDocLab);
+ /// Restores the selected sub-algorithm by the naming name.
+ /// Returns not empty label of the context.
+ SELECTOR_EXPORT static Selector_Algo* restoreByName(
+ TDF_Label theLab, TDF_Label theBaseDocLab, std::string theName,
+ const TopAbs_ShapeEnum theShapeType, const bool theGeomNaming,
+ Selector_NameGenerator* theNameGenerator, TDF_Label& theContextLab);
+
+ /// Returns true if the given shapes are based on the same geometry
+ static bool sameGeometry(const TopoDS_Shape theShape1, const TopoDS_Shape theShape2);
+
+ /// Creates a new selection algorithm for selection of all topology based on the same geometry
+ SELECTOR_EXPORT static Selector_Algo* relesectWithAllGeometry(
+ Selector_Algo* theOldAlgo, const TopoDS_Shape theContext);
+ /// Sets geometrical naming flag to true
+ void setGeometricalNaming()
+ {myGeometricalNaming = true;}
+
+protected:
+ /// Returns label where this algorithm is attached to, or just an access label to the document
+ const TDF_Label& label() const
+ {return myLab;}
+ /// Stores the array of references to theLab: references to elements of ref-list, then the last
+ void storeBaseArray(const TDF_LabelList& theRef, const TDF_Label& theLast);
+ /// Restores references to the labels: references to elements of ref-list, then the last
+ bool restoreBaseArray(TDF_LabelList& theRef, TDF_Label& theLast);
+ /// Stores result of selection at the given label
+ void store(const TopoDS_Shape theShape);
+ /// Returns an access-label of the document that may contain initial shapes
+ const TDF_Label& baseDocument() const
+ {return myBaseDocumentLab;}
+ /// Returns the geometrical naming flag
+ bool geometricalNaming() const
+ {return myGeometricalNaming;}
+ /// Returns always geometrical naming flag
+ bool alwaysGeometricalNaming() const
+ {return myAlwaysGeometricalNaming;}
+ /// Returns use neighbors flag
+ bool useNeighbors() const
+ {return myUseNeighbors;}
+ /// Returns use intersections flag
+ bool useIntersections() const
+ {return myUseIntersections;}
+ /// Returns GUID for the weak index (integer attribute) of the sub-shape
+ static const Standard_GUID& weakID()
+ {
+ static const Standard_GUID kWEAK_INDEX("e9373a61-cabc-4ee8-aabf-aea47c62ed87");
+ return kWEAK_INDEX;
+ }
+ /// Returns GUID for the type of the shape, stored in case it is intersection or container
+ static const Standard_GUID& shapeTypeID()
+ {
+ static const Standard_GUID kSHAPE_TYPE("864b3267-cb9d-4107-bf58-c3ce1775b171");
+ return kSHAPE_TYPE;
+ }
+ /// string identifier of the weak name in modification or intersection types of algorithm
+ static const std::string& weakNameID()
+ {
+ static const std::string kWEAK_NAME_IDENTIFIER = "weak_name_";
+ return kWEAK_NAME_IDENTIFIER;
+ }
+ /// string identifier of the pure weak name
+ static const std::string& pureWeakNameID()
+ {
+ static const std::string kPURE_WEAK_NAME_IDENTIFIER = "_weak_name_";
+ return kPURE_WEAK_NAME_IDENTIFIER;
+ }
+ /// Stores the type of an algorithm in the data tree (in myLab)
+ void storeType(const Selector_Type theType);
+
+ /// Searches the newer version of the shape in the document if the base shape does not
+ /// belong to context. Returns it in theResult (if any). Returns true is theResult is changed.
+ bool findNewVersion(const TopoDS_Shape& theContext, TopoDS_Shape& theResult) const;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_AlgoWithSubs.h>
+
+Selector_AlgoWithSubs::Selector_AlgoWithSubs() : Selector_Algo()
+{}
+
+void Selector_AlgoWithSubs::clearSubAlgos()
+{
+ std::list<Selector_Algo*>::iterator anAlgo = mySubSelList.begin();
+ for(; anAlgo != mySubSelList.end(); anAlgo++) {
+ delete *anAlgo;
+ }
+ mySubSelList.clear();
+}
+
+Selector_AlgoWithSubs::~Selector_AlgoWithSubs()
+{
+ clearSubAlgos();
+}
+
+TDF_Label Selector_AlgoWithSubs::newSubLabel()
+{
+ return label().FindChild(int(mySubSelList.size() + 1));
+}
+
+bool Selector_AlgoWithSubs::append(Selector_Algo* theAlgo, const bool theEraseIfNull)
+{
+ if (theAlgo) {
+ mySubSelList.push_back(theAlgo);
+ return true;
+ }
+ if (theEraseIfNull)
+ clearSubAlgos();
+ return false;
+}
+
+std::list<Selector_Algo*>& Selector_AlgoWithSubs::list()
+{
+ return mySubSelList;
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_AlgoWithSubs_H_
+#define Selector_AlgoWithSubs_H_
+
+#include "Selector_Algo.h"
+
+#include <list>
+
+/**\class Selector_AlgoWithSubs
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: generic algorithm that contains sub-algorithms inside.
+ * It is base for Container, Intersection and FilterByNeighbours algorithms.
+ */
+class Selector_AlgoWithSubs: public Selector_Algo
+{
+ std::list<Selector_Algo*> mySubSelList; ///< list of sub-algorithms
+public:
+ /// Initializes selector
+ Selector_AlgoWithSubs();
+ /// Destructor
+ virtual ~Selector_AlgoWithSubs();
+ /// Erases the sub-algorithms stored
+ void clearSubAlgos();
+ /// Returns the next label for a new sub-selector created
+ TDF_Label newSubLabel();
+ /// Appends a new algorithm to the list, erases list if it is null (failed)
+ bool append(Selector_Algo* theAlgo, const bool theEraseIfNull = true);
+ /// Returns the stored list of sub-algorithms.
+ std::list<Selector_Algo*>& list();
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_Container.h>
+
+#include <Selector_NameGenerator.h>
+#include <Selector_NExplode.h>
+
+#include <TNaming_NamedShape.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDF_ChildIterator.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+
+Selector_Container::Selector_Container() : Selector_AlgoWithSubs()
+{}
+
+bool Selector_Container::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue)
+{
+ myShapeType = theValue.ShapeType();
+
+ // iterate all sub-shapes and select them on sublabels
+ for(TopoDS_Iterator aSubIter(theValue); aSubIter.More(); aSubIter.Next()) {
+ Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, aSubIter.Value(),
+ newSubLabel(), baseDocument(),
+ false, useNeighbors(), useIntersections()); //for subs no geometrical naming allowed
+ if (!append(aSubAlgo))
+ return false;
+ }
+ return true;
+}
+
+void Selector_Container::store()
+{
+ storeType(Selector_Algo::SELTYPE_CONTAINER);
+ // store all sub-selectors
+ TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
+ std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+ for(; aSubSel != list().cend(); aSubSel++) {
+ (*aSubSel)->store();
+ }
+ TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
+}
+
+bool Selector_Container::restore()
+{
+ Handle(TDataStd_Integer) aShapeTypeAttr;
+ if (!label().FindAttribute(shapeTypeID(), aShapeTypeAttr))
+ return false;
+ myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get());
+ // restore sub-selectors
+ bool aSubResult = true;
+ for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) {
+ Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument());
+ if (!append(aSubSel, false)) {
+ break; // some empty label left in the end
+ }
+ }
+ return true;
+}
+
+TDF_Label Selector_Container::restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+{
+ myShapeType = theShapeType;
+ TDF_Label aContext;
+ for(size_t aStart = 0; aStart != std::string::npos; aStart = theName.find('[', aStart + 1)) {
+ size_t anEndPos = theName.find(']', aStart + 1);
+ if (anEndPos != std::string::npos) {
+ // there could be sub-intersections, so, [[...]] case; searching for other open-bracket
+ size_t aNextStart = theName.find('[', aStart + 1);
+ while(aNextStart != std::string::npos && aNextStart < anEndPos) {
+ anEndPos = theName.find(']', anEndPos + 1);
+ if (anEndPos == std::string::npos) {
+ return TDF_Label(); // invalid parentheses
+ }
+ aNextStart = theName.find('[', aNextStart + 1);
+ }
+ if (anEndPos == std::string::npos)
+ return TDF_Label(); // invalid parentheses
+ std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
+ TopAbs_ShapeEnum aSubShapeType = TopAbs_FACE;
+ switch (myShapeType) {
+ case TopAbs_COMPSOLID: aSubShapeType = TopAbs_SOLID; break;
+ case TopAbs_WIRE: aSubShapeType = TopAbs_EDGE; break;
+ default:;
+ }
+ TDF_Label aSubContext;
+ Selector_Algo* aSubSel =
+ Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, aSubShapeType,
+ geometricalNaming(), theNameGenerator, aSubContext);
+ if (!append(aSubSel))
+ return TDF_Label();
+
+ if (aSubContext.IsNull()) {
+ delete aSubSel;
+ clearSubAlgos();
+ return TDF_Label();
+ }
+ if (!aContext.IsNull() && !aContext.IsEqual(aSubContext)) {
+ if (!theNameGenerator->isLater(aContext, aSubContext))
+ aContext = aSubContext;
+ } else {
+ aContext = aSubContext;
+ }
+ } else
+ return TDF_Label(); // invalid parentheses
+ aStart = anEndPos; // for recursive parenthesis set start on the current end
+ }
+ return aContext;
+}
+
+bool Selector_Container::solve(const TopoDS_Shape& theContext)
+{
+ TopoDS_Shape aResult;
+
+ TopoDS_Builder aBuilder;
+ switch(myShapeType) {
+ case TopAbs_COMPOUND: {
+ TopoDS_Compound aComp;
+ aBuilder.MakeCompound(aComp);
+ aResult = aComp;
+ break;
+ }
+ case TopAbs_COMPSOLID: {
+ TopoDS_CompSolid aComp;
+ aBuilder.MakeCompSolid(aComp);
+ aResult = aComp;
+ break;
+ }
+ case TopAbs_SHELL: {
+ TopoDS_Shell aShell;
+ aBuilder.MakeShell(aShell);
+ aResult = aShell;
+ break;
+ }
+ case TopAbs_WIRE: {
+ TopoDS_Wire aWire;
+ aBuilder.MakeWire(aWire);
+ aResult = aWire;
+ break;
+ }
+ }
+ TopoDS_ListOfShape aSubSelectorShapes;
+ std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+ for(; aSubSel != list().cend(); aSubSel++) {
+ if (!(*aSubSel)->solve(theContext)) {
+ return false;
+ }
+ aBuilder.Add(aResult, (*aSubSel)->value());
+ }
+ if (!aResult.IsNull()) {
+ Selector_Algo::store(aResult);
+ return true;
+ }
+ return false;
+}
+
+std::string Selector_Container::name(Selector_NameGenerator* theNameGenerator)
+{
+ std::string aResult;
+ // add names of sub-components one by one in "[]"
+ std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+ for(; aSubSel != list().cend(); aSubSel++) {
+ aResult += '[';
+ aResult += (*aSubSel)->name(theNameGenerator);
+ aResult += ']';
+ }
+ return aResult;
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_Container_H_
+#define Selector_Container_H_
+
+#include "Selector_AlgoWithSubs.h"
+
+#include <list>
+
+/**\class Selector_Container
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: selected shape is a container of sub-shapes that must
+ * be named one by one.
+ */
+class Selector_Container: public Selector_AlgoWithSubs
+{
+ TopAbs_ShapeEnum myShapeType; ///< type of this container
+public:
+ /// Initializes the selection of this kind
+ SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue);
+
+ /// Stores the name to the label and sub-labels tree
+ SELECTOR_EXPORT virtual void store() override;
+
+ /// Restores the selected shape by the topological naming kept in the data structure
+ /// Returns true if it can restore structure correctly
+ SELECTOR_EXPORT virtual bool restore() override;
+
+ /// Restores the selected shape by the topological name string.
+ /// Returns not empty label of the context.
+ SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
+
+ /// Updates the current shape by the stored topological name
+ SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
+
+ /// Returns the naming name of the selection
+ SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+private:
+ /// Initializes selector
+ Selector_Container();
+
+ friend class Selector_Algo;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_FilterByNeighbors.h>
+
+#include <Selector_NameGenerator.h>
+
+#include <TopoDS.hxx>
+#include <TopoDS_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDataStd_IntegerArray.hxx>
+#include <TDF_ChildIterator.hxx>
+
+// array of the neighbor levels
+static const Standard_GUID kLEVELS_ARRAY("ee4c4b45-e859-4e86-aa4f-6eac68e0ca1f");
+
+Selector_FilterByNeighbors::Selector_FilterByNeighbors() : Selector_AlgoWithSubs()
+{}
+
+/// Searches neighbor of theLevel of neighborhood to theValue in theContex
+static void findNeighbors(const TopoDS_Shape theContext, const TopoDS_Shape theValue,
+ const int theLevel, TopTools_MapOfShape& theResult)
+{
+ TopAbs_ShapeEnum aConnectorType = TopAbs_VERTEX; // type of the connector sub-shapes
+ if (theValue.ShapeType() == TopAbs_FACE)
+ aConnectorType = TopAbs_EDGE;
+ TopTools_MapOfShape aNBConnectors; // connector shapes that already belong to neighbors
+ for(TopExp_Explorer aValExp(theValue, aConnectorType); aValExp.More(); aValExp.Next()) {
+ aNBConnectors.Add(aValExp.Current());
+ }
+
+ TopTools_MapOfShape alreadyProcessed;
+ alreadyProcessed.Add(theValue);
+
+ for(int aLevel = 1; aLevel <= theLevel; aLevel++) {
+ TopoDS_ListOfShape aGoodCandidates;
+ TopExp_Explorer aCandidate(theContext, theValue.ShapeType());
+ for(; aCandidate.More(); aCandidate.Next()) {
+ if (alreadyProcessed.Contains(aCandidate.Current()))
+ continue;
+ TopExp_Explorer aCandConnector(aCandidate.Current(), aConnectorType);
+ for(; aCandConnector.More(); aCandConnector.Next()) {
+ if (aNBConnectors.Contains(aCandConnector.Current())) // candidate is neighbor
+ break;
+ }
+ if (aCandConnector.More()) {
+ if (aLevel == theLevel) { // add a NB into result: it is connected to other neighbors
+ theResult.Add(aCandidate.Current());
+ } else { // add to the NB of the current level
+ aGoodCandidates.Append(aCandidate.Current());
+ }
+ }
+ }
+ if (aLevel != theLevel) { // good candidates are added to neighbor of this level by connectors
+ for(TopoDS_ListOfShape::Iterator aGood(aGoodCandidates); aGood.More(); aGood.Next()) {
+ TopExp_Explorer aGoodConnector(aGood.Value(), aConnectorType);
+ for(; aGoodConnector.More(); aGoodConnector.Next()) {
+ aNBConnectors.Add(aGoodConnector.Current());
+ }
+ alreadyProcessed.Add(aGood.Value());
+ }
+ }
+ }
+}
+
+/// Searches the neighbor shape by neighbors defined in theNB in theContext shape
+static const TopoDS_Shape findNeighbor(const TopoDS_Shape theContext,
+ const std::list<std::pair<TopoDS_Shape, int> >& theNB, const bool theGeometrical)
+{
+ // searching for neighbors with minimum level
+ int aMinLevel = 0;
+ std::list<std::pair<TopoDS_Shape, int> >::const_iterator aNBIter = theNB.cbegin();
+ for(; aNBIter != theNB.cend(); aNBIter++) {
+ if (aMinLevel == 0 || aNBIter->second < aMinLevel) {
+ aMinLevel = aNBIter->second;
+ }
+ }
+ // collect all neighbors which are neighbors of sub-shapes with minimum level
+ bool aFirst = true;
+ TopoDS_ListOfShape aMatches;
+ for(aNBIter = theNB.cbegin(); aNBIter != theNB.cend(); aNBIter++) {
+ if (aNBIter->second == aMinLevel) {
+ TopTools_MapOfShape aThisNBs;
+ findNeighbors(theContext, aNBIter->first, aMinLevel, aThisNBs);
+ // aMatches must contain common part of all NBs lists
+ for(TopTools_MapOfShape::Iterator aThisNB(aThisNBs); aThisNB.More(); aThisNB.Next()) {
+ if (aFirst) {
+ aMatches.Append(aThisNB.Value());
+ } else {
+ // remove all in aMatches which are not in this NBs
+ for(TopoDS_ListOfShape::Iterator aMatch(aMatches); aMatch.More(); ) {
+ if (aThisNBs.Contains(aMatch.Value())) {
+ aMatch.Next();
+ } else {
+ aMatches.Remove(aMatch);
+ }
+ }
+ }
+ }
+ aFirst = false;
+ }
+ }
+ if (aMatches.IsEmpty())
+ return TopoDS_Shape(); // not found any candidate
+ if (aMatches.Extent() == 1)
+ return aMatches.First(); // already found good candidate
+ TopoDS_Compound aResultCompound; // in case of geometrical name and many candidates
+ // iterate all matches to find by other (higher level) neighbors the best candidate
+ TopoDS_Shape aGoodCandidate;
+ TopTools_MapOfShape aGoodCandidates; // already added good candidates to the map
+ for(TopoDS_ListOfShape::Iterator aCandidate(aMatches); aCandidate.More(); aCandidate.Next()) {
+ bool aValidCadidate = true;
+ for(int aLevel = aMinLevel + 1; true; aLevel++) {
+ bool aFooundHigherLevel = false;
+ TopoDS_ListOfShape aLevelNBs;
+ for(aNBIter = theNB.cbegin(); aNBIter != theNB.cend(); aNBIter++) {
+ if (aNBIter->second == aLevel)
+ aLevelNBs.Append(aNBIter->first);
+ else if (aNBIter->second >= aLevel)
+ aFooundHigherLevel = true;
+ }
+ if (!aFooundHigherLevel && aLevelNBs.IsEmpty()) { // iterated all, so, good candidate
+ if (aGoodCandidate.IsNull()) {
+ aGoodCandidate = aCandidate.Value();
+ } else { // another good candidate
+ if (theGeometrical && Selector_Algo::sameGeometry(aGoodCandidate, aCandidate.Value())) {
+ if (!aGoodCandidates.Add(aCandidate.Value()))
+ break;
+ static TopoDS_Builder aBuilder;
+ if (aResultCompound.IsNull()) {
+ aBuilder.MakeCompound(aResultCompound);
+ aBuilder.Add(aResultCompound, aGoodCandidate);
+ }
+ aBuilder.Add(aResultCompound, aCandidate.Value());
+ } else
+ return TopoDS_Shape();
+ }
+ }
+ if (!aLevelNBs.IsEmpty()) {
+ TopTools_MapOfShape aNBsOfCandidate;
+ findNeighbors(theContext, aCandidate.Value(), aLevel, aNBsOfCandidate);
+ // check all stored neighbors are in the map of real neighbors
+ for(TopoDS_ListOfShape::Iterator aLevIter(aLevelNBs); aLevIter.More(); aLevIter.Next()) {
+ if (!aNBsOfCandidate.Contains(aLevIter.Value())) {
+ aValidCadidate = false;
+ break;
+ }
+ }
+ }
+ if (!aValidCadidate) // candidate is not valid, break the checking
+ break;
+ }
+ }
+ if (!aResultCompound.IsNull())
+ return aResultCompound;
+ return aGoodCandidate;
+}
+
+bool Selector_FilterByNeighbors::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue)
+{
+ myShapeType = theValue.ShapeType();
+ // searching by neighbors
+ std::list<std::pair<TopoDS_Shape, int> > aNBs; /// neighbor sub-shape -> level of neighborhood
+ for(int aLevel = 1; true; aLevel++) {
+ TopTools_MapOfShape aNewNB;
+ findNeighbors(theContext, theValue, aLevel, aNewNB);
+ if (aNewNB.Extent() == 0) { // there are no neighbors of the given level, stop iteration
+ break;
+ }
+ // iterate by the order in theContext to keep same naming names
+ TopExp_Explorer anOrder(theContext, theValue.ShapeType());
+ TopTools_MapOfShape alreadyProcessed;
+ for (; anOrder.More(); anOrder.Next()) {
+ if (alreadyProcessed.Add(anOrder.Current()) && aNewNB.Contains(anOrder.Current())) {
+ TopoDS_Shape aNewNBShape = anOrder.Current();
+ // check which can be named correctly, without "by neighbors" type
+ Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, aNewNBShape,
+ newSubLabel(), baseDocument(), geometricalNaming(), false, useIntersections());
+ if (aSubAlgo) {
+ // add to list of good NBs
+ aNBs.push_back(std::pair<TopoDS_Shape, int>(aNewNBShape, aLevel));
+ }
+ delete aSubAlgo; // don't keep this sub-algo until all subs and whole validity are checked
+ }
+ }
+ TopoDS_Shape aResult = findNeighbor(theContext, aNBs, geometricalNaming());
+ if (!aResult.IsNull() && aResult.IsSame(theValue)) {
+ std::list<std::pair<TopoDS_Shape, int> >::iterator aNBIter = aNBs.begin();
+ for(; aNBIter != aNBs.end(); aNBIter++) {
+ Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, aNBIter->first,
+ newSubLabel(), baseDocument(), geometricalNaming(), false, useIntersections());
+ if (append(aSubAlgo)) {
+ myNBLevel.push_back(aNBIter->second);
+ } else {
+ delete aSubAlgo;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+}
+
+void Selector_FilterByNeighbors::store()
+{
+ storeType(Selector_Algo::SELTYPE_FILTER_BY_NEIGHBOR);
+ TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
+ // store numbers of levels corresponded to the neighbors in sub-selectors
+ Handle(TDataStd_IntegerArray) anArray =
+ TDataStd_IntegerArray::Set(label(), kLEVELS_ARRAY, 0, int(myNBLevel.size()) - 1);
+ std::list<int>::iterator aLevel = myNBLevel.begin();
+ for(int anIndex = 0; aLevel != myNBLevel.end(); aLevel++, anIndex++) {
+ anArray->SetValue(anIndex, Abs(*aLevel));
+ }
+ // store all sub-selectors
+ std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+ for(; aSubSel != list().cend(); aSubSel++) {
+ (*aSubSel)->store();
+ }
+}
+
+bool Selector_FilterByNeighbors::restore()
+{
+ Handle(TDataStd_Integer) aShapeTypeAttr;
+ if (!label().FindAttribute(shapeTypeID(), aShapeTypeAttr))
+ return false;
+ myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get());
+ // restore levels indices
+ Handle(TDataStd_IntegerArray) anArray;
+ if (!label().FindAttribute(kLEVELS_ARRAY, anArray))
+ return false;
+ for(int anIndex = 0; anIndex <= anArray->Upper(); anIndex++) {
+ myNBLevel.push_back(anArray->Value(anIndex));
+ }
+ // restore sub-selectors
+ bool aSubResult = true;
+ for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) {
+ Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument());
+ if (!append(aSubSel, false)) {
+ if (!aSub.Value().HasAttribute())
+ break; // some empty label left in the end
+ // some selector fails, try to use rest selectors, myNBLevel becomes negative: unused
+ if (myNBLevel.size() > list().size()) {
+ std::list<int>::iterator aListIter = myNBLevel.begin();
+ for(int a = 0; a < list().size(); a++)
+ aListIter++;
+ *aListIter = -*aListIter;
+ list().push_back(NULL);
+ }
+ }
+ }
+ return myNBLevel.size() == list().size() && !myNBLevel.empty();
+}
+
+TDF_Label Selector_FilterByNeighbors::restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+{
+ myShapeType = theShapeType;
+ TDF_Label aContext;
+ for (size_t aStart = 0; aStart != std::string::npos;
+ aStart = theName.find('(', aStart + 1)) {
+ size_t anEndPos = theName.find(')', aStart + 1);
+ if (anEndPos != std::string::npos) {
+ std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
+ TDF_Label aSubContext;
+ Selector_Algo* aSubSel =
+ Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, myShapeType,
+ geometricalNaming(), theNameGenerator, aSubContext);
+ if (!append(aSubSel))
+ return TDF_Label();
+
+ if (aSubContext.IsNull()) {
+ delete aSubSel;
+ clearSubAlgos();
+ return TDF_Label();
+ }
+ if (!aContext.IsNull() && !aContext.IsEqual(aSubContext)) {
+ if (!theNameGenerator->isLater(aContext, aSubContext))
+ aContext = aSubContext;
+ } else {
+ aContext = aSubContext;
+ }
+ if (!aContext.IsNull()) // for filters by neighbor the latest context shape is vital
+ aContext = theNameGenerator->newestContext(aContext);
+
+ // searching for the level index
+ std::string aLevel;
+ for (anEndPos++; anEndPos != std::string::npos &&
+ theName[anEndPos] != '(' && theName[anEndPos] != 0;
+ anEndPos++) {
+ aLevel += theName[anEndPos];
+ }
+ if (aLevel.empty())
+ myNBLevel.push_back(1); // by default it is 1
+ else {
+ int aNum = atoi(aLevel.c_str());
+ if (aNum > 0)
+ myNBLevel.push_back(aNum);
+ else
+ return TDF_Label(); // invalid number
+ }
+ } else
+ return TDF_Label(); // invalid parentheses
+ }
+ return aContext;
+}
+
+bool Selector_FilterByNeighbors::solve(const TopoDS_Shape& theContext)
+{
+ TopoDS_Shape aResult;
+
+ std::list<std::pair<TopoDS_Shape, int> > aNBs; /// neighbor sub-shape -> level of neighborhood
+ std::list<int>::iterator aLevel = myNBLevel.begin();
+ std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+ for(; aSubSel != list().cend(); aSubSel++, aLevel++) {
+ if (*aLevel < 0)
+ continue; // skip because sub-selector is not good
+ if ((*aSubSel)->solve(theContext)) {
+ aNBs.push_back(std::pair<TopoDS_Shape, int>((*aSubSel)->value(), *aLevel));
+ }
+ }
+ if (!aNBs.empty()) {
+ aResult = findNeighbor(theContext, aNBs, geometricalNaming());
+ if (!aResult.IsNull()) {
+ Selector_Algo::store(aResult);
+ return true;
+ }
+ }
+ return false;
+}
+
+std::string Selector_FilterByNeighbors::name(Selector_NameGenerator* theNameGenerator)
+{
+ // (nb1)level_if_more_than_1(nb2)level_if_more_than_1(nb3)level_if_more_than_1
+ std::string aResult;
+ std::list<int>::iterator aLevel = myNBLevel.begin();
+ std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+ for(; aSubSel != list().cend(); aSubSel++, aLevel++) {
+ if (!*aSubSel)
+ continue;
+ aResult += "(" + (*aSubSel)->name(theNameGenerator) + ")";
+ if (*aLevel > 1) {
+ std::ostringstream aLevelStr;
+ aLevelStr<<*aLevel;
+ aResult += aLevelStr.str();
+ }
+ }
+ return aResult;
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_FilterByNeighbors_H_
+#define Selector_FilterByNeighbors_H_
+
+#include "Selector_AlgoWithSubs.h"
+
+#include <list>
+
+/**\class Selector_FilterByNeighbors
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: selected shape is identified by neighbor faces of
+ * the same type. Or neighbors of neighbors are considered, etc.
+ * be named one by one.
+ */
+class Selector_FilterByNeighbors: public Selector_AlgoWithSubs
+{
+ TopAbs_ShapeEnum myShapeType; ///< type of this shape
+ std::list<int> myNBLevel; ///< list of integers corresponding to subs neighborhood level
+public:
+ /// Initializes the selection of this kind
+ SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue);
+
+ /// Stores the name to the label and sub-labels tree
+ SELECTOR_EXPORT virtual void store() override;
+
+ /// Restores the selected shape by the topological naming kept in the data structure
+ /// Returns true if it can restore structure correctly
+ SELECTOR_EXPORT virtual bool restore() override;
+
+ /// Restores the selected shape by the topological name string.
+ /// Returns not empty label of the context.
+ SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
+
+ /// Updates the current shape by the stored topological name
+ SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
+
+ /// Returns the naming name of the selection
+ SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+private:
+ /// Initializes selector
+ Selector_FilterByNeighbors();
+
+ friend class Selector_Algo;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_Intersect.h>
+
+#include <Selector_NameGenerator.h>
+#include <Selector_NExplode.h>
+
+#include <TNaming_NamedShape.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDF_ChildIterator.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+
+Selector_Intersect::Selector_Intersect() : Selector_AlgoWithSubs()
+{
+ myWeakIndex = -1; // no index by default
+}
+
+// returns the sub-shapes of theSubType which belong to all theShapes (so, common or intersection)
+static void commonShapes(const TopoDS_ListOfShape& theShapes, TopAbs_ShapeEnum theSubType,
+ TopoDS_ListOfShape& theResults)
+{
+ TopoDS_ListOfShape::iterator aSubSel = theShapes.begin();
+ for(; aSubSel != theShapes.end(); aSubSel++) {
+ TopTools_MapOfShape aCurrentMap;
+ for(TopExp_Explorer anExp(*aSubSel, theSubType); anExp.More(); anExp.Next()) {
+ if (aCurrentMap.Add(anExp.Current()) && aSubSel == theShapes.begin())
+ theResults.Append(anExp.Current());
+ }
+ if (aSubSel != theShapes.begin()) { // remove from common shapes not in aCurrentMap
+ for(TopoDS_ListOfShape::Iterator aComIter(theResults); aComIter.More(); ) {
+ if (aCurrentMap.Contains(aComIter.Value()))
+ aComIter.Next();
+ else
+ theResults.Remove(aComIter);
+ }
+ }
+ }
+}
+
+bool Selector_Intersect::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue)
+{
+ if (!useIntersections())
+ return false;
+ myShapeType = theValue.ShapeType();
+ TopAbs_ShapeEnum aSelectionType = myShapeType;
+ // try to find the shape of the higher level type in the context shape
+ bool aFacesTried = false; // for identification of vertices, faces are tried, then edges
+ TopoDS_ListOfShape aLastCommon; // store not good commons, but which may be used for weak naming
+ TopoDS_ListOfShape aLastIntersectors;
+ while(aSelectionType != TopAbs_FACE || !aFacesTried) {
+ if (aSelectionType == TopAbs_FACE) {
+ if (theValue.ShapeType() != TopAbs_VERTEX)
+ break;
+ aFacesTried = true;
+ aSelectionType = TopAbs_EDGE;
+ } else
+ aSelectionType = TopAbs_FACE;
+ TopTools_MapOfShape anIntersectors; // shapes of aSelectionType that contain theValue
+ TopoDS_ListOfShape anIntList; // same as anIntersectors
+ for(TopExp_Explorer aSelExp(theContext, aSelectionType); aSelExp.More(); aSelExp.Next()) {
+ if (aSelectionType == TopAbs_EDGE &&
+ BRep_Tool::Degenerated(TopoDS::Edge(aSelExp.Current())))
+ continue;
+ TopExp_Explorer aSubExp(aSelExp.Current(), theValue.ShapeType());
+ for(; aSubExp.More(); aSubExp.Next()) {
+ if (aSubExp.Current().IsSame(theValue)) {
+ if (anIntersectors.Add(aSelExp.Current()))
+ anIntList.Append(aSelExp.Current());
+ break;
+ }
+ }
+ }
+ // check that solution is only one
+ TopoDS_ListOfShape aCommon;
+ commonShapes(anIntList, theValue.ShapeType(), aCommon);
+ if (aCommon.Extent() == 1 && aCommon.First().IsSame(theValue)) {
+ // name the intersectors
+ TopoDS_ListOfShape::Iterator anInt(anIntList);
+ for (; anInt.More(); anInt.Next()) {
+ Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, anInt.Value(),
+ newSubLabel(), baseDocument(), geometricalNaming(), useNeighbors(), false);
+ if (!append(aSubAlgo))
+ break; // if some selector is failed, stop and search another solution
+ }
+ if (!anInt.More()) { // all intersectors were correctly named
+ return true;
+ }
+ } else if (aCommon.Extent() > 1 && aLastCommon.IsEmpty()) {
+ aLastCommon = aCommon;
+ aLastIntersectors = anIntList;
+ }
+ }
+ if (aLastCommon.Extent() > 1) {
+ if (alwaysGeometricalNaming()) {
+ TopoDS_ListOfShape::Iterator aCommonIter(aLastCommon);
+ TopoDS_Shape aFirst = aCommonIter.Value();
+ for(aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) {
+ if (!sameGeometry(aFirst, aCommonIter.Value()))
+ break;
+ }
+ if (!aCommonIter.More()) { // all geometry is same, result is a compound
+ return true;
+ }
+ }
+ // weak naming to distinguish commons coming from intersection
+ Selector_NExplode aNexp(aLastCommon);
+ myWeakIndex = aNexp.index(theValue);
+ if (myWeakIndex != -1) {
+ // name the intersectors
+ TopoDS_ListOfShape::Iterator anInt(aLastIntersectors);
+ for (; anInt.More(); anInt.Next()) {
+ Selector_Algo* aSubAlgo = Selector_Algo::select(theContext, anInt.Value(),
+ newSubLabel(), baseDocument(), geometricalNaming(), useNeighbors(), false);
+ if (!append(aSubAlgo))
+ break; // if some selector is failed, stop and search another solution
+ }
+ if (!anInt.More()) { // all intersectors were correctly named
+ return true;
+ }
+ }
+ }
+ return false; // solution does not found
+}
+
+void Selector_Intersect::store()
+{
+ storeType(Selector_Algo::SELTYPE_INTERSECT);
+ // store all sub-selectors
+ TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
+ std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+ for(; aSubSel != list().cend(); aSubSel++) {
+ (*aSubSel)->store();
+ }
+ TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
+ if (myWeakIndex != -1) {
+ TDataStd_Integer::Set(label(), weakID(), myWeakIndex);
+ }
+}
+
+bool Selector_Intersect::restore()
+{
+ Handle(TDataStd_Integer) aShapeTypeAttr;
+ if (!label().FindAttribute(shapeTypeID(), aShapeTypeAttr))
+ return false;
+ myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get());
+ // restore sub-selectors
+ bool aSubResult = true;
+ for(TDF_ChildIterator aSub(label(), false); aSub.More(); aSub.Next()) {
+ Selector_Algo* aSubSel = restoreByLab(aSub.Value(), baseDocument());
+ if (!append(aSubSel, false)) {
+ break; // some empty label left in the end
+ }
+ }
+ Handle(TDataStd_Integer) aWeakInt;
+ if (label().FindAttribute(weakID(), aWeakInt)) {
+ myWeakIndex = aWeakInt->Get();
+ }
+ return true;
+}
+
+TDF_Label Selector_Intersect::restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+{
+ myShapeType = theShapeType;
+ TDF_Label aContext;
+ for(size_t aStart = 0; aStart != std::string::npos; aStart = theName.find('[', aStart + 1)) {
+ size_t anEndPos = theName.find(']', aStart + 1);
+ if (anEndPos != std::string::npos) {
+ std::string aSubStr = theName.substr(aStart + 1, anEndPos - aStart - 1);
+ if (aSubStr.find(weakNameID()) == 0) { // weak name identifier
+ std::string aWeakIndex = aSubStr.substr(weakNameID().size());
+ myWeakIndex = atoi(aWeakIndex.c_str());
+ continue;
+ }
+ TopAbs_ShapeEnum aSubShapeType = TopAbs_FACE;
+ if (anEndPos != std::string::npos && anEndPos + 1 < theName.size()) {
+ char aShapeChar = theName[anEndPos + 1];
+ if (theName[anEndPos + 1] != '[') {
+ switch(aShapeChar) {
+ case 'e': aSubShapeType = TopAbs_EDGE; break;
+ case 'v': aSubShapeType = TopAbs_VERTEX; break;
+ default:;
+ }
+ }
+ }
+ TDF_Label aSubContext;
+ Selector_Algo* aSubSel =
+ Selector_Algo::restoreByName(newSubLabel(), baseDocument(), aSubStr, aSubShapeType,
+ geometricalNaming(), theNameGenerator, aSubContext);
+ if (!append(aSubSel))
+ return TDF_Label();
+
+ if (aSubContext.IsNull()) {
+ delete aSubSel;
+ clearSubAlgos();
+ return TDF_Label();
+ }
+ if (!aContext.IsNull() && !aContext.IsEqual(aSubContext)) {
+ if (!theNameGenerator->isLater(aContext, aSubContext))
+ aContext = aSubContext;
+ } else {
+ aContext = aSubContext;
+ }
+ } else
+ return TDF_Label(); // invalid parentheses
+ }
+ return aContext;
+}
+
+bool Selector_Intersect::solve(const TopoDS_Shape& theContext)
+{
+ TopoDS_Shape aResult;
+ TopoDS_ListOfShape aSubSelectorShapes;
+ std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+ for(; aSubSel != list().cend(); aSubSel++) {
+ if (!(*aSubSel)->solve(theContext)) {
+ return false;
+ }
+ aSubSelectorShapes.Append((*aSubSel)->value());
+ }
+ TopoDS_ListOfShape aCommon; // common sub shapes in each sub-selector (a result)
+ commonShapes(aSubSelectorShapes, myShapeType, aCommon);
+ if (aCommon.Extent() != 1) {
+ if (myWeakIndex != -1) {
+ Selector_NExplode aNexp(aCommon);
+ aResult = aNexp.shape(myWeakIndex);
+ } else if (geometricalNaming() && aCommon.Extent() > 1) {
+ // check results are on the same geometry, create compound
+ TopoDS_ListOfShape::Iterator aCommonIter(aCommon);
+ TopoDS_Shape aFirst = aCommonIter.Value();
+ for(aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) {
+ if (!sameGeometry(aFirst, aCommonIter.Value()))
+ break;
+ }
+ if (!aCommonIter.More()) { // all geometry is same, create a result compound
+ TopoDS_Builder aBuilder;
+ TopoDS_Compound aCompound;
+ aBuilder.MakeCompound(aCompound);
+ for(aCommonIter.Initialize(aCommon); aCommonIter.More(); aCommonIter.Next()) {
+ aBuilder.Add(aCompound, aCommonIter.Value());
+ }
+ aResult = aCompound;
+ }
+ } else {
+ return false;
+ }
+ } else {
+ aResult = aCommon.First();
+ }
+ if (!aResult.IsNull()) {
+ Selector_Algo::store(aResult);
+ return true;
+ }
+ return false;
+}
+
+std::string Selector_Intersect::name(Selector_NameGenerator* theNameGenerator)
+{
+ std::string aResult;
+ // add names of sub-components one by one in "[]" +optionally [weak_name_1]
+ std::list<Selector_Algo*>::const_iterator aSubSel = list().cbegin();
+ for(; aSubSel != list().cend(); aSubSel++) {
+ aResult += '[';
+ aResult += (*aSubSel)->name(theNameGenerator);
+ aResult += ']';
+ TopoDS_Shape aSubVal = (*aSubSel)->value();
+ if (!aSubVal.IsNull()) {
+ TopAbs_ShapeEnum aSubType = aSubVal.ShapeType();
+ if (aSubType != TopAbs_FACE) { // in case the sub shape type must be stored
+ switch(aSubType) {
+ case TopAbs_EDGE: aResult += "e"; break;
+ case TopAbs_VERTEX: aResult += "v"; break;
+ default:;
+ }
+ }
+ }
+ }
+ if (myWeakIndex != -1) {
+ std::ostringstream aWeakStr;
+ aWeakStr<<"["<<weakNameID()<<myWeakIndex<<"]";
+ aResult += aWeakStr.str();
+ }
+ return aResult;
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_Intersect_H_
+#define Selector_Intersect_H_
+
+#include "Selector_AlgoWithSubs.h"
+
+#include <list>
+
+/**\class Selector_Intersect
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: sub-shape is intersection of higher level objects.
+ */
+class Selector_Intersect: public Selector_AlgoWithSubs
+{
+ TopAbs_ShapeEnum myShapeType; ///< type of this shape
+ int myWeakIndex; ///< weak index in case intersection produces several shapes
+public:
+ /// Initializes the selection of this kind
+ SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue);
+
+ /// Stores the name to the label and sub-labels tree
+ SELECTOR_EXPORT virtual void store() override;
+
+ /// Restores the selected shape by the topological naming kept in the data structure
+ /// Returns true if it can restore structure correctly
+ SELECTOR_EXPORT virtual bool restore() override;
+
+ /// Restores the selected shape by the topological name string.
+ /// Returns not empty label of the context.
+ SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
+
+ /// Updates the current shape by the stored topological name
+ SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
+
+ /// Returns the naming name of the selection
+ SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+private:
+ /// Initializes selector
+ Selector_Intersect();
+
+ friend class Selector_Algo;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_Modify.h>
+
+#include <Selector_NameGenerator.h>
+#include <Selector_NExplode.h>
+
+#include <TNaming_NamedShape.hxx>
+#include <TNaming_Iterator.hxx>
+#include <TNaming_SameShapeIterator.hxx>
+#include <TNaming_NewShapeIterator.hxx>
+#include <TNaming_Tool.hxx>
+#include <TDataStd_Name.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDF_ChildIterator.hxx>
+#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+
+Selector_Modify::Selector_Modify() : Selector_Algo()
+{
+ myWeakIndex = -1; // no index by default
+}
+
+// adds to theResult all labels that contain initial shapes for theValue located in theFinal
+static void findBases(TDF_Label theAccess, Handle(TNaming_NamedShape) theFinal,
+ const TopoDS_Shape& theValue,
+ bool aMustBeAtFinal, const TDF_Label& theAdditionalDocument, TDF_LabelList& theResult)
+{
+ bool aFoundAnyShape = false;
+ TNaming_SameShapeIterator aLabIter(theValue, theAccess);
+ for(; aLabIter.More(); aLabIter.Next()) {
+ Handle(TNaming_NamedShape) aNS;
+ if (aLabIter.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ if (aMustBeAtFinal && aNS != theFinal)
+ continue; // looking for old at the same final label only
+ TNaming_Evolution anEvolution = aNS->Evolution();
+ if (anEvolution == TNaming_PRIMITIVE) {
+ // check that this is not in the results already
+ const TDF_Label aResult = aNS->Label();
+ TDF_LabelList::Iterator aResIter(theResult);
+ for(; aResIter.More(); aResIter.Next()) {
+ if (aResIter.Value().IsEqual(aResult))
+ break;
+ }
+ if (!aResIter.More()) // not found, so add this new
+ theResult.Append(aResult);
+ aFoundAnyShape = true;
+ }
+ if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) {
+ for(TNaming_Iterator aThisIter(aNS); aThisIter.More(); aThisIter.Next()) {
+ if (aThisIter.NewShape().IsSame(theValue)) {
+ // continue recursively, null NS means that any NS are ok
+ findBases(theAccess, theFinal, aThisIter.OldShape(),
+ false, theAdditionalDocument, theResult);
+ aFoundAnyShape = true;
+ }
+ }
+ }
+ }
+ }
+ if (!aFoundAnyShape && !theAdditionalDocument.IsNull()) { // try to find in additional document
+ static TDF_Label anEmpty;
+ if (TNaming_Tool::HasLabel(theAdditionalDocument, theValue))
+ findBases(theAdditionalDocument, Handle(TNaming_NamedShape)(), theValue,
+ false, anEmpty, theResult);
+ }
+}
+
+/// Returns in theResults all shapes with history started in theBase and ended in theFinal
+static void findFinals(const TDF_Label& anAccess, const TopoDS_Shape& theBase,
+ const TDF_Label& theFinal,
+ const TDF_Label& theAdditionalDoc, TopTools_MapOfShape& theResults)
+{
+ if (TNaming_Tool::HasLabel(anAccess, theBase)) {
+ for(TNaming_NewShapeIterator aBaseIter(theBase, anAccess); aBaseIter.More(); aBaseIter.Next())
+ {
+ TNaming_Evolution anEvolution = aBaseIter.NamedShape()->Evolution();
+ if (anEvolution == TNaming_GENERATED || anEvolution == TNaming_MODIFY) {
+ if (aBaseIter.NamedShape()->Label().IsEqual(theFinal)) {
+ theResults.Add(aBaseIter.Shape());
+ } else {
+ findFinals(anAccess, aBaseIter.Shape(), theFinal, theAdditionalDoc, theResults);
+ }
+ }
+ }
+ }
+ if (!theAdditionalDoc.IsNull()) { // search additionally by the additional access label
+ static TDF_Label anEmpty;
+ findFinals(theAdditionalDoc, theBase, theFinal, anEmpty, theResults);
+ }
+}
+
+void Selector_Modify::findModificationResult(TopoDS_ListOfShape& theCommon) {
+ for(TDF_LabelList::Iterator aBase(myBases); aBase.More(); aBase.Next()) {
+ TDF_Label anAdditionalDoc; // this document if base is started in extra document
+ if (aBase.Value().Root() != label().Root()) {
+ anAdditionalDoc = label();
+ }
+ TopTools_MapOfShape aFinals;
+ for(TNaming_Iterator aBaseShape(aBase.Value()); aBaseShape.More(); aBaseShape.Next()) {
+ findFinals(aBase.Value(), aBaseShape.NewShape(), myFinal, anAdditionalDoc, aFinals);
+ }
+ if (!aFinals.IsEmpty()) {
+ if (theCommon.IsEmpty()) { // just copy all to common
+ for(TopTools_MapOfShape::Iterator aFinal(aFinals); aFinal.More(); aFinal.Next()) {
+ theCommon.Append(aFinal.Key());
+ }
+ } else { // keep only shapes presented in both lists
+ for(TopoDS_ListOfShape::Iterator aCommon(theCommon); aCommon.More(); ) {
+ if (aFinals.Contains(aCommon.Value())) {
+ aCommon.Next();
+ } else { // common is not found, remove it
+ theCommon.Remove(aCommon);
+ }
+ }
+ }
+ }
+ }
+}
+
+bool Selector_Modify::select(NCollection_List<Handle(TNaming_NamedShape)>& theModifList,
+ const TopoDS_Shape theContext, const TopoDS_Shape theValue)
+{
+ if (theModifList.Extent() > 1) { // searching for the best modification result: by context
+ Handle(TNaming_NamedShape) aCandidate;
+ NCollection_List<Handle(TNaming_NamedShape)>::Iterator aModIter(theModifList);
+ for (; !theModifList.IsEmpty() && aModIter.More(); aModIter.Next()) {
+ aCandidate = aModIter.Value();
+ TDF_Label aFatherLab = aCandidate->Label().Father();
+ Handle(TNaming_NamedShape) aFatherNS;
+ if (aFatherLab.FindAttribute(TNaming_NamedShape::GetID(), aFatherNS)) {
+ for (TNaming_Iterator anIter(aFatherNS); anIter.More(); anIter.Next()) {
+ if (theContext.IsSame(anIter.NewShape())) { // found the best modification
+ theModifList.Clear();
+ break;
+ }
+ }
+ }
+ }
+ // take the best candidate, or the last in the iteration
+ theModifList.Clear();
+ theModifList.Append(aCandidate);
+ }
+
+ if (!theModifList.IsEmpty()) {
+ // searching for all the base shapes of this modification
+ findBases(label(), theModifList.First(), theValue, true, baseDocument(), myBases);
+ if (!myBases.IsEmpty()) {
+ myFinal = theModifList.First()->Label();
+ TopoDS_ListOfShape aCommon;
+ findModificationResult(aCommon);
+ // trying to search by neighbors
+ if (aCommon.Extent() > 1) { // more complicated selection
+ if (alwaysGeometricalNaming()) {
+ TopoDS_ListOfShape::Iterator aCommonIter(aCommon);
+ TopoDS_Shape aFirst = aCommonIter.Value();
+ for (aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) {
+ if (!sameGeometry(aFirst, aCommonIter.Value()))
+ break;
+ }
+ if (!aCommonIter.More()) { // all geometry is same, result is a compound
+ return true;
+ }
+ }
+ } else if (aCommon.Extent() == 1) {
+ return true; // simple modification
+ }
+ // weak naming between the common results
+ Selector_NExplode aNexp(aCommon);
+ myWeakIndex = aNexp.index(theValue);
+ return myWeakIndex != -1;
+ }
+ // weak naming case
+ TopoDS_ListOfShape aCommon;
+ myFinal = theModifList.First()->Label();
+ Handle(TNaming_NamedShape) aNS;
+ if (myFinal.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ for(TNaming_Iterator aFinalIter(aNS); aFinalIter.More(); aFinalIter.Next()) {
+ const TopoDS_Shape& aNewShape = aFinalIter.NewShape();
+ if (!aNewShape.IsNull())
+ aCommon.Append(aNewShape);
+ }
+ }
+ Selector_NExplode aNexp(aCommon);
+ myWeakIndex = aNexp.index(theValue);
+ return myWeakIndex != -1;
+ }
+ return false;
+}
+
+void Selector_Modify::store()
+{
+ storeType(Selector_Algo::SELTYPE_MODIFICATION);
+ storeBaseArray(myBases, myFinal);
+ if (myWeakIndex != -1) {
+ TDataStd_Integer::Set(label(), weakID(), myWeakIndex);
+ }
+}
+
+bool Selector_Modify::restore()
+{
+ if (restoreBaseArray(myBases, myFinal)) {
+ Handle(TDataStd_Integer) aWeakInt;
+ if (label().FindAttribute(weakID(), aWeakInt)) {
+ myWeakIndex = aWeakInt->Get();
+ }
+ return true;
+ }
+ return false;
+}
+
+TDF_Label Selector_Modify::restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+{
+ TDF_Label aContext;
+ for(size_t anEnd, aStart = 0; aStart != std::string::npos; aStart = anEnd) {
+ if (aStart != 0)
+ aStart++;
+ anEnd = theName.find('&', aStart);
+ std::string aSubStr =
+ theName.substr(aStart, anEnd == std::string::npos ? anEnd : anEnd - aStart);
+ if (aSubStr.find(weakNameID()) == 0) { // weak name identifier
+ std::string aWeakIndex = aSubStr.substr(weakNameID().size());
+ myWeakIndex = atoi(aWeakIndex.c_str());
+ continue;
+ }
+ TDF_Label aSubContext, aValue;
+ if (!theNameGenerator->restoreContext(aSubStr, aSubContext, aValue))
+ return TDF_Label(); // can not restore
+ if(aSubContext.IsNull() || aValue.IsNull())
+ return TDF_Label(); // can not restore
+ if (myFinal.IsNull()) {
+ myFinal = aValue;
+ aContext = aSubContext;
+ } else
+ myBases.Append(aValue);
+ }
+ return aContext;
+}
+
+bool Selector_Modify::solve(const TopoDS_Shape& theContext)
+{
+ TopoDS_Shape aResult;
+ if (myBases.IsEmpty() && myWeakIndex > 0) { // weak name by the final shapes index
+ TopoDS_ListOfShape aCommon;
+ Handle(TNaming_NamedShape) aNS;
+ if (myFinal.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ for(TNaming_Iterator aFinalIter(aNS); aFinalIter.More(); aFinalIter.Next()) {
+ const TopoDS_Shape& aNewShape = aFinalIter.NewShape();
+ if (!aNewShape.IsNull())
+ aCommon.Append(aNewShape);
+ }
+ }
+ Selector_NExplode aNexp(aCommon);
+ aResult = aNexp.shape(myWeakIndex);
+ } else { // standard case
+ TopoDS_ListOfShape aFinalsCommon; // final shapes presented in all results from bases
+ findModificationResult(aFinalsCommon);
+ if (aFinalsCommon.Extent() == 1) { // result is valid: found only one shape
+ aResult = aFinalsCommon.First();
+ findNewVersion(theContext, aResult);
+ } else if (aFinalsCommon.Extent() > 1 && myWeakIndex > 0) {
+ Selector_NExplode aNExp(aFinalsCommon);
+ aResult = aNExp.shape(myWeakIndex);
+ findNewVersion(theContext, aResult);
+ } else if (aFinalsCommon.Extent() > 1 && geometricalNaming()) {// if same geometry - compound
+ TopoDS_ListOfShape::Iterator aCommonIter(aFinalsCommon);
+ TopoDS_Shape aFirst = aCommonIter.Value();
+ for(aCommonIter.Next(); aCommonIter.More(); aCommonIter.Next()) {
+ if (!sameGeometry(aFirst, aCommonIter.Value()))
+ break;
+ }
+ if (!aCommonIter.More()) { // all geometry is same, create a result compound
+ TopoDS_Builder aBuilder;
+ TopoDS_Compound aCompound;
+ aBuilder.MakeCompound(aCompound);
+ for(aCommonIter.Initialize(aFinalsCommon); aCommonIter.More(); aCommonIter.Next()) {
+ TopoDS_Shape aSub = aCommonIter.Value();
+ findNewVersion(theContext, aSub);
+ aBuilder.Add(aCompound, aSub);
+ }
+ aResult = aCompound;
+ }
+
+ }
+ }
+
+ if (!aResult.IsNull()) {
+ Selector_Algo::store(aResult);
+ return true;
+ }
+ return false;
+}
+
+std::string Selector_Modify::name(Selector_NameGenerator* theNameGenerator)
+{
+ // final&base1&base2 +optionally: [weak_name_1]
+ std::string aResult;
+ Handle(TDataStd_Name) aName;
+ if (!myFinal.FindAttribute(TDataStd_Name::GetID(), aName))
+ return "";
+ aResult += theNameGenerator->contextName(myFinal) + "/" +
+ std::string(TCollection_AsciiString(aName->Get()).ToCString());
+ for(TDF_LabelList::iterator aBase = myBases.begin(); aBase != myBases.end(); aBase++) {
+ if (!aBase->FindAttribute(TDataStd_Name::GetID(), aName))
+ return "";
+ aResult += "&";
+ aResult += theNameGenerator->contextName(*aBase) + "/" +
+ std::string(TCollection_AsciiString(aName->Get()).ToCString());
+ }
+ if (myWeakIndex != -1) {
+ std::ostringstream aWeakStr;
+ aWeakStr<<"&"<<weakNameID()<<myWeakIndex;
+ aResult += aWeakStr.str();
+ }
+ return aResult;
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_Modify_H_
+#define Selector_Modify_H_
+
+#include "Selector_Algo.h"
+
+#include <TNaming_NamedShape.hxx>
+
+#include <list>
+
+/**\class Selector_Modify
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: sub-shape is modification of primitive at some
+ * final stage.
+ */
+class Selector_Modify: public Selector_Algo
+{
+ TDF_Label myFinal; ///< final label of the primitive or generation, where the value is
+ TDF_LabelList myBases; ///< initial labels that contain shapes that produce the modification
+ int myWeakIndex; ///< weak index in case modification produces several shapes
+public:
+ /// Initializes the selection of this kind by list of named shapes where the modification results
+ /// are presented and the selected value.
+ SELECTOR_EXPORT bool select(NCollection_List<Handle(TNaming_NamedShape)>& theModifList,
+ const TopoDS_Shape theContext, const TopoDS_Shape theValue);
+
+ /// Stores the name to the label and sub-labels tree
+ SELECTOR_EXPORT virtual void store() override;
+
+ /// Restores the selected shape by the topological naming kept in the data structure
+ /// Returns true if it can restore structure correctly
+ SELECTOR_EXPORT virtual bool restore() override;
+
+ /// Restores the selected shape by the topological name string.
+ /// Returns not empty label of the context.
+ SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
+
+ /// Updates the current shape by the stored topological name
+ SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
+
+ /// Returns the naming name of the selection
+ SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+
+private:
+ /// Initializes selector
+ Selector_Modify();
+ /// Searches the final shapes presented in all results from bases basing on modification fields
+ void findModificationResult(TopoDS_ListOfShape& theCommon);
+
+ friend class Selector_Algo;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "Selector_NExplode.h"
+
+#include <TopoDS_Shape.hxx>
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+#include <GProp_GProps.hxx>
+#include <BRepGProp.hxx>
+#include <NCollection_DataMap.hxx>
+#include <Precision.hxx>
+#include <Bnd_Box.hxx>
+#include <BRepBndLib.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_MapOfShape.hxx>
+
+#include <vector>
+#include <algorithm>
+
+static std::pair<double, double> ShapeToDouble (const TopoDS_Shape& S)
+{
+ // Computing of CentreOfMass
+ gp_Pnt GPoint;
+ double Len;
+
+ if (S.ShapeType() == TopAbs_VERTEX) {
+ GPoint = BRep_Tool::Pnt(TopoDS::Vertex(S));
+ Len = (double)S.Orientation();
+ }
+ else {
+ GProp_GProps GPr;
+ if (S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE) {
+ BRepGProp::LinearProperties(S, GPr);
+ }
+ else if (S.ShapeType() == TopAbs_FACE || S.ShapeType() == TopAbs_SHELL) {
+ BRepGProp::SurfaceProperties(S, GPr);
+ }
+ else {
+ BRepGProp::VolumeProperties(S, GPr);
+ }
+ GPoint = GPr.CentreOfMass();
+ Len = GPr.Mass();
+ }
+
+ double dMidXYZ = GPoint.X() * 999.0 + GPoint.Y() * 99.0 + GPoint.Z() * 0.9;
+ return std::make_pair(dMidXYZ, Len);
+}
+
+/*!
+* \brief Sort shapes in the list by their coordinates.
+*/
+struct CompareShapes : public std::binary_function<TopoDS_Shape, TopoDS_Shape, bool>
+{
+ typedef NCollection_DataMap<TopoDS_Shape, std::pair<double, double> > DataMapOfShapeDouble;
+
+ CompareShapes(DataMapOfShapeDouble* theCashMap) : myMap(theCashMap) {}
+
+ bool operator() (const TopoDS_Shape& lhs, const TopoDS_Shape& rhs);
+
+ DataMapOfShapeDouble* myMap;
+};
+
+bool CompareShapes::operator() (const TopoDS_Shape& theShape1,
+ const TopoDS_Shape& theShape2)
+{
+ if (!myMap->IsBound(theShape1)) {
+ myMap->Bind(theShape1, ShapeToDouble(theShape1));
+ }
+
+ if (!myMap->IsBound(theShape2)) {
+ myMap->Bind(theShape2, ShapeToDouble(theShape2));
+ }
+
+ std::pair<double, double> val1 = myMap->Find(theShape1);
+ std::pair<double, double> val2 = myMap->Find(theShape2);
+
+ double tol = Precision::Confusion();
+ bool exchange = Standard_False;
+
+ double dMidXYZ = val1.first - val2.first;
+ if (dMidXYZ >= tol) {
+ exchange = Standard_True;
+ }
+ else if (Abs(dMidXYZ) < tol) {
+ double dLength = val1.second - val2.second;
+ if (dLength >= tol) {
+ exchange = Standard_True;
+ }
+ else if (Abs(dLength) < tol && theShape1.ShapeType() <= TopAbs_FACE) {
+ // equal values possible on shapes such as two halves of a sphere and
+ // a membrane inside the sphere
+// LCOV_EXCL_START
+ // this part of code is taken from GEOM module, but can not reproduce in SHAPER
+ Bnd_Box box1,box2;
+ BRepBndLib::Add(theShape1, box1);
+ if (!box1.IsVoid()) {
+ BRepBndLib::Add(theShape2, box2);
+ Standard_Real dSquareExtent = box1.SquareExtent() - box2.SquareExtent();
+ if (dSquareExtent >= tol) {
+ exchange = Standard_True;
+ }
+ else if (Abs(dSquareExtent) < tol) {
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax, val1, val2;
+ box1.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ val1 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9;
+ box2.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
+ val2 = (aXmin+aXmax)*999.0 + (aYmin+aYmax)*99.0 + (aZmin+aZmax)*0.9;
+ if ((val1 - val2) >= tol) {
+ exchange = Standard_True;
+ }
+ }
+ }
+// LCOV_EXCL_STOP
+ } else // compare addresses if shapes are geometrically equal
+ return theShape1.TShape().get() > theShape2.TShape().get();
+ }
+
+ //return val1 < val2;
+ return !exchange;
+}
+
+Selector_NExplode::Selector_NExplode(const TopoDS_ListOfShape& theShapes)
+{
+ std::vector<TopoDS_Shape> aShapesVec;
+
+ for(TopoDS_ListOfShape::Iterator anIter(theShapes); anIter.More(); anIter.Next()) {
+ aShapesVec.push_back(anIter.Value());
+ }
+
+ CompareShapes::DataMapOfShapeDouble aCash;
+ CompareShapes shComp(&aCash);
+ std::stable_sort(aShapesVec.begin(), aShapesVec.end(), shComp);
+
+ std::vector<TopoDS_Shape>::const_iterator anIter = aShapesVec.begin();
+ for (; anIter != aShapesVec.end(); ++anIter) {
+ mySorted.Append(*anIter);
+ }
+}
+
+Selector_NExplode::Selector_NExplode(const TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType)
+{
+ std::vector<TopoDS_Shape> aShapesVec;
+ TopTools_MapOfShape anAdded; // to avoid same shapes duplication
+ for(TopExp_Explorer anExp(theShape, theType); anExp.More(); anExp.Next()) {
+ if (anAdded.Add(anExp.Current()))
+ aShapesVec.push_back(anExp.Current());
+ }
+
+ CompareShapes::DataMapOfShapeDouble aCash;
+ CompareShapes shComp(&aCash);
+ std::stable_sort(aShapesVec.begin(), aShapesVec.end(), shComp);
+
+ std::vector<TopoDS_Shape>::const_iterator anIter = aShapesVec.begin();
+ for (; anIter != aShapesVec.end(); ++anIter) {
+ mySorted.Append(*anIter);
+ }
+}
+
+
+int Selector_NExplode::index(const TopoDS_Shape& theSubShape)
+{
+ TopoDS_ListOfShape::Iterator anIter(mySorted);
+ for(int anIndex = 1; anIter.More(); anIter.Next(), anIndex++) {
+ if (anIter.Value().IsSame(theSubShape))
+ return anIndex;
+ }
+ return -1; // not found
+}
+
+TopoDS_Shape Selector_NExplode::shape(const int theIndex)
+{
+ TopoDS_ListOfShape::Iterator anIter(mySorted);
+ for(int anIndex = 1; anIter.More(); anIter.Next(), anIndex++) {
+ if (anIndex == theIndex)
+ return anIter.Value();
+ }
+ return TopoDS_Shape(); // not found
+}
--- /dev/null
+// Copyright (C) 2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_NExplode_H_
+#define Selector_NExplode_H_
+
+#include "Selector.h"
+
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_ListOfShape.hxx>
+
+/// \class Selector_NExplode
+/// \ingroup DataModel
+/// \brief Sort shapes by their centers of mass, using formula X*999 + Y*99 + Z*0.9.
+/// Algorithm is copied from GEOM module, which uses nexplode Draw command from OCCT.
+/// Used for getting index of sub0shape in WeakNaming algorithm.
+class Selector_NExplode
+{
+ public:
+ /// \brief Initializes the sorted list of shapes by the shapes list.
+ SELECTOR_EXPORT Selector_NExplode(const TopoDS_ListOfShape& theShapes);
+ /// \brief Initializes the sorted list of shapes by the context shape and type of sub-shapes.
+ SELECTOR_EXPORT Selector_NExplode(const TopoDS_Shape& theShape, const TopAbs_ShapeEnum theType);
+
+ /// Returns an index (started from one) of sub-shape in the sorted list. Returns 0 if not found.
+ SELECTOR_EXPORT int index(const TopoDS_Shape& theSubShape);
+ /// Returns a shape by an index (started from one). Returns null if not found.
+ SELECTOR_EXPORT TopoDS_Shape shape(const int theIndex);
+
+protected:
+ TopoDS_ListOfShape mySorted; ///< keep the ordered list of shapes
+};
+
+#endif
--- /dev/null
+#include <Selector_NameGenerator.h>
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_NameGenerator_H_
+#define Selector_NameGenerator_H_
+
+#include "Selector.h"
+
+#include <TDF_Label.hxx>
+
+/**\class Selector_NameGenerator
+ * \ingroup DataModel
+ * \brief An interface for generation of the naming name basing on the current selection and
+ * document information. This requires higher-level data access, so, the caller of "name" method
+ * of Selector must implement this helper-class abstract methods.
+ */
+class Selector_NameGenerator
+{
+public:
+ /// empty constructor, nothing to add
+ Selector_NameGenerator() {};
+
+ /// This method returns the context name by the label of the sub-selected shape
+ virtual std::string contextName(const TDF_Label theSelectionLab) = 0;
+
+ /// This method restores by the context and value name the context label and
+ /// sub-label where the value is. Returns true if it is valid.
+ virtual bool restoreContext(std::string theName,
+ TDF_Label& theContext, TDF_Label& theValue) = 0;
+
+ /// Returns true if the first result is older than the second one in the tree of features
+ virtual bool isLater(const TDF_Label theResult1, const TDF_Label theResult2) const = 0;
+
+ /// Returns the label of the newest context presented by the current one
+ virtual TDF_Label newestContext(const TDF_Label theCurrentContext) = 0;
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_Primitive.h>
+
+#include <Selector_NameGenerator.h>
+
+#include <TNaming_NamedShape.hxx>
+#include <TDataStd_Name.hxx>
+
+
+Selector_Primitive::Selector_Primitive() : Selector_Algo()
+{
+}
+
+void Selector_Primitive::select(const TDF_Label theFinalLabel)
+{
+ myFinal = theFinalLabel;
+}
+
+void Selector_Primitive::store()
+{
+ storeType(Selector_Algo::SELTYPE_PRIMITIVE);
+ static const TDF_LabelList anEmptyRefList;
+ storeBaseArray(anEmptyRefList, myFinal);
+}
+
+bool Selector_Primitive::restore()
+{
+ static TDF_LabelList anEmptyRefList;
+ return restoreBaseArray(anEmptyRefList, myFinal);
+}
+
+TDF_Label Selector_Primitive::restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+{
+ TDF_Label aContext;
+ if (theNameGenerator->restoreContext(theName, aContext, myFinal)) {
+ if (myFinal.IsNull())
+ aContext.Nullify();
+ }
+ return aContext;
+}
+
+bool Selector_Primitive::solve(const TopoDS_Shape& theContext)
+{
+ Handle(TNaming_NamedShape) aNS;
+ if (myFinal.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ TopoDS_Shape aResult = aNS->Get();
+ // if shape was modified and not exists in the context anymore, check evolution of this shape
+ // issue 2254 and similar (document CEA parametric first issue description)
+ findNewVersion(theContext, aResult);
+ Selector_Algo::store(aResult);
+ return true;
+ }
+ return false;
+}
+
+std::string Selector_Primitive::name(Selector_NameGenerator* theNameGenerator)
+{
+ Handle(TDataStd_Name) aName;
+ if (!myFinal.FindAttribute(TDataStd_Name::GetID(), aName))
+ return "";
+ std::string aResult = theNameGenerator->contextName(myFinal);
+ if (!aResult.empty())
+ aResult += "/" + std::string(TCollection_AsciiString(aName->Get()).ToCString());
+ return aResult;
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_Primitive_H_
+#define Selector_Primitive_H_
+
+#include "Selector_Algo.h"
+
+/**\class Selector_Primitive
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: exact referencing to alone shape in the data structure.
+ */
+class Selector_Primitive: public Selector_Algo
+{
+ TDF_Label myFinal; ///< final label of the where the value is
+public:
+ /// Initializes the selection of this kind
+ /// \param theLabel the final label with the primitive shape
+ SELECTOR_EXPORT void select(const TDF_Label theFinalLabel);
+
+ /// Stores the name to the label and sub-labels tree
+ SELECTOR_EXPORT virtual void store() override;
+
+ /// Restores the selected shape by the topological naming kept in the data structure
+ /// Returns true if it can restore structure correctly
+ SELECTOR_EXPORT virtual bool restore() override;
+
+ /// Restores the selected shape by the topological name string.
+ /// Returns not empty label of the context.
+ SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
+
+ /// Updates the current shape by the stored topological name
+ SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
+
+ /// Returns the naming name of the selection
+ SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+private:
+ /// Initializes selector
+ Selector_Primitive();
+
+ friend class Selector_Algo;
+};
+
+#endif
--- /dev/null
+ // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_Selector.h>
+
+#include <Selector_NameGenerator.h>
+#include <Selector_Algo.h>
+
+#include <TopTools_MapOfShape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS_Builder.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TNaming_NamedShape.hxx>
+
+Selector_Selector::Selector_Selector(TDF_Label theLab, TDF_Label theBaseDocLab) :
+ myLab(theLab), myBaseDocumentLab(theBaseDocLab), myAlgo(NULL)
+{}
+
+Selector_Selector::~Selector_Selector()
+{
+ if (myAlgo)
+ delete myAlgo;
+}
+
+bool Selector_Selector::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue,
+ const bool theGeometricalNaming)
+{
+ if (theValue.IsNull() || theContext.IsNull())
+ return false;
+
+ myAlgo = Selector_Algo::select(theContext, theValue, myLab, myBaseDocumentLab,
+ theGeometricalNaming, true, true);
+
+ return myAlgo != NULL;
+}
+
+bool Selector_Selector::store(const TopoDS_Shape theContext)
+{
+ myAlgo->store();
+ return myAlgo->solve(theContext); // to update the selection shape on the label
+}
+
+bool Selector_Selector::restore(const TopoDS_Shape theContext)
+{
+ myAlgo = Selector_Algo::restoreByLab(myLab, myBaseDocumentLab);
+ if (myAlgo) {
+ return myAlgo->solve(theContext); // to update the selection shape on the label
+ }
+ return false;
+}
+
+TopoDS_Shape Selector_Selector::value()
+{
+ Handle(TNaming_NamedShape) aNS;
+ if (myLab.FindAttribute(TNaming_NamedShape::GetID(), aNS))
+ return aNS->Get();
+ return TopoDS_Shape(); // empty, error shape
+}
+
+std::string Selector_Selector::name(Selector_NameGenerator* theNameGenerator) {
+ return myAlgo->name(theNameGenerator);
+}
+
+TDF_Label Selector_Selector::restoreByName(
+ std::string theName, const TopAbs_ShapeEnum theShapeType,
+ Selector_NameGenerator* theNameGenerator, const bool theGeometricalNaming)
+{
+ TDF_Label aResult;
+ myAlgo = Selector_Algo::restoreByName(myLab, myBaseDocumentLab, theName, theShapeType,
+ theGeometricalNaming, theNameGenerator, aResult);
+ if (myAlgo) {
+ return aResult;
+ }
+ return TDF_Label();
+}
+
+void Selector_Selector::combineGeometrical(const TopoDS_Shape theContext)
+{
+ TopoDS_Shape aValue = value();
+ if (aValue.IsNull() || aValue.ShapeType() == TopAbs_COMPOUND)
+ return;
+
+ Selector_Algo* aNewAlgo = Selector_Algo::relesectWithAllGeometry(myAlgo, theContext);
+ if (aNewAlgo) {
+ aNewAlgo->store();
+ aNewAlgo->solve(theContext);
+ delete myAlgo;
+ myAlgo = aNewAlgo;
+ }
+}
+
+bool Selector_Selector::solve(const TopoDS_Shape theContext)
+{
+ return myAlgo->solve(theContext);
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_Selector_H_
+#define Selector_Selector_H_
+
+#include "Selector.h"
+
+#include <TDF_Label.hxx>
+#include <TopoDS_Shape.hxx>
+
+class Selector_NameGenerator;
+class Selector_Algo;
+
+/**\class Selector_Selector
+ * \ingroup DataModel
+ * \brief Main object for selection of the sub-shapes in the parametrically updated
+ * shapes using topological naming mechanism.
+ */
+class Selector_Selector
+{
+ TDF_Label myLab; ///< main label where selector is performed
+ TDF_Label myBaseDocumentLab; ///< an access-label to the document that may contain initial shapes
+ Selector_Algo* myAlgo; ///< root algorithm of the selector
+
+public:
+ /// Initializes selector on the label
+ SELECTOR_EXPORT Selector_Selector(TDF_Label theLab, TDF_Label theBaseDocLab = TDF_Label());
+
+ /// Destructor
+ SELECTOR_EXPORT ~Selector_Selector();
+
+ /// Initializes the selector structure on the label.
+ /// Stores the name data to restore after modification.
+ /// \param theContext whole shape that contains the selected sub-shape
+ /// \param theValue selected subshape
+ /// \param theGeometricalNaming treats selection with equal surfaces as one
+ /// \param theUseNeighbors enables searching algorithm by neighbors
+ /// \param theUseIntersections enables searching algorithm by intersection of higher level shapes
+ SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue,
+ const bool theGeometricalNaming = false);
+
+ /// Stores the name to the label and sub-labels tree
+ SELECTOR_EXPORT bool store(const TopoDS_Shape theContext);
+
+ /// Restores the selected shape by the topological naming kept in the data structure
+ /// Returns true if it can restore structure correctly
+ SELECTOR_EXPORT bool restore(const TopoDS_Shape theContext);
+
+ /// Restores the selected shape by the topological name string.
+ /// Returns not empty label of the context.
+ SELECTOR_EXPORT TDF_Label restoreByName(
+ std::string theName, const TopAbs_ShapeEnum theShapeType,
+ Selector_NameGenerator* theNameGenerator, const bool theGeometricalNaming = false);
+
+ /// Returns the current sub-shape value (null if can not resolve)
+ SELECTOR_EXPORT TopoDS_Shape value();
+
+ /// Returns the naming name of the selection
+ SELECTOR_EXPORT std::string name(Selector_NameGenerator* theNameGenerator);
+
+ /// Makes the current local selection becomes all sub-shapes with same base geometry.
+ SELECTOR_EXPORT void combineGeometrical(const TopoDS_Shape theContext);
+
+ /// Stores the selected shape in he tree and returns true if shape found correctly
+ SELECTOR_EXPORT bool solve(const TopoDS_Shape theContext);
+};
+
+#endif
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <Selector_WeakName.h>
+
+#include <Selector_NameGenerator.h>
+#include <Selector_NExplode.h>
+
+#include <TNaming_Tool.hxx>
+#include <TNaming_SameShapeIterator.hxx>
+#include <TNaming_Iterator.hxx>
+#include <TDataStd_Integer.hxx>
+
+Selector_WeakName::Selector_WeakName() : Selector_Algo()
+{
+}
+
+bool Selector_WeakName::select(const TopoDS_Shape theContext, const TopoDS_Shape theValue)
+{
+ myShapeType = theValue.ShapeType();
+ Selector_NExplode aNexp(theContext, myShapeType);
+ myWeakIndex = aNexp.index(theValue);
+ if (myWeakIndex != -1) {
+ // searching for context shape label to store in myFinal
+ if (TNaming_Tool::HasLabel(label(), theContext)) {
+ for(TNaming_SameShapeIterator aShapes(theContext, label()); aShapes.More(); aShapes.Next())
+ {
+ Handle(TNaming_NamedShape) aNS;
+ if (aShapes.Label().FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ TNaming_Evolution anEvolution = aNS->Evolution();
+ if (anEvolution == TNaming_PRIMITIVE || anEvolution == TNaming_GENERATED ||
+ anEvolution == TNaming_MODIFY) {
+ // check this is a new shape
+ for(TNaming_Iterator aNSIter(aNS); aNSIter.More(); aNSIter.Next()) {
+ if (aNSIter.NewShape().IsSame(theContext)) {
+ myContext = aNS->Label();
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+void Selector_WeakName::store()
+{
+ static const TDF_LabelList anEmptyRefList;
+ storeType(Selector_Algo::SELTYPE_WEAK_NAMING);
+ storeBaseArray(anEmptyRefList, myContext);
+ TDataStd_Integer::Set(label(), weakID(), myWeakIndex);
+ TDataStd_Integer::Set(label(), shapeTypeID(), (int)myShapeType);
+}
+
+bool Selector_WeakName::restore()
+{
+ Handle(TDataStd_Integer) aWeakInt;
+ if (!label().FindAttribute(weakID(), aWeakInt))
+ return false;
+ myWeakIndex = aWeakInt->Get();
+ Handle(TDataStd_Integer) aShapeTypeAttr;
+ if (!label().FindAttribute(shapeTypeID(), aShapeTypeAttr))
+ return false;
+ myShapeType = TopAbs_ShapeEnum(aShapeTypeAttr->Get());
+ static TDF_LabelList anEmptyRefList;
+ return restoreBaseArray(anEmptyRefList, myContext);
+}
+
+TDF_Label Selector_WeakName::restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator)
+{
+ std::string aWeakIndex = theName.substr(pureWeakNameID().size());
+ std::size_t aContextPosition = aWeakIndex.find("_");
+ myWeakIndex = atoi(aWeakIndex.c_str());
+ myShapeType = theShapeType;
+ TDF_Label aContext;
+ if (aContextPosition != std::string::npos) { // context is also defined
+ std::string aContextName = aWeakIndex.substr(aContextPosition + 1);
+ if (theNameGenerator->restoreContext(aContextName, aContext, myContext)) {
+ if (myContext.IsNull())
+ aContext.Nullify();
+ }
+ }
+ return aContext;
+}
+
+bool Selector_WeakName::solve(const TopoDS_Shape& theContext)
+{
+
+ TopoDS_Shape aContext;
+ if (myContext.IsNull()) {
+ aContext = theContext;
+ } else {
+ Handle(TNaming_NamedShape) aNS;
+ if (myContext.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
+ aContext = aNS->Get();
+ }
+ }
+ if (!aContext.IsNull()) {
+ Selector_NExplode aNexp(aContext, myShapeType);
+ TopoDS_Shape aResult = aNexp.shape(myWeakIndex);
+ if (!aResult.IsNull()) {
+ Selector_Algo::store(aResult);
+ return true;
+ }
+ }
+ return false;
+}
+
+std::string Selector_WeakName::name(Selector_NameGenerator* theNameGenerator)
+{
+ // _weak_naming_1_Context
+ std::ostringstream aWeakStr;
+ aWeakStr<<pureWeakNameID()<<myWeakIndex;
+ std::string aResult = aWeakStr.str();
+ if (!myContext.IsNull())
+ aResult += "_" + theNameGenerator->contextName(myContext);
+ return aResult;
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef Selector_WeakName_H_
+#define Selector_WeakName_H_
+
+#include "Selector_Algo.h"
+
+/**\class Selector_WeakName
+ * \ingroup DataModel
+ * \brief Kind of selection algorithm: if other algorithms fail, this stores the geometrical
+ * index of the selected shape. Pure weak naming approach.
+ */
+class Selector_WeakName: public Selector_Algo
+{
+ TopAbs_ShapeEnum myShapeType; ///< type of this shape
+ int myWeakIndex; ///< weak index in case modification produces several shapes
+ TDF_Label myContext; ///< context shape label
+public:
+ /// Initializes the selection of this kind
+ SELECTOR_EXPORT bool select(const TopoDS_Shape theContext, const TopoDS_Shape theValue);
+
+ /// Stores the name to the label and sub-labels tree
+ SELECTOR_EXPORT virtual void store() override;
+
+ /// Restores the selected shape by the topological naming kept in the data structure
+ /// Returns true if it can restore structure correctly
+ SELECTOR_EXPORT virtual bool restore() override;
+
+ /// Restores the selected shape by the topological name string.
+ /// Returns not empty label of the context.
+ SELECTOR_EXPORT virtual TDF_Label restoreByName(std::string theName,
+ const TopAbs_ShapeEnum theShapeType, Selector_NameGenerator* theNameGenerator) override;
+
+ /// Updates the current shape by the stored topological name
+ SELECTOR_EXPORT virtual bool solve(const TopoDS_Shape& theContext) override;
+
+ /// Returns the naming name of the selection
+ SELECTOR_EXPORT virtual std::string name(Selector_NameGenerator* theNameGenerator) override;
+private:
+ /// Initializes selector
+ Selector_WeakName();
+
+ friend class Selector_Algo;
+};
+
+#endif
return true;
}
+void SketchAPI_Constraint::setEntityA(const ModelHighAPI_RefAttr& theEntity)
+{
+ fillAttribute(theEntity, feature()->refattr(SketchPlugin_Constraint::ENTITY_A()));
+}
+
+void SketchAPI_Constraint::setEntityB(const ModelHighAPI_RefAttr& theEntity)
+{
+ fillAttribute(theEntity, feature()->refattr(SketchPlugin_Constraint::ENTITY_B()));
+}
+
+void SketchAPI_Constraint::setEntityC(const ModelHighAPI_RefAttr& theEntity)
+{
+ fillAttribute(theEntity, feature()->refattr(SketchPlugin_Constraint::ENTITY_C()));
+}
+
+void SketchAPI_Constraint::setEntityD(const ModelHighAPI_RefAttr& theEntity)
+{
+ fillAttribute(theEntity, feature()->refattr(SketchPlugin_Constraint::ENTITY_D()));
+}
+
+void SketchAPI_Constraint::setValue(const ModelHighAPI_Double& theValue)
+{
+ fillAttribute(theValue, feature()->real(SketchPlugin_Constraint::VALUE()));
+}
+
static const std::string& constraintTypeToSetter(const std::string& theType)
{
if (theType == SketchPlugin_ConstraintCoincidence::ID()) {
#include <SketchPlugin_Constraint.h>
+class ModelHighAPI_Double;
+
/**\class SketchAPI_Constraint
* \ingroup CPPHighAPI
* \brief Interface for Constraint feature
SKETCHAPI_EXPORT
bool initialize();
+ SKETCHAPI_EXPORT void setEntityA(const ModelHighAPI_RefAttr& theEntity);
+ SKETCHAPI_EXPORT void setEntityB(const ModelHighAPI_RefAttr& theEntity);
+ SKETCHAPI_EXPORT void setEntityC(const ModelHighAPI_RefAttr& theEntity);
+ SKETCHAPI_EXPORT void setEntityD(const ModelHighAPI_RefAttr& theEntity);
+
+ SKETCHAPI_EXPORT void setValue(const ModelHighAPI_Double& theValue);
+
/// Dump wrapped feature
SKETCHAPI_EXPORT
virtual void dump(ModelHighAPI_Dumper& theDumper) const;
SketchPlugin_Tools.h
SketchPlugin_Trim.h
SketchPlugin_Validators.h
+ SketchPlugin_SketchDrawer.h
)
SET(PROJECT_SOURCES
SketchPlugin_Circle.cpp
SketchPlugin_Constraint.cpp
SketchPlugin_ConstraintAngle.cpp
- SketchPlugin_ConstraintBase.cpp
SketchPlugin_ConstraintCoincidence.cpp
SketchPlugin_ConstraintCollinear.cpp
SketchPlugin_ConstraintDistance.cpp
SketchPlugin_Tools.cpp
SketchPlugin_Trim.cpp
SketchPlugin_Validators.cpp
+ SketchPlugin_SketchDrawer.cpp
)
SET(PROJECT_LIBRARIES
INSTALL(DIRECTORY icons/ DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}/icons/Sketch)
INSTALL(FILES ${TEXT_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
-ADD_UNIT_TESTS(TestSketchPointLine.py
- TestCreateArcByCenterStartEnd.py
- TestCreateArcByThreePoints.py
- TestCreateArcByTangentEdge.py
- TestCreateArcChangeType.py
- TestCreateCircleByCenterAndPassed.py
- TestCreateCircleByThreePoints.py
- TestCreateCircleChangeType.py
- TestConstraintCoincidence.py
- TestConstraintCollinear.py
- TestConstraintLength.py
- TestConstraintDistance.py
- TestConstraintDistanceHorizontal.py
- TestConstraintDistanceVertical.py
- TestConstraintDistanceBehavior.py
- TestConstraintParallel.py
- TestConstraintPerpendicular.py
- TestConstraintRadius.py
- TestConstraintFixed.py
- TestConstraintHorizontal.py
- TestConstraintHorizontalValidator.py
- TestConstraintVertical.py
- TestConstraintEqual.py
- TestConstraintTangent.py
- TestConstraintAngle.py
- TestConstraintMiddlePoint.py
- TestEdgesOrder.py
- TestMirror.py
- TestMultiTranslation.py
- TestMultiRotation.py
- TestMultiRotationWithParameter.py
- TestMultiRotation01.py
- TestMultiRotation02.py
- TestMultiRotation03.py
- TestMultiRotation04.py
- TestMultiRotation05.py
- TestFillet.py
- TestFilletAfterFolder.py
- TestFilletInteracting.py
- TestRectangle.py
- TestProjection.py
- TestProjectionIntoResult.py
- TestSplit.py
- TestHighload.py
- TestSnowflake.py
- TestArcBehavior.py
- TestRemoveSketch.py
- Test1061.py
- Test1673.py
- Test1924.py
- Test1966.py
- Test1967.py
- Test2062.py
- Test2095.py
- Test2115.py
- TestTrimArc01.py
- TestTrimArc02.py
- TestTrimArc03.py
- TestTrimArc04.py
- TestTrimArc05.py
- TestTrimArc06.py
- TestTrimArc07.py
- TestTrimCircle01.py
- TestTrimCircle02.py
- TestTrimCircle03.py
- TestTrimCircle04.py
- TestTrimCircle05.py
- TestTrimCircleAndArc01.py
- TestTrimLine01.py
- TestTrimLine02.py
- Test2229.py
- Test2239.py
- TestDistanceDump.py
- TestDistanceSignedVsUnsigned01.py
- TestDistanceSignedVsUnsigned02.py
- TestDistanceSignedVsUnsigned03.py
- TestDistanceSignedVsUnsigned04.py
- TestDistanceSignedVsUnsigned05.py
- TestSignedDistancePointPoint.py
- TestSignedDistancePointLine.py
- TestIntersectionWithLine.py
- TestIntersectionWithCircle.py
- TestIntersectionWithSpline.py
- TestIntersectionChangeEdge.py
- Test2273.py
- Test2280.py
- Test2287.py
- Test2341.py
- Test2390.py
- Test2393.py
- Test2425.py
- Test2440.py
- Test2157.py
- Test2157_2.py
- Test2481.py
- Test1963.py
- Test2034_1.py
- Test2034_2.py
- Test2034_3.py
- Test2134.py
- TestDegeneratedGeometry.py
- Test2119.py
- Test2224.py
- Test2427.py
- Test1577.py
- Test1578.py
- Test2654.py
- Test1779.py
- Test2711.py
+ADD_UNIT_TESTS(
+ Test1061.py
+ Test1577.py
+ Test1578.py
+ Test1673.py
+ Test1779.py
+ Test1924.py
+ Test1963.py
+ Test1966.py
+ Test1967.py
+ Test2034_1.py
+ Test2034_2.py
+ Test2034_3.py
+ Test2062.py
+ Test2095.py
+ Test2115.py
+ Test2119.py
+ Test2134.py
+ Test2157.py
+ Test2157_2.py
+ Test2224.py
+ Test2229.py
+ Test2239.py
+ Test2273.py
+ Test2280.py
+ Test2287.py
+ Test2341.py
+ Test2390.py
+ Test2393.py
+ Test2425.py
+ Test2427.py
+ Test2440.py
+ Test2481.py
+ Test2654.py
+ Test2711.py
+ Test2741.py
+ Test2810.py
+ TestArcBehavior.py
+ TestConstraintAngle.py
+ TestConstraintCoincidence.py
+ TestConstraintCollinear.py
+ TestConstraintDistance.py
+ TestConstraintDistanceBehavior.py
+ TestConstraintDistanceHorizontal.py
+ TestConstraintDistanceVertical.py
+ TestConstraintEqual.py
+ TestConstraintFixed.py
+ TestConstraintHorizontal.py
+ TestConstraintHorizontalValidator.py
+ TestConstraintLength.py
+ TestConstraintMiddlePoint.py
+ TestConstraintParallel.py
+ TestConstraintPerpendicular.py
+ TestConstraintRadius.py
+ TestConstraintRadiusFailure.py
+ TestConstraintTangent.py
+ TestConstraintVertical.py
+ TestCreateArcByCenterStartEnd.py
+ TestCreateArcByTangentEdge.py
+ TestCreateArcByThreePoints.py
+ TestCreateArcChangeType.py
+ TestCreateCircleByCenterAndPassed.py
+ TestCreateCircleByThreePoints.py
+ TestCreateCircleChangeType.py
+ TestDegeneratedGeometry.py
+ TestDistanceDump.py
+ TestDistanceSignedVsUnsigned01.py
+ TestDistanceSignedVsUnsigned02.py
+ TestDistanceSignedVsUnsigned03.py
+ TestDistanceSignedVsUnsigned04.py
+ TestDistanceSignedVsUnsigned05.py
+ TestEdgesOrder.py
+ TestFillet.py
+ TestFilletAfterFolder.py
+ TestFilletInteracting.py
+ TestHighload.py
+ TestIntersectionChangeEdge.py
+ TestIntersectionWithCircle.py
+ TestIntersectionWithLine.py
+ TestIntersectionWithSpline.py
+ TestMirror.py
+ TestMultiRotation.py
+ TestMultiRotation01.py
+ TestMultiRotation02.py
+ TestMultiRotation03.py
+ TestMultiRotation04.py
+ TestMultiRotation05.py
+ TestMultiRotationWithParameter.py
+ TestMultiTranslation.py
+ TestPresentation.py
+ TestProjection.py
+ TestProjectionIntoResult.py
+ TestProjectionUpdate.py
+ TestRectangle.py
+ TestRemoveSketch.py
+ TestSignedDistancePointLine.py
+ TestSignedDistancePointPoint.py
+ TestSketchDrawer.py
+ TestSketchPointLine.py
+ TestSnowflake.py
+ TestSplit.py
+ TestSplitLine.py
+ TestSplitPreview.py
+ TestTrimArc01.py
+ TestTrimArc02.py
+ TestTrimArc03.py
+ TestTrimArc04.py
+ TestTrimArc05.py
+ TestTrimArc06.py
+ TestTrimArc07.py
+ TestTrimArc08.py
+ TestTrimCircle01.py
+ TestTrimCircle02.py
+ TestTrimCircle03.py
+ TestTrimCircle04.py
+ TestTrimCircle05.py
+ TestTrimCircleAndArc01.py
+ TestTrimLine01.py
+ TestTrimLine02.py
+ TestTrimLine03.py
+ TestTrimPreview.py
)
if(${SKETCHER_CHANGE_RADIUS_WHEN_MOVE})
ADD_UNIT_TESTS(
- TestMovePoint.py
- TestMoveLine.py
- TestMoveCircle.py
- TestMoveArc.py
- TestMovementComplex.py
+ TestMoveArc.py
+ TestMoveCircle.py
+ TestMoveLine.py
+ TestMovementComplex.py
+ TestMovePoint.py
)
endif()
+++ /dev/null
-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#include "SketchPlugin_ConstraintBase.h"
-
-AISObjectPtr SketchPlugin_ConstraintBase::getAISObject(AISObjectPtr thePrevious)
-{
- return thePrevious;
-}
-
-const void SketchPlugin_ConstraintBase::addSub(const FeaturePtr& theFeature)
-{
-
-}
public GeomAPI_ICustomPrs
{
public:
- /// Returns the AIS preview
- SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
-
- /** \brief Adds sub-feature of the higher level feature (sub-element of the sketch)
- * \param theFeature sub-feature
- */
- SKETCHPLUGIN_EXPORT virtual const void addSub(const FeaturePtr& theFeature);
-
- /// Customize presentation of the feature
+ /// Customize presentation of the feature
virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs)
{
return anAIS;
}
-FeaturePtr SketchPlugin_ConstraintCoincidence::findCoincidenceFeature(const FeaturePtr& theFeature1,
- const FeaturePtr& theFeature2)
-{
- FeaturePtr aResultFeature;
-
- std::list<AttributePtr> anAttrList;
- if (theFeature1->getKind() == SketchPlugin_Circle::ID() ||
- theFeature2->getKind() == SketchPlugin_Circle::ID())
- return aResultFeature;
-
- if (theFeature2->getKind() == SketchPlugin_Line::ID()) {
- anAttrList.push_back(theFeature2->attribute(SketchPlugin_Line::START_ID()));
- anAttrList.push_back(theFeature2->attribute(SketchPlugin_Line::END_ID()));
- } else if (theFeature2->getKind() == SketchPlugin_Arc::ID()) {
- anAttrList.push_back(theFeature2->attribute(SketchPlugin_Arc::START_ID()));
- anAttrList.push_back(theFeature2->attribute(SketchPlugin_Arc::END_ID()));
- }
-
- const std::set<AttributePtr>& aRefsList = theFeature1->data()->refsToMe();
- std::set<AttributePtr>::const_iterator aRefIt = aRefsList.begin();
- for (; aRefIt != aRefsList.end() && !aResultFeature.get(); ++aRefIt) {
- FeaturePtr aConstrFeature = std::dynamic_pointer_cast<ModelAPI_Feature>((*aRefIt)->owner());
- if (aConstrFeature->getKind() != SketchPlugin_ConstraintCoincidence::ID())
- continue;
- AttributeRefAttrPtr aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*aRefIt);
- AttributePtr anAttr = aRefAttr->attr();
- if (anAttr->id() == SketchPlugin_Arc::CENTER_ID())
- continue;
-
- anAttr = aConstrFeature->attribute(SketchPlugin_Constraint::ENTITY_A());
- if (anAttr == *aRefIt)
- anAttr = aConstrFeature->attribute(SketchPlugin_Constraint::ENTITY_B());
-
- aRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(anAttr);
- if (!aRefAttr)
- continue;
- anAttr = aRefAttr->attr();
- for (std::list<AttributePtr>::const_iterator anIt = anAttrList.begin();
- anIt != anAttrList.end() && !aResultFeature.get(); ++anIt)
- if (*anIt == anAttr)
- aResultFeature = aConstrFeature;
- }
- return aResultFeature;
-}
-
AttributePoint2DPtr SketchPlugin_ConstraintCoincidence::getPoint(const FeaturePtr& theFeature)
{
AttributePoint2DPtr aPoint = ModelGeomAlgo_Point2D::getPointOfRefAttr(theFeature.get(),
/// \brief Request for initialization of data model of the feature: adding all attributes
SKETCHPLUGIN_EXPORT virtual void initAttributes();
- /// Returns coincident feature if there is a coincidence built on the given features
- /// \param theFeature1 the first feature
- /// \param theFeature2 the second feature
- static FeaturePtr findCoincidenceFeature(const FeaturePtr& theFeature1,
- const FeaturePtr& theFeature2);
-
/// Creates a constraint on two points
/// \param theSketch a sketch feature
/// \param thePoint1 the first point
return true;
}
- /// Construction result is allways recomuted on the fly
- SKETCHPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
-
/// Returns true is sketch element is under the rigid constraint
SKETCHPLUGIN_EXPORT virtual bool isFixed() {return false;}
// create feature for fillet arc
FeaturePtr aFilletArc = createFilletArc();
+ if (!aFilletArc) {
+ setError("Error: unable to create a fillet arc.");
+ return;
+ }
// collect features referred to the edges participating in fillet
AttributePoint2DPtr aFilletPoints[2];
if (!myBaseFeatures[0] || !myBaseFeatures[1])
calculateFilletParameters();
+ // fix for issue #2810 (sometimes, myCenterXY is NULL, fillet should report an error)
+ if (!myCenterXY)
+ return FeaturePtr();
+
// Create arc feature.
FeaturePtr aFilletArc = sketch()->addFeature(SketchPlugin_Arc::ID());
}
}
+// LCOV_EXCL_START
std::string SketchPlugin_Line::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
std::string aFilledAttributeName;
}
return aFilledAttributeName;
}
+// LCOV_EXCL_STOP
double SketchPlugin_Line::distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
{
SKETCHPLUGIN_EXPORT virtual void execute();
/// Apply information of the message to current object. It fills start attribute of
- /// the currrent feature by last attribute of the message feature, build coincidence
+ /// the current feature by last attribute of the message feature, build coincidence
/// if message has selected object
virtual std::string processEvent(const std::shared_ptr<Events_Message>& theMessage);
SketchPlugin_Line();
private:
- /// Calculates the lenght of the line and fill the lenght attribute with the value
+ /// Calculates the length of the line and fill the length attribute with the value
void updateLenghtValue();
protected:
Events_Loop::loop()->send(aMessage);
}
+// LCOV_EXCL_START
std::string SketchPlugin_MacroArc::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
std::string aFilledAttributeName;
}
return aFilledAttributeName;
}
+// LCOV_EXCL_STOP
FeaturePtr SketchPlugin_MacroArc::createArcFeature()
{
return;
GeomAPI_Circ2d aCircleForArc(myCenter, myStart);
+ // avoid degerated arc, when the center and the start points are equal
+ if (!aCircleForArc.implPtr<void*>())
+ return;
bool aWasBlocked = data()->blockSendAttributeUpdated(true);
// check the end point is referred to another feature
Events_Loop::loop()->send(aMessage);
}
+// LCOV_EXCL_START
std::string SketchPlugin_MacroCircle::processEvent(
const std::shared_ptr<Events_Message>& theMessage)
{
}
return aFilledAttributeName;
}
+// LCOV_EXCL_STOP
void SketchPlugin_MacroCircle::constraintsForCircleByCenterAndPassed(FeaturePtr theCircleFeature)
{
#include <SketchPlugin_ExternalValidator.h>
#include <SketchPlugin_Ellipse.h>
#include <SketchPlugin_MacroEllipse.h>
+#include <SketchPlugin_SketchDrawer.h>
#include <SketcherPrs_Tools.h>
return FeaturePtr(new SketchPlugin_Ellipse);
} else if (theFeatureID == SketchPlugin_MacroEllipse::ID()) {
return FeaturePtr(new SketchPlugin_MacroEllipse);
+ } else if (theFeatureID == SketchPlugin_SketchDrawer::ID()) {
+ return FeaturePtr(new SketchPlugin_SketchDrawer);
}
// feature of such kind is not found
return FeaturePtr();
}
+// LCOV_EXCL_START
void SketchPlugin_Plugin::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
const Events_ID kRequestEvent =
}
return aMsg;
}
+// LCOV_EXCL_STOP
}
void SketchPlugin_Point::attributeChanged(const std::string& theID) {
- // the second condition for unability to move external point anywhere
+ // the second condition for inability to move external point anywhere
if (theID == EXTERNAL_ID() || isFixed()) {
std::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(EXTERNAL_ID())->value();
if (!aSelection) {
#include <GeomAPI_Dir.h>
#include <GeomAPI_PlanarEdges.h>
+#include <GeomAPI_ShapeIterator.h>
#include <GeomAPI_Vertex.h>
#include <GeomDataAPI_Point2D.h>
std::shared_ptr<GeomAPI_Shape> aSelection = aSelAttr->value();
if (!aSelection.get()) aSelection = aSelAttr->context()->shape();
// update the sketch plane
- std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aSelection));
- std::shared_ptr<GeomAPI_Pln> aPlane = aFace->getPlane();
- if (aPlane) {
- double anA, aB, aC, aD;
- aPlane->coefficients(anA, aB, aC, aD);
-
- // calculate attributes of the sketch
- std::shared_ptr<GeomAPI_Dir> aNormDir(new GeomAPI_Dir(anA, aB, aC));
- std::shared_ptr<GeomAPI_XYZ> aCoords = aNormDir->xyz();
- std::shared_ptr<GeomAPI_XYZ> aZero(new GeomAPI_XYZ(0, 0, 0));
- aCoords = aCoords->multiplied(-aD * aCoords->distance(aZero));
- std::shared_ptr<GeomAPI_Pnt> anOrigPnt(new GeomAPI_Pnt(aCoords));
- // X axis is preferable to be dirX on the sketch
- // here can not be very small value to avoid very close to X normal axis (issue 595)
- static const double tol = 0.1;
- bool isX = fabs(anA) - 1.0 < tol && fabs(aB) < tol && fabs(aC) < tol;
- std::shared_ptr<GeomAPI_Dir> aTempDir(
- isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0));
- std::shared_ptr<GeomAPI_Dir> aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir)));
- std::shared_ptr<GeomAPI_Dir> aXDir(new GeomAPI_Dir(aYDir->cross(aNormDir)));
-
- // update position of the sketch
- std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast
- <GeomDataAPI_Point>(data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
- anOrigin->setValue(anOrigPnt);
- std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
- data()->attribute(SketchPlugin_Sketch::NORM_ID()));
- aNormal->setValue(aNormDir);
- std::shared_ptr<GeomDataAPI_Dir> aDirX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
- data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
- aDirX->setValue(aXDir);
- std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
+ std::shared_ptr<GeomAPI_Face> aFace;
+ if (aSelection->isFace()) {
+ aFace = aSelection->face();
+ } else if (aSelection->isCompound()) {
+ GeomAPI_ShapeIterator anIt(aSelection);
+ aFace = anIt.current()->face();
+ }
+ if (aFace.get()) {
+ std::shared_ptr<GeomAPI_Pln> aPlane = aFace->getPlane();
+ if (aPlane.get()) {
+ double anA, aB, aC, aD;
+ aPlane->coefficients(anA, aB, aC, aD);
+
+ // calculate attributes of the sketch
+ std::shared_ptr<GeomAPI_Dir> aNormDir(new GeomAPI_Dir(anA, aB, aC));
+ std::shared_ptr<GeomAPI_XYZ> aCoords = aNormDir->xyz();
+ std::shared_ptr<GeomAPI_XYZ> aZero(new GeomAPI_XYZ(0, 0, 0));
+ aCoords = aCoords->multiplied(-aD * aCoords->distance(aZero));
+ std::shared_ptr<GeomAPI_Pnt> anOrigPnt(new GeomAPI_Pnt(aCoords));
+ // X axis is preferable to be dirX on the sketch
+ // here can not be very small value to avoid very close to X normal axis (issue 595)
+ static const double tol = 0.1;
+ bool isX = fabs(anA) - 1.0 < tol && fabs(aB) < tol && fabs(aC) < tol;
+ std::shared_ptr<GeomAPI_Dir> aTempDir(
+ isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0));
+ std::shared_ptr<GeomAPI_Dir> aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir)));
+ std::shared_ptr<GeomAPI_Dir> aXDir(new GeomAPI_Dir(aYDir->cross(aNormDir)));
+
+ // update position of the sketch
+ std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast
+ <GeomDataAPI_Point>(data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
+ anOrigin->setValue(anOrigPnt);
+ std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ data()->attribute(SketchPlugin_Sketch::NORM_ID()));
+ aNormal->setValue(aNormDir);
+ std::shared_ptr<GeomDataAPI_Dir> aDirX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
+ aDirX->setValue(aXDir);
+ std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
+ }
}
}
} else if (theID == NORM_ID() || theID == DIRX_ID() || theID == ORIGIN_ID()) {
return std::shared_ptr<GeomAPI_Ax3>(new GeomAPI_Ax3(anOrigin->pnt(), aDirX->dir(), aNorm->dir()));
}
-
-void SketchPlugin_Sketch::exchangeIDs(
- std::shared_ptr<ModelAPI_Feature> theFeature1, std::shared_ptr<ModelAPI_Feature> theFeature2)
-{
- reflist(SketchPlugin_Sketch::FEATURES_ID())->exchange(theFeature1, theFeature2);
-}
/// Returns true if feature or reuslt belong to this composite feature as subs
SKETCHPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const;
- /// Construction result is allways recomuted on the fly
- SKETCHPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
-
SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
- /// Exchanges IDs of two given features: needed for fillet feature better naming (issue 769)
- SKETCHPLUGIN_EXPORT virtual void exchangeIDs(std::shared_ptr<ModelAPI_Feature> theFeature1,
- std::shared_ptr<ModelAPI_Feature> theFeature2);
-
-
/// \brief Create a result for the point in the attribute if the attribute is initialized
/// \param theFeature a source feature
/// \param theSketch a sketch intance
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "SketchPlugin_SketchDrawer.h"
+
+#include "SketchPlugin_Arc.h"
+#include "SketchPlugin_Line.h"
+#include "SketchPlugin_Circle.h"
+#include "SketchPlugin_Point.h"
+#include "SketchPlugin_Sketch.h"
+#include "SketchPlugin_ConstraintDistance.h"
+#include "SketchPlugin_ConstraintCoincidence.h"
+#include "SketchPlugin_ConstraintLength.h"
+#include "SketchPlugin_ConstraintRadius.h"
+#include "SketchPlugin_ConstraintVertical.h"
+#include "SketchPlugin_ConstraintHorizontal.h"
+#include "SketchPlugin_ConstraintDistanceVertical.h"
+#include "SketchPlugin_ConstraintDistanceHorizontal.h"
+#include "SketchPlugin_Tools.h"
+
+#include <GeomAPI_Face.h>
+#include <GeomAPI_Edge.h>
+#include <GeomAPI_Circ.h>
+#include <GeomAPI_ShapeExplorer.h>
+#include <GeomAPI_DataMapOfShapeShape.h>
+
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_ResultConstruction.h>
+
+#include <cmath>
+
+static const double kTOL = 1.e-6;
+
+SketchPlugin_SketchDrawer::SketchPlugin_SketchDrawer() : ModelAPI_Feature()
+{}
+
+void SketchPlugin_SketchDrawer::initAttributes()
+{
+ data()->addAttribute(BASE_ID(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(PLANE_ID(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(ADD_DIMENSIONS_ID(), ModelAPI_AttributeBoolean::typeId());
+}
+
+// sets a point attribute of the feature by 3D point on the sketch
+static void setPoint(FeaturePtr theFeature, const std::string& theAttrID,
+ std::shared_ptr<SketchPlugin_Sketch> theSketch, GeomPointPtr thePoint,
+ std::list<std::pair<GeomPnt2dPtr, std::string> >& aPoints)
+{
+ GeomPnt2dPtr aPnt2D = theSketch->to2D(thePoint);
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ theFeature->attribute(theAttrID))->setValue(aPnt2D);
+ aPoints.push_back(std::pair<GeomPnt2dPtr, std::string>(aPnt2D, theAttrID));
+}
+
+void SketchPlugin_SketchDrawer::execute()
+{
+ GeomShapePtr aBase = selection(BASE_ID())->value();
+ if (!aBase.get() && selection(BASE_ID())->context().get())
+ aBase = selection(BASE_ID())->context()->shape();
+ if (!aBase.get()) {
+ setError("Error: a base shape can not be obtained");
+ return; // invalid case
+ }
+
+ ObjectPtr aPlaneContext = selection(PLANE_ID())->contextObject();
+ GeomShapePtr aPlaneShape = selection(PLANE_ID())->value();
+ if (!aPlaneShape.get() && aPlaneContext.get())
+ aPlaneShape = selection(PLANE_ID())->context()->shape();
+ if (!aPlaneShape.get() || aPlaneShape->shapeType() != GeomAPI_Shape::FACE) {
+ setError("Error: a sketch plane can not be obtained");
+ return; // invalid case
+ }
+ GeomFacePtr aPlaneFace(new GeomAPI_Face(aPlaneShape));
+ GeomPlanePtr aPlane = aPlaneFace->getPlane();
+
+ // create and initialize sketch
+ DocumentPtr aMyDoc = document();
+ std::shared_ptr<SketchPlugin_Sketch> aSketch =
+ std::dynamic_pointer_cast<SketchPlugin_Sketch>(aMyDoc->addFeature(SketchPlugin_Sketch::ID()));
+ // by selection of plane
+ aSketch->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())->
+ setValue(selection(PLANE_ID())->context(), aPlaneShape);
+ // remove reference, but keep the sketch position
+ aSketch->selection(SketchPlugin_SketchEntity::EXTERNAL_ID())->
+ setValue(ResultPtr(), GeomShapePtr());
+
+ bool addDimensions = boolean(ADD_DIMENSIONS_ID())->value();
+ // iterate all edges of the base to find all edges that belong to this plane
+ GeomAPI_DataMapOfShapeShape alreadyProcessed;
+ std::list<AttributePoint2DPtr> aCreatedPoints;// points to check and set coincidence
+ for(GeomAPI_ShapeExplorer anEdges(aBase, GeomAPI_Shape::EDGE); anEdges.more(); anEdges.next()) {
+ if (!alreadyProcessed.bind(anEdges.current(), anEdges.current()))
+ continue; // skip duplicated edges
+ GeomEdgePtr anEdge(new GeomAPI_Edge(anEdges.current()));
+ if (anEdge->isDegenerated())
+ continue; // skip degenerated edges
+ GeomPointPtr aStart = anEdge->firstPoint();
+ GeomPointPtr anEnd = anEdge->lastPoint();
+ if (aPlane->distance(aStart) >= kTOL || aPlane->distance(anEnd) >= kTOL)
+ continue; // skip edges not in plane
+
+ FeaturePtr anItem;
+ std::list<std::pair<GeomPnt2dPtr, std::string> > aPoints; // created point to attribute ID
+ if (anEdge->isLine()) { // line is already in the plane: create by two points
+ anItem = aSketch->addFeature(SketchPlugin_Line::ID());
+ setPoint(anItem, SketchPlugin_Line::START_ID(), aSketch, aStart, aPoints);
+ setPoint(anItem, SketchPlugin_Line::END_ID(), aSketch, anEnd, aPoints);
+ anItem->execute(); // for constraints setting on result
+ // add a vertical or horizontal constraints
+ bool isHorVertConstr = true;
+ if (fabs(aPoints.front().first->x() - aPoints.back().first->x()) < kTOL) {
+ FeaturePtr aVert = aSketch->addFeature(SketchPlugin_ConstraintVertical::ID());
+ aVert->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(anItem->firstResult());
+ } else if (fabs(aPoints.front().first->y() - aPoints.back().first->y()) < kTOL) {
+ FeaturePtr aHor = aSketch->addFeature(SketchPlugin_ConstraintHorizontal::ID());
+ aHor->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(anItem->firstResult());
+ } else {
+ isHorVertConstr = false;
+ }
+ if (addDimensions) {
+ if (isHorVertConstr) { // only length constraint is enough
+ FeaturePtr aLen = aSketch->addFeature(SketchPlugin_ConstraintLength::ID());
+ aLen->refattr(SketchPlugin_ConstraintLength::ENTITY_A())
+ ->setObject(anItem->firstResult());
+ aLen->real(SketchPlugin_ConstraintLength::VALUE())->setValue(anEdge->length());
+ } else { // set horizontal and vertical distance constraints
+ FeaturePtr aVDist = aSketch->addFeature(SketchPlugin_ConstraintDistanceVertical::ID());
+ aVDist->refattr(SketchPlugin_Constraint::ENTITY_A())
+ ->setAttr(anItem->attribute(SketchPlugin_Line::START_ID()));
+ aVDist->refattr(SketchPlugin_Constraint::ENTITY_B())
+ ->setAttr(anItem->attribute(SketchPlugin_Line::END_ID()));
+ aVDist->real(SketchPlugin_ConstraintDistanceVertical::VALUE())
+ ->setValue(aPoints.back().first->y() - aPoints.front().first->y());
+ FeaturePtr aHDist = aSketch->addFeature(SketchPlugin_ConstraintDistanceHorizontal::ID());
+ aHDist->refattr(SketchPlugin_Constraint::ENTITY_A())
+ ->setAttr(anItem->attribute(SketchPlugin_Line::START_ID()));
+ aHDist->refattr(SketchPlugin_Constraint::ENTITY_B())
+ ->setAttr(anItem->attribute(SketchPlugin_Line::END_ID()));
+ aHDist->real(SketchPlugin_ConstraintDistanceVertical::VALUE())
+ ->setValue(aPoints.back().first->x() - aPoints.front().first->x());
+ }
+ }
+ } else if (anEdge->isArc()) { // check also center
+ GeomPointPtr aCenter = anEdge->circle()->center();
+ if (aPlane->distance(aCenter) >= kTOL)
+ continue;
+ // create arc by 3 points
+ anItem = aSketch->addFeature(SketchPlugin_Arc::ID());
+ setPoint(anItem, SketchPlugin_Arc::CENTER_ID(), aSketch, aCenter, aPoints);
+ setPoint(anItem, SketchPlugin_Arc::START_ID(), aSketch, aStart, aPoints);
+ setPoint(anItem, SketchPlugin_Arc::END_ID(), aSketch, anEnd, aPoints);
+ anItem->execute(); // for constraints setting on result
+ // set radius constraint
+ if (addDimensions) {
+ FeaturePtr aRad = aSketch->addFeature(SketchPlugin_ConstraintRadius::ID());
+ aRad->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(anItem->lastResult());
+ }
+ } else if (anEdge->isCircle()) { // check also center and middle (at value 2.)
+ GeomPointPtr aCenter = anEdge->circle()->center();
+ if (aPlane->distance(aCenter) >= kTOL || aPlane->distance(anEdge->middlePoint()) >= kTOL)
+ continue;
+ // circle by center and radius
+ anItem = aSketch->addFeature(SketchPlugin_Circle::ID());
+ setPoint(anItem, SketchPlugin_Circle::CENTER_ID(), aSketch, aCenter, aPoints);
+ anItem->real(SketchPlugin_Circle::RADIUS_ID())->setValue(anEdge->circle()->radius());
+ anItem->execute(); // for constraints setting on result
+ // set radius constraint
+ if (addDimensions) {
+ FeaturePtr aRad = aSketch->addFeature(SketchPlugin_ConstraintRadius::ID());
+ aRad->refattr(SketchPlugin_Constraint::ENTITY_A())->setObject(anItem->lastResult());
+ }
+ } else {
+ continue; // other types of edges are not supported, only lines, circles and arcs
+ }
+ // check some resulting points are coincident to existing
+ std::list<std::pair<GeomPnt2dPtr, std::string> >::iterator aPIter = aPoints.begin();
+ for(; aPIter != aPoints.end(); aPIter++) {
+ AttributePoint2DPtr aPointAttr =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anItem->attribute(aPIter->second));
+ std::list<AttributePoint2DPtr>::iterator aCoincIter = aCreatedPoints.begin();
+ for(; aCoincIter != aCreatedPoints.end(); aCoincIter++) {
+ double aDX = (*aCoincIter)->x() - aPIter->first->x();
+ if (fabs(aDX) >= kTOL)
+ continue;
+ double aDY = (*aCoincIter)->y() - aPIter->first->y();
+ if (fabs(aDY) >= kTOL)
+ continue;
+ // create a coincidence constraint
+ FeaturePtr aCoinc = aSketch->addFeature(SketchPlugin_ConstraintCoincidence::ID());
+ aCoinc->refattr(SketchPlugin_Constraint::ENTITY_A())->setAttr(aPointAttr);
+ aCoinc->refattr(SketchPlugin_Constraint::ENTITY_B())->setAttr(*aCoincIter);
+ break; // only one coincidence per point
+ }
+ aCreatedPoints.push_back(aPointAttr);
+ }
+ }
+ aMyDoc->setCurrentFeature(aSketch, false);
+}
--- /dev/null
+// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef SketchPlugin_SketchDrawer_H_
+#define SketchPlugin_SketchDrawer_H_
+
+#include "SketchPlugin.h"
+#include <ModelAPI_Feature.h>
+
+/// \class SketchPlugin_SketchDrawer
+/// \ingroup Plugins
+/// \brief Feature for creation of a sketch on selected base object and plane. It tries
+/// to make sketch elements equal to edges and vertices of the objects that belong to
+/// the selected plane.
+class SketchPlugin_SketchDrawer: public ModelAPI_Feature
+{
+ public:
+ /// A constructor
+ SketchPlugin_SketchDrawer();
+
+ /// Feature kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_FEATURE_ID("SketchDrawer");
+ return MY_FEATURE_ID;
+ }
+
+ /// Attribute name of the base shape selected.
+ inline static const std::string& BASE_ID()
+ {
+ static const std::string ID("base_shape");
+ return ID;
+ }
+ /// Attribute name of the plane selected.
+ inline static const std::string& PLANE_ID()
+ {
+ static const std::string ID("plane");
+ return ID;
+ }
+ /// Attribute name of the add-dimensions flag.
+ inline static const std::string& ADD_DIMENSIONS_ID()
+ {
+ static const std::string ID("add_dimensions");
+ return ID;
+ }
+
+ /// \return the kind of a feature.
+ SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = SketchPlugin_SketchDrawer::ID();
+ return MY_KIND;
+ }
+
+ /// Creates a new sketch.
+ SKETCHPLUGIN_EXPORT virtual void execute();
+
+ /// Request for initialization of data model of the feature: adding all attributes.
+ SKETCHPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Reimplemented from ModelAPI_Feature::isMacro(). Means that feature is removed on apply.
+ /// \returns true
+ SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}
+
+ /// No preview is generated until it is applied.
+ SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;}
+};
+
+#endif
return false;
}
+// LCOV_EXCL_START
/// Customize presentation of the feature
virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs)
}
return isCustomized;
}
+// LCOV_EXCL_STOP
protected:
/// initializes mySketch
#endif
}
+// LCOV_EXCL_START
std::string SketchPlugin_Split::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
#ifdef DEBUG_SPLIT
}
return aFilledAttributeName;
}
+// LCOV_EXCL_STOP
AISObjectPtr SketchPlugin_Split::getAISObject(AISObjectPtr thePrevious)
{
return aBaseShape;
}
-std::shared_ptr<GeomDataAPI_Point2D> SketchPlugin_Split::getPointOfRefAttr(
- const AttributePtr& theAttribute)
-{
- AttributePoint2DPtr aPointAttribute;
-
- if (theAttribute->attributeType() == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr aRefAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
- if (aRefAttr.get() && aRefAttr->isInitialized()) {
- AttributePtr anAttribute = aRefAttr->attr();
- if (anAttribute.get() && anAttribute->attributeType() == GeomDataAPI_Point2D::typeId())
- aPointAttribute = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttribute);
- }
- }
- return aPointAttribute;
-}
-
void SketchPlugin_Split::getFeaturePoints(const FeaturePtr& theFeature,
AttributePoint2DPtr& theStartPointAttr,
AttributePoint2DPtr& theEndPointAttr)
return aResult;
}
+#ifdef _DEBUG
std::set<std::shared_ptr<ModelAPI_Attribute> > SketchPlugin_Split::getEdgeAttributes(
const std::shared_ptr<ModelAPI_Feature>& theFeature)
{
return anAttributes;
}
+#endif
std::shared_ptr<GeomDataAPI_Point2D> SketchPlugin_Split::getPointAttribute
(const bool isFirstAttribute)
std::shared_ptr<GeomDataAPI_Point2D>& theStartPointAttr,
std::shared_ptr<GeomDataAPI_Point2D>& theEndPointAttr);
- /// Returns cast of attribute to geometrical point if the attribute is a ref attr attribute
- /// \param theAttribute an attribute
- /// \param geom point 2D or NULL
- std::shared_ptr<GeomDataAPI_Point2D> getPointOfRefAttr(const AttributePtr& theAttribute);
-
/// Obtains those constraints of the feature that should be modified. output maps contain
/// point of coincidence and attribute id to be modified after split
/// \param theFeaturesToDelete [out] constrains that will be deleted after split
#endif
}
+// LCOV_EXCL_START
std::string SketchPlugin_Trim::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
#ifdef DEBUG_TRIM_METHODS
}
return aFilledAttributeName;
}
+// LCOV_EXCL_STOP
bool SketchPlugin_Trim::setCoincidenceToAttribute(const AttributePtr& theAttribute,
const std::set<AttributePoint2DPtr>& theFurtherCoincidences,
if (aModifiedAttribute.get() && aSourceAttribute.get())
aModifiedAttribute->setValue(aSourceAttribute->value());
}
- else if (anAttributeType == ModelAPI_AttributeRefAttr::typeId()) {
- AttributeRefAttrPtr aRefAttributeToFill = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
- theModifiedAttribute);
- AttributeRefAttrPtr aSourceRefAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(
- theSourceAttribute);
- if (!aSourceRefAttr.get())
- aRefAttributeToFill->setAttr(theSourceAttribute);
- else {
- if (aSourceRefAttr->isObject())
- aRefAttributeToFill->setObject(aSourceRefAttr->object());
- else
- aRefAttributeToFill->setAttr(aSourceRefAttr->attr());
- }
- }
}
FeaturePtr SketchPlugin_Trim::createLineFeature(const FeaturePtr& theBaseFeature,
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_5.result(), 10)
model.do()
Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"), False)
SketchPoint_1 = SketchProjection_3.createdFeature()
SketchArc_1 = Sketch_2.addArc(0, 5, -5, 0, 5, 0, False)
SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_1.startPoint())
-SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_5e"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), False)
SketchPoint_2 = SketchProjection_4.createdFeature()
SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchArc_1.endPoint(), SketchAPI_Point(SketchPoint_2).coordinates())
-SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_4s-SketchLine_1e"), False)
+SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), False)
SketchPoint_3 = SketchProjection_5.createdFeature()
model.do()
SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "PartSet/Origin"))
SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.coordinates())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchArc_1_2r-SketchArc_2_2r")], model.selection(), "b/2", "b/2")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchArc_2_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchArc_1_2r-SketchLine_10f")], model.selection(), "b/2", "b/2")
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]"), False)
SketchPoint_2 = SketchProjection_1.createdFeature()
SketchCircle_1 = Sketch_2.addCircle(-15, 35, 25)
SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchCircle_1.center(), SketchPoint_2.result())
SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_1.results()[1], "50/2")
model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection(), 0, 13, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"))
-SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_4"), False)
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2f_wire")], model.selection(), 0, 13, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face"))
+SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "ExtrusionCut_1_1/Generated_Vertex&ExtrusionCut_1_1/From_Face"), False)
SketchPoint_3 = SketchProjection_2.createdFeature()
-SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_4"), False)
+SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face&weak_name_2"), False)
SketchLine_11 = SketchProjection_3.createdFeature()
SketchArc_3 = Sketch_3.addArc(-15, 35, -15, 46.0103340429751, -17.02045759563166, 24.17663606626138, True)
SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchPoint_3.result(), SketchArc_3.center())
SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_11.result(), SketchArc_3.startPoint())
-SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), False)
+SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face&weak_name_1"), False)
SketchArc_4 = SketchProjection_4.createdFeature()
SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchArc_4.results()[1])
SketchLine_12 = Sketch_3.addLine(-15, 46.0103340429751, -15, 35)
Part_1_doc = Part_1.document()
Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 5, 10)
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Cylinder_1_1/Face_2"))
-SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), True)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("EDGE", "[Cylinder_1_1/Face_1][Cylinder_1_1/Face_2]"), True)
SketchCircle_1 = SketchProjection_1.createdFeature()
SketchCircle_2 = Sketch_1.addCircle(0.0, 10.0, 8.0)
model.do()
SketchLine_1 = Sketch_1.addLine(-20, -62, 81, 60)
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), True)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"), True)
SketchLine_2 = SketchProjection_1.createdFeature()
model.do()
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchProjection_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchProjection_1")])
model.end()
# before bug fix it was "Sketch_2"
-assert(Edge_1.baseObjects().value(0).namingName() == "Sketch_2/Edge-SketchProjection_1")
+assert(Edge_1.baseObjects().value(0).namingName() == "Sketch_2/SketchProjection_1")
assert(model.checkPythonDump())
SketchConstraintLength_6 = Sketch_1.setLength(SketchLine_9.result(), 20)
SketchConstraintLength_6.setName("SketchConstraintLength_8")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6r-SketchLine_7r-SketchLine_8f-SketchArc_1_2f-SketchArc_2_2f-SketchArc_3_2r-SketchLine_11f-SketchLine_12r")], model.selection(), 3.5, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchArc_2_2f-SketchLine_11f-SketchArc_3_2r-SketchLine_12r-SketchLine_7r-SketchLine_6r-SketchLine_8f-SketchArc_1_2f")], model.selection(), 3.5, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"))
SketchLine_14 = Sketch_2.addLine(6, 0, -6, 0)
-SketchProjection_8 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_7s-SketchLine_6e"), False)
+SketchProjection_8 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_6_EndVertex"), False)
SketchPoint_7 = SketchProjection_8.createdFeature()
SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchLine_14.startPoint(), SketchPoint_7.result())
-SketchProjection_9 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_6s-SketchLine_8s"), False)
+SketchProjection_9 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_6_StartVertex"), False)
SketchPoint_8 = SketchProjection_9.createdFeature()
SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchPoint_8.result())
SketchLine_15 = Sketch_2.addLine(-6, 0, -6, -3.5)
SketchLine_16 = Sketch_2.addLine(-6, -3.5, -6, -10.5)
SketchConstraintCoincidence_23 = Sketch_2.setCoincident(SketchLine_15.endPoint(), SketchLine_16.startPoint())
SketchLine_17 = Sketch_2.addLine(5.978225648847096, 0.08643259872215214, 6, -3.5)
-SketchProjection_10 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_10 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False)
SketchPoint_9 = SketchProjection_10.createdFeature()
SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchPoint_9.result())
SketchLine_18 = Sketch_2.addLine(6, -3.5, 6, -10.5)
SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint())
SketchConstraintLength_7 = Sketch_2.setLength(SketchLine_18.result(), 7)
SketchConstraintLength_7.setName("SketchConstraintLength_9")
-SketchProjection_11 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_11 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/To_Face]"), False)
SketchPoint_10 = SketchProjection_11.createdFeature()
SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_10).coordinates(), SketchLine_15.endPoint())
SketchConstraintVertical_5 = Sketch_2.setVertical(SketchLine_18.result())
SketchConstraintVertical_16 = Sketch_4.setVertical(SketchLine_55.result())
SketchConstraintVertical_17 = Sketch_4.setVertical(SketchLine_58.result())
SketchConstraintHorizontal_11 = Sketch_4.setHorizontal(SketchLine_56.result())
-SketchProjection_13 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5e"), False)
+SketchProjection_13 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_5_EndVertex"), False)
SketchPoint_4 = SketchProjection_13.createdFeature()
SketchConstraintDistanceHorizontal_17 = Sketch_4.setHorizontalDistance(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_52.endPoint(), "Drill2_Loc")
SketchConstraintLength_3 = Sketch_4.setLength(SketchLine_54.result(), "Drill2_InnerRadius")
-SketchProjection_14 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), False)
+SketchProjection_14 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_3"), False)
SketchLine_59 = SketchProjection_14.createdFeature()
SketchConstraintAngle_6 = Sketch_4.setAngle(SketchLine_57.result(), SketchLine_56.result(), 45)
SketchConstraintLength_4 = Sketch_4.setLength(SketchLine_56.result(), "Drill2_Radius")
SketchConstraintTangent_3 = Sketch_4.setTangent(SketchLine_58.result(), SketchArc_2.results()[1])
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_9r-SketchLine_10r-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchArc_1_2f")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_7"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchArc_1_2f-SketchLine_10r-SketchLine_9r-SketchLine_7r")], model.selection("EDGE", "Sketch_2/SketchLine_7"), 360, 0)
model.do()
from GeomAPI import GeomAPI_Shape
model.end()
# TODO: uncomment following line when issue #2389 is fixed
-#assert(model.checkPythonDump())
\ No newline at end of file
+#assert(model.checkPythonDump())
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
-SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "Box_1_1/Front&Box_1_1/Top"), True)
+SketchProjection_2 = Sketch_1.addProjection(model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]"), True)
SketchLine_1 = SketchProjection_2.createdFeature()
SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_1.result()], SketchAPI_Point(SketchPoint_1).coordinates(), 90, 3)
[SketchLine_1, SketchLine_2, SketchLine_3] = SketchMultiRotation_1.rotated()
model.end()
-assert(model.checkPythonDump())
\ No newline at end of file
+assert(model.checkPythonDump())
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
SketchLine_1 = Sketch_1.addLine(-0.5, 0, -0.1, 0.5)
-SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "profile_top_1/Shape2"), False)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "profile_top_1/Shape_2"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
model.do()
SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_23")
SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_11.result(), SketchArc_2.startPoint(), 7.37, True)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchLine_10r-SketchArc_1_2r-SketchArc_2_2f-SketchArc_3_2f")], model.selection(), "h", 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), False)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchArc_3_2f-SketchLine_10r-SketchArc_1_2r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchArc_2_2f")], model.selection(), "h", 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7"))
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/From_Face]"), False)
SketchPoint_2 = SketchProjection_3.createdFeature()
-SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/From_Face]"), False)
SketchPoint_3 = SketchProjection_4.createdFeature()
-SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_5 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/To_Face]"), False)
SketchPoint_4 = SketchProjection_5.createdFeature()
SketchLine_13 = Sketch_2.addLine(6.005577592461473, 0, -5.994422407538528, 0)
SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_13.startPoint())
SketchLine_14 = Sketch_2.addLine(-5.994422407538528, 0, -5.994422407538528, -3.5)
SketchConstraintCoincidence_21 = Sketch_2.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
SketchConstraintCoincidence_21.setName("SketchConstraintCoincidence_27")
-SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_6 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"), False)
SketchPoint_5 = SketchProjection_6.createdFeature()
SketchConstraintCoincidence_22 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchPoint_5.result())
SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_28")
SketchConstraintLength_6 = Sketch_2.setLength(SketchLine_17.result(), 7)
SketchConstraintEqual_2 = Sketch_2.setEqual(SketchLine_17.result(), SketchLine_15.result())
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchLine_16r-SketchLine_17r-SketchArc_5_2f")], model.selection(), "h", 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_14f-SketchLine_15f-SketchArc_5_2f-SketchLine_17r-SketchLine_16r")], model.selection(), "h", 0)
model.do()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+ Test2741.py
+ Test case for issue #2741 "Undo of distance argument change produces crash"
+"""
+
+from salome.shaper import model
+from SketchAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(-34.48932587013569, -5.994823429605995, -23.03828378136105, 27.99739301876914)
+SketchLine_2 = Sketch_1.addLine(-23.03828378136105, 27.99739301876914, -14.34307552407934, -3.849202930145424)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_2.result(), 20, True)
+model.do()
+
+# Change point-line distance constraint to point-point distance
+SketchAPI_Constraint(SketchConstraintDistance_1).setEntityB(SketchLine_2.endPoint())
+model.do()
+model.end()
+
+# Check no crash on undo distance changing
+model.undo()
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+ Test2810.py
+ Test case for issue #2810 "crash creating arc fillet"
+"""
+
+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"))
+SketchArc_1 = Sketch_1.addArc(10, 10, 11, 10, 10, 11, False)
+SketchLine_1 = Sketch_1.addLine(12, 10, 12, 9)
+model.do()
+
+Sketch_1.setFixed(SketchArc_1.results()[1])
+Sketch_1.setFixed(SketchLine_1.result())
+
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.startPoint())
+model.do()
+
+SketchFillet = Sketch_1.setFillet(SketchArc_1.startPoint())
+model.do()
+
+assert(Sketch_1.feature().error() != "")
+
+model.end()
assert (aDistance.isInitialized())
assert math.fabs(aDistance.value() - aDist) < 1.e-4, "Distance values are different: {0} != {1}".format(aDistance.value(), aDist)
assert (model.dof(aSketchFeature) == 5)
+
+#=========================================================================
+# Swap point and line in the distance
+#=========================================================================
+aSession.startOperation()
+refattrA.setAttr(aSketchPointCoords)
+refattrB.setObject(aLineResult)
+aSession.finishOperation()
+assert (model.dof(aSketchFeature) == 5)
+# set flyout point then abort operation, after that check the Distance is correct
+aSession.startOperation()
+aFlyoutPoint = geomDataAPI_Point2D(aConstraint.attribute("ConstraintFlyoutValuePnt"))
+aFlyoutPoint.setValue(100.0, 100.0)
+aSession.abortOperation()
+assert (refattrA.isInitialized())
+assert (refattrB.isInitialized())
+assert (aDistance.isInitialized())
+assert math.fabs(aDistance.value() - aDist) < 1.e-4, "Distance values are different: {0} != {1}".format(aDistance.value(), aDist)
+assert (model.dof(aSketchFeature) == 5)
#=========================================================================
# Change distance value
#=========================================================================
anExtCircleRadius = anExtCircle.real("circle_radius")
anExtCircleCenter.setValue(-50., 50.)
anExtCircleRadius.setValue(10.)
-anExtCircle.selection("External").selectSubShape("EDGE", "Sketch_1/Edge-SketchCircle_1_2")
+anExtCircle.selection("External").selectSubShape("EDGE", "Sketch_1/SketchCircle_1_2")
aSession.finishOperation()
assert (model.dof(aSketchFeature) == 7)
aSession.startOperation()
anExtLineEnd = geomDataAPI_Point2D(anExtLine.attribute("EndPoint"))
anExtLineStart.setValue(-40., 35.)
anExtLineEnd.setValue(-60., 25.)
-anExtLine.selection("External").selectSubShape("EDGE", "Sketch_1/Edge-SketchLine_1")
+anExtLine.selection("External").selectSubShape("EDGE", "Sketch_1/SketchLine_1")
anExtLineLen = lineLength(anExtLine)
aSession.finishOperation()
assert (model.dof(aSketchFeature) == 13)
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+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(-30, 0, -10, 0)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchLine_1.result(), 20)
+model.do()
+
+assert(SketchConstraintRadius_1.feature().error() != "")
+
+model.end()
model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 6)
model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 0)
+#=========================================================================
+# Test 5. Create another arc by center and points coincident to other features
+#=========================================================================
+# create new arc
+aSession.startOperation()
+anArc = aSketchFeature.addFeature("SketchMacroArc")
+aCenter = geomDataAPI_Point2D(anArc.attribute("center_point"))
+aCenterRef = anArc.refattr("center_point_ref")
+aStart = geomDataAPI_Point2D(anArc.attribute("start_point_1"))
+aStartRef = anArc.refattr("start_point_ref")
+aEnd = geomDataAPI_Point2D(anArc.attribute("end_point_1"))
+aEndRef = anArc.refattr("end_point_ref")
+anArcType = anArc.string("arc_type")
+# initialize attributes
+anArcType.setValue("by_center_and_points")
+aCenterRef.setObject(aLine.lastResult())
+aCenter.setValue(aLineStartPoint.pnt())
+aStartRef.setObject(aLine.lastResult())
+aStart.setValue(aLineEndPoint.pnt())
+aEndRef.setObject(aPrevArc.lastResult())
+aEnd.setValue(aPrevArcStart.pnt())
+aSession.finishOperation()
+assert (aSketchFeature.numberOfSubs() == 16), "Number of subs {}".format(aSketchFeature.numberOfSubs())
+# check connected features do not change their positions
+model.assertArc(aPrevArc, aPrevArcCenterXY, aPrevArcStartXY, aPrevArcEndXY)
+model.assertLine(aLine, aLineStart, aLineEnd)
+# verify newly created arc
+anArc = model.lastSubFeature(aSketchFeature, "SketchArc")
+aCenter = geomDataAPI_Point2D(anArc.attribute("center_point"))
+aStart = geomDataAPI_Point2D(anArc.attribute("start_point"))
+aEnd = geomDataAPI_Point2D(anArc.attribute("end_point"))
+verifyPointOnLine(aCenter, aLine)
+verifyPointOnLine(aStart, aLine)
+verifyPointOnCircle(aEnd, aPrevArc)
+model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 9)
+model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 0)
+
+#=========================================================================
+# Test 6. Create one more arc by center and points coincident to other features
+#=========================================================================
+# get previous arc
+aPrevArc = model.lastSubFeature(aSketchFeature, "SketchArc")
+aPrevArcCenter = geomDataAPI_Point2D(aPrevArc.attribute("center_point"))
+aPrevArcStart = geomDataAPI_Point2D(aPrevArc.attribute("start_point"))
+aPrevArcEnd = geomDataAPI_Point2D(aPrevArc.attribute("end_point"))
+aPrevArcCenterXY = [aPrevArcCenter.x(), aPrevArcCenter.y()]
+aPrevArcStartXY = [aPrevArcStart.x(), aPrevArcStart.y()]
+aPrevArcEndXY = [aPrevArcEnd.x(), aPrevArcEnd.y()]
+# create new arc
+aSession.startOperation()
+anArc = aSketchFeature.addFeature("SketchMacroArc")
+aCenter = geomDataAPI_Point2D(anArc.attribute("center_point"))
+aCenterRef = anArc.refattr("center_point_ref")
+aStart = geomDataAPI_Point2D(anArc.attribute("start_point_1"))
+aStartRef = anArc.refattr("start_point_ref")
+aEnd = geomDataAPI_Point2D(anArc.attribute("end_point_1"))
+aEndRef = anArc.refattr("end_point_ref")
+anArcType = anArc.string("arc_type")
+# initialize attributes
+anArcType.setValue("by_center_and_points")
+delta = [aPrevArcEndXY[0] - aPrevArcCenterXY[0], aPrevArcEndXY[1] - aPrevArcCenterXY[1]]
+aCenter.setValue(aPrevArcCenterXY[0] + 2 * delta[0], aPrevArcCenterXY[1] + 2 * delta[1])
+aStart.setValue(aPrevArcCenterXY[0] + 2 * delta[0] - 0.9 * delta[1], aPrevArcCenterXY[1] + 2 * delta[1] + 0.9 * delta[0])
+aEndRef.setObject(aPrevArc.lastResult())
+aEnd.setValue(aPrevArcCenterXY[0] + 1.1 * delta[0], aPrevArcCenterXY[1] + 1.1 * delta[1])
+aSession.finishOperation()
+assert (aSketchFeature.numberOfSubs() == 18), "Number of subs {}".format(aSketchFeature.numberOfSubs())
+# verify newly created arc
+anArc = model.lastSubFeature(aSketchFeature, "SketchArc")
+aCenter = geomDataAPI_Point2D(anArc.attribute("center_point"))
+aStart = geomDataAPI_Point2D(anArc.attribute("start_point"))
+aEnd = geomDataAPI_Point2D(anArc.attribute("end_point"))
+verifyPointOnCircle(aEnd, aPrevArc)
+model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 10)
+model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 0)
+
+#=========================================================================
+# Test 7. Create one more arc by center and points coincident to other features
+#=========================================================================
+aPrevArcCenterXY = [aPrevArcCenter.x(), aPrevArcCenter.y()]
+aPrevArcStartXY = [aPrevArcStart.x(), aPrevArcStart.y()]
+aPrevArcEndXY = [aPrevArcEnd.x(), aPrevArcEnd.y()]
+# create new arc
+aSession.startOperation()
+anArc = aSketchFeature.addFeature("SketchMacroArc")
+aCenter = geomDataAPI_Point2D(anArc.attribute("center_point"))
+aCenterRef = anArc.refattr("center_point_ref")
+aStart = geomDataAPI_Point2D(anArc.attribute("start_point_1"))
+aStartRef = anArc.refattr("start_point_ref")
+aEnd = geomDataAPI_Point2D(anArc.attribute("end_point_1"))
+aEndRef = anArc.refattr("end_point_ref")
+anArcType = anArc.string("arc_type")
+# initialize attributes
+anArcType.setValue("by_center_and_points")
+delta = [aPrevArcEndXY[0] - aPrevArcCenterXY[0], aPrevArcEndXY[1] - aPrevArcCenterXY[1]]
+aCenter.setValue(aPrevArcCenterXY[0] + 2 * delta[0], aPrevArcCenterXY[1] + 2 * delta[1])
+aStart.setValue(aPrevArcCenterXY[0] + 2 * delta[0] - delta[1], aPrevArcCenterXY[1] + 2 * delta[1] + delta[0])
+aEndRef.setObject(aPrevArc.lastResult())
+aEnd.setValue(aPrevArcCenterXY[0] + delta[0], aPrevArcCenterXY[1] + delta[1])
+aSession.finishOperation()
+assert (aSketchFeature.numberOfSubs() == 20), "Number of subs {}".format(aSketchFeature.numberOfSubs())
+# verify newly created arc
+anArc = model.lastSubFeature(aSketchFeature, "SketchArc")
+aCenter = geomDataAPI_Point2D(anArc.attribute("center_point"))
+aStart = geomDataAPI_Point2D(anArc.attribute("start_point"))
+aEnd = geomDataAPI_Point2D(anArc.attribute("end_point"))
+verifyPointOnCircle(aEnd, aPrevArc)
+model.testNbSubFeatures(aSketch, "SketchConstraintCoincidence", 11)
+model.testNbSubFeatures(aSketch, "SketchConstraintTangent", 0)
+
#=========================================================================
# End of test
#=========================================================================
Sketch_1.setLength(SketchLine_1.result(), 20)
Sketch_1.setLength(SketchLine_2.result(), 40)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r")], model.selection(), 10, 0)
# Extrude all lateral faces to check their area
Extrusion_2 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"))
SketchLine_5 = Sketch_2.addLine(0.7346748749771982, 2.736245541082907e-015, 0.7346748749771982, 10.00000000000001)
-SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_5 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchPoint_1.result())
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False)
SketchPoint_2 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_6 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchPoint_2.result())
SketchLine_6 = Sketch_2.addLine(0.7346748749771982, 10.00000000000001, -19.2653251250228, 10.00000000000001)
SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False)
SketchPoint_3 = SketchProjection_3.createdFeature()
SketchConstraintCoincidence_8 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchPoint_3.result())
SketchLine_7 = Sketch_2.addLine(-19.2653251250228, 10.00000000000001, -19.2653251250228, 2.775557561562891e-015)
SketchConstraintCoincidence_9 = Sketch_2.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
-SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False)
SketchPoint_4 = SketchProjection_4.createdFeature()
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchPoint_4.result())
SketchLine_8 = Sketch_2.addLine(-19.2653251250228, 2.775557561562891e-015, 0.7346748749771974, 3.386180225106727e-015)
Extrusion_2.setNestedSketch(Sketch_2)
Extrusion_3 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0)
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_2"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"))
SketchLine_9 = Sketch_3.addLine(36.86324678550901, 2.286454635368208e-015, 36.86324678550901, 10)
-SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_5 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False)
SketchPoint_5 = SketchProjection_5.createdFeature()
SketchConstraintCoincidence_13 = Sketch_3.setCoincident(SketchLine_9.startPoint(), SketchPoint_5.result())
-SketchProjection_6 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_6 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False)
SketchPoint_6 = SketchProjection_6.createdFeature()
SketchConstraintCoincidence_14 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchPoint_6.result())
SketchLine_10 = Sketch_3.addLine(36.86324678550901, 10, -3.136753214490995, 10)
SketchConstraintCoincidence_15 = Sketch_3.setCoincident(SketchLine_9.endPoint(), SketchLine_10.startPoint())
-SketchProjection_7 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_7 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False)
SketchPoint_7 = SketchProjection_7.createdFeature()
SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchPoint_7.result())
SketchLine_11 = Sketch_3.addLine(-3.136753214490995, 10, -3.136753214490995, 2.275957200481571e-015)
SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_10.endPoint(), SketchLine_11.startPoint())
-SketchProjection_8 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_8 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"), False)
SketchPoint_8 = SketchProjection_8.createdFeature()
SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchLine_11.endPoint(), SketchPoint_8.result())
SketchLine_12 = Sketch_3.addLine(-3.136753214490995, 2.275957200481571e-015, 36.86324678550902, 1.387778780781446e-015)
Extrusion_3.setNestedSketch(Sketch_3)
Extrusion_4 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0)
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"))
SketchLine_13 = Sketch_4.addLine(22.60959895285982, 4.420942808558057e-016, 22.60959895285982, 10)
-SketchProjection_9 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_9 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/From_Face]"), False)
SketchPoint_9 = SketchProjection_9.createdFeature()
SketchConstraintCoincidence_21 = Sketch_4.setCoincident(SketchLine_13.startPoint(), SketchPoint_9.result())
-SketchProjection_10 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_10 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), False)
SketchPoint_10 = SketchProjection_10.createdFeature()
SketchConstraintCoincidence_22 = Sketch_4.setCoincident(SketchLine_13.endPoint(), SketchPoint_10.result())
SketchLine_14 = Sketch_4.addLine(22.60959895285982, 10, -7.390401047140179, 10)
SketchConstraintCoincidence_23 = Sketch_4.setCoincident(SketchLine_13.endPoint(), SketchLine_14.startPoint())
-SketchProjection_11 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_11 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), False)
SketchPoint_11 = SketchProjection_11.createdFeature()
SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchLine_14.endPoint(), SketchPoint_11.result())
SketchLine_15 = Sketch_4.addLine(-7.390401047140179, 10, -7.390401047140179, 8.881784197001252e-016)
SketchConstraintCoincidence_25 = Sketch_4.setCoincident(SketchLine_14.endPoint(), SketchLine_15.startPoint())
-SketchProjection_12 = Sketch_4.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_12 = Sketch_4.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"), False)
SketchPoint_12 = SketchProjection_12.createdFeature()
SketchConstraintCoincidence_26 = Sketch_4.setCoincident(SketchLine_15.endPoint(), SketchPoint_12.result())
SketchLine_16 = Sketch_4.addLine(-7.390401047140179, 8.881784197001252e-016, 22.60959895285983, 0)
Extrusion_4.setNestedSketch(Sketch_4)
Extrusion_5 = model.addExtrusion(Part_1_doc, [], model.selection(), 10, 0)
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"))
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"))
SketchLine_17 = Sketch_5.addLine(-10.64977324988603, -1.185841873934692e-016, -10.64977324988603, -10)
-SketchProjection_13 = Sketch_5.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_13 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/From_Face]"), False)
SketchPoint_13 = SketchProjection_13.createdFeature()
SketchConstraintCoincidence_29 = Sketch_5.setCoincident(SketchLine_17.startPoint(), SketchPoint_13.result())
-SketchProjection_14 = Sketch_5.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_14 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), False)
SketchPoint_14 = SketchProjection_14.createdFeature()
SketchConstraintCoincidence_30 = Sketch_5.setCoincident(SketchLine_17.endPoint(), SketchPoint_14.result())
SketchLine_18 = Sketch_5.addLine(-10.64977324988603, -10, 39.35022675011398, -10)
SketchConstraintCoincidence_31 = Sketch_5.setCoincident(SketchLine_17.endPoint(), SketchLine_18.startPoint())
-SketchProjection_15 = Sketch_5.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_15 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]"), False)
SketchPoint_15 = SketchProjection_15.createdFeature()
SketchConstraintCoincidence_32 = Sketch_5.setCoincident(SketchLine_18.endPoint(), SketchPoint_15.result())
SketchLine_19 = Sketch_5.addLine(39.35022675011398, -10, 39.35022675011398, 4.440892098500626e-016)
SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchLine_18.endPoint(), SketchLine_19.startPoint())
-SketchProjection_16 = Sketch_5.addProjection(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+SketchProjection_16 = Sketch_5.addProjection(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), False)
SketchPoint_16 = SketchProjection_16.createdFeature()
SketchConstraintCoincidence_34 = Sketch_5.setCoincident(SketchLine_19.endPoint(), SketchPoint_16.result())
SketchLine_20 = Sketch_5.addLine(39.35022675011398, 4.440892098500626e-016, -10.64977324988603, 0)
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "Size")
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_2.result(), "Size")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), "Size", 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), "Size", 0)
Folder_1 = model.addFolder(Part_1_doc, Sketch_1, Extrusion_1)
model.do()
SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 60)
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchArc_2_2f-SketchLine_1f-SketchLine_2r")], model.selection(), 50, 50)
-Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1")])
-Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"), model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), False)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchArc_2_2f-SketchLine_2r-SketchArc_1_2r")], model.selection(), 50, 50)
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/To_Face]")])
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/From_Face]"), False)
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_1-SketchArc_2-SketchProjection_1-SketchPoint_1"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchArc_1"), False)
SketchPoint_2 = SketchProjection_2.createdFeature()
SketchLine_3 = Sketch_2.addLine(-70, 60, 70, 60)
SketchLine_4 = Sketch_2.addLine(70, 60, 70, -60)
SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_4.result(), 70, True)
SketchConstraintDistance_4 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_2).coordinates(), SketchLine_6.result(), 70, True)
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_6r")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r")])
Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("FACE", "Filling_1_1"), model.selection("FACE", "Face_1_1")])
# set different edges used for intersection and check reference data: number of intersection points and their coordinates
-REF_DATA = [("Sketch_1/Edge-SketchArc_1_2", 1, [[30, 0]]),
- ("Sketch_1/Edge-SketchLine_2", 1, [[-36.024358588836, 0]]),
- ("Sketch_1/Edge-SketchArc_2_2", 2, [[60, 0], [-60, 0]]),
- ("Sketch_1/Edge-SketchLine_1", 0, []),
- ("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1", 1, [[30, 50]]),
- ("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1", 1, [[-36.024358588836, 50]]),
- ("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1", 2, [[60, 50], [-60, 50]]),
- ("Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1", 0, []),
- ("Intersection_1_1", 2, [[-0.0515933488223, -11.6181750315], [41.6438615258, -11.6181750315]])]
+REF_DATA = [("Sketch_1/SketchArc_1_2", 1, [[30, 0]]),
+ ("Sketch_1/SketchLine_2", 1, [[-36.024358588836, 0]]),
+ ("Sketch_1/SketchArc_2_2", 2, [[60, 0], [-60, 0]]),
+ ("Sketch_1/SketchLine_1", 0, []),
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]", 1, [[30, 50]]),
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face]", 1, [[-36.024358588836, 50]]),
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/To_Face]", 2, [[60, 50], [-60, 50]]),
+ ("[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]", 0, []),
+ ("Intersection_1_1", 2, [[41.6438615258, -11.6181750315], [-0.0515933488223, -11.6181750315]])]
TOLERANCE = 1.e-7
Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 10)
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchArc_1.center(), SketchLine_2.result(), 19, True)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchArc_1_2r")], model.selection(), 10, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), "D", True)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchArc_1_2r")], model.selection(), 10, 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"), "D", True)
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), True)
+SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]"), True)
SketchIntersectionPoint_1.result().setName("SketchIntersectionPoint_1")
[SketchPoint_2, SketchPoint_3] = SketchIntersectionPoint_1.intersectionPoints()
SketchCircle_1 = Sketch_2.addCircle(38.14142842854285, 10, 1)
SketchConstraintDistanceVertical_2 = Sketch_2.setVerticalDistance(SketchAPI_Point(SketchPoint_3).coordinates(), SketchArc_2.startPoint(), 5)
SketchConstraintTangent_1 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_6.result())
model.do()
-RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchArc_2_2f")], model.selection("EDGE", "Sketch_2/Edge-SketchLine_5"), 360, 0, [model.selection("SOLID", "Extrusion_1_1")])
+RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_6r-SketchArc_2_2f-SketchLine_5r")], model.selection("EDGE", "Sketch_2/SketchLine_5"), 360, 0, [model.selection("SOLID", "Extrusion_1_1")])
ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection(), 5, 5, [model.selection("SOLID", "RevolutionCut_1_1")])
model.do()
SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_1.startPoint(), SketchLine_4.startPoint(), "D")
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.endPoint(), SketchLine_7.startPoint(), 40, True)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f")], model.selection(), 10, 0)
ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 5, 5, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_5"))
-SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"))
+SketchIntersectionPoint_1 = Sketch_2.addIntersectionPoint(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/To_Face]"), False)
[SketchPoint_2] = SketchIntersectionPoint_1.intersectionPoints()
SketchCircle_1 = Sketch_2.addCircle(40, 10, 5)
SketchConstraintCoincidence_10 = Sketch_2.setCoincident(SketchAPI_Point(SketchPoint_2).coordinates(), SketchCircle_1.center())
SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchArc_1.center(), SketchAPI_Line(SketchLine_3).startPoint(), 20)
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_1.result(), 55)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_1f-SketchLine_2f")], model.selection(), 25, 25)
-Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1")])
-Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_1f-SketchLine_2f")])
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_1f-SketchLine_2f")], model.selection(), 25, 25)
+Filling_1 = model.addFilling(Part_1_doc, [model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/From_Face]"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2r-SketchLine_1f-SketchLine_2f")])
Intersection_1 = model.addIntersection(Part_1_doc, [model.selection("FACE", "Filling_1_1"), model.selection("FACE", "Face_1_1")])
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchLine_4 = Sketch_2.addLine(-34.11217447219568, 40, 20, -37.28019411294778)
SketchConstraintDistance_3 = Sketch_2.setDistance(SketchAPI_Point(SketchPoint_1).coordinates(), SketchLine_4.result(), "D", True)
SketchConstraintAngle_1 = Sketch_2.setAngle(SketchLine_5.result(), SketchLine_4.result(), 35)
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_4f-SketchLine_5f-SketchLine_6f")], model.selection(), 10, 10)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_4r-SketchLine_5f-SketchLine_6f")], model.selection(), 10, 10)
ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [], model.selection(), 10, 0, [model.selection("SOLID", "Extrusion_2_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face_3"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_4"))
SketchIntersectionPoint_1 = Sketch_3.addIntersectionPoint(model.selection("EDGE", "Intersection_1_1"), False)
[SketchPoint_2, SketchPoint_3] = SketchIntersectionPoint_1.intersectionPoints()
SketchCircle_1 = Sketch_3.addCircle(-33.22640570408476, 0, 5)
assert(SketchIntersectionPoint_1.feature().results().size() == 1)
model.testNbResults(ExtrusionFuse_1, 1)
-model.testNbSubResults(ExtrusionFuse_1, [1])
+model.testNbSubResults(ExtrusionFuse_1, [0])
model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.SOLID, [1])
-model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.FACE, [11])
-model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.EDGE, [42])
-model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.VERTEX, [84])
-model.testResultsVolumes(ExtrusionFuse_1, [89224.362837261898675933480262756])
+model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.FACE, [9])
+model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.EDGE, [30])
+model.testNbSubShapes(ExtrusionFuse_1, GeomAPI_Shape.VERTEX, [60])
+model.testResultsVolumes(ExtrusionFuse_1, [89638.890852351003559306263923645])
# change parameter and check intersection is NOT valid now
ParamD.setValue(50)
assert(model.dof(Sketch_1) == 0)
# Extrude main part of clamp
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchArc_1_2f-SketchCircle_1_2r")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_5r-SketchArc_1_2f-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r-SketchCircle_1_2r")], model.selection(), 10, 0)
model.do()
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
SketchRectangle_1 = Sketch_2.addRectangle(20, 0, 100, 50)
[SketchLine_6, SketchLine_7, SketchLine_8, SketchLine_9] = SketchRectangle_1.lines()
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"))
SketchLine_10 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_7).startPoint(), SketchAPI_Line(SketchLine_10).startPoint())
SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_8.result(), SketchLine_10.result())
SketchConstraintDistance_3 = Sketch_2.setDistance(SketchCircle_2.center(), SketchLine_8.result(), 30)
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchCircle_2_2r-SketchArc_2_2r-SketchLine_13r-SketchLine_14f-SketchLine_15f-SketchArc_3_2r-SketchLine_16r")], model.selection(), -165, 155)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_14f-SketchLine_16r-SketchArc_3_2r-SketchLine_15f-SketchLine_13r-SketchArc_2_2r-SketchCircle_2_2r")], model.selection(), -165, 155)
Boolean_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Fuse_1_1/Modified_Face_2"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "(Fuse_1_1/Modified_Face&Extrusion_1_1/To_Face)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2)(Fuse_1_1/Modified_Face&Sketch_1/SketchLine_5&Sketch_2/SketchLine_7)"))
SketchLine_17 = Sketch_3.addLine(145, 0, 165, 0)
-SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "Fuse_1_1/Modified_Face_divided_6_1&Fuse_1_1/Modified_Face_3&Fuse_1_1/Modified_Face_divided_5_1"))
+SketchProjection_2 = Sketch_3.addProjection(model.selection("VERTEX", "[Fuse_1_1/Modified_Face&Extrusion_1_1/From_Face&Sketch_2/SketchLine_6][Fuse_1_1/Modified_Face&Sketch_1/SketchLine_1&Extrusion_2_1/To_Face][Fuse_1_1/Modified_Face&Sketch_1/SketchLine_5&Sketch_2/SketchLine_7]"))
SketchPoint_2 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_17.endPoint(), SketchAPI_Point(SketchPoint_2).result())
SketchLine_18 = Sketch_3.addLine(165, 0, 165, -20)
SketchConstraintCoincidence_31 = Sketch_3.setCoincident(SketchLine_19.endPoint(), SketchArc_5.center())
SketchConstraintCoincidence_32 = Sketch_3.setCoincident(SketchLine_20.result(), SketchArc_5.endPoint())
SketchConstraintCoincidence_33 = Sketch_3.setCoincident(SketchArc_5.startPoint(), SketchLine_19.result())
-SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "Fuse_1_1/Modified_Face_4&Fuse_1_1/Modified_Face_divided_2_1"))
+SketchLine_21 = Sketch_3.addLine(model.selection("EDGE", "[Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face][(Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face)(Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_8)(Fuse_1_1/Modified_Face&Sketch_1/SketchLine_5&Sketch_2/SketchLine_7)]"))
SketchConstraintTangent_5 = Sketch_3.setTangent(SketchArc_5.results()[1], SketchLine_21.result())
model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_17r-SketchLine_18r-SketchArc_4_2r")], model.selection(), model.selection("FACE", "Fuse_1_1/Modified_Face_divided_1_1"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")])
-ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_19r-SketchLine_20r-SketchArc_4_2f-SketchArc_5_2r")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_8"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_4_2r-SketchLine_18r-SketchLine_17r")], model.selection(), model.selection("FACE", "Fuse_1_1/Modified_Face&Sketch_1/SketchLine_2&Sketch_2/SketchLine_9"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")])
+ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_4_2f-SketchLine_20r-SketchArc_5_2r-SketchLine_19r")], model.selection(), model.selection("FACE", "(Fuse_1_1/Modified_Face&Extrusion_2_1/From_Face)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_2&Sketch_2/SketchLine_9)(ExtrusionCut_1_1/Generated_Face&Sketch_3/SketchArc_4_2)(ExtrusionCut_1_1/Modified_Face&Extrusion_2_1/To_Face)(Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_8)"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
model.do()
model.end()
SketchPoint_1 = SketchProjection_1.createdFeature()
model.do()
SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_2.result()], SketchAPI_Point(SketchPoint_1).coordinates(), "360/N", "N")
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection(), 10, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 10, 0)
model.do()
# change parameters
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+ TestPresentation.py
+ Test AIS presentations for constraints and macro-features
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+from ModelAPI import *
+from GeomDataAPI import *
+
+from ConfigAPI import *
+Config_PropManager().registerProp("Visualization", "dimension_value_size", "Dimension value size", Config_Prop.IntSpin, "16")
+
+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(-1.492165138365909, 9.860293583877349, 21.86930170264727, 26.80555863006795)
+SketchLine_2 = Sketch_1.addLine(21.86930170264727, 26.80555863006795, 23.42558840321396, 11.88651135131589)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_1.result(), SketchLine_2.result(), 60)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_2.endPoint(), 25, True)
+SketchLine_3 = Sketch_1.addLine(23.50783486163409, 27.99407041552052, 34.45590553653152, 35.9352652297464)
+SketchConstraintCollinear_1 = Sketch_1.setCollinear(SketchLine_1.result(), SketchLine_3.result())
+SketchConstraintDistanceHorizontal_1 = Sketch_1.setHorizontalDistance(SketchLine_1.startPoint(), SketchLine_3.startPoint(), 25)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 15)
+SketchLine_4 = Sketch_1.addLine(53.74716193144771, -7.706985565972583, 35.95905823005196, -7.706985565972583)
+SketchLine_5 = Sketch_1.addLine(35.95905823005196, -7.706985565972583, 35.95905823005196, 16.71916358123427)
+SketchLine_6 = Sketch_1.addLine(35.95905823005196, 16.71916358123427, 53.74716193144771, 16.71916358123427)
+SketchLine_7 = Sketch_1.addLine(53.74716193144771, 16.71916358123427, 53.74716193144771, -7.706985565972583)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_7.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_5.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_5.endPoint(), SketchLine_6.startPoint())
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchLine_7.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_4.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_5.result())
+SketchConstraintParallel_1 = Sketch_1.setParallel(SketchLine_5.result(), SketchLine_7.result())
+SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_6.result(), SketchLine_7.result())
+SketchCircle_1 = Sketch_1.addCircle(20.43340729011699, -17.26699099051272, 10)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchCircle_1.results()[1], 10)
+SketchConstraintRigid_1 = Sketch_1.setFixed(SketchCircle_1.center())
+SketchArc_1 = Sketch_1.addArc(44.85311008074984, -7.706985565972585, 49.46781809225963, -16.57853954306742, 34.85430557643821, -7.861609252895618, False)
+SketchConstraintEqual_1 = Sketch_1.setEqual(SketchCircle_1.results()[1], SketchArc_1.results()[1])
+SketchConstraintMiddle_1 = Sketch_1.setMiddlePoint(SketchArc_1.center(), SketchLine_4.result())
+SketchLine_8 = Sketch_1.addLine(49.46781809225963, -16.57853954306742, 32.21747944141746, -25.55163221418553)
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_8.startPoint())
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_8.result())
+SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_1.result(), [SketchLine_2.result()])
+SketchMultiTranslation_1 = Sketch_1.addTranslation([SketchLine_2.result()], SketchLine_3.startPoint(), SketchLine_3.endPoint(), 3, True)
+SketchMultiRotation_1 = Sketch_1.addRotation([SketchLine_3.result()], SketchLine_3.endPoint(), 360, 4, True)
+model.do()
+
+assert(featureToPresentation(SketchConstraintAngle_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintCoincidence_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintCollinear_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintDistance_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintDistanceHorizontal_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintEqual_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintHorizontal_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintLength_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintMiddle_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintParallel_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintPerpendicular_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintRadius_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintRigid_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintTangent_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintVertical_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchConstraintMirror_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchMultiTranslation_1.feature()).getAISObject(None) is not None)
+assert(featureToPresentation(SketchMultiRotation_1.feature()).getAISObject(None) is not None)
+
+# Test presentation for Fillet on low-level
+aSession = ModelAPI_Session.get()
+aSketchFeature = featureToCompositeFeature(Sketch_1.feature())
+aSession.startOperation()
+aFillet = aSketchFeature.addFeature("SketchFillet")
+aFillet.refattr("fillet_point").setAttr(SketchLine_1.endPoint());
+assert(featureToPresentation(aFillet).getAISObject(None) is not None)
+aSession.finishOperation()
+
+# Test presentation for MacroCircle on low-level
+aSession.startOperation()
+aCircle = aSketchFeature.addFeature("SketchMacroCircle")
+aCirclePnt1 = geomDataAPI_Point2D(aCircle.attribute("first_point"))
+aCirclePnt2 = geomDataAPI_Point2D(aCircle.attribute("second_point"))
+aCirclePnt3 = geomDataAPI_Point2D(aCircle.attribute("third_point"))
+aCircleType = aCircle.string("circle_type")
+aCircleType.setValue("circle_type_by_three_points")
+aCirclePnt1.setValue(10, 0)
+aCirclePnt2.setValue(-10, 0)
+aCirclePnt3.setValue(0, 10)
+assert(featureToPresentation(aCircle).getAISObject(None) is not None)
+aSession.finishOperation()
+
+# Test presentation for MacroArc on low-level
+aSession.startOperation()
+anArc = aSketchFeature.addFeature("SketchMacroArc")
+anArcPnt1 = geomDataAPI_Point2D(anArc.attribute("start_point_2"))
+anArcPnt2 = geomDataAPI_Point2D(anArc.attribute("end_point_2"))
+anArcPnt3 = geomDataAPI_Point2D(anArc.attribute("passed_point"))
+anArcType = anArc.string("arc_type")
+anArcType.setValue("by_three_points")
+anArcPnt1.setValue(5, 0)
+anArcPnt2.setValue(-5, 0)
+anArcPnt3.setValue(0, 5)
+assert(featureToPresentation(anArc).getAISObject(None) is not None)
+aSession.finishOperation()
+
+model.end()
#=========================================================================
aSession.startOperation()
aLineProjector = aSketchFeature.addFeature("SketchProjection")
-aLineProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/Edge-SketchLine_1")
+aLineProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/SketchLine_1")
aLineProjector.boolean("IncludeToResult").setValue(False)
aLineProjector.execute()
aCircleProjector = aSketchFeature.addFeature("SketchProjection")
-aCircleProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/Edge-SketchCircle_1_2")
+aCircleProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/SketchCircle_1_2")
aCircleProjector.boolean("IncludeToResult").setValue(False)
aCircleProjector.execute()
anArcProjector = aSketchFeature.addFeature("SketchProjection")
-anArcProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/Edge-SketchArc_1_2")
+anArcProjector.selection("ExternalFeature").selectSubShape("EDGE", "Sketch_1/SketchArc_1_2")
anArcProjector.boolean("IncludeToResult").setValue(False)
anArcProjector.execute()
aSession.finishOperation()
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+ TestProjectionIntoResult.py
+ Unit test of SketchPlugin_Projection class
+"""
+
from salome.shaper import model
from GeomAPI import *
SketchConstraintCoincidence_7 = Sketch_2.setCoincident(SketchLine_2.startPoint(), SketchLine_7.endPoint())
SketchConstraintHorizontal_1 = Sketch_2.setHorizontal(SketchLine_7.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_2r-SketchLine_5r-SketchLine_6r-SketchLine_7r")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_2r")], model.selection(), 100, 0)
model.do()
#==============================================================================
# Tests
#==============================================================================
-aProjectedList = [("EDGE", "Sketch_1/Edge-SketchCircle_1_2"),
- ("EDGE", "Sketch_1/Edge-SketchArc_1_2"),
- ("EDGE", "Sketch_1/Edge-SketchLine_1"),
- ("VERTEX", "Sketch_1/Vertex-SketchPoint_1"),
+aProjectedList = [("EDGE", "Sketch_1/SketchCircle_1_2"),
+ ("EDGE", "Sketch_1/SketchArc_1_2"),
+ ("EDGE", "Sketch_1/SketchLine_1"),
+ ("VERTEX", "Sketch_1/SketchPoint_1"),
#
- ("VERTEX", "Sketch_1/Vertex-SketchCircle_1"),
- ("VERTEX", "Sketch_1/Vertex-SketchLine_1e"),
- ("VERTEX", "Sketch_1/Vertex-SketchLine_1s"),
- ("VERTEX", "Sketch_1/Vertex-SketchArc_1_2s"),
- ("VERTEX", "Sketch_1/Vertex-SketchArc_1_2e"),
- ("VERTEX", "Sketch_1/Vertex-SketchArc_1"),
+ ("VERTEX", "Sketch_1/SketchCircle_1_2__cc"),
+ ("VERTEX", "Sketch_1/SketchLine_1_EndVertex"),
+ ("VERTEX", "Sketch_1/SketchLine_1_StartVertex"),
+ ("VERTEX", "Sketch_1/SketchArc_1_2_StartVertex"),
+ ("VERTEX", "Sketch_1/SketchArc_1_2_EndVertex"),
+ ("VERTEX", "Sketch_1/SketchArc_1"),
#
- ("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"),
- ("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"),
- ("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"),
- ("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"),
- ("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"),
- ("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"),
- ("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"),
- ("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"),
+ ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/From_Face]"),
+ ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/From_Face]"),
+ ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/From_Face]"),
+ ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/From_Face]"),
+ ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/To_Face]"),
+ ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/To_Face]"),
+ ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/To_Face]"),
+ ("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/To_Face]"),
#
- ("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1"),
- ("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1"),
- ("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1"),
- ("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"),
+ ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/From_Face]"),
+ ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/From_Face]"),
+ ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/From_Face]"),
+ ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/From_Face]"),
#
- ("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_3"),
- ("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/Generated_Face_2"),
- ("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1"),
- ("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3"),
+ ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5]"),
+ ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2]"),
+ ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2]"),
+ ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6]"),
#
- ("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"),
- ("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"),
- ("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"),
- ("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1")
+ ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5][Extrusion_1_1/To_Face]"),
+ ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2][Extrusion_1_1/To_Face]"),
+ ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_1_1/To_Face]"),
+ ("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_1_1/To_Face]")
]
# Test projection to the same plane
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_2"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_5"))
aFailedIDs = set([21, 29])
testProjections(Part_1_doc, Sketch_3, aProjectedList, aFailedIDs)
# Test projection to parallel plane
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_7"))
testProjections(Part_1_doc, Sketch_4, aProjectedList, aFailedIDs)
# Test projection to lower base of the prism
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1"))
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face"))
aFailedIDs = set([0, 1, 22, 23, 24, 25])
testProjections(Part_1_doc, Sketch_5, aProjectedList, aFailedIDs)
# Test projection to upper base of the prism
-Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
testProjections(Part_1_doc, Sketch_6, aProjectedList, aFailedIDs)
# Test projection to orthogonal side face of the prism
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_6"))
aFailedIDs = set([0, 1, 18, 20, 26, 28])
testProjections(Part_1_doc, Sketch_7, aProjectedList, aFailedIDs)
# Test projection to slope side face of the prism
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"))
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_2"))
aFailedIDs = set([0, 1])
testProjections(Part_1_doc, Sketch_8, aProjectedList, aFailedIDs)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+from SketchAPI import *
+
+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(-14.48008258397498, -13.79591274114419, 5.519917416025022, -13.79591274114419)
+SketchLine_2 = Sketch_1.addLine(10.51991741602502, -8.795912741144186, 10.51991741602502, 18.20408725885581)
+SketchLine_3 = Sketch_1.addLine(10.51991741602502, 18.20408725885581, -14.48008258397498, 13.79591274114419)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_1.setName("SketchConstraintCoincidence_2")
+SketchLine_4 = Sketch_1.addLine(-14.48008258397498, 13.79591274114419, -14.48008258397498, -13.79591274114419)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintCoincidence_2.setName("SketchConstraintCoincidence_3")
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
+SketchConstraintCoincidence_3.setName("SketchConstraintCoincidence_4")
+SketchArc_1 = Sketch_1.addArc(5.519917416025022, -8.795912741144186, 5.519917416025022, -13.79591274114419, 10.51991741602502, -8.795912741144186, False)
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_1.endPoint())
+SketchConstraintCoincidence_4.setName("SketchConstraintCoincidence_5")
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_5.setName("SketchConstraintCoincidence_6")
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_1.result())
+SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_2.result())
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 5)
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintAngle_1 = Sketch_1.setAngle(SketchLine_4.result(), SketchLine_3.result(), 100)
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_2.result(), 27)
+SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_1.startPoint(), SketchLine_2.result(), 25, True)
+SketchConstraintRadius_1 = Sketch_1.setRadius(SketchArc_1.results()[1], 5)
+SketchConstraintPerpendicular_1 = Sketch_1.setPerpendicular(SketchLine_1.result(), SketchLine_4.result())
+SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_4.startPoint(), SketchCircle_1.center(), 20, True)
+SketchConstraintDistance_3 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchCircle_1.center(), 20, True)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchAPI_Point(SketchPoint_1).coordinates(), SketchCircle_1.center())
+SketchConstraintCoincidence_6.setName("SketchConstraintCoincidence_7")
+SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchCircle_1_2r")], model.selection(), 10, 0)
+model.do()
+# create a drawer feature of the extrusion and upper face
+Drawer = Part_1_doc.addFeature("SketchDrawer")
+Drawer.selection("base_shape").setValue(Extrusion_1.feature(), None)
+PlaneSelection = model.selection("FACE", "Extrusion_1_1/To_Face")
+PlaneSelection.fillAttribute(Drawer.selection("plane"))
+model.end()
+
+# check that a sketch is created with valid elements
+assert(Part_1_doc.size("Construction") == 2) # two sketches: base of extrusion and this new one
+
+from ModelAPI import *
+aFactory = ModelAPI_Session.get().validators()
+
+Sketch = objectToFeature(Part_1_doc.object("Features", 2)) # created sketch feature
+assert(aFactory.validate(Sketch))
+assert(len(Sketch.results()) == 1)
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from SketchAPI import *
+
+from salome.shaper import model
+from salome.shaper import geom
+
+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(-38.2842712474619, 18.28427124746191, -10, -10)
+SketchLine_2 = Sketch_1.addLine(-10, -10, -10, 20)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(-10, 20, -25, 5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40)
+SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), [SketchLine_1.result(), SketchLine_3.result()])
+[SketchLine_4, SketchLine_5] = SketchConstraintMirror_1.mirrored()
+model.do()
+
+model.testNbSubFeatures(Sketch_1, "SketchLine", 5)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 3)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintLength", 1)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintMirror", 1)
+
+#perform split
+SketchSplit = Sketch_1.addSplit(SketchLine_1, geom.Pnt2d(-12, -8))
+SketchSplit.execute()
+model.do()
+
+model.testNbSubFeatures(Sketch_1, "SketchLine", 6)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 5)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintLength", 1)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintMirror", 0)
+
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+
+from ConfigAPI import *
+Config_PropManager().registerProp("Visualization", "operation_remove_feature_color", "Color of removed feature in operation", Config_Prop.Color, "255, 174, 201")
+
+# base sketch
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch.addLine(0, 20, 100, 20)
+SketchLine_2 = Sketch.addLine(20, 0, 20, 40)
+SketchLine_3 = Sketch.addLine(80, 0, 80, 40)
+SketchCircle_1 = Sketch.addCircle(50, 50, 50)
+SketchPoint_1 = Sketch.addPoint(20, 20)
+SketchConstraintCoincidence_1 = Sketch.setCoincident(SketchPoint_1.coordinates(), SketchLine_2.result())
+SketchConstraintCoincidence_2 = Sketch.setCoincident(SketchPoint_1.coordinates(), SketchLine_1.result())
+SketchPoint_2 = Sketch.addPoint(80, 20)
+SketchConstraintCoincidence_3 = Sketch.setCoincident(SketchPoint_2.coordinates(), SketchLine_1.result())
+SketchConstraintCoincidence_4 = Sketch.setCoincident(SketchPoint_2.coordinates(), SketchLine_3.result())
+SketchPoint_3 = Sketch.addPoint(20, 10)
+SketchConstraintCoincidence_5 = Sketch.setCoincident(SketchPoint_3.coordinates(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_6 = Sketch.setCoincident(SketchPoint_3.coordinates(), SketchLine_2.result())
+SketchPoint_4 = Sketch.addPoint(80, 10)
+SketchConstraintCoincidence_7 = Sketch.setCoincident(SketchPoint_4.coordinates(), SketchCircle_1.results()[1])
+SketchConstraintCoincidence_8 = Sketch.setCoincident(SketchPoint_4.coordinates(), SketchLine_3.result())
+model.do()
+model.end()
+
+aSession = ModelAPI_Session.get()
+aSketchFeature = featureToCompositeFeature(Sketch.feature())
+
+# Create Split feature for a line
+aSession.startOperation()
+aSplit = aSketchFeature.addFeature("SketchSplit")
+aSelectedObj = aSplit.reference("SelectedObject")
+aSelectedObj.setValue(SketchLine_1.feature())
+aSelectedPoint = geomDataAPI_Point2D(aSplit.attribute("SelectedPoint"))
+aSelectedPoint.setValue(50, 20)
+aPreviewObj = aSplit.reference("PreviewObject")
+aPreviewObj.setValue(SketchLine_1.feature())
+aPreviewPoint = geomDataAPI_Point2D(aSplit.attribute("PreviewPoint"))
+aPreviewPoint.setValue(aSelectedPoint.pnt())
+assert(featureToPresentation(aSplit).getAISObject(None) is not None)
+aSession.finishOperation()
+
+model.testNbSubFeatures(Sketch, "SketchArc", 0)
+model.testNbSubFeatures(Sketch, "SketchCircle", 1)
+model.testNbSubFeatures(Sketch, "SketchLine", 5)
+model.testNbSubFeatures(Sketch, "SketchConstraintCoincidence", 12)
+
+# Create Split feature for a circle to perform its substitution by an arc
+aSession.startOperation()
+aSplit = aSketchFeature.addFeature("SketchSplit")
+aSelectedObj = aSplit.reference("SelectedObject")
+aSelectedObj.setValue(SketchCircle_1.feature())
+aSelectedPoint = geomDataAPI_Point2D(aSplit.attribute("SelectedPoint"))
+aSelectedPoint.setValue(50, 0)
+aPreviewObj = aSplit.reference("PreviewObject")
+aPreviewObj.setValue(SketchCircle_1.feature())
+aPreviewPoint = geomDataAPI_Point2D(aSplit.attribute("PreviewPoint"))
+aPreviewPoint.setValue(aSelectedPoint.pnt())
+assert(featureToPresentation(aSplit).getAISObject(None) is not None)
+aSession.finishOperation()
+
+model.testNbSubFeatures(Sketch, "SketchArc", 2)
+model.testNbSubFeatures(Sketch, "SketchCircle", 0)
+model.testNbSubFeatures(Sketch, "SketchLine", 5)
+model.testNbSubFeatures(Sketch, "SketchConstraintCoincidence", 16)
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+from salome.shaper import geom
+
+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(12, -8, -12, -8)
+SketchLine_2 = Sketch_1.addLine(-12, -8, -12, 20)
+SketchLine_3 = Sketch_1.addLine(-12, 20, 12, 20)
+SketchLine_4 = Sketch_1.addLine(12, 20, 12, -8)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_1.startPoint())
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
+SketchConstraintHorizontal_1 = Sketch_1.setHorizontal(SketchLine_1.result())
+SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_2.result())
+SketchConstraintHorizontal_2 = Sketch_1.setHorizontal(SketchLine_3.result())
+SketchConstraintVertical_2 = Sketch_1.setVertical(SketchLine_4.result())
+SketchArc_1 = Sketch_1.addArc(0, -3, 20, -3, -20, -3, False)
+SketchLine_5 = Sketch_1.addLine(20, -3, 20, -30)
+SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_5.startPoint())
+SketchLine_6 = Sketch_1.addLine(20, 17, 50, 17)
+SketchConstraintTangent_1 = Sketch_1.setTangent(SketchLine_5.result(), SketchArc_1.results()[1])
+SketchConstraintTangent_2 = Sketch_1.setTangent(SketchLine_6.result(), SketchArc_1.results()[1])
+model.do()
+
+model.testNbSubFeatures(Sketch_1, "SketchArc", 1)
+model.testNbSubFeatures(Sketch_1, "SketchLine", 6)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 5)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 2)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintEqual", 0)
+
+# perform trim
+SketchTrim = Sketch_1.addTrim(SketchArc_1, geom.Pnt2d(0, 17))
+SketchTrim.execute()
+model.do()
+
+model.testNbSubFeatures(Sketch_1, "SketchArc", 2)
+model.testNbSubFeatures(Sketch_1, "SketchLine", 6)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 8)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintTangent", 2)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintEqual", 1)
+
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from SketchAPI import *
+
+from salome.shaper import model
+from salome.shaper import geom
+
+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(-38.2842712474619, 18.28427124746191, -10, -10)
+SketchLine_2 = Sketch_1.addLine(-10, -10, -10, 20)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchLine_2.startPoint())
+SketchLine_3 = Sketch_1.addLine(-10, 20, -25, 5)
+SketchConstraintCoincidence_2 = Sketch_1.setCoincident(SketchLine_2.endPoint(), SketchLine_3.startPoint())
+SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_1.result())
+SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), 40)
+SketchConstraintMirror_1 = Sketch_1.addMirror(SketchLine_2.result(), [SketchLine_1.result(), SketchLine_3.result()])
+[SketchLine_4, SketchLine_5] = SketchConstraintMirror_1.mirrored()
+model.do()
+
+model.testNbSubFeatures(Sketch_1, "SketchLine", 5)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 3)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintLength", 1)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintMirror", 1)
+
+#perform trim
+SketchTrim = Sketch_1.addTrim(SketchLine_1, geom.Pnt2d(-12, -8))
+SketchTrim.execute()
+model.do()
+
+model.testNbSubFeatures(Sketch_1, "SketchLine", 5)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintCoincidence", 2)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintLength", 1)
+model.testNbSubFeatures(Sketch_1, "SketchConstraintMirror", 0)
+
+model.end()
+
+assert(model.checkPythonDump())
--- /dev/null
+## Copyright (C) 2018-20xx CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+
+from ModelAPI import *
+from GeomDataAPI import *
+
+from ConfigAPI import *
+Config_PropManager().registerProp("Visualization", "operation_remove_feature_color", "Color of removed feature in operation", Config_Prop.Color, "255, 174, 201")
+
+# base sketch
+model.begin()
+partSet = model.moduleDocument()
+Part = model.addPart(partSet)
+Part_doc = Part.document()
+Sketch = model.addSketch(Part_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch.addLine(0, 20, 100, 20)
+SketchLine_2 = Sketch.addLine(20, 0, 20, 40)
+SketchLine_3 = Sketch.addLine(80, 0, 80, 40)
+SketchCircle_1 = Sketch.addCircle(50, 50, 50)
+model.do()
+model.end()
+
+aSession = ModelAPI_Session.get()
+aSketchFeature = featureToCompositeFeature(Sketch.feature())
+
+# Create Trim feature for a line
+aSession.startOperation()
+aTrim = aSketchFeature.addFeature("SketchTrim")
+aSelectedObj = aTrim.reference("SelectedObject")
+aSelectedObj.setValue(SketchLine_1.feature())
+aSelectedPoint = geomDataAPI_Point2D(aTrim.attribute("SelectedPoint"))
+aSelectedPoint.setValue(50, 20)
+aPreviewObj = aTrim.reference("PreviewObject")
+aPreviewObj.setValue(SketchLine_1.feature())
+aPreviewPoint = geomDataAPI_Point2D(aTrim.attribute("PreviewPoint"))
+aPreviewPoint.setValue(aSelectedPoint.pnt())
+assert(featureToPresentation(aTrim).getAISObject(None) is not None)
+aSession.finishOperation()
+
+model.testNbSubFeatures(Sketch, "SketchArc", 0)
+model.testNbSubFeatures(Sketch, "SketchCircle", 1)
+model.testNbSubFeatures(Sketch, "SketchLine", 4)
+model.testNbSubFeatures(Sketch, "SketchConstraintCoincidence", 2)
+
+# Create Trim feature for a circle to perform its substitution by an arc
+aSession.startOperation()
+aTrim = aSketchFeature.addFeature("SketchTrim")
+aSelectedObj = aTrim.reference("SelectedObject")
+aSelectedObj.setValue(SketchCircle_1.feature())
+aSelectedPoint = geomDataAPI_Point2D(aTrim.attribute("SelectedPoint"))
+aSelectedPoint.setValue(50, 0)
+aPreviewObj = aTrim.reference("PreviewObject")
+aPreviewObj.setValue(SketchCircle_1.feature())
+aPreviewPoint = geomDataAPI_Point2D(aTrim.attribute("PreviewPoint"))
+aPreviewPoint.setValue(aSelectedPoint.pnt())
+assert(featureToPresentation(aTrim).getAISObject(None) is not None)
+aSession.finishOperation()
+
+model.testNbSubFeatures(Sketch, "SketchArc", 1)
+model.testNbSubFeatures(Sketch, "SketchCircle", 0)
+model.testNbSubFeatures(Sketch, "SketchLine", 4)
+model.testNbSubFeatures(Sketch, "SketchConstraintCoincidence", 4)
mirrorFeature.rst
translationFeature.rst
rotationFeature.rst
+ sketchDrawer.rst
--- /dev/null
+ .. _create_sketch_drawer:
+
+Sketch Drawer
+=========
+
+Sketch Drawer featrure is a macro-feature, i.e. it is removed after its execution.
+It allows simplify creation of sketches basing on existing models without referencing to
+these models.
+
+For an example, to create a sketch on exising STEP file model planar face
+and then remove the original model, to keep only the sketch with copy of contour. So, to be
+able to remove the initial model, there are no references created by this feature.
+
+To add a new Sketch Drawing:
+
+#. select in the Main Menu *Macros - > Sketch drawer* item or
+#. click **Sketch drawer** button in Macros toolbar:
+
+.. image:: images/SketchDrawer.png
+ :align: center
+
+.. centered::
+ **Sketch drawer** button
+
+The following property panel appears:
+
+.. image:: images/SketchDrawer_panel.png
+ :align: center
+
+.. centered::
+ Sketch drawer
+
+Click in the view once to set the whole original model, then click a second time to set the
+plane or planar face - a base of sketch. This can be plane on the original model.
+On Apply button press the new sketch will be created in the Object Browser tree.
+
+Result
+""""""
+
+A resulting sketch will contain linear and circular edges as well as circular arcs corresponding to the
+original model edges that lay in the sketch plane. Other types of edges are not supported.
+
+Radius, length, vertical, horizontal and points-coincidence constraints will be created
+automatically where it is possible. The resulting sketch may be overconstrained or not fully
+constrained. So, it is just a helper for the sketch creation, not universal tool. After this
+sketch creation normally user must edit this sketch to input reasonable constraints and
+parametrization, or remove not needed constraints or sketch lements.
+
+.. image:: images/SketchDrawer_res.png
+ :align: center
+
+.. centered::
+ Drawn sketch
</group>
</workbench>
+ <workbench id="Macros" document="Part">
+ <group id="Samples">
+
+ <feature id="SketchDrawer" title="Sketch drawer" tooltip="Creates sketch using elements of selected shape belonging to selected plane"
+ icon="icons/Sketch/drawer.png"
+ helpfile="sketchDrawer.html">
+ <shape_selector id="base_shape" label="Shape:" tooltip="Select a shape for extraction to sketch."
+ shape_types="objects" concealment="false"/>
+ <shape_selector id="plane" label="Plane:" tooltip="Select plane for sketch" shape_types="face">
+ <validator id="GeomValidators_Face" parameters="plane"/>
+ </shape_selector>
+ <boolvalue id="add_dimensions" label="Create dimensions" default="true" tooltip="To add dimensions into created sketch" obligatory="0"/>
+ </feature>
+ </group>
+ </workbench>
</plugin>
aParams.insert(myOddPoint->y);
aStorage->removeParameters(aParams);
- aGCSConstraints.pop_back();
- aGCSConstraints.pop_back();
+ // remove constraints keeping sign of point-line distance,
+ // not more than 2 additional constraints is possible
+ if (!aGCSConstraints.empty())
+ aGCSConstraints.pop_back();
+ if (!aGCSConstraints.empty())
+ aGCSConstraints.pop_back();
aConstraint->setConstraints(aGCSConstraints);
aStorage->addConstraint(myBaseConstraint, aConstraint);
if (aDoF > 0 && myDOF <= 0)
sendMessage(EVENT_SKETCH_UNDER_CONSTRAINED, mySketch, aDoF);
- else if (aDoF == 0/* && myDOF > 0*/)
+ else if (aDoF == 0 && myDOF != 0)
sendMessage(EVENT_SKETCH_FULLY_CONSTRAINED, mySketch, aDoF);
else if (aDoF < 0)
sendMessage(EVENT_SKETCH_OVER_CONSTRAINED, mySketch, aDoF);
theConstraint->data()->blockSendAttributeUpdated(myEventsBlocked);
}
-static std::list<AttributePtr> pointAttributes(FeaturePtr theFeature)
-{
- std::list<AttributePtr> aPoints;
- if (!theFeature->data() || !theFeature->data()->isValid())
- return aPoints;
- if (theFeature->getKind() == SketchPlugin_Arc::ID()) {
- aPoints.push_back(theFeature->attribute(SketchPlugin_Arc::CENTER_ID()));
- aPoints.push_back(theFeature->attribute(SketchPlugin_Arc::START_ID()));
- aPoints.push_back(theFeature->attribute(SketchPlugin_Arc::END_ID()));
- }
- else if (theFeature->getKind() == SketchPlugin_Circle::ID())
- aPoints.push_back(theFeature->attribute(SketchPlugin_Circle::CENTER_ID()));
- else if (theFeature->getKind() == SketchPlugin_Line::ID()) {
- aPoints.push_back(theFeature->attribute(SketchPlugin_Line::START_ID()));
- aPoints.push_back(theFeature->attribute(SketchPlugin_Line::END_ID()));
- }
- else if (theFeature->getKind() == SketchPlugin_Point::ID() ||
- theFeature->getKind() == SketchPlugin_IntersectionPoint::ID())
- aPoints.push_back(theFeature->attribute(SketchPlugin_Point::COORD_ID()));
- return aPoints;
-}
-
void SketchSolver_Storage::addEntity(FeaturePtr theFeature,
EntityWrapperPtr theSolverEntity)
{
if (theSolverEntity) {
myFeatureMap[theFeature] = theSolverEntity;
setNeedToResolve(true);
- } else {
- // feature links to the empty entity, add its attributes
- std::list<AttributePtr> aPntAttrs = pointAttributes(theFeature);
- std::list<AttributePtr>::const_iterator anAttrIt = aPntAttrs.begin();
- for (; anAttrIt != aPntAttrs.end(); ++anAttrIt)
- addEntity(*anAttrIt, EntityWrapperPtr());
- myFeatureMap[theFeature] = theSolverEntity;
}
// block events if necessary
std::shared_ptr<GeomAPI_Pnt2d> aPnt = getCoincidencePoint(myConstraint);
std::shared_ptr<GeomAPI_Pnt2d> aP;
FeaturePtr aSub;
- for (int i = 0; i < mySketch->numberOfSubs(); i++) {
+ int aNumberOfSubs = mySketch->numberOfSubs();
+ for (int i = 0; i < aNumberOfSubs; i++) {
aSub = mySketch->subFeature(i);
if (aSub->getKind() == SketchPlugin_ConstraintCoincidence::ID() &&
aSub.get() != myConstraint) {
ModuleBase_ITreeNode* aParent;
int aRow = 0;
QModelIndex aParentIndex1, aParentIndex2;
+ ObjectPtr aObj;
foreach(ModuleBase_ITreeNode* aNode, aNodes) {
+ aObj = aNode->object();
aParent = aNode->parent();
- aRow = aParent->nodeRow(aNode);
- aParentIndex1 = getParentIndex(aNode, 0);
- aParentIndex2 = getParentIndex(aNode, 2);
- insertRows(aRow, 1, aParentIndex1);
- dataChanged(aParentIndex1, aParentIndex2);
+ if (aObj.get() && (aObj->groupName() == ModelAPI_Folder::group())) {
+ aParent->update();
+ rebuildDataTree();
+ }
+ else {
+ aRow = aParent->nodeRow(aNode);
+ aParentIndex1 = getParentIndex(aNode, 0);
+ aParentIndex2 = getParentIndex(aNode, 2);
+ insertRows(aRow, 1, aParentIndex1);
+ dataChanged(aParentIndex1, aParentIndex2);
+ }
}
}
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
for (aIt = aMsgGroups.cbegin(); aIt != aMsgGroups.cend(); aIt++) {
aList.append(myRoot->objectsDeleted(aIt->first, aIt->second.c_str()));
}
+ // Remove obsolete nodes
+ QTreeNodesList aRemaining;
foreach(ModuleBase_ITreeNode* aNode, aList) {
+ if (myRoot->hasSubNode(aNode))
+ aRemaining.append(aNode);
+ }
+ // Update remaining nodes
+ foreach(ModuleBase_ITreeNode* aNode, aRemaining) {
if (aNode->parent())
aNode->parent()->update();
}
rebuildDataTree();
}
else {
+ QSet<ModuleBase_ITreeNode*> aParents;
foreach(ObjectPtr aObj, aCreated) {
ModuleBase_ITreeNode* aNode = myRoot->subNode(aObj);
if (aNode) {
- int aOldNb = aNode->childrenCount();
- aNode->update();
- int aNewNb = aNode->childrenCount();
-
- QModelIndex aFirstIdx = getIndex(aNode, 0);
- QModelIndex aLastIdx = getIndex(aNode, 2);
-
- if (aNewNb > aOldNb) {
- insertRows(aOldNb - 1, aNewNb - aOldNb, aFirstIdx);
- }
- else if (aNewNb < aOldNb) {
- if (aNewNb)
- removeRows(aNewNb - 1, aOldNb - aNewNb, aFirstIdx);
- else if (aOldNb)
- removeRows(0, aOldNb, aFirstIdx);
+ if (aNode->parent()) {
+ if (aNode->parent() == myRoot) {
+ aParents.clear();
+ aParents.insert(myRoot);
+ break;
+ }
+ else {
+ aNode = aNode->parent();
+ }
}
- dataChanged(aFirstIdx, aLastIdx);
+ aParents.insert(aNode);
}
}
+ foreach(ModuleBase_ITreeNode* aNode, aParents) {
+ aNode->update();
+ }
+ rebuildDataTree();
}
}
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_ORDER_UPDATED)) {
if (!aVisible && aResult.get() && aResult->groupName() == ModelAPI_ResultBody::group()) {
ResultBodyPtr aCompsolidResult = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
if (aCompsolidResult.get() != NULL) { // change colors for all sub-solids
- bool anAllSubsVisible = aCompsolidResult->numberOfSubs() > 0;
- for(int i = 0; i < aCompsolidResult->numberOfSubs() && anAllSubsVisible; i++) {
+ int aNumberOfSubs = aCompsolidResult->numberOfSubs();
+ bool anAllSubsVisible = aNumberOfSubs > 0;
+ for(int i = 0; i < aNumberOfSubs && anAllSubsVisible; i++) {
anAllSubsVisible = theDisplayer->isVisible(aCompsolidResult->subResult(i));
}
aVisible = anAllSubsVisible;
foreach(ModuleBase_ViewerPrsPtr aVal, theValues) {
anObjects.append(aVal->object());
}
- bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);
aBrowser->setObjectsSelected(anObjects);
- myWorkshop->objectBrowser()->blockSignals(aBlocked);
}
}
#include <QAction>
#include <QStyledItemDelegate>
#include <QMessageBox>
+#include <QApplication>
#ifdef DEBUG_INDXES
#include <QToolTip>
// Find index which corresponds the feature
QModelIndex aIndex;
foreach(QModelIndex aIdx, selectedIndexes()) {
- ObjectPtr aFea = dataModel()->object(aIdx);
- if (dataModel()->object(aIdx)->isSame(anObject)) {
- aIndex = aIdx;
- break;
+ if (aIdx.column() == 1) {
+ ObjectPtr aFea = dataModel()->object(aIdx);
+ if (dataModel()->object(aIdx)->isSame(anObject)) {
+ aIndex = aIdx;
+ break;
+ }
}
}
if (aIndex.isValid()) {
//***************************************************
void XGUI_ObjectsBrowser::setObjectsSelected(const QObjectPtrList& theObjects)
{
- QList<QModelIndex> theIndexes;
QItemSelectionModel* aSelectModel = myTreeView->selectionModel();
- aSelectModel->clear();
+ QModelIndexList aIndexes = aSelectModel->selectedIndexes();
+ if (theObjects.size() == 0) {
+ bool aIsBlock = aSelectModel->blockSignals(true);
+ aSelectModel->clear();
+ aSelectModel->blockSignals(aIsBlock);
+ foreach(QModelIndex aIdx, aIndexes) {
+ myTreeView->update(aIdx);
+ }
+ return;
+ }
- foreach(ObjectPtr aFeature, theObjects)
- {
- QModelIndex aIndex = myDocModel->objectIndex(aFeature);
- if (aIndex.isValid()) {
- aSelectModel->select(aIndex, QItemSelectionModel::Select);
+ ObjectPtr aObject;
+ QModelIndexList aUnselect;
+ QObjectPtrList aToSelect = theObjects;
+ QHash<qint64, ObjectPtr> aNotChanged;
+ foreach(QModelIndex aIdx, aIndexes) {
+ aObject = myDocModel->object(aIdx);
+ if (aObject.get()) {
+ if (aToSelect.contains(aObject)) {
+ aNotChanged.insert((qint64)aObject.get(), aObject);
+ } else {
+ aUnselect.append(aIdx);
+ }
+ }
+ else {
+ aUnselect.append(aIdx);
}
}
+
+ foreach(ObjectPtr aObj, aNotChanged)
+ aToSelect.removeAll(aObj);
+
+ bool aIsBlock = aSelectModel->blockSignals(true);
+ foreach(QModelIndex aIdx, aUnselect) {
+ aSelectModel->select(aIdx, QItemSelectionModel::Deselect);
+ myTreeView->update(aIdx);
+ }
+
+ QModelIndex aIndex0, aIndex1, aIndex2, aCurrent;
+ foreach(ObjectPtr aFeature, aToSelect) {
+ aIndex1 = myDocModel->objectIndex(aFeature, 1);
+ if (aIndex1.isValid()) {
+ if (!aCurrent.isValid())
+ aCurrent = aIndex1;
+ aIndex0 = myDocModel->objectIndex(aFeature, 0);
+ aIndex2 = myDocModel->objectIndex(aFeature, 2);
+ aSelectModel->select(aIndex1, QItemSelectionModel::Select | QItemSelectionModel::Rows);
+ myTreeView->update(aIndex0);
+ myTreeView->update(aIndex1);
+ myTreeView->update(aIndex2);
+ }
+ }
+ aSelectModel->setCurrentIndex(aCurrent, QItemSelectionModel::NoUpdate);
+ aSelectModel->blockSignals(aIsBlock);
}
//***************************************************
QObjectPtrList aList;
QModelIndexList aIndexes = selectedIndexes();
XGUI_DataModel* aModel = dataModel();
- QModelIndexList::const_iterator aIt;
- for (aIt = aIndexes.constBegin(); aIt != aIndexes.constEnd(); ++aIt) {
- if ((*aIt).column() == 1) {
- ObjectPtr aObject = aModel->object(*aIt);
+
+ foreach(QModelIndex aIdx, aIndexes) {
+ if (aIdx.column() == 1) {
+ ObjectPtr aObject = aModel->object(aIdx);
if (aObject) {
aList.append(aObject);
if (theIndexes)
- theIndexes->append(*aIt);
+ theIndexes->append(aIdx);
}
}
}
QObjectPtrList anObjects;
convertToObjectBrowserSelection(aValues, anObjects);
-
- bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);
myWorkshop->objectBrowser()->setObjectsSelected(anObjects);
- myWorkshop->objectBrowser()->blockSignals(aBlocked);
emit selectionChanged();
}
void XGUI_SelectionMgr::clearSelection()
{
QObjectPtrList aFeatures;
- bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);
myWorkshop->objectBrowser()->setObjectsSelected(aFeatures);
- myWorkshop->objectBrowser()->blockSignals(aBlocked);
QList<ModuleBase_ViewerPrsPtr> aSelectedPrs =
myWorkshop->selector()->selection()->getSelected(ModuleBase_ISelection::Browser);
aDisplayer->setSelected(theValues);
// update selection in Object Browser
- bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);
QObjectPtrList anObjects;
convertToObjectBrowserSelection(theValues, anObjects);
-
myWorkshop->objectBrowser()->setObjectsSelected(anObjects);
- myWorkshop->objectBrowser()->blockSignals(aBlocked);
}
//**************************************************************
#include <ModelAPI_ResultPart.h>
#include <ModelAPI_CompositeFeature.h>
#include <ModelAPI_Tools.h>
+#include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_ResultBody.h>
#include <Events_InfoMessage.h>
#include <GeomAPI_Shape.h>
//******************************************************************
bool canRename(const ObjectPtr& theObject, const QString& theName)
{
- if (std::dynamic_pointer_cast<ModelAPI_ResultParameter>(theObject).get()) {
+ std::string aType = theObject->groupName();
+ if (aType == ModelAPI_ResultParameter::group()) {
double aValue;
ResultParameterPtr aParam;
if (ModelAPI_Tools::findVariable(theObject->document(),
FeaturePtr(), qPrintable(theName), aValue, aParam)) {
const char* aKeyStr = "Selected parameter can not be renamed to: %1. "
"There is a parameter with the same name. Its value is: %2.";
- QString aErrMsg(QObject::tr(aKeyStr).arg(qPrintable(theName)).arg(aValue));
+ QString aErrMsg(QObject::tr(aKeyStr).arg(theName).arg(aValue));
+ // We can not use here a dialog box for message -
+ // it will crash editing process in ObjectBrowser
+ Events_InfoMessage("XGUI_Tools", aErrMsg.toStdString()).send();
+ return false;
+ }
+ }
+ else if ((aType == ModelAPI_ResultConstruction::group()) ||
+ (aType == ModelAPI_ResultBody::group())) {
+ DocumentPtr aDoc = theObject->document();
+ ObjectPtr aObj =
+ aDoc->objectByName(ModelAPI_ResultConstruction::group(), theName.toStdString());
+ if (!aObj.get())
+ aObj = aDoc->objectByName(ModelAPI_ResultBody::group(), theName.toStdString());
+
+ if (aObj.get()) {
+ QString aErrMsg(QObject::tr("Object with name %1 already exists.").arg(theName));
// We can not use here a dialog box for message -
// it will crash editing process in ObjectBrowser
Events_InfoMessage("XGUI_Tools", aErrMsg.toStdString()).send();
//#define DEBUG_FEATURE_NAME
//#define DEBUG_CLEAN_HISTORY
-
-static QString MyFilter(QObject::tr("OpenParts files (*.opp)"));
+#ifdef HAVE_SALOME
+static QString MyFilter(QObject::tr("SHAPER files (*.shaper *.opp)"));
+static QString MyFilter2(QObject::tr("SHAPER files (*.shaper)"));
+static QString MyExtension(".shaper");
+#else
+static QString MyFilter(QObject::tr("OpenParts files (*.opp);;All files (*.*)"));
+static QString MyFilter2(QObject::tr("OpenParts files (*.opp)"));
+static QString MyExtension(".opp");
+#endif
//******************************************************
delete myDisplayer;
delete myDataModelXMLReader;
+ delete mySelectionActivate;
+ delete myMenuMgr;
clearTemporaryDir();
}
if(!myOperationMgr->abortAllOperations(XGUI_OperationMgr::XGUI_InformationMessage))
return false;
myCurrentFile = QFileDialog::getSaveFileName(desktop(), tr("Select name to save file..."),
- QString(), MyFilter);
+ QString(), MyFilter2);
if (!myCurrentFile.isNull()) {
- if (!myCurrentFile.endsWith(".opp")) {
- myCurrentFile += ".opp";
+ if (!myCurrentFile.endsWith(MyExtension)) {
+ myCurrentFile += MyExtension;
}
}
else
aColorAttr->setValue(1, theColor[1]);
aColorAttr->setValue(2, theColor[2]);
}
+ static const Events_ID kRedisplayEvent =
+ Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ ModelAPI_EventCreator::get()->sendUpdated(theResult, kRedisplayEvent);
}
//**************************************************************
AttributeDoublePtr aDeflectionAttr = theResult->data()->real(ModelAPI_Result::DEFLECTION_ID());
if (aDeflectionAttr.get() != NULL)
aDeflectionAttr->setValue(theDeflection);
+ static const Events_ID kRedisplayEvent =
+ Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ ModelAPI_EventCreator::get()->sendUpdated(theResult, kRedisplayEvent);
}
//**************************************************************
AttributeDoublePtr anAttribute = theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID());
if (anAttribute.get() != NULL)
anAttribute->setValue(theTransparency);
+ static const Events_ID kRedisplayEvent =
+ Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ ModelAPI_EventCreator::get()->sendUpdated(theResult, kRedisplayEvent);
}
//**************************************************************
}
if (aSelList.count() > theObjects.count()) {
// if something was found
- bool aBlocked = objectBrowser()->blockSignals(true);
objectBrowser()->setObjectsSelected(aSelList);
- objectBrowser()->blockSignals(aBlocked);
objectBrowser()->ensureVisible(aNewSel.first());
}
if (aHasHidden)
}
if (aSelList.count() > theObjects.count()) {
// if something was found
- bool aBlocked = objectBrowser()->blockSignals(true);
objectBrowser()->setObjectsSelected(aSelList);
- objectBrowser()->blockSignals(aBlocked);
objectBrowser()->ensureVisible(aNewSel.first());
}
}
SketchLine_8 = Sketch_2.addLine(20, 20, 20, 10)
SketchConstraintCoincidence_3 = Sketch_2.setCoincident(SketchLine_7.endPoint(), SketchLine_8.startPoint())
SketchConstraintCoincidence_4 = Sketch_2.setCoincident(SketchLine_5.startPoint(), SketchLine_8.endPoint())
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_4e")])
-Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_7s-SketchLine_6e")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex")])
+Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_2/SketchLine_6_EndVertex")])
# Extrusion
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection("EDGE", "PartSet/OZ"), 100, 0)
Box_12 = model.addBox(Part_1_doc, Point_1, Point_5)
Box_13 = model.addBox(Part_1_doc, Vertex_3, Point_2)
Box_14 = model.addBox(Part_1_doc, Point_2, Vertex_3)
-Box_15 = model.addBox(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_4e"), model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_7s-SketchLine_6e"))
-Box_16 = model.addBox(Part_1_doc, model.selection("VERTEX", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/Generated_Face_2&Extrusion_2_1/To_Face_1"))
+Box_15 = model.addBox(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), model.selection("VERTEX", "Sketch_2/SketchLine_6_EndVertex"))
+Box_16 = model.addBox(Part_1_doc, model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4][Extrusion_1_1/To_Face]"), model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_6][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_7][Extrusion_2_1/To_Face]"))
Box_17 = model.addBox(Part_1_doc, model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_2_1"))
Box_18 = model.addBox(Part_1_doc, "dx", "dy", "dz")
model.do()
model.do()
# Extrusion
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f")], model.selection(), 100, 0)
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")], model.selection(), 100, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection(), 100, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")], model.selection(), 100, 0)
# Edge
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_3")])
# Axis
Axis_1 = model.addAxis(Part_1_doc, 0, 10, 0)
Cylinder_7 = model.addCylinder(Part_1_doc, 5, -10)
Cylinder_8 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "InvalidName"), model.selection("EDGE", "PartSet/OX"), 5, 10)
Cylinder_9 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "InvalidName"), 5, 10)
-Cylinder_10 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_3s-SketchLine_2e"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), 50, 120)
+Cylinder_10 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchLine_2_EndVertex"), model.selection("EDGE", "Sketch_1/SketchLine_3"), 50, 120)
Cylinder_11 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_1_1"), 60, 100)
-Cylinder_12 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"), 5, 10)
+Cylinder_12 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"), model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"), 5, 10)
Cylinder_13 = model.addCylinder(Part_1_doc, "r", "h")
Cylinder_14 = model.addCylinder(Part_1_doc, 5, 10, 45)
Cylinder_15 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("EDGE", "PartSet/OX"), 5, 10, 90)
Cylinder_24 = model.addCylinder(Part_1_doc, 5, 10, 450)
Cylinder_25 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "InvalidName"), model.selection("EDGE", "PartSet/OX"), 5, 10, 90)
Cylinder_26 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "InvalidName"), 5, 10, 90)
-Cylinder_27 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2s-SketchLine_1e"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), 50, 120, 90)
+Cylinder_27 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), model.selection("EDGE", "Sketch_1/SketchLine_3"), 50, 120, 90)
Cylinder_28 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Vertex_1_1"), model.selection("EDGE", "Edge_2_1"), 60, 100, 180)
-Cylinder_29 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/Generated_Face_2&Extrusion_2_1/To_Face_1"), model.selection("EDGE", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/To_Face_1"), 5, 10, 120)
+Cylinder_29 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_2_1/To_Face]"), model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_2_1/To_Face]"), 5, 10, 120)
Cylinder_30 = model.addCylinder(Part_1_doc, "r2", "h2", "angle")
model.do()
model.do()
# Create Wire & Extrusion
-Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2"), model.selection("EDGE", "Sketch_1/SketchLine_1"), model.selection("EDGE", "Sketch_1/SketchLine_3")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OZ"), 50, 0)
# Revolution of the circle
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
# Create MultiTranslations
MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("EDGE", "PartSet/OX"), 15, 5)
#model.testNbSubShapes(MultiTranslation_9, GeomAPI_Shape.SOLID, [0])
#model.testNbSubShapes(MultiTranslation_9, GeomAPI_Shape.SHELL, [10])
#model.testNbSubShapes(MultiTranslation_9, GeomAPI_Shape.FACE, [30])
-#model.testHaveNamingFaces(MultiTranslation_9, model, Part_1_doc)
\ No newline at end of file
+#model.testHaveNamingFaces(MultiTranslation_9, model, Part_1_doc)
Point_1 = model.addPoint(Part_1_doc, -10, -10, -10)
# Create Vertexes
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex")])
# Create Wire & Extrusion
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f_wire")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 50, 0)
# Create Scales
Scale_1 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_1_1")] , model.selection("VERTEX", "PartSet/Origin"), 2)
Scale_2 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_2_1")] , model.selection("VERTEX", "Point_1"), 2)
-Scale_3 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_3_1")] , model.selection("VERTEX", "Box_3_1/Back&Box_3_1/Left&Box_3_1/Top"), 2)
-Scale_4 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_4_1")] , model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e"), 2)
+Scale_3 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_3_1")] , model.selection("VERTEX", "[Box_3_1/Back][Box_3_1/Left][Box_3_1/Top]"), 2)
+Scale_4 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_4_1")] , model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), 2)
Scale_5 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_5_1")] , model.selection("VERTEX", "Vertex_1_1"), 2)
Scale_6 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_6_1")] , model.selection("VERTEX", "PartSet/Origin"), 0)
Scale_7 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_7_1")] , model.selection("VERTEX", "PartSet/Origin"), -3)
Scale_8 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_8_1")] , model.selection("VERTEX", "InvalidName"), 2)
Scale_9 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_9_1")] , model.selection("VERTEX", "PartSet/Origin"), 2 , 3, 1)
Scale_10 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_10_1")] , model.selection("VERTEX", "Point_1"), 2 , 3, 1)
-Scale_11 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_11_1")] , model.selection("VERTEX", "Box_11_1/Back&Box_11_1/Right&Box_11_1/Top"), 2 , 3, 1)
-Scale_12 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_12_1")] , model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e"), 2 , 3, 1)
+Scale_11 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_11_1")] , model.selection("VERTEX", "[Box_11_1/Back][Box_11_1/Right][Box_11_1/Top]"), 2 , 3, 1)
+Scale_12 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_12_1")] , model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"), 2 , 3, 1)
Scale_13 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_13_1")] , model.selection("VERTEX", "Vertex_1_1"), 2 , 3, 1)
Scale_14 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_14_1")] , model.selection("VERTEX", "PartSet/Origin"), 0 , 3, 1)
Scale_15 = model.addScale(Part_1_doc, [model.selection("SOLID", "Box_15_1")] , model.selection("VERTEX", "PartSet/Origin"), 2 , 0, 1)
#model.testNbSubShapes(Scale_19, GeomAPI_Shape.SHELL, [1])
#model.testNbSubShapes(Scale_19, GeomAPI_Shape.SOLID, [0])
#model.testNbSubShapes(Scale_19, GeomAPI_Shape.FACE, [5])
-#model.testHaveNamingFaces(Scale_19, model, Part_1_doc)
\ No newline at end of file
+#model.testHaveNamingFaces(Scale_19, model, Part_1_doc)
model.do()
# Vertexes
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex")])
# Edges
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
# Wire & Extrusion
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_6r-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f_wire")])
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection(), 50, 0)
# Planes
Plane_2 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOZ"), 40, False)
# Faces
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f_wire")])
# Symmetries
Symmetry_1 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "PartSet/Origin"))
Symmetry_2 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("VERTEX", "Point_1"))
-Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("VERTEX", "Box_3_1/Front&Box_3_1/Right&Box_3_1/Top"))
-Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1e"))
+Symmetry_3 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("VERTEX", "[Box_3_1/Front][Box_3_1/Right][Box_3_1/Top]"))
+Symmetry_4 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"))
Symmetry_5 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_5_1")], model.selection("VERTEX", "Vertex_1_1"))
Symmetry_6 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_6_1")], model.selection("VERTEX", "InvalidName"))
Symmetry_7 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_7_1")], model.selection("VERTEX", "PartSet/Origin"), False)
Symmetry_8 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_8_1")], model.selection("EDGE", "PartSet/OZ"))
Symmetry_9 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_9_1")], model.selection("EDGE", "Axis_1"))
-Symmetry_10 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_10_1")], model.selection("EDGE", "Box_9_1/Front&Box_9_1/Top"))
-Symmetry_11 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_11_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+Symmetry_10 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_10_1")], model.selection("EDGE", "[Box_9_1/Front][Box_9_1/Top]"))
+Symmetry_11 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_11_1")], model.selection("EDGE", "Sketch_1/SketchLine_1"))
Symmetry_12 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_12_1")], model.selection("EDGE", "Edge_1_1"))
Symmetry_13 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_13_1")], model.selection("EDGE", "InvalidName"))
Symmetry_14 = model.addSymmetry(Part_1_doc, [model.selection("SOLID", "Box_14_1")], model.selection("EDGE", "PartSet/OZ"), False)
model.testNbSubShapes(Symmetry_9, GeomAPI_Shape.FACE, [12])
model.testHaveNamingFaces(Symmetry_9, model, Part_1_doc)
-model.testNbResults(Symmetry_10, 0)
+model.testNbResults(Symmetry_10, 1)
+model.testNbSubResults(Symmetry_10, [2])
+model.testNbSubShapes(Symmetry_10, GeomAPI_Shape.SOLID, [2])
+model.testNbSubShapes(Symmetry_10, GeomAPI_Shape.FACE, [12])
+model.testHaveNamingFaces(Symmetry_10, model, Part_1_doc)
model.testNbResults(Symmetry_11, 1)
model.testNbSubResults(Symmetry_11, [2])
model.testNbSubShapes(Symmetry_16, GeomAPI_Shape.FACE, [12])
model.testHaveNamingFaces(Symmetry_16, model, Part_1_doc)
-model.testNbResults(Symmetry_17, 0)
+model.testNbResults(Symmetry_17, 1)
+model.testNbSubResults(Symmetry_17, [2])
+model.testNbSubShapes(Symmetry_17, GeomAPI_Shape.SOLID, [2])
+model.testNbSubShapes(Symmetry_17, GeomAPI_Shape.FACE, [12])
+model.testHaveNamingFaces(Symmetry_17, model, Part_1_doc)
model.testNbResults(Symmetry_18, 1)
model.testNbSubResults(Symmetry_18, [2])
model.do()
# Extrusions
-Extrusion_1 = model.addExtrusion(Part_2_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_3 = model.addExtrusion(Part_3_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_4 = model.addExtrusion(Part_4_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_5 = model.addExtrusion(Part_5_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_6 = model.addExtrusion(Part_6_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_7 = model.addExtrusion(Part_7_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_8 = model.addExtrusion(Part_8_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_9 = model.addExtrusion(Part_9_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
+Extrusion_1 = model.addExtrusion(Part_2_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_3 = model.addExtrusion(Part_3_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_4 = model.addExtrusion(Part_4_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_5 = model.addExtrusion(Part_5_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_6 = model.addExtrusion(Part_6_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_7 = model.addExtrusion(Part_7_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_8 = model.addExtrusion(Part_8_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_9 = model.addExtrusion(Part_9_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
# Edges
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Edge_2 = model.addEdge(Part_7_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_1")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Edge_2 = model.addEdge(Part_7_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
# Axis
Axis_1 = model.addAxis(partSet, 10, 10, 10)
Translation_3 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
Translation_4 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("EDGE", "InvalidName"), 15)
Translation_5 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_5_1")], model.selection("EDGE", "PartSet/OY"), "d")
-Translation_6 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_6_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), 15)
+Translation_6 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_6_1")], model.selection("EDGE", "Sketch_1/SketchLine_3"), 15)
Translation_7 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_7_1")], model.selection("EDGE", "Edge_1_1"), 15)
-Translation_8 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_8_1")], model.selection("EDGE", "Box_8_1/Right&Box_8_1/Top"), 15)
+Translation_8 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_8_1")], model.selection("EDGE", "[Box_8_1/Right][Box_8_1/Top]"), 15)
Translation_9 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_9_1")], model.selection("EDGE", "PartSet/Axis_4"), 15)
Translation_10 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_1_1")], model.selection("EDGE", "PartSet/OZ"), 15)
Translation_11 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_2_1")], model.selection("EDGE", "PartSet/OZ"), 0)
Translation_12 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_3_1")], model.selection("EDGE", "PartSet/OZ"), -15)
Translation_13 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_4_1")], model.selection("EDGE", "InvalidName"), 15)
Translation_14 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_5_1")], model.selection("EDGE", "PartSet/OZ"), "d")
-Translation_15 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_6_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), 50)
+Translation_15 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_6_1")], model.selection("EDGE", "Sketch_1/SketchLine_2"), 50)
Translation_16 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_7_1")], model.selection("EDGE", "Edge_1_1"), 50)
-#Translation_17 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_8_1")], model.selection("EDGE", "LinearCopy_8_1/Translated_Edge_8_8"), 50)
-Translation_17 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_8_1")], model.selection("EDGE", "LinearCopy_8_1/Translated_Face_3_4&LinearCopy_8_1/Translated_Face_3_1"), 50)
+Translation_17 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_8_1")], model.selection("EDGE", "[LinearCopy_8_1_3/MF:Translated_Face&Box_17_1/Left][LinearCopy_8_1_3/MF:Translated_Face&Box_17_1/Top]"), 50)
Translation_18 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "LinearCopy_9_1")], model.selection("EDGE", "PartSet/Axis_4"), 50)
Translation_19 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("EDGE", "OX"), 15)
Translation_20 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_3/")], model.selection("EDGE", "OX"), 0)
Translation_22 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_5/")], model.selection("EDGE", "InvalidName"), 15)
Translation_23 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_6/")], model.selection("EDGE", "OX"), "d")
Translation_24 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_7/")], model.selection("EDGE", "Part_7/Edge_1_1"), 15)
-Translation_25 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_8/")], model.selection("EDGE", "Part_8/Box_1_1/Front&Box_1_1/Left"), 15)
+Translation_25 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_8/")], model.selection("EDGE", "Part_8/[Box_1_1/Front][Box_1_1/Left]"), 15)
Translation_26 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_9/")], model.selection("EDGE", "Axis_4"), 15)
model.do()
model.end()
#model.testNbSubShapes(Translation_26, GeomAPI_Shape.COMPOUND, [1])
#model.testNbSubShapes(Translation_26, GeomAPI_Shape.SOLID, [2])
#model.testNbSubShapes(Translation_26, GeomAPI_Shape.FACE, [9])
-#model.testHaveNamingFaces(Translation_26, model, Part_9_doc)
\ No newline at end of file
+#model.testHaveNamingFaces(Translation_26, model, Part_9_doc)
model.do()
# Edges
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2")])
# Axis
Axis_1 = model.addAxis(Part_1_doc, 10, 10, 10)
# Translation 32
Translation_32_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_11_1")], model.selection("EDGE", "PartSet/OX"), 5)
Intersection_6 = model.addIntersection(Part_1_doc, [model.selection("SOLID", "Box_12_1"), model.selection("SOLID", "Translation_11_1")])
-Translation_32 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Intersection_6_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 15)
+Translation_32 = model.addTranslation(Part_1_doc, [model.selection("COMPOUND", "Intersection_6_1")], model.selection("EDGE", "Sketch_1/SketchLine_1"), 15)
# Translation 33
Translation_33_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_13_1")], model.selection("EDGE", "PartSet/OX"), 5)
# Translation 41
Translation_41_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_29_1")], model.selection("EDGE", "PartSet/OX"), 5)
Partition_6 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Box_30_1"), model.selection("SOLID", "Translation_29_1")])
-Translation_41 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_6_1")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 15)
+Translation_41 = model.addTranslation(Part_1_doc, [model.selection("COMPSOLID", "Partition_6_1")], model.selection("EDGE", "Sketch_1/SketchLine_1"), 15)
# Translation 42
Translation_42_1 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_31_1")], model.selection("EDGE", "PartSet/OX"), 5)
model.do()
# Extrusions
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection(), 15, 0)
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_8/Wire-SketchCircle_2_2f")], model.selection(), 15, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r_wire")], model.selection(), 15, 0)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_8/Face-SketchCircle_2_2r_wire")], model.selection(), 15, 0)
# Edges
-Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/Edge-SketchLine_2")])
-Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_5")])
-Edge_3 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_5")])
-Edge_4 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_5")])
-Edge_5 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_5")])
-Edge_6 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/Edge-SketchLine_5")])
-Edge_7 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/Edge-SketchLine_7")])
-Edge_8 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/Edge-SketchLine_6")])
-Edge_9 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/Edge-SketchLine_7")])
-Edge_10 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/Edge-SketchLine_7")])
-Edge_11 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_5/Edge-SketchLine_11")])
-Edge_12 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_7/Edge-SketchLine_22")])
+Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_2")])
+Edge_2 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
+Edge_3 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
+Edge_4 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
+Edge_5 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
+Edge_6 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_3/SketchLine_5")])
+Edge_7 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/SketchLine_7")])
+Edge_8 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/SketchLine_6")])
+Edge_9 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/SketchLine_7")])
+Edge_10 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_4/SketchLine_7")])
+Edge_11 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_5/SketchLine_11")])
+Edge_12 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_7/SketchLine_22")])
# Axis
Axis_1 = model.addAxis(Part_1_doc, 10, 10, 10)
# Vertex
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_4 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_5 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_6 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_7 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_8 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
-Vertex_9 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/Vertex-SketchLine_5e")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_3 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_4 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_5 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_6 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_7 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_8 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
+Vertex_9 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_3/SketchLine_5_EndVertex")])
# Wires
-Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Wire_2 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Wire_3 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Wire_4 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Wire_5 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Wire_6 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_8f-SketchLine_9f-SketchLine_10f")])
-Wire_7 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_8f-SketchLine_9f-SketchLine_10f")])
-Wire_8 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Wire_9 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
+Wire_1 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Wire_2 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Wire_3 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Wire_4 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Wire_5 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Wire_6 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f_wire")])
+Wire_7 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f_wire")])
+Wire_8 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Wire_9 = model.addWire(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
# Faces
-Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_6 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_8f-SketchLine_9f-SketchLine_10f")])
-Face_7 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_8f-SketchLine_9f-SketchLine_10f")])
-Face_8 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_9 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_2f-SketchLine_3f")])
-Face_10 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_6/Wire-SketchLine_12f-SketchLine_13f-SketchLine_14f")])
-Face_11 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_6/Wire-SketchLine_14r-SketchLine_15r-SketchLine_16r")])
-Face_12 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_7/Wire-SketchLine_17f-SketchLine_18f-SketchLine_19f")])
-Face_13 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_7/Wire-SketchLine_19r-SketchLine_20r-SketchLine_21r")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_4 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_5 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_6 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f_wire")])
+Face_7 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_8r-SketchLine_9f-SketchLine_10f_wire")])
+Face_8 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_9 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")])
+Face_10 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_6/Face-SketchLine_12r-SketchLine_13f-SketchLine_14f_wire")])
+Face_11 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_6/Face-SketchLine_16r-SketchLine_15r-SketchLine_14r_wire")])
+Face_12 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_7/Face-SketchLine_17r-SketchLine_18f-SketchLine_19f_wire")])
+Face_13 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_7/Face-SketchLine_21r-SketchLine_20r-SketchLine_19r_wire")])
# Shells
Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Face_10_1"), model.selection("FACE", "Face_11_1")])
Translation_47 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
Translation_48 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_4_1")], model.selection("EDGE", "InvalidName"), 15)
Translation_49 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_5_1")], model.selection("EDGE", "PartSet/OX"), "d")
-Translation_50 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_6_1")], model.selection("EDGE", "Sketch_3/Edge-SketchLine_5"), 15)
+Translation_50 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_6_1")], model.selection("EDGE", "Sketch_3/SketchLine_5"), 15)
Translation_51 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_7_1")], model.selection("EDGE", "Edge_2_1"), 15)
-Translation_52 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_8_1")], model.selection("EDGE", "Box_1_1/Back&Box_1_1/Right"), 15)
+Translation_52 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_8_1")], model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), 15)
Translation_53 = model.addTranslation(Part_1_doc, [model.selection("VERTEX", "Vertex_9_1")], model.selection("EDGE", "Axis_1"), 15)
Translation_54 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_2_1")], model.selection("EDGE", "PartSet/OX"), 15)
Translation_55 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_3_1")], model.selection("EDGE", "PartSet/OX"), 0)
Translation_56 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_4_1")], model.selection("EDGE", "PartSet/OX"), -15)
Translation_57 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_5_1")], model.selection("EDGE", "InvalidName"), 15)
Translation_58 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_6_1")], model.selection("EDGE", "PartSet/OY"), "d")
-Translation_59 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_7_1")], model.selection("EDGE", "Sketch_4/Edge-SketchLine_6"), 15)
+Translation_59 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_7_1")], model.selection("EDGE", "Sketch_4/SketchLine_6"), 15)
Translation_60 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_8_1")], model.selection("EDGE", "Edge_9_1"), 15)
-Translation_61 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_9_1")], model.selection("EDGE", "Box_1_1/Front&Box_1_1/Right"), 15)
+Translation_61 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_9_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), 15)
Translation_62 = model.addTranslation(Part_1_doc, [model.selection("EDGE", "Edge_10_1")], model.selection("EDGE", "Axis_1"), 15)
Translation_63 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_1_1")], model.selection("EDGE", "PartSet/OX"), 15)
Translation_64 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_2_1")], model.selection("EDGE", "PartSet/OX"), 0)
Translation_65 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
Translation_66 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_4_1")], model.selection("EDGE", "InvalidName"), 15)
Translation_67 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_5_1")], model.selection("EDGE", "PartSet/OY"), "d")
-Translation_68 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_6_1")], model.selection("EDGE", "Sketch_5/Edge-SketchLine_11"), 15)
+Translation_68 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_6_1")], model.selection("EDGE", "Sketch_5/SketchLine_11"), 15)
Translation_69 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_7_1")], model.selection("EDGE", "Edge_11_1"), 15)
-Translation_70 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_8_1")], model.selection("EDGE", "Box_1_1/Back&Box_1_1/Right"), 15)
+Translation_70 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_8_1")], model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Right]"), 15)
Translation_71 = model.addTranslation(Part_1_doc, [model.selection("WIRE", "Wire_9_1")], model.selection("EDGE", "Axis_1"), 15)
Translation_72 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "PartSet/OX"), 15)
Translation_73 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_2_1")], model.selection("EDGE", "PartSet/OX"), 0)
Translation_74 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
Translation_75 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_4_1")], model.selection("EDGE", "InvalidName"), -15)
Translation_76 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_5_1")], model.selection("EDGE", "PartSet/OX"), "d")
-Translation_77 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_6_1")], model.selection("EDGE", "Sketch_5/Edge-SketchLine_11"), 15)
+Translation_77 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_6_1")], model.selection("EDGE", "Sketch_5/SketchLine_11"), 15)
Translation_78 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_7_1")], model.selection("EDGE", "Edge_11_1"), 15)
-Translation_79 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_8_1")], model.selection("EDGE", "Box_1_1/Front&Box_1_1/Right"), 15)
+Translation_79 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_8_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), 15)
Translation_80 = model.addTranslation(Part_1_doc, [model.selection("FACE", "Face_9_1")], model.selection("EDGE", "Axis_1"), 15)
Translation_81 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OX"), 15)
Translation_82 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_2_1")], model.selection("EDGE", "PartSet/OX"), 0)
Translation_83 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_3_1")], model.selection("EDGE", "PartSet/OX"), -15)
Translation_84 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_4_1")], model.selection("EDGE", "InvalidName"), 15)
Translation_85 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_5_1")], model.selection("EDGE", "PartSet/OX"), "d")
-Translation_86 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_6_1")], model.selection("EDGE", "Sketch_7/Edge-SketchLine_22"), 15)
+Translation_86 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_6_1")], model.selection("EDGE", "Sketch_7/SketchLine_22"), 15)
Translation_87 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_7_1")], model.selection("EDGE", "Edge_12_1"), 15)
-Translation_88 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_8_1")], model.selection("EDGE", "Box_1_1/Front&Box_1_1/Right"), 15)
+Translation_88 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_8_1")], model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Right]"), 15)
Translation_89 = model.addTranslation(Part_1_doc, [model.selection("SHELL", "Shell_9_1")], model.selection("EDGE", "Axis_1"), 15)
Translation_90 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1"), model.selection("SOLID", "Extrusion_2_1")], model.selection("EDGE", "PartSet/OY"), 15)
model.do()
Point_2 = model.addPoint(Part_1_doc, 10, 10, 0)
# Vertex
-Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_3e")])
-Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2s-SketchLine_1e")])
+Vertex_1 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex")])
+Vertex_2 = model.addVertex(Part_1_doc, [model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex")])
# Translations
Translation_99 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_2"))
-Translation_100 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_1"))
-Translation_101 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "InvalidName"), model.selection("VERTEX", "Point_1"))
-Translation_102 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_1_1")], model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "InvalidName"))
-Translation_103 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_3e"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2s-SketchLine_1e"))
+Translation_100 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Point_1"))
+Translation_101 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("VERTEX", "InvalidName"), model.selection("VERTEX", "Point_1"))
+Translation_102 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Translation_1_1")], model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "InvalidName"))
+Translation_103 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_2_1")], model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"))
Translation_104 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_3_1")], model.selection("VERTEX", "Vertex_1_1"), model.selection("VERTEX", "Vertex_2_1"))
-Translation_105 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("VERTEX", "Box_4_1/Back&Box_4_1/Left&Box_4_1/Bottom"), model.selection("VERTEX", "Box_4_1/Front&Box_4_1/Right&Box_4_1/Top"))
+Translation_105 = model.addTranslation(Part_1_doc, [model.selection("SOLID", "Box_4_1")], model.selection("VERTEX", "[Box_4_1/Back][Box_4_1/Left][Box_4_1/Bottom]"), model.selection("VERTEX", "[Box_4_1/Front][Box_4_1/Right][Box_4_1/Top]"))
model.do()
model.end()
assert(Translation_101.feature().error() == 'Attribute "start_point" is not initialized.')
model.testNbResults(Translation_102, 0)
-assert(Translation_102.feature().error() == 'Attribute "end_point" is not initialized.')
\ No newline at end of file
+assert(Translation_102.feature().error() == 'Attribute "end_point" is not initialized.')
SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchPoint_1.coordinates())
SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_15")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchLine_10f-SketchArc_1_2r-SketchArc_2_2r")], model.selection(), "b/2", "b/2")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchArc_2_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_7f-SketchLine_8f-SketchLine_9f-SketchArc_1_2r-SketchLine_10f")], model.selection(), "b/2", "b/2")
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/To_Face]"))
SketchCircle_1 = Sketch_2.addCircle(-15, 35.00000000000001, 25)
SketchConstraintCoincidence_15 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchCircle_1.center())
SketchConstraintCoincidence_15.setName("SketchConstraintCoincidence_16")
SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_1.results()[1], "50/2")
model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection(), 0, 13, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"))
-SketchPoint_3 = Sketch_3.addPoint(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_4"))
-SketchLine_11 = Sketch_3.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_4"))
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2f_wire")], model.selection(), 0, 13, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&ExtrusionCut_1_1/From_Face"))
+SketchPoint_3 = Sketch_3.addPoint(model.selection("VERTEX", "ExtrusionCut_1_1/Generated_Vertex&ExtrusionCut_1_1/From_Face"))
+SketchLine_11 = Sketch_3.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face&weak_name_2"))
SketchArc_3 = Sketch_3.addArc(-15, 35.00000000000001, -15, 46.0103340429751, -17.02045759563166, 24.17663606626138, True)
SketchConstraintCoincidence_16 = Sketch_3.setCoincident(SketchPoint_3.result(), SketchArc_3.center())
SketchConstraintCoincidence_16.setName("SketchConstraintCoincidence_17")
SketchConstraintCoincidence_17 = Sketch_3.setCoincident(SketchLine_11.result(), SketchArc_3.startPoint())
SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_18")
-SketchArc_4 = Sketch_3.addArc(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"))
+SketchArc_4 = Sketch_3.addArc(model.selection("EDGE", "ExtrusionCut_1_1/Generated_Edge&ExtrusionCut_1_1/From_Face&weak_name_1"))
SketchConstraintCoincidence_18 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchArc_4.results()[1])
SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_19")
SketchLine_12 = Sketch_3.addLine(-15, 46.0103340429751, -15, 35.00000000000001)
SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_24")
model.do()
ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchArc_3_2f-SketchLine_12f-SketchArc_5_2r")], model.selection(), 5, 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1/To_Face_1"))
-SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "ExtrusionFuse_1_1/Modfied_4&ExtrusionFuse_1_1/Modfied_5&ExtrusionFuse_1_1/To_Face_1"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1/To_Face"))
+SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "[ExtrusionFuse_1_1/Generated_Face&Sketch_3/SketchArc_5_2][ExtrusionFuse_1_1/Generated_Face&Sketch_3/SketchLine_12][ExtrusionFuse_1_1/To_Face]"))
SketchCircle_2 = Sketch_4.addCircle(-15, 35.00000000000001, 5)
SketchConstraintCoincidence_24 = Sketch_4.setCoincident(SketchPoint_4.result(), SketchCircle_2.center())
SketchConstraintCoincidence_24.setName("SketchConstraintCoincidence_25")
SketchConstraintRadius_4 = Sketch_4.setRadius(SketchCircle_2.results()[1], "10/2")
model.do()
ExtrusionFuse_2 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchCircle_2_2f")], model.selection(), 8, 0, [model.selection("SOLID", "ExtrusionFuse_1_1")])
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_1"))
-SketchArc_6 = Sketch_5.addArc(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_1&ExtrusionFuse_1_1/Modfied_3"))
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face"))
+SketchArc_6 = Sketch_5.addArc(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionFuse_1_1/Modified_Face&Sketch_1/SketchArc_1_2]"))
SketchArc_7 = Sketch_5.addArc(-45, 35, -45, 5, -25.41666666666737, 12.27351642784166, False)
SketchConstraintCoincidence_25 = Sketch_5.setCoincident(SketchArc_6.result(), SketchArc_7.center())
SketchConstraintCoincidence_25.setName("SketchConstraintCoincidence_26")
-SketchCircle_3 = Sketch_5.addCircle(model.selection("EDGE", "ExtrusionFuse_2_1/Modfied_5&ExtrusionFuse_2_1/To_Face_1"))
+SketchCircle_3 = Sketch_5.addCircle(model.selection("EDGE", "[ExtrusionFuse_2_1/Generated_Face&Sketch_4/SketchCircle_2_2][ExtrusionFuse_2_1/To_Face]"))
SketchArc_8 = Sketch_5.addArc(-15, 35.00000000000001, -25.41666666666737, 12.27351642784166, -30.00000000000075, 14.99999999999944, True)
SketchConstraintCoincidence_26 = Sketch_5.setCoincident(SketchCircle_3.result(), SketchArc_8.center())
SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_27")
SketchConstraintCoincidence_33 = Sketch_5.setCoincident(SketchArc_9.startPoint(), SketchLine_13.endPoint())
SketchConstraintCoincidence_33.setName("SketchConstraintCoincidence_34")
model.do()
-ExtrusionFuse_3 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_7_2f-SketchArc_8_2r-SketchLine_13r-SketchArc_9_2r")], model.selection(), 0, 8, [model.selection("SOLID", "ExtrusionFuse_2_1")])
-Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_3_1/Modfied_3"))
-SketchLine_14 = Sketch_6.addLine(model.selection("EDGE", "ExtrusionFuse_3_1/Modfied_3&Extrusion_1_1/Generated_Face_7"))
+ExtrusionFuse_3 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_7_2f-SketchArc_8_2r-SketchArc_9_2r-SketchLine_13r")], model.selection(), 0, 8, [model.selection("SOLID", "ExtrusionFuse_2_1")])
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_3_1/Modified_Face&Extrusion_1_1/To_Face"))
+SketchLine_14 = Sketch_6.addLine(model.selection("EDGE", "[ExtrusionFuse_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"))
SketchArc_10 = Sketch_6.addArc(55, 35, 55, 15, 35, 35, True)
SketchConstraintCoincidence_34 = Sketch_6.setCoincident(SketchLine_14.result(), SketchArc_10.center())
SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_35")
SketchConstraintCoincidence_35 = Sketch_6.setCoincident(SketchLine_14.result(), SketchArc_10.startPoint())
SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_36")
-SketchLine_15 = Sketch_6.addLine(model.selection("EDGE", "ExtrusionFuse_3_1/Modfied_3&Extrusion_1_1/Generated_Face_8"))
-SketchConstraintDistance_8 = Sketch_6.setDistance(SketchArc_10.center(), SketchLine_15.result(), 35)
-SketchLine_16 = Sketch_6.addLine(35, 35, 35, 48)
+SketchLine_15 = Sketch_6.addLine(model.selection("EDGE", "[ExtrusionFuse_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4]"))
+SketchConstraintDistance_8 = Sketch_6.setDistance(SketchArc_10.center(), SketchLine_15.result(), 35, False)
+SketchLine_16 = Sketch_6.addLine(35, 35, 35, 47.99999999999999)
SketchConstraintCoincidence_36 = Sketch_6.setCoincident(SketchArc_10.endPoint(), SketchLine_16.startPoint())
SketchConstraintCoincidence_36.setName("SketchConstraintCoincidence_37")
-SketchLine_17 = Sketch_6.addLine(model.selection("EDGE", "ExtrusionFuse_3_1/Modfied_3&Extrusion_1_1/Generated_Face_6"))
+SketchLine_17 = Sketch_6.addLine(model.selection("EDGE", "[ExtrusionFuse_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"))
SketchConstraintCoincidence_37 = Sketch_6.setCoincident(SketchLine_16.endPoint(), SketchLine_17.result())
SketchConstraintCoincidence_37.setName("SketchConstraintCoincidence_38")
SketchConstraintVertical_6 = Sketch_6.setVertical(SketchLine_16.result())
SketchConstraintTangent_4 = Sketch_6.setTangent(SketchLine_16.result(), SketchArc_10.results()[1])
SketchConstraintRadius_5 = Sketch_6.setRadius(SketchArc_10.results()[1], 20)
-SketchLine_18 = Sketch_6.addLine(55, 15, 55, 48)
+SketchLine_18 = Sketch_6.addLine(55, 15, 55, 47.99999999999999)
SketchConstraintCoincidence_38 = Sketch_6.setCoincident(SketchArc_10.startPoint(), SketchLine_18.startPoint())
SketchConstraintCoincidence_38.setName("SketchConstraintCoincidence_39")
SketchConstraintCoincidence_39 = Sketch_6.setCoincident(SketchLine_14.endPoint(), SketchLine_18.endPoint())
SketchConstraintCoincidence_39.setName("SketchConstraintCoincidence_40")
-SketchLine_19 = Sketch_6.addLine(35, 48, 55, 48)
+SketchLine_19 = Sketch_6.addLine(35, 47.99999999999999, 55, 47.99999999999999)
SketchConstraintCoincidence_40 = Sketch_6.setCoincident(SketchLine_16.endPoint(), SketchLine_19.startPoint())
SketchConstraintCoincidence_40.setName("SketchConstraintCoincidence_41")
SketchConstraintCoincidence_41 = Sketch_6.setCoincident(SketchLine_14.endPoint(), SketchLine_19.endPoint())
SketchConstraintCoincidence_41.setName("SketchConstraintCoincidence_42")
model.do()
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_6/Wire-SketchArc_10_2f-SketchLine_16r-SketchLine_18f-SketchLine_19r")], model.selection(), 0, 9, [model.selection("SOLID", "ExtrusionFuse_3_1")])
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/From_Face_1"))
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_6/Face-SketchArc_10_2f-SketchLine_18f-SketchLine_19r-SketchLine_16r_wire")], model.selection(), 0, 9, [model.selection("SOLID", "ExtrusionFuse_3_1")])
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/From_Face"))
SketchCircle_4 = Sketch_7.addCircle(45, -35, 5)
-SketchLine_20 = Sketch_7.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/From_Face_1"))
-SketchConstraintDistance_9 = Sketch_7.setDistance(SketchCircle_4.center(), SketchLine_20.result(), 10)
+SketchLine_20 = Sketch_7.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_5][ExtrusionCut_2_1/From_Face]"))
+SketchConstraintDistance_9 = Sketch_7.setDistance(SketchCircle_4.center(), SketchLine_20.result(), 10, False)
SketchConstraintRadius_6 = Sketch_7.setRadius(SketchCircle_4.results()[1], "10/2")
SketchLine_21 = Sketch_7.addLine(35, -35, 45, -35)
SketchLine_21.setAuxiliary(True)
-SketchPoint_5 = Sketch_7.addPoint(model.selection("VERTEX", "ExtrusionCut_2_1/Generated_Face_1&ExtrusionCut_2_1/Generated_Face_4&ExtrusionCut_2_1/From_Face_1"))
+SketchPoint_5 = Sketch_7.addPoint(model.selection("VERTEX", "[ExtrusionCut_2_1/Generated_Face&Sketch_6/SketchLine_16][ExtrusionCut_2_1/Generated_Face&Sketch_6/SketchArc_10_2][ExtrusionCut_2_1/From_Face]"))
SketchConstraintCoincidence_42 = Sketch_7.setCoincident(SketchLine_21.startPoint(), SketchPoint_5.result())
SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_43")
SketchConstraintCoincidence_43 = Sketch_7.setCoincident(SketchCircle_4.center(), SketchLine_21.endPoint())
SketchConstraintCoincidence_43.setName("SketchConstraintCoincidence_44")
SketchConstraintHorizontal_4 = Sketch_7.setHorizontal(SketchLine_21.result())
model.do()
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_7/Face-SketchCircle_4_2f")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/From_Face_1"), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"))
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_7/Face-SketchCircle_4_2r")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/From_Face"), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8"))
SketchLine_22 = Sketch_8.addLine(55, 25, 5.000000000000002, 25)
SketchLine_23 = Sketch_8.addLine(5.000000000000002, 25, 5.000000000000002, 13)
SketchLine_24 = Sketch_8.addLine(5.000000000000002, 13, 55, 13)
SketchConstraintVertical_8 = Sketch_8.setVertical(SketchLine_25.result())
SketchConstraintLength_2 = Sketch_8.setLength(SketchLine_22.result(), 50)
SketchConstraintLength_3 = Sketch_8.setLength(SketchLine_25.result(), 12)
-SketchProjection_1 = Sketch_8.addProjection(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_1"))
+SketchProjection_1 = Sketch_8.addProjection(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_5][ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_6]"), False)
SketchLine_26 = SketchProjection_1.createdFeature()
SketchConstraintCoincidence_48 = Sketch_8.setCoincident(SketchLine_22.startPoint(), SketchLine_26.result())
SketchConstraintCoincidence_48.setName("SketchConstraintCoincidence_49")
-SketchLine_27 = Sketch_8.addLine(model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&Extrusion_1_1/Generated_Face_4"))
+SketchLine_27 = Sketch_8.addLine(model.selection("EDGE", "[ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8]"))
SketchConstraintCoincidence_49 = Sketch_8.setCoincident(SketchLine_22.startPoint(), SketchLine_27.result())
SketchConstraintCoincidence_49.setName("SketchConstraintCoincidence_50")
model.do()
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_22f-SketchLine_23f-SketchLine_24f-SketchLine_25f")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face_8"), 0, [model.selection("SOLID", "ExtrusionCut_3_1")])
-Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1/Modfied_2"))
-SketchLine_28 = Sketch_9.addLine(25, -45, 18.44853578320836, -63)
-SketchLine_29 = Sketch_9.addLine(model.selection("EDGE", "ExtrusionFuse_1_1/Modfied_2&ExtrusionCut_4_1/Modfied_6"))
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_22r-SketchLine_23f-SketchLine_24f-SketchLine_25f")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), 0, [model.selection("SOLID", "ExtrusionCut_3_1")])
+Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_1_1/Modified_Face&Sketch_1/SketchLine_9"))
+SketchLine_28 = Sketch_9.addLine(25, -45, 18.44853578320833, -63)
+SketchLine_29 = Sketch_9.addLine(model.selection("EDGE", "[ExtrusionFuse_1_1/Modified_Face&Sketch_1/SketchLine_9][ExtrusionCut_4_1/Modified_Face&Sketch_1/SketchLine_8]"))
SketchConstraintCoincidence_50 = Sketch_9.setCoincident(SketchLine_28.endPoint(), SketchLine_29.result())
SketchConstraintCoincidence_50.setName("SketchConstraintCoincidence_51")
-SketchLine_30 = Sketch_9.addLine(model.selection("EDGE", "ExtrusionCut_4_1/Modfied_9&ExtrusionFuse_1_1/Modfied_2"))
+SketchLine_30 = Sketch_9.addLine(model.selection("EDGE", "[ExtrusionCut_4_1/Modified_Face&Extrusion_1_1/From_Face][ExtrusionFuse_1_1/Modified_Face&Sketch_1/SketchLine_9]"))
SketchConstraintCoincidence_51 = Sketch_9.setCoincident(SketchLine_28.startPoint(), SketchLine_30.result())
SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_52")
-SketchConstraintAngle_3 = Sketch_9.setAngle(SketchLine_28.result(), SketchLine_30.result(), 20)
-SketchConstraintDistance_10 = Sketch_9.setDistance(SketchLine_28.startPoint(), SketchLine_29.result(), 18)
-SketchLine_31 = Sketch_9.addLine(18.44853578320836, -63, 25, -63)
+SketchConstraintAngle_3 = Sketch_9.setAngle(SketchLine_28.result(), SketchLine_30.result(), 20.00000000000009)
+SketchConstraintDistance_10 = Sketch_9.setDistance(SketchLine_28.startPoint(), SketchLine_29.result(), 18, False)
+SketchLine_31 = Sketch_9.addLine(18.44853578320833, -63, 25, -63)
SketchConstraintCoincidence_52 = Sketch_9.setCoincident(SketchLine_28.endPoint(), SketchLine_31.startPoint())
SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_53")
SketchConstraintCoincidence_53 = Sketch_9.setCoincident(SketchLine_29.startPoint(), SketchLine_31.endPoint())
SketchConstraintCoincidence_55 = Sketch_9.setCoincident(SketchLine_28.startPoint(), SketchLine_32.endPoint())
SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_56")
model.do()
-ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_9/Face-SketchLine_28f-SketchLine_31f-SketchLine_32f")], model.selection(), model.selection(), 0, model.selection("FACE", "ExtrusionCut_4_1/Modfied_3"), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
-Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_5_1/Modfied_1"))
+ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_9/Face-SketchLine_28r-SketchLine_31f-SketchLine_32f")], model.selection(), model.selection(), 0, model.selection("FACE", "ExtrusionCut_4_1/Modified_Face&Sketch_1/SketchLine_5"), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
+Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_8"))
SketchCircle_5 = Sketch_10.addCircle(-6.000000000000002, 4.999999999999997, 5)
-SketchLine_33 = Sketch_10.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_5_1/Modfied_1"))
-SketchConstraintDistance_11 = Sketch_10.setDistance(SketchCircle_5.center(), SketchLine_33.result(), 30)
-SketchLine_34 = Sketch_10.addLine(model.selection("EDGE", "ExtrusionCut_5_1/Modfied_2&ExtrusionCut_5_1/Modfied_1"))
-SketchConstraintDistance_12 = Sketch_10.setDistance(SketchCircle_5.result(), SketchLine_34.result(), 9)
+SketchLine_33 = Sketch_10.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_8]"))
+SketchConstraintDistance_11 = Sketch_10.setDistance(SketchCircle_5.center(), SketchLine_33.result(), 30, False)
+SketchLine_34 = Sketch_10.addLine(model.selection("EDGE", "[ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_9][ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_8]"))
+SketchConstraintDistance_12 = Sketch_10.setDistance(SketchCircle_5.result(), SketchLine_34.result(), 9, False)
SketchConstraintRadius_7 = Sketch_10.setRadius(SketchCircle_5.results()[1], "10/2")
model.do()
-ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_10/Face-SketchCircle_5_2f")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face_12"), 0, [model.selection("SOLID", "ExtrusionCut_5_1")])
+ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_10/Face-SketchCircle_5_2r")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"), 0, [model.selection("SOLID", "ExtrusionCut_5_1")])
model.do()
# Test reexecution after parameter change
SketchConstraintHorizontal_2 = Sketch_3.setHorizontal(SketchLine_16.result())
SketchConstraintVertical_3 = Sketch_3.setVertical(SketchLine_15.result())
SketchConstraintVertical_4 = Sketch_3.setVertical(SketchLine_13.result())
-SketchLine_17 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"))
+SketchLine_17 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/SketchLine_4"))
SketchConstraintParallel_2 = Sketch_3.setParallel(SketchLine_14.result(), SketchLine_17.result())
SketchConstraintDistance_6 = Sketch_3.setDistance(SketchLine_14.endPoint(), SketchLine_17.result(), 1, False)
SketchLine_18 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OZ"))
SketchLine_19 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY"))
SketchConstraintDistance_9 = Sketch_3.setDistance(SketchLine_15.endPoint(), SketchLine_19.result(), 70, False)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f")], model.selection(), 75, 45)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2r-SketchCircle_2_2r_wire")], model.selection(), 75, 45)
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 22, 22)
Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
Sketch_4 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchConstraintCoincidence_51.setName("SketchConstraintCoincidence_57")
SketchConstraintCoincidence_52 = Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchLine_34.endPoint())
SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_58")
-SketchCircle_3 = Sketch_4.addCircle(model.selection("EDGE", "Sketch_2/Edge-SketchCircle_1_2"))
+SketchCircle_3 = Sketch_4.addCircle(model.selection("EDGE", "Sketch_2/SketchCircle_1_2"))
SketchConstraintCoincidence_53 = Sketch_4.setCoincident(SketchLine_22.startPoint(), SketchCircle_3.results()[1])
SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_59")
SketchConstraintCoincidence_54 = Sketch_4.setCoincident(SketchArc_4.endPoint(), SketchCircle_3.results()[1])
SketchLine_38 = Sketch_5.addLine(44, 3.464101615137744, 16.50000000000003, 51.09549882328188)
SketchLine_38.setName("SketchLine_41")
SketchLine_38.result().setName("SketchLine_41")
-SketchPoint_5 = Sketch_5.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"))
+SketchPoint_5 = Sketch_5.addPoint(model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"))
SketchConstraintCoincidence_69 = Sketch_5.setCoincident(SketchLine_38.startPoint(), SketchPoint_5.result())
SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_73")
-SketchLine_39 = Sketch_5.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_4"))
+SketchLine_39 = Sketch_5.addLine(model.selection("EDGE", "Sketch_1/SketchLine_4"))
SketchLine_39.setName("SketchLine_42")
SketchLine_39.result().setName("SketchLine_42")
SketchConstraintPerpendicular_2 = Sketch_5.setPerpendicular(SketchLine_38.result(), SketchLine_39.result())
SketchConstraintLength_1 = Sketch_5.setLength(SketchLine_38.result(), 55)
SketchConstraintLength_1.setName("SketchConstraintLength_6")
model.do()
-Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_10r-SketchLine_11r-SketchLine_8r-SketchLine_3r-SketchLine_9r-SketchLine_6r-SketchArc_1_2r-SketchArc_2_2f"), model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_5s-SketchLine_4e"))
-Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Sketch_5/Vertex-SketchLine_41e"), False)
+Axis_4 = model.addAxis(Part_1_doc, model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_8r-SketchArc_1_2r-SketchLine_9r-SketchLine_3r-SketchLine_11r-SketchArc_2_2f-SketchLine_10r"), model.selection("VERTEX", "Sketch_1/SketchLine_4_EndVertex"))
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Sketch_5/SketchLine_41_EndVertex"), False)
Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_40 = Sketch_6.addLine(3.999999999999999, 13.00000000002605, 4, 12.89999999999998)
SketchLine_40.setName("SketchLine_55")
SketchConstraintDistance_20.setName("SketchConstraintDistance_20")
SketchConstraintDistance_21 = Sketch_6.setDistance(SketchLine_51.startPoint(), SketchLine_49.result(), 0.8, False)
SketchConstraintDistance_21.setName("SketchConstraintDistance_21")
-SketchLine_52 = Sketch_6.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_41"))
+SketchLine_52 = Sketch_6.addLine(model.selection("EDGE", "Sketch_5/SketchLine_41"))
SketchLine_52.setName("SketchLine_51")
SketchLine_52.result().setName("SketchLine_51")
SketchConstraintDistance_22 = Sketch_6.setDistance(SketchLine_45.startPoint(), SketchLine_52.result(), 4, False)
SketchConstraintCoincidence_90 = Sketch_6.setCoincident(SketchArc_12.startPoint(), SketchLine_53.result())
SketchConstraintCoincidence_90.setName("SketchConstraintCoincidence_94")
model.do()
-Extrusion_7 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchLine_55r-SketchLine_44r-SketchLine_52r-SketchLine_53r-SketchLine_54r-SketchLine_47r-SketchLine_48r-SketchLine_49r-SketchArc_12_2r-SketchArc_13_2r")], model.selection(), 0, 40)
+Extrusion_7 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchArc_13_2r-SketchLine_54r-SketchLine_49r-SketchLine_48r-SketchLine_47r-SketchLine_53r-SketchArc_12_2r-SketchLine_52r-SketchLine_44r-SketchLine_55r")], model.selection(), 0, 40)
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Common_1_1")], [model.selection("SOLID", "Common_2_1")])
Fuse_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Fuse_1_1")], [model.selection("SOLID", "Extrusion_7_1")])
Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Fuse_2_1")], [model.selection("SOLID", "Common_3_1")])
-Extrusion_8 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_10r-SketchLine_11r-SketchLine_8r-SketchLine_3r-SketchLine_9r-SketchLine_6r-SketchArc_1_2r-SketchArc_2_2f")], model.selection(), 55, 55)
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_8_1/Generated_Face_1"))
+Extrusion_8 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_6r-SketchLine_8r-SketchArc_1_2r-SketchLine_9r-SketchLine_3r-SketchLine_11r-SketchArc_2_2f-SketchLine_10r_wire")], model.selection(), 55, 55)
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10"))
SketchLine_54 = Sketch_7.addLine(55, -9.237604307034024, 55, -60)
SketchLine_54.setName("SketchLine_66")
SketchLine_54.result().setName("SketchLine_66")
-SketchPoint_6 = Sketch_7.addPoint(model.selection("VERTEX", "Extrusion_8_1/Generated_Face_2&Extrusion_8_1/Generated_Face_1&Extrusion_8_1/To_Face_1"))
+SketchPoint_6 = Sketch_7.addPoint(model.selection("VERTEX", "[Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_8_1/To_Face]"))
SketchLine_55 = Sketch_7.addLine(55, -9.237604307034024, 55, -70)
SketchLine_55.setName("SketchLine_57")
SketchLine_55.result().setName("SketchLine_57")
SketchLine_55.setAuxiliary(True)
SketchConstraintCoincidence_91 = Sketch_7.setCoincident(SketchLine_55.startPoint(), SketchPoint_6.result())
SketchConstraintCoincidence_91.setName("SketchConstraintCoincidence_95")
-SketchPoint_7 = Sketch_7.addPoint(model.selection("VERTEX", "Extrusion_8_1/Generated_Face_8&Extrusion_8_1/Generated_Face_1&Extrusion_8_1/To_Face_1"))
+SketchPoint_7 = Sketch_7.addPoint(model.selection("VERTEX", "[Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_8_1/To_Face]"))
SketchConstraintCoincidence_92 = Sketch_7.setCoincident(SketchLine_55.endPoint(), SketchPoint_7.result())
SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_96")
SketchLine_56 = Sketch_7.addLine(45.00000000000001, -70, -45.00000000000001, -70)
SketchLine_57.setAuxiliary(True)
SketchConstraintCoincidence_93 = Sketch_7.setCoincident(SketchLine_55.endPoint(), SketchLine_57.startPoint())
SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_97")
-SketchPoint_8 = Sketch_7.addPoint(model.selection("VERTEX", "Extrusion_8_1/Generated_Face_8&Extrusion_8_1/Generated_Face_1&Extrusion_8_1/From_Face_1"))
+SketchPoint_8 = Sketch_7.addPoint(model.selection("VERTEX", "[Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_8_1/From_Face]"))
SketchConstraintCoincidence_94 = Sketch_7.setCoincident(SketchLine_57.endPoint(), SketchPoint_8.result())
SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_98")
SketchLine_58 = Sketch_7.addLine(-55.00000000000001, -59.99999999999999, -55, -9.237604307034024)
SketchLine_59.setAuxiliary(True)
SketchConstraintCoincidence_95 = Sketch_7.setCoincident(SketchLine_57.endPoint(), SketchLine_59.startPoint())
SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_99")
-SketchPoint_9 = Sketch_7.addPoint(model.selection("VERTEX", "Extrusion_8_1/Generated_Face_2&Extrusion_8_1/Generated_Face_1&Extrusion_8_1/From_Face_1"))
+SketchPoint_9 = Sketch_7.addPoint(model.selection("VERTEX", "[Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_8_1/From_Face]"))
SketchConstraintCoincidence_96 = Sketch_7.setCoincident(SketchLine_59.endPoint(), SketchPoint_9.result())
SketchConstraintCoincidence_96.setName("SketchConstraintCoincidence_100")
SketchLine_60 = Sketch_7.addLine(-55, -9.237604307034024, -60.00000000000001, -9.237604307034024)
SketchConstraintRadius_16 = Sketch_7.setRadius(SketchCircle_7.results()[1], 5)
SketchConstraintDistance_31 = Sketch_7.setDistance(SketchCircle_6.center(), SketchLine_54.result(), 11, False)
SketchConstraintDistance_31.setName("SketchConstraintDistance_31")
-SketchLine_66 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_8_1/Generated_Face_2&Extrusion_8_1/Generated_Face_1"))
+SketchLine_66 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_10]"))
SketchLine_66.setName("SketchLine_69")
SketchLine_66.result().setName("SketchLine_69")
SketchConstraintDistance_32 = Sketch_7.setDistance(SketchCircle_6.center(), SketchLine_66.result(), 11, False)
SketchConstraintLength_3.setName("SketchConstraintLength_8")
SketchConstraintDistanceHorizontal_1 = Sketch_7.setHorizontalDistance(SketchPoint_7.coordinates(), SketchLine_62.endPoint(), 5)
model.do()
-ExtrusionCut_1_objects_1 = [model.selection("WIRE", "Sketch_7/Wire-SketchLine_66f-SketchLine_67f-SketchLine_68f-SketchLine_60f-SketchLine_61f-SketchLine_62f-SketchLine_63f-SketchLine_64f-SketchArc_14_2r-SketchArc_15_2r"), model.selection("FACE", "Sketch_7/Face-SketchCircle_4_2f"), model.selection("FACE", "Sketch_7/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_7/Face-SketchCircle_7_2f"), model.selection("FACE", "Sketch_7/Face-SketchCircle_6_2f")]
+ExtrusionCut_1_objects_1 = [model.selection("WIRE", "Sketch_7/Face-SketchLine_66r-SketchArc_14_2r-SketchLine_67f-SketchArc_15_2r-SketchLine_68f-SketchLine_60f-SketchLine_61f-SketchLine_62f-SketchLine_63f-SketchLine_64f_wire"), model.selection("FACE", "Sketch_7/Face-SketchCircle_4_2f"), model.selection("FACE", "Sketch_7/Face-SketchCircle_5_2f"), model.selection("FACE", "Sketch_7/Face-SketchCircle_7_2f"), model.selection("FACE", "Sketch_7/Face-SketchCircle_6_2f")]
ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_1_objects_1, model.selection(), 0, 10, [model.selection("SOLID", "Extrusion_8_1")])
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_8_1/Generated_Face_3"))
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11"))
SketchLine_67 = Sketch_8.addLine(55, -34.06366588218793, 55, 66.69872981077805)
SketchLine_67.setName("SketchLine_79")
SketchLine_67.result().setName("SketchLine_79")
-SketchPoint_10 = Sketch_8.addPoint(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_3&Extrusion_8_1/Generated_Face_3&ExtrusionCut_1_1/Modfied_13"))
+SketchPoint_10 = Sketch_8.addPoint(model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_2_2][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_2_2)(ExtrusionCut_1_1/Generated_Face&Sketch_7/SketchLine_66)(Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_9)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_3)]"))
SketchLine_68 = Sketch_8.addLine(55, -34.06366588218793, 55, 76.69872981077803)
SketchLine_68.setName("SketchLine_70")
SketchLine_68.result().setName("SketchLine_70")
SketchLine_68.setAuxiliary(True)
SketchConstraintCoincidence_116 = Sketch_8.setCoincident(SketchLine_68.startPoint(), SketchPoint_10.result())
SketchConstraintCoincidence_116.setName("SketchConstraintCoincidence_120")
-SketchPoint_11 = Sketch_8.addPoint(model.selection("VERTEX", "Extrusion_8_1/Generated_Face_3&ExtrusionCut_1_1/Modfied_13&Extrusion_8_1/Generated_Face_4"))
+SketchPoint_11 = Sketch_8.addPoint(model.selection("VERTEX", "[Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_2_2)(ExtrusionCut_1_1/Generated_Face&Sketch_7/SketchLine_66)(Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_9)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_3)][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_3]"))
SketchConstraintCoincidence_117 = Sketch_8.setCoincident(SketchLine_68.endPoint(), SketchPoint_11.result())
SketchConstraintCoincidence_117.setName("SketchConstraintCoincidence_121")
SketchLine_69 = Sketch_8.addLine(45, 76.69872981077805, -44.9999999570576, 76.69872981077805)
SketchLine_70.setAuxiliary(True)
SketchConstraintCoincidence_118 = Sketch_8.setCoincident(SketchLine_68.endPoint(), SketchLine_70.startPoint())
SketchConstraintCoincidence_118.setName("SketchConstraintCoincidence_122")
-SketchPoint_12 = Sketch_8.addPoint(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_1&Extrusion_8_1/Generated_Face_3&Extrusion_8_1/Generated_Face_4"))
+SketchPoint_12 = Sketch_8.addPoint(model.selection("VERTEX", "[(ExtrusionCut_1_1/Generated_Face&Sketch_7/SketchLine_68)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_2_2)(Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_9)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_3)][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_3]"))
SketchConstraintCoincidence_119 = Sketch_8.setCoincident(SketchLine_70.endPoint(), SketchPoint_12.result())
SketchConstraintCoincidence_119.setName("SketchConstraintCoincidence_123")
SketchLine_71 = Sketch_8.addLine(-55, 66.69872976783566, -55, -34.06366588218793)
SketchLine_72.setAuxiliary(True)
SketchConstraintCoincidence_120 = Sketch_8.setCoincident(SketchLine_70.endPoint(), SketchLine_72.startPoint())
SketchConstraintCoincidence_120.setName("SketchConstraintCoincidence_124")
-SketchPoint_13 = Sketch_8.addPoint(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_3&ExtrusionCut_1_1/Modfied_1&Extrusion_8_1/Generated_Face_3"))
+SketchPoint_13 = Sketch_8.addPoint(model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_2_2][(ExtrusionCut_1_1/Generated_Face&Sketch_7/SketchLine_68)(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchArc_2_2)(Extrusion_8_1/Generated_Face&Sketch_1/SketchArc_1_2)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_9)(Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_3)][Extrusion_8_1/Generated_Face&Sketch_1/SketchLine_11]"))
SketchConstraintCoincidence_121 = Sketch_8.setCoincident(SketchLine_72.endPoint(), SketchPoint_13.result())
SketchConstraintCoincidence_121.setName("SketchConstraintCoincidence_125")
SketchLine_73 = Sketch_8.addLine(-55, -34.06366588218793, -83.25521566485324, -34.06366588218793)
SketchConstraintDistance_44 = Sketch_8.setDistance(SketchArc_18.startPoint(), SketchLine_69.result(), 25, False)
SketchConstraintDistance_44.setName("SketchConstraintDistance_46")
model.do()
-ExtrusionCut_2_objects_1 = [model.selection("FACE", "Sketch_8/Face-SketchLine_79r-SketchLine_80r-SketchLine_81r-SketchLine_73r-SketchLine_74r-SketchLine_75r-SketchLine_76r-SketchLine_77r-SketchArc_16_2r-SketchArc_17_2r"), model.selection("WIRE", "Sketch_8/Wire-SketchCircle_8_2f"), model.selection("WIRE", "Sketch_8/Wire-SketchCircle_9_2f"), model.selection("WIRE", "Sketch_8/Wire-SketchArc_19_2f-SketchArc_18_2f-SketchLine_82f-SketchLine_83r")]
+ExtrusionCut_2_objects_1 = [model.selection("FACE", "Sketch_8/Face-SketchLine_77r-SketchLine_76r-SketchLine_75r-SketchLine_74r-SketchLine_73r-SketchLine_81r-SketchArc_17_2r-SketchLine_80r-SketchArc_16_2r-SketchLine_79r"), model.selection("WIRE", "Sketch_8/Face-SketchCircle_8_2f_wire"), model.selection("WIRE", "Sketch_8/Face-SketchCircle_9_2f_wire"), model.selection("WIRE", "Sketch_8/Face-SketchArc_19_2f-SketchLine_82f-SketchArc_18_2f-SketchLine_83r_wire")]
ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_2_objects_1, model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_1_1")])
Fuse_3 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Cut_1_1")], [model.selection("SOLID", "ExtrusionCut_2_1")])
model.do()
model.testNbSubResults(Fuse_3, [0])
model.testNbSubShapes(Fuse_3, GeomAPI_Shape.SOLID, [1])
model.testNbSubShapes(Fuse_3, GeomAPI_Shape.FACE, [50])
-model.testNbSubShapes(Fuse_3, GeomAPI_Shape.EDGE, [266])
-model.testNbSubShapes(Fuse_3, GeomAPI_Shape.VERTEX, [532])
+# unstable numbers
+#model.testNbSubShapes(Fuse_3, GeomAPI_Shape.EDGE, [266])
+#model.testNbSubShapes(Fuse_3, GeomAPI_Shape.VERTEX, [532])
model.testResultsVolumes(Fuse_3, [156999.209584889642428606748580933])
assert(model.checkPythonDump())
SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchLine_5.startPoint(), SketchLine_7.result())
SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_35")
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_4r-SketchArc_1_2f-SketchArc_2_2f-SketchLine_28r-SketchLine_29r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_2"))
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_2_2f-SketchArc_1_2f-SketchLine_4r-SketchLine_29r-SketchLine_28r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2"))
SketchLine_8 = Sketch_2.addLine(0, 0, 25, 43.30127018922193)
SketchLine_8.setName("SketchLine_5")
SketchLine_8.result().setName("SketchLine_5")
SketchLine_8.setAuxiliary(True)
SketchPoint_3 = Sketch_2.addPoint(model.selection("VERTEX", "PartSet/Origin"))
SketchConstraintCoincidence_11 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchPoint_3.result())
-SketchCircle_1 = Sketch_2.addCircle(model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Revolution_1_1/Generated_Face_1"))
+SketchCircle_1 = Sketch_2.addCircle(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]"))
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchCircle_1.results()[1])
SketchLine_9 = Sketch_2.addLine(39.43375672974064, -43.30127018922192, 15.87711932209923, -2.499977343709401)
SketchLine_9.setName("SketchLine_10")
SketchLine_10.result().setName("SketchLine_6")
SketchLine_10.setAuxiliary(True)
SketchConstraintCoincidence_13 = Sketch_2.setCoincident(SketchLine_10.startPoint(), SketchPoint_3.result())
-SketchCircle_2 = Sketch_2.addCircle(model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Revolution_1_1/Generated_Face_1"))
+SketchCircle_2 = Sketch_2.addCircle(model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1]"))
SketchConstraintCoincidence_14 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchCircle_2.results()[1])
SketchLine_11 = Sketch_2.addLine(15.87713238415337, 2.499999967850816, 39.43375672974065, 43.30127018922192)
SketchLine_11.setName("SketchLine_11")
SketchConstraintDistance_9 = Sketch_2.setDistance(SketchArc_9.center(), SketchPoint_3.coordinates(), 21)
SketchConstraintDistance_9.setName("SketchConstraintDistance_8")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_10r-SketchLine_11r-SketchArc_3_2f-SketchArc_4_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchLine_14r-SketchArc_7_2f-SketchLine_15r-SketchArc_8_2f"), model.selection("FACE", "Sketch_2/Face-SketchLine_12r-SketchArc_5_2f-SketchLine_13r-SketchArc_6_2f"), model.selection("FACE", "Sketch_2/Face-SketchLine_19f-SketchLine_20f-SketchLine_21f-SketchArc_10_2f"), model.selection("FACE", "Sketch_2/Face-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchArc_9_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchLine_22f-SketchLine_23f-SketchLine_24f-SketchArc_11_2f")], model.selection(), model.selection(), 10, model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 10)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchArc_4_2f-SketchLine_11r-SketchArc_3_2f-SketchLine_10r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchArc_7_2f-SketchLine_15r-SketchArc_8_2f-SketchLine_14r_wire"), model.selection("FACE", "Sketch_2/Face-SketchArc_5_2f-SketchLine_13r-SketchArc_6_2f-SketchLine_12r"), model.selection("FACE", "Sketch_2/Face-SketchLine_19f-SketchLine_20f-SketchLine_21f-SketchArc_10_2f"), model.selection("FACE", "Sketch_2/Face-SketchLine_16f-SketchLine_17f-SketchLine_18f-SketchArc_9_2f"), model.selection("WIRE", "Sketch_2/Face-SketchLine_22f-SketchLine_23f-SketchLine_24f-SketchArc_11_2f_wire")], model.selection(), model.selection(), 10, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_4"), 10)
Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_4"), model.selection("SOLID", "Extrusion_1_5")])
Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_1_1")], [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_3"), model.selection("SOLID", "Extrusion_1_6")])
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Cut_2_1/Modified_Face_7"), model.selection("FACE", "Cut_2_1/Modified_Face_9"))
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_2/SketchLine_21"), model.selection("FACE", "Cut_2_1/Modified_Face&Sketch_2/SketchLine_19"))
Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchCircle_3 = Sketch_3.addCircle(25, -10, 4)
SketchCircle_4 = Sketch_3.addCircle(40, -10, 4)
SketchConstraintDistance_10.setName("SketchConstraintDistance_9")
SketchConstraintDistance_11 = Sketch_3.setDistance(SketchCircle_4.center(), SketchLine_28.result(), 40)
SketchConstraintDistance_11.setName("SketchConstraintDistance_10")
-SketchProjection_1 = Sketch_3.addProjection(model.selection("EDGE", "Cut_2_1/Modified_Face_divided_20_e_15_1"), False)
+SketchProjection_1 = Sketch_3.addProjection(model.selection("EDGE", "Cut_2_1/Generated_Edge&Sketch_2/SketchLine_21&Sketch_1/SketchLine_2"), False)
SketchLine_29 = SketchProjection_1.createdFeature()
SketchLine_29.setName("SketchLine_26")
SketchLine_29.result().setName("SketchLine_26")
SketchConstraintDistance_13 = Sketch_3.setDistance(SketchCircle_3.center(), SketchLine_29.result(), 10)
SketchConstraintDistance_13.setName("SketchConstraintDistance_12")
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_3_2f"), model.selection("WIRE", "Sketch_3/Wire-SketchCircle_4_2f")], model.selection(), model.selection("FACE", "Cut_1_1/Modified_Face_6"), 5, model.selection("FACE", "Cut_1_1/Modified_Face_8"), 5)
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_3_2r"), model.selection("WIRE", "Sketch_3/Face-SketchCircle_4_2f_wire")], model.selection(), model.selection("FACE", "Cut_1_1/Modified_Face&Sketch_2/SketchLine_11"), 5, model.selection("FACE", "Cut_1_1/Modified_Face&Sketch_2/SketchLine_13"), 5)
Cut_3 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_2_1")], [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
Recover_1 = model.addRecover(Part_1_doc, Cut_3, [Extrusion_2.results()[1], Extrusion_2.result()])
Rotation_1 = model.addRotation(Part_1_doc, [model.selection("SOLID", "Recover_1_1"), model.selection("SOLID", "Recover_1_2")], model.selection("EDGE", "PartSet/OZ"), 120)
SketchConstraintCoincidence_97.setName("SketchConstraintCoincidence_75")
SketchConstraintDistance_19 = Sketch_5.setDistance(SketchLine_49.endPoint(), SketchLine_41.result(), 10)
model.do()
-Face_1 = model.addFace(Part_2_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchArc_4_2f-SketchArc_5_2f-SketchArc_6_2f-SketchArc_7_2f-SketchArc_8_2f-SketchArc_9_2f-SketchArc_10_2f")])
-Axis_4 = model.addAxis(Part_2_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("VERTEX", "Sketch_2/Vertex-SketchArc_3-SketchLine_20s"))
+Face_1 = model.addFace(Part_2_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_1_2f-SketchArc_7_2f-SketchArc_8_2f-SketchArc_9_2f-SketchArc_10_2f-SketchArc_6_2f-SketchArc_5_2f-SketchArc_4_2f_wire")])
+Axis_4 = model.addAxis(Part_2_doc, model.selection("FACE", "PartSet/XOZ"), model.selection("VERTEX", "Sketch_2/SketchArc_3"))
Rotation_3 = model.addRotation(Part_2_doc, [model.selection("FACE", "Face_1_1")], model.selection("EDGE", "Axis_1"), -43.8752)
-Pipe_1 = model.addPipe(Part_2_doc, [model.selection("FACE", "Rotation_1_1")], model.selection("EDGE", "Sketch_2/Edge-SketchArc_3_2"))
-Extrusion_3 = model.addExtrusion(Part_2_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_2_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchLine_14r-SketchLine_15r-SketchLine_16r-SketchLine_17r")], model.selection(), "Gap/2", "Gap/2")
+Pipe_1 = model.addPipe(Part_2_doc, [model.selection("FACE", "Rotation_1_1")], model.selection("EDGE", "Sketch_2/SketchArc_3_2"))
+Extrusion_3 = model.addExtrusion(Part_2_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_2_2f-SketchCircle_3_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchLine_17r-SketchLine_16r-SketchLine_15r-SketchLine_14r_wire")], model.selection(), "Gap/2", "Gap/2")
Fuse_1 = model.addFuse(Part_2_doc, [model.selection("SOLID", "Pipe_1_1")], [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_1_2")])
Extrusion_4 = model.addExtrusion(Part_2_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")], model.selection(), "Gap", "Gap")
Cut_1 = model.addCut(Part_2_doc, [model.selection("SOLID", "Fuse_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
-Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Cut_1_1")], model.selection("VERTEX", "Sketch_2/Edge-SketchCircle_2_2__cc"), model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_21e"))
+Translation_1 = model.addTranslation(Part_2_doc, [model.selection("SOLID", "Cut_1_1")], model.selection("VERTEX", "Sketch_2/SketchCircle_2_2__cc"), model.selection("VERTEX", "Sketch_2/SketchLine_21_EndVertex"))
model.do()
Part_3 = model.duplicatePart(Part_2)
Part_3.setName("Arm 2")
SketchLine_99 = Sketch_10.addLine(model.selection("EDGE", "PartSet/OY"))
SketchConstraintDistance_35 = Sketch_10.setDistance(SketchLine_98.endPoint(), SketchLine_99.result(), "Thickness")
model.do()
-Revolution_2 = model.addRevolution(Part_5_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_6r")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"), 360, 0)
-Sketch_11 = model.addSketch(Part_5_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_1"))
+Revolution_2 = model.addRevolution(Part_5_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r")], model.selection("EDGE", "Sketch_1/SketchLine_6"), 360, 0)
+Sketch_11 = model.addSketch(Part_5_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_1"))
SketchCircle_14 = Sketch_11.addCircle(0, 0, 8.5)
SketchCircle_14.setAuxiliary(True)
-SketchPoint_8 = Sketch_11.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_6e"))
+SketchPoint_8 = Sketch_11.addPoint(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"))
SketchConstraintCoincidence_239 = Sketch_11.setCoincident(SketchCircle_14.center(), SketchPoint_8.result())
SketchConstraintRadius_18 = Sketch_11.setRadius(SketchCircle_14.results()[1], "(Rod+5)/2")
SketchLine_100 = Sketch_11.addLine(-8.5, -4.907477288111821, -8.5, 4.907477288111821)
SketchConstraintEqual_9 = Sketch_11.setEqual(SketchLine_102.result(), SketchLine_103.result())
SketchConstraintEqual_10 = Sketch_11.setEqual(SketchLine_103.result(), SketchLine_104.result())
model.do()
-Extrusion_9 = model.addExtrusion(Part_5_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_8r-SketchLine_9r-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_13r")], model.selection(), 25, 0)
+Extrusion_9 = model.addExtrusion(Part_5_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13r-SketchLine_12r-SketchLine_11r-SketchLine_10r-SketchLine_9r-SketchLine_8r")], model.selection(), 25, 0)
Sketch_12 = model.addSketch(Part_5_doc, model.standardPlane("YOZ"))
SketchLine_106 = Sketch_12.addLine(9.814954576223595, 48.99999999999999, 9.814954576223595, 52.35726558990813)
SketchLine_107 = Sketch_12.addLine(9.814954576223595, 52.35726558990813, 4, 52.35726558990813)
SketchConstraintHorizontal_20 = Sketch_12.setHorizontal(SketchLine_107.result())
SketchConstraintVertical_20 = Sketch_12.setVertical(SketchLine_106.result())
SketchConstraintAngle_8 = Sketch_12.setAngle(SketchLine_108.result(), SketchLine_107.result(), 30)
-SketchLine_109 = Sketch_12.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_3"))
+SketchLine_109 = Sketch_12.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_10][Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_9]"))
SketchConstraintCoincidence_249 = Sketch_12.setCoincident(SketchLine_108.endPoint(), SketchLine_109.result())
-SketchProjection_2 = Sketch_12.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"))
+SketchProjection_2 = Sketch_12.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_2/SketchLine_10][Extrusion_1_1/To_Face]"), False)
SketchLine_110 = SketchProjection_2.createdFeature()
SketchConstraintDistance_36 = Sketch_12.setDistance(SketchLine_110.result(), SketchLine_108.endPoint(), 1)
SketchLine_111 = Sketch_12.addLine(model.selection("EDGE", "PartSet/OZ"))
SketchConstraintDistance_37 = Sketch_12.setDistance(SketchLine_108.startPoint(), SketchLine_111.result(), 4)
model.do()
-Revolution_3 = model.addRevolution(Part_5_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_14f-SketchLine_15f-SketchLine_16f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Revolution_3 = model.addRevolution(Part_5_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_14r-SketchLine_15f-SketchLine_16f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
Cut_12 = model.addCut(Part_5_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")])
Cut_13 = model.addFuse(Part_5_doc, [model.selection("SOLID", "Cut_1_1"), model.selection("SOLID", "Revolution_1_1")], [])
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.endPoint(), SketchCircle_1.results()[1])
model.do()
Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), "h", 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"))
SketchLine_2 = SketchProjection_1.createdFeature()
SketchCircle_2 = Sketch_2.addCircle(0, 0, 33.5)
SketchConstraintRadius_2 = Sketch_2.setRadius(SketchCircle_2.results()[1], "R2")
model.do()
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f")], model.selection(), "h2", 0)
Extrusion_3 = model.addExtrusion(Part_1_doc, [], model.selection(), "h2*3", 0)
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_1"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face"))
SketchCircle_3 = Sketch_3.addCircle(0, 0, 28.25)
SketchConstraintRadius_3 = Sketch_3.setRadius(SketchCircle_3.results()[1], 28.25)
-SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchProjection_2 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"))
SketchLine_3 = SketchProjection_2.createdFeature()
SketchConstraintCoincidence_6 = Sketch_3.setCoincident(SketchCircle_3.center(), SketchAPI_Line(SketchLine_3).startPoint())
Extrusion_3.setNestedSketch(Sketch_3)
Extrusion_4 = model.addExtrusion(Part_1_doc, [], model.selection(), "h2", 0)
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_3_1/To_Face_1"))
-SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_3_1/To_Face"))
+SketchProjection_3 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"))
SketchLine_4 = SketchProjection_3.createdFeature()
SketchCircle_4 = Sketch_4.addCircle(0, 0, 25.9)
SketchConstraintRadius_4 = Sketch_4.setRadius(SketchCircle_4.results()[1], "R3")
SketchConstraintCoincidence_7.setName("SketchConstraintCoincidence_15")
Extrusion_4.setNestedSketch(Sketch_4)
Extrusion_5 = model.addExtrusion(Part_1_doc, [], model.selection(), "h2", 0)
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_4_1/To_Face_1"))
-SketchProjection_4 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_4_1/To_Face"))
+SketchProjection_4 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_1"))
SketchLine_5 = SketchProjection_4.createdFeature()
SketchCircle_5 = Sketch_5.addCircle(0, 0, 8)
SketchConstraintRadius_5 = Sketch_5.setRadius(SketchCircle_5.results()[1], 8)
SketchConstraintCoincidence_8.setName("SketchConstraintCoincidence_16")
Extrusion_5.setNestedSketch(Sketch_5)
Fuse_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1"), model.selection("SOLID", "Extrusion_5_1"), model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_3_1")], [])
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection("FACE", "Extrusion_5_1/To_Face_1"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")])
-Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face_1"))
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), model.selection("FACE", "Extrusion_5_1/To_Face"), 0, model.selection(), 0, [model.selection("SOLID", "Fuse_1_1")])
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/From_Face"))
SketchCircle_6 = Sketch_6.addCircle(0, 0, 4.2)
SketchConstraintRadius_6 = Sketch_6.setRadius(SketchCircle_6.results()[1], 4.2)
SketchPoint_2 = Sketch_6.addPoint(model.selection("VERTEX", "PartSet/Origin"))
SketchConstraintCoincidence_9 = Sketch_6.setCoincident(SketchPoint_2.coordinates(), SketchCircle_6.center())
SketchConstraintCoincidence_9.setName("SketchConstraintCoincidence_17")
ExtrusionCut_1.setNestedSketch(Sketch_6)
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_2"))
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/From_Face"))
SketchCircle_7 = Sketch_7.addCircle(0, -85, 66)
SketchLine_6 = Sketch_7.addLine(model.selection("EDGE", "PartSet/OY"))
SketchConstraintCoincidence_10 = Sketch_7.setCoincident(SketchCircle_7.center(), SketchLine_6.result())
SketchMultiRotation_1 = Sketch_7.addRotation([SketchCircle_7.results()[1]], SketchLine_6.startPoint(), 120, 3)
[SketchCircle_8, SketchCircle_9] = SketchMultiRotation_1.rotated()
model.do()
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_1"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modfied_1"))
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_5_1/To_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face"))
SketchLine_7 = Sketch_8.addLine(-2.320957096353877e-016, 11.00000001704673, -7, 11.00000001704673)
SketchConstraintHorizontal_1 = Sketch_8.setHorizontal(SketchLine_7.result())
SketchLine_8 = Sketch_8.addLine(-7, 11.00000001704673, -6.329882773485103e-016, 30.00000001704673)
SketchLine_13.setName("SketchLine_16")
SketchLine_13.result().setName("SketchLine_16")
model.do()
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_7r-SketchLine_8r-SketchLine_10f-SketchLine_11f"), model.selection("FACE", "Sketch_8/Face-SketchLine_16f-SketchLine_17f-SketchLine_18r-SketchLine_19r"), model.selection("FACE", "Sketch_8/Face-SketchLine_12f-SketchLine_13f-SketchLine_14r-SketchLine_15r")], model.selection(), model.selection("FACE", "ExtrusionCut_2_1/Modfied_3"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+ExtrusionCut_3_objects_1 = [model.selection("FACE", "Sketch_8/Face-SketchLine_10f-SketchLine_11f-SketchLine_8r-SketchLine_7r"), model.selection("FACE", "Sketch_8/Face-SketchLine_16f-SketchLine_18r-SketchLine_19r-SketchLine_17f"), model.selection("FACE", "Sketch_8/Face-SketchLine_12f-SketchLine_14r-SketchLine_15r-SketchLine_13f")]
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_3_objects_1, model.selection(), model.selection("FACE", "ExtrusionCut_2_1/Modified_Face&Extrusion_4_1/To_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
# Test reexecution after parameter change
Parameter_R.setValue(50)
SketchConstraintRadius_8.setName("SketchConstraintRadius_2")
SketchConstraintDistance_15 = Sketch_3.setDistance(SketchCircle_2.center(), SketchCircle_1.center(), 30)
SketchConstraintDistance_15.setName("SketchConstraintDistance_9")
-SketchLine_36 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchLine_36 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/SketchLine_1"))
SketchLine_36.setName("SketchLine_25")
SketchLine_36.result().setName("SketchLine_25")
SketchConstraintDistance_16 = Sketch_3.setDistance(SketchCircle_1.center(), SketchLine_36.result(), 85)
Sketch_4 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
SketchCircle_3 = Sketch_4.addCircle(0, 85, 7)
SketchCircle_4 = Sketch_4.addCircle(0, 55, 7)
-SketchPoint_1 = Sketch_4.addPoint(model.selection("VERTEX", "Sketch_3/Edge-SketchCircle_1_2__cc"))
+SketchPoint_1 = Sketch_4.addPoint(model.selection("VERTEX", "Sketch_3/SketchCircle_1_2__cc"))
SketchConstraintCoincidence_61 = Sketch_4.setCoincident(SketchPoint_1.coordinates(), SketchCircle_3.center())
SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_19")
-SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "Sketch_3/Edge-SketchCircle_2_2__cc"))
+SketchPoint_2 = Sketch_4.addPoint(model.selection("VERTEX", "Sketch_3/SketchCircle_2_2__cc"))
SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchPoint_2.coordinates(), SketchCircle_4.center())
SketchConstraintCoincidence_62.setName("SketchConstraintCoincidence_20")
SketchConstraintRadius_9 = Sketch_4.setRadius(SketchCircle_3.results()[1], "TDI/2")
model.do()
Sketch_6 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchCircle_9 = Sketch_6.addCircle(30, -41, 4)
-SketchPoint_3 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/Edge-SketchCircle_5_2__cc"))
+SketchPoint_3 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchCircle_5_2__cc"))
SketchConstraintCoincidence_63 = Sketch_6.setCoincident(SketchPoint_3.coordinates(), SketchCircle_9.center())
SketchConstraintCoincidence_63.setName("SketchConstraintCoincidence_21")
SketchConstraintRadius_12 = Sketch_6.setRadius(SketchCircle_9.results()[1], "BHD/2")
Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 30, False)
Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_41 = Sketch_7.addLine(-41, 0, -41, 8)
-SketchPoint_4 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_5/Edge-SketchCircle_5_2__cc"))
+SketchPoint_4 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_5/SketchCircle_5_2__cc"))
SketchConstraintCoincidence_64 = Sketch_7.setCoincident(SketchLine_41.startPoint(), SketchPoint_4.result())
SketchConstraintCoincidence_64.setName("SketchConstraintCoincidence_34")
SketchLine_42 = Sketch_7.addLine(-41, 8, -34, 8)
SketchConstraintRadius_13 = Sketch_7.setRadius(SketchArc_7.results()[1], "BHPFR")
SketchConstraintRadius_13.setName("SketchConstraintRadius_8")
model.do()
-RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection("EDGE", "Sketch_7/Edge-SketchLine_41"), 360, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection("EDGE", "Sketch_7/SketchLine_41"), 360, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_49 = Sketch_8.addLine(32, 6, 32.50001476412091, 6.000000000000001)
SketchLine_49.setName("SketchLine_55")
SketchLine_50 = Sketch_8.addLine(32, 0, 41, 0)
SketchLine_50.setName("SketchLine_49")
SketchLine_50.result().setName("SketchLine_49")
-SketchPoint_5 = Sketch_8.addPoint(model.selection("VERTEX", "Sketch_6/Edge-SketchCircle_10_2__cc"))
+SketchPoint_5 = Sketch_8.addPoint(model.selection("VERTEX", "Sketch_6/SketchCircle_10_2__cc"))
SketchConstraintCoincidence_78 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchPoint_5.result())
SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_50")
SketchLine_51 = Sketch_8.addLine(41, 0, 41, 8)
SketchConstraintRadius_14 = Sketch_8.setRadius(SketchArc_8.results()[1], 1.5)
SketchConstraintRadius_14.setName("SketchConstraintRadius_9")
model.do()
-RevolutionFuse_2 = model.addRevolutionFuse(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_55r-SketchLine_49f-SketchLine_50f-SketchLine_56r-SketchLine_52f-SketchLine_53f-SketchArc_7_2r")], model.selection("EDGE", "Sketch_8/Edge-SketchLine_50"), 360, 0, [model.selection("SOLID", "RevolutionFuse_1_1")])
+RevolutionFuse_2 = model.addRevolutionFuse(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_52f-SketchLine_49f-SketchLine_50f-SketchLine_53f-SketchLine_56r-SketchArc_7_2r-SketchLine_55r")], model.selection("EDGE", "Sketch_8/SketchLine_50"), 360, 0, [model.selection("SOLID", "RevolutionFuse_1_1")])
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 30, True)
Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2"))
SketchLine_57 = Sketch_9.addLine(-32.50001494742042, 5.999999999999998, -32, 6)
SketchLine_58 = Sketch_9.addLine(-32, 0, -41, 0)
SketchLine_58.setName("SketchLine_57")
SketchLine_58.result().setName("SketchLine_57")
-SketchPoint_8 = Sketch_9.addPoint(model.selection("VERTEX", "Sketch_6/Edge-SketchCircle_11_2__cc"))
+SketchPoint_8 = Sketch_9.addPoint(model.selection("VERTEX", "Sketch_6/SketchCircle_11_2__cc"))
SketchConstraintCoincidence_95 = Sketch_9.setCoincident(SketchLine_58.endPoint(), SketchPoint_8.result())
SketchConstraintCoincidence_95.setName("SketchConstraintCoincidence_67")
SketchLine_59 = Sketch_9.addLine(-41, 0, -41, 7.999999999999999)
SketchLine_66 = Sketch_10.addLine(32, 0, 41, 0)
SketchLine_66.setName("SketchLine_65")
SketchLine_66.result().setName("SketchLine_65")
-SketchPoint_11 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_6/Edge-SketchCircle_12_2__cc"))
+SketchPoint_11 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_6/SketchCircle_12_2__cc"))
SketchConstraintCoincidence_112 = Sketch_10.setCoincident(SketchLine_66.endPoint(), SketchPoint_11.result())
SketchConstraintCoincidence_112.setName("SketchConstraintCoincidence_84")
SketchLine_67 = Sketch_10.addLine(41, 0, 41, 7.999999999999999)
SketchConstraintRadius_16 = Sketch_10.setRadius(SketchArc_10.results()[1], 1.5)
SketchConstraintRadius_16.setName("SketchConstraintRadius_11")
model.do()
-RevolutionFuse_3 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection("EDGE", "Sketch_9/Edge-SketchLine_58"), 360, 0, [model.selection("SOLID", "RevolutionFuse_2_1")])
-RevolutionFuse_4 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_10")], model.selection("EDGE", "Sketch_10/Edge-SketchLine_66"), 360, 0, [model.selection("SOLID", "RevolutionFuse_3_1")])
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchCircle_11_2f"), model.selection("FACE", "Sketch_6/Face-SketchCircle_9_2f"), model.selection("WIRE", "Sketch_6/Wire-SketchCircle_10_2f"), model.selection("FACE", "Sketch_6/Face-SketchCircle_12_2f")], model.selection("EDGE", "PartSet/OZ"), "BPS+5", 5, [model.selection("SOLID", "RevolutionFuse_4_1")])
+RevolutionFuse_3 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection("EDGE", "Sketch_9/SketchLine_58"), 360, 0, [model.selection("SOLID", "RevolutionFuse_2_1")])
+RevolutionFuse_4 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_10")], model.selection("EDGE", "Sketch_10/SketchLine_66"), 360, 0, [model.selection("SOLID", "RevolutionFuse_3_1")])
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchCircle_11_2f"), model.selection("FACE", "Sketch_6/Face-SketchCircle_9_2r"), model.selection("WIRE", "Sketch_6/Face-SketchCircle_10_2f_wire"), model.selection("FACE", "Sketch_6/Face-SketchCircle_12_2f")], model.selection("EDGE", "PartSet/OZ"), "BPS+5", 5, [model.selection("SOLID", "RevolutionFuse_4_1")])
# Test reexecution after parameter change
Parameter_BPS.setValue(3)
SketchLine_379 = Sketch_3.addLine(model.selection("EDGE", "PartSet/OY"))
SketchConstraintDistance_13 = Sketch_3.setDistance(SketchCircle_4.center(), SketchLine_379.result(), 15)
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_8f-SketchLine_9f-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_14f")], model.selection("EDGE", "PartSet/OX"), 360, 0)
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_1_2r-SketchLine_382f-SketchLine_383f-SketchLine_20f-SketchLine_22f-SketchLine_23f-SketchLine_24f-SketchLine_25f-SketchLine_26f-SketchLine_27f-SketchLine_28f-SketchLine_29f-SketchLine_30f-SketchLine_31f-SketchLine_32f-SketchLine_33f-SketchLine_34f-SketchLine_35f-SketchLine_36f-SketchLine_37f-SketchLine_38f-SketchLine_39f-SketchLine_40f-SketchLine_41f-SketchLine_42f-SketchLine_43f-SketchLine_44f-SketchLine_45f-SketchLine_46f-SketchLine_47f-SketchLine_48f-SketchLine_49f-SketchLine_50f-SketchLine_51f-SketchLine_52f-SketchLine_53f-SketchLine_54f-SketchLine_55f-SketchLine_56f-SketchLine_57f-SketchLine_58f-SketchLine_59f-SketchLine_60f-SketchLine_61f-SketchLine_62f-SketchLine_63f-SketchLine_64f-SketchLine_65f-SketchLine_66f-SketchLine_67f-SketchLine_68f-SketchLine_69f-SketchLine_70f-SketchLine_71f-SketchLine_72f-SketchLine_73f-SketchLine_74f-SketchLine_75f-SketchLine_76f-SketchLine_77f-SketchLine_78f-SketchLine_79f-SketchLine_80f-SketchLine_81f-SketchLine_82f-SketchLine_83f-SketchLine_84f-SketchLine_85f-SketchLine_86f-SketchLine_87f-SketchLine_88f-SketchLine_89f-SketchLine_90f-SketchLine_91f-SketchLine_92f-SketchLine_93f-SketchLine_94f-SketchLine_95f-SketchLine_96f-SketchLine_97f-SketchLine_98f-SketchLine_99f-SketchLine_100f-SketchLine_101f-SketchLine_102f-SketchLine_103f-SketchLine_104f-SketchLine_105f-SketchLine_106f-SketchLine_107f-SketchLine_108f-SketchLine_109f-SketchLine_110f-SketchLine_111f-SketchLine_112f-SketchLine_113f-SketchLine_114f-SketchLine_115f-SketchLine_116f-SketchLine_117f-SketchLine_118f-SketchLine_119f-SketchLine_120f-SketchLine_121f-SketchLine_122f-SketchLine_123f-SketchLine_124f-SketchLine_125f-SketchLine_126f-SketchLine_127f-SketchLine_128f-SketchLine_129f-SketchLine_130f-SketchLine_131f-SketchLine_132f-SketchLine_133f-SketchLine_134f-SketchLine_135f-SketchLine_136f-SketchLine_137f-SketchLine_138f-SketchLine_139f-SketchLine_140f-SketchLine_141f-SketchLine_142f-SketchLine_143f-SketchLine_144f-SketchLine_145f-SketchLine_146f-SketchLine_147f-SketchLine_148f-SketchLine_149f-SketchLine_150f-SketchLine_151f-SketchLine_152f-SketchLine_153f-SketchLine_154f-SketchLine_155f-SketchLine_156f-SketchLine_157f-SketchLine_158f-SketchLine_159f-SketchLine_160f-SketchLine_161f-SketchLine_162f-SketchLine_163f-SketchLine_164f-SketchLine_165f-SketchLine_166f-SketchLine_167f-SketchLine_168f-SketchLine_169f-SketchLine_170f-SketchLine_171f-SketchLine_172f-SketchLine_173f-SketchLine_174f-SketchLine_175f-SketchLine_176f-SketchLine_177f-SketchLine_178f-SketchLine_179f-SketchLine_180f-SketchLine_181f-SketchLine_182f-SketchLine_183f-SketchLine_184f-SketchLine_185f-SketchLine_186f-SketchLine_187f-SketchLine_188f-SketchLine_189f-SketchLine_190f-SketchLine_191f-SketchLine_192f-SketchLine_193f-SketchLine_194f-SketchLine_195f-SketchLine_196f-SketchLine_197f-SketchLine_198f-SketchLine_199f-SketchArc_2_2r-SketchArc_3_2r-SketchArc_4_2r-SketchArc_5_2r-SketchArc_6_2r-SketchArc_7_2r-SketchArc_8_2r-SketchArc_9_2r-SketchArc_10_2r-SketchArc_11_2r-SketchArc_12_2r-SketchArc_13_2r-SketchArc_14_2r-SketchArc_15_2r-SketchArc_16_2r-SketchArc_17_2r-SketchArc_18_2r-SketchArc_19_2r-SketchArc_20_2r-SketchArc_21_2r-SketchArc_22_2r-SketchArc_23_2r-SketchArc_24_2r-SketchArc_25_2r-SketchArc_26_2r-SketchArc_27_2r-SketchArc_28_2r-SketchArc_29_2r-SketchArc_30_2r-SketchArc_31_2r-SketchArc_32_2r-SketchArc_33_2r-SketchArc_34_2r-SketchArc_35_2r-SketchArc_36_2r-SketchArc_37_2r-SketchArc_38_2r-SketchArc_39_2r-SketchArc_40_2r-SketchArc_41_2r-SketchArc_42_2r-SketchArc_43_2r-SketchArc_44_2r-SketchArc_45_2r-SketchArc_46_2r-SketchArc_47_2r-SketchArc_48_2r-SketchArc_49_2r-SketchArc_50_2r-SketchArc_51_2r-SketchArc_52_2r-SketchArc_53_2r-SketchArc_54_2r-SketchArc_55_2r-SketchArc_56_2r-SketchArc_57_2r-SketchArc_58_2r-SketchArc_59_2r-SketchArc_60_2r-SketchArc_61_2r-SketchArc_62_2r-SketchArc_63_2r-SketchArc_64_2r-SketchArc_65_2r-SketchArc_66_2r-SketchArc_67_2r-SketchArc_68_2r-SketchArc_69_2r-SketchArc_70_2r-SketchArc_71_2r-SketchArc_72_2r-SketchArc_73_2r-SketchArc_74_2r-SketchArc_75_2r-SketchArc_76_2r-SketchArc_77_2r-SketchArc_78_2r-SketchArc_79_2r-SketchArc_80_2r-SketchArc_81_2r-SketchArc_82_2r-SketchArc_83_2r-SketchArc_84_2r-SketchArc_85_2r-SketchArc_86_2r-SketchArc_87_2r-SketchArc_88_2r-SketchArc_89_2r-SketchArc_90_2r-SketchArc_91_2r-SketchArc_92_2r-SketchArc_93_2r-SketchArc_94_2r-SketchArc_95_2r-SketchArc_96_2r-SketchArc_97_2r-SketchArc_98_2r-SketchArc_99_2r-SketchArc_100_2r-SketchArc_101_2r-SketchArc_102_2r-SketchArc_103_2r-SketchArc_104_2r-SketchArc_105_2r-SketchArc_106_2r-SketchArc_107_2r-SketchArc_108_2r-SketchArc_109_2r-SketchArc_110_2r-SketchArc_111_2r-SketchArc_112_2r-SketchArc_113_2r-SketchArc_114_2r-SketchArc_115_2r-SketchArc_116_2r-SketchArc_117_2r-SketchArc_118_2r-SketchArc_119_2r-SketchArc_120_2r-SketchArc_121_2r-SketchArc_122_2r-SketchArc_123_2r-SketchArc_124_2r-SketchArc_125_2r-SketchArc_126_2r-SketchArc_127_2r-SketchArc_128_2r-SketchArc_129_2r-SketchArc_130_2r-SketchArc_131_2r-SketchArc_132_2r-SketchArc_133_2r-SketchArc_134_2r-SketchArc_135_2r-SketchArc_136_2r-SketchArc_137_2r-SketchArc_138_2r-SketchArc_139_2r-SketchArc_140_2r-SketchArc_141_2r-SketchArc_142_2r-SketchArc_143_2r-SketchArc_144_2r-SketchArc_145_2r-SketchArc_146_2r-SketchArc_147_2r-SketchArc_148_2r-SketchArc_149_2r-SketchArc_150_2r-SketchArc_151_2r-SketchArc_152_2r-SketchArc_153_2r-SketchArc_154_2r-SketchArc_155_2r-SketchArc_156_2r-SketchArc_157_2r-SketchArc_158_2r-SketchArc_159_2r-SketchArc_160_2r-SketchArc_161_2r-SketchArc_162_2r-SketchArc_163_2r-SketchArc_164_2r-SketchArc_165_2r-SketchArc_166_2r-SketchArc_167_2r-SketchArc_168_2r-SketchArc_169_2r-SketchArc_170_2r-SketchArc_171_2r-SketchArc_172_2r-SketchArc_173_2r-SketchArc_174_2r-SketchArc_175_2r-SketchArc_176_2r-SketchArc_177_2r-SketchArc_178_2r-SketchArc_179_2r-SketchArc_180_2r-SketchLine_21f-SketchLine_200f-SketchLine_201f-SketchLine_202f-SketchLine_203f-SketchLine_204f-SketchLine_205f-SketchLine_206f-SketchLine_207f-SketchLine_208f-SketchLine_209f-SketchLine_210f-SketchLine_211f-SketchLine_212f-SketchLine_213f-SketchLine_214f-SketchLine_215f-SketchLine_216f-SketchLine_217f-SketchLine_218f-SketchLine_219f-SketchLine_220f-SketchLine_221f-SketchLine_222f-SketchLine_223f-SketchLine_224f-SketchLine_225f-SketchLine_226f-SketchLine_227f-SketchLine_228f-SketchLine_229f-SketchLine_230f-SketchLine_231f-SketchLine_232f-SketchLine_233f-SketchLine_234f-SketchLine_235f-SketchLine_236f-SketchLine_237f-SketchLine_238f-SketchLine_239f-SketchLine_240f-SketchLine_241f-SketchLine_242f-SketchLine_243f-SketchLine_244f-SketchLine_245f-SketchLine_246f-SketchLine_247f-SketchLine_248f-SketchLine_249f-SketchLine_250f-SketchLine_251f-SketchLine_252f-SketchLine_253f-SketchLine_254f-SketchLine_255f-SketchLine_256f-SketchLine_257f-SketchLine_258f-SketchLine_259f-SketchLine_260f-SketchLine_261f-SketchLine_262f-SketchLine_263f-SketchLine_264f-SketchLine_265f-SketchLine_266f-SketchLine_267f-SketchLine_268f-SketchLine_269f-SketchLine_270f-SketchLine_271f-SketchLine_272f-SketchLine_273f-SketchLine_274f-SketchLine_275f-SketchLine_276f-SketchLine_277f-SketchLine_278f-SketchLine_279f-SketchLine_280f-SketchLine_281f-SketchLine_282f-SketchLine_283f-SketchLine_284f-SketchLine_285f-SketchLine_286f-SketchLine_287f-SketchLine_288f-SketchLine_289f-SketchLine_290f-SketchLine_291f-SketchLine_292f-SketchLine_293f-SketchLine_294f-SketchLine_295f-SketchLine_296f-SketchLine_297f-SketchLine_298f-SketchLine_299f-SketchLine_300f-SketchLine_301f-SketchLine_302f-SketchLine_303f-SketchLine_304f-SketchLine_305f-SketchLine_306f-SketchLine_307f-SketchLine_308f-SketchLine_309f-SketchLine_310f-SketchLine_311f-SketchLine_312f-SketchLine_313f-SketchLine_314f-SketchLine_315f-SketchLine_316f-SketchLine_317f-SketchLine_318f-SketchLine_319f-SketchLine_320f-SketchLine_321f-SketchLine_322f-SketchLine_323f-SketchLine_324f-SketchLine_325f-SketchLine_326f-SketchLine_327f-SketchLine_328f-SketchLine_329f-SketchLine_330f-SketchLine_331f-SketchLine_332f-SketchLine_333f-SketchLine_334f-SketchLine_335f-SketchLine_336f-SketchLine_337f-SketchLine_338f-SketchLine_339f-SketchLine_340f-SketchLine_341f-SketchLine_342f-SketchLine_343f-SketchLine_344f-SketchLine_345f-SketchLine_346f-SketchLine_347f-SketchLine_348f-SketchLine_349f-SketchLine_350f-SketchLine_351f-SketchLine_352f-SketchLine_353f-SketchLine_354f-SketchLine_355f-SketchLine_356f-SketchLine_357f-SketchLine_358f-SketchLine_359f-SketchLine_360f-SketchLine_361f-SketchLine_362f-SketchLine_363f-SketchLine_364f-SketchLine_365f-SketchLine_366f-SketchLine_367f-SketchLine_368f-SketchLine_369f-SketchLine_370f-SketchLine_371f-SketchLine_372f-SketchLine_373f-SketchLine_374f-SketchLine_375f-SketchLine_376f-SketchLine_377f-SketchCircle_3_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_4_2f")], model.selection(), 30, 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_6f-SketchLine_12f-SketchLine_13f-SketchLine_14f-SketchLine_8f-SketchLine_9f-SketchLine_11f")], model.selection("EDGE", "PartSet/OX"), 360, 0)
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f-SketchLine_383f-SketchLine_199f-SketchArc_180_2r-SketchLine_377f-SketchLine_198f-SketchArc_179_2r-SketchLine_376f-SketchLine_197f-SketchArc_178_2r-SketchLine_375f-SketchLine_196f-SketchArc_177_2r-SketchLine_374f-SketchLine_195f-SketchArc_176_2r-SketchLine_373f-SketchLine_194f-SketchArc_175_2r-SketchLine_372f-SketchLine_193f-SketchArc_174_2r-SketchLine_371f-SketchLine_192f-SketchArc_173_2r-SketchLine_370f-SketchLine_191f-SketchArc_172_2r-SketchLine_369f-SketchLine_190f-SketchArc_171_2r-SketchLine_368f-SketchLine_189f-SketchArc_170_2r-SketchLine_367f-SketchLine_188f-SketchArc_169_2r-SketchLine_366f-SketchLine_187f-SketchArc_168_2r-SketchLine_365f-SketchLine_186f-SketchArc_167_2r-SketchLine_364f-SketchLine_185f-SketchArc_166_2r-SketchLine_363f-SketchLine_184f-SketchArc_165_2r-SketchLine_362f-SketchLine_183f-SketchArc_164_2r-SketchLine_361f-SketchLine_182f-SketchArc_163_2r-SketchLine_360f-SketchLine_181f-SketchArc_162_2r-SketchLine_359f-SketchLine_180f-SketchArc_161_2r-SketchLine_358f-SketchLine_179f-SketchArc_160_2r-SketchLine_357f-SketchLine_178f-SketchArc_159_2r-SketchLine_356f-SketchLine_177f-SketchArc_158_2r-SketchLine_355f-SketchLine_176f-SketchArc_157_2r-SketchLine_354f-SketchLine_175f-SketchArc_156_2r-SketchLine_353f-SketchLine_174f-SketchArc_155_2r-SketchLine_352f-SketchLine_173f-SketchArc_154_2r-SketchLine_351f-SketchLine_172f-SketchArc_153_2r-SketchLine_350f-SketchLine_171f-SketchArc_152_2r-SketchLine_349f-SketchLine_170f-SketchArc_151_2r-SketchLine_348f-SketchLine_169f-SketchArc_150_2r-SketchLine_347f-SketchLine_168f-SketchArc_149_2r-SketchLine_346f-SketchLine_167f-SketchArc_148_2r-SketchLine_345f-SketchLine_166f-SketchArc_147_2r-SketchLine_344f-SketchLine_165f-SketchArc_146_2r-SketchLine_343f-SketchLine_164f-SketchArc_145_2r-SketchLine_342f-SketchLine_163f-SketchArc_144_2r-SketchLine_341f-SketchLine_162f-SketchArc_143_2r-SketchLine_340f-SketchLine_161f-SketchArc_142_2r-SketchLine_339f-SketchLine_160f-SketchArc_141_2r-SketchLine_338f-SketchLine_159f-SketchArc_140_2r-SketchLine_337f-SketchLine_158f-SketchArc_139_2r-SketchLine_336f-SketchLine_157f-SketchArc_138_2r-SketchLine_335f-SketchLine_156f-SketchArc_137_2r-SketchLine_334f-SketchLine_155f-SketchArc_136_2r-SketchLine_333f-SketchLine_154f-SketchArc_135_2r-SketchLine_332f-SketchLine_153f-SketchArc_134_2r-SketchLine_331f-SketchLine_152f-SketchArc_133_2r-SketchLine_330f-SketchLine_151f-SketchArc_132_2r-SketchLine_329f-SketchLine_150f-SketchArc_131_2r-SketchLine_328f-SketchLine_149f-SketchArc_130_2r-SketchLine_327f-SketchLine_148f-SketchArc_129_2r-SketchLine_326f-SketchLine_147f-SketchArc_128_2r-SketchLine_325f-SketchLine_146f-SketchArc_127_2r-SketchLine_324f-SketchLine_145f-SketchArc_126_2r-SketchLine_323f-SketchLine_144f-SketchArc_125_2r-SketchLine_322f-SketchLine_143f-SketchArc_124_2r-SketchLine_321f-SketchLine_142f-SketchArc_123_2r-SketchLine_320f-SketchLine_141f-SketchArc_122_2r-SketchLine_319f-SketchLine_140f-SketchArc_121_2r-SketchLine_318f-SketchLine_139f-SketchArc_120_2r-SketchLine_317f-SketchLine_138f-SketchArc_119_2r-SketchLine_316f-SketchLine_137f-SketchArc_118_2r-SketchLine_315f-SketchLine_136f-SketchArc_117_2r-SketchLine_314f-SketchLine_135f-SketchArc_116_2r-SketchLine_313f-SketchLine_134f-SketchArc_115_2r-SketchLine_312f-SketchLine_133f-SketchArc_114_2r-SketchLine_311f-SketchLine_132f-SketchArc_113_2r-SketchLine_310f-SketchLine_131f-SketchArc_112_2r-SketchLine_309f-SketchLine_130f-SketchArc_111_2r-SketchLine_308f-SketchLine_129f-SketchArc_110_2r-SketchLine_307f-SketchLine_128f-SketchArc_109_2r-SketchLine_306f-SketchLine_127f-SketchArc_108_2r-SketchLine_305f-SketchLine_126f-SketchArc_107_2r-SketchLine_304f-SketchLine_125f-SketchArc_106_2r-SketchLine_303f-SketchLine_124f-SketchArc_105_2r-SketchLine_302f-SketchLine_123f-SketchArc_104_2r-SketchLine_301f-SketchLine_122f-SketchArc_103_2r-SketchLine_300f-SketchLine_121f-SketchArc_102_2r-SketchLine_299f-SketchLine_120f-SketchArc_101_2r-SketchLine_298f-SketchLine_119f-SketchArc_100_2r-SketchLine_297f-SketchLine_118f-SketchArc_99_2r-SketchLine_296f-SketchLine_117f-SketchArc_98_2r-SketchLine_295f-SketchLine_116f-SketchArc_97_2r-SketchLine_294f-SketchLine_115f-SketchArc_96_2r-SketchLine_293f-SketchLine_114f-SketchArc_95_2r-SketchLine_292f-SketchLine_113f-SketchArc_94_2r-SketchLine_291f-SketchLine_112f-SketchArc_93_2r-SketchLine_290f-SketchLine_111f-SketchArc_92_2r-SketchLine_289f-SketchLine_110f-SketchArc_91_2r-SketchLine_288f-SketchLine_109f-SketchArc_90_2r-SketchLine_287f-SketchLine_108f-SketchArc_89_2r-SketchLine_286f-SketchLine_107f-SketchArc_88_2r-SketchLine_285f-SketchLine_106f-SketchArc_87_2r-SketchLine_284f-SketchLine_105f-SketchArc_86_2r-SketchLine_283f-SketchLine_104f-SketchArc_85_2r-SketchLine_282f-SketchLine_103f-SketchArc_84_2r-SketchLine_281f-SketchLine_102f-SketchArc_83_2r-SketchLine_280f-SketchLine_101f-SketchArc_82_2r-SketchLine_279f-SketchLine_100f-SketchArc_81_2r-SketchLine_278f-SketchLine_99f-SketchArc_80_2r-SketchLine_277f-SketchLine_98f-SketchArc_79_2r-SketchLine_276f-SketchLine_97f-SketchArc_78_2r-SketchLine_275f-SketchLine_96f-SketchArc_77_2r-SketchLine_274f-SketchLine_95f-SketchArc_76_2r-SketchLine_273f-SketchLine_94f-SketchArc_75_2r-SketchLine_272f-SketchLine_93f-SketchArc_74_2r-SketchLine_271f-SketchLine_92f-SketchArc_73_2r-SketchLine_270f-SketchLine_91f-SketchArc_72_2r-SketchLine_269f-SketchLine_90f-SketchArc_71_2r-SketchLine_268f-SketchLine_89f-SketchArc_70_2r-SketchLine_267f-SketchLine_88f-SketchArc_69_2r-SketchLine_266f-SketchLine_87f-SketchArc_68_2r-SketchLine_265f-SketchLine_86f-SketchArc_67_2r-SketchLine_264f-SketchLine_85f-SketchArc_66_2r-SketchLine_263f-SketchLine_84f-SketchArc_65_2r-SketchLine_262f-SketchLine_83f-SketchArc_64_2r-SketchLine_261f-SketchLine_82f-SketchArc_63_2r-SketchLine_260f-SketchLine_81f-SketchArc_62_2r-SketchLine_259f-SketchLine_80f-SketchArc_61_2r-SketchLine_258f-SketchLine_79f-SketchArc_60_2r-SketchLine_257f-SketchLine_78f-SketchArc_59_2r-SketchLine_256f-SketchLine_77f-SketchArc_58_2r-SketchLine_255f-SketchLine_76f-SketchArc_57_2r-SketchLine_254f-SketchLine_75f-SketchArc_56_2r-SketchLine_253f-SketchLine_74f-SketchArc_55_2r-SketchLine_252f-SketchLine_73f-SketchArc_54_2r-SketchLine_251f-SketchLine_72f-SketchArc_53_2r-SketchLine_250f-SketchLine_71f-SketchArc_52_2r-SketchLine_249f-SketchLine_70f-SketchArc_51_2r-SketchLine_248f-SketchLine_69f-SketchArc_50_2r-SketchLine_247f-SketchLine_68f-SketchArc_49_2r-SketchLine_246f-SketchLine_67f-SketchArc_48_2r-SketchLine_245f-SketchLine_66f-SketchArc_47_2r-SketchLine_244f-SketchLine_65f-SketchArc_46_2r-SketchLine_243f-SketchLine_64f-SketchArc_45_2r-SketchLine_242f-SketchLine_63f-SketchArc_44_2r-SketchLine_241f-SketchLine_62f-SketchArc_43_2r-SketchLine_240f-SketchLine_61f-SketchArc_42_2r-SketchLine_239f-SketchLine_60f-SketchArc_41_2r-SketchLine_238f-SketchLine_59f-SketchArc_40_2r-SketchLine_237f-SketchLine_58f-SketchArc_39_2r-SketchLine_236f-SketchLine_57f-SketchArc_38_2r-SketchLine_235f-SketchLine_56f-SketchArc_37_2r-SketchLine_234f-SketchLine_55f-SketchArc_36_2r-SketchLine_233f-SketchLine_54f-SketchArc_35_2r-SketchLine_232f-SketchLine_53f-SketchArc_34_2r-SketchLine_231f-SketchLine_52f-SketchArc_33_2r-SketchLine_230f-SketchLine_51f-SketchArc_32_2r-SketchLine_229f-SketchLine_50f-SketchArc_31_2r-SketchLine_228f-SketchLine_49f-SketchArc_30_2r-SketchLine_227f-SketchLine_48f-SketchArc_29_2r-SketchLine_226f-SketchLine_47f-SketchArc_28_2r-SketchLine_225f-SketchLine_46f-SketchArc_27_2r-SketchLine_224f-SketchLine_45f-SketchArc_26_2r-SketchLine_223f-SketchLine_44f-SketchArc_25_2r-SketchLine_222f-SketchLine_43f-SketchArc_24_2r-SketchLine_221f-SketchLine_42f-SketchArc_23_2r-SketchLine_220f-SketchLine_41f-SketchArc_22_2r-SketchLine_219f-SketchLine_40f-SketchArc_21_2r-SketchLine_218f-SketchLine_39f-SketchArc_20_2r-SketchLine_217f-SketchLine_38f-SketchArc_19_2r-SketchLine_216f-SketchLine_37f-SketchArc_18_2r-SketchLine_215f-SketchLine_36f-SketchArc_17_2r-SketchLine_214f-SketchLine_35f-SketchArc_16_2r-SketchLine_213f-SketchLine_34f-SketchArc_15_2r-SketchLine_212f-SketchLine_33f-SketchArc_14_2r-SketchLine_211f-SketchLine_32f-SketchArc_13_2r-SketchLine_210f-SketchLine_31f-SketchArc_12_2r-SketchLine_209f-SketchLine_30f-SketchArc_11_2r-SketchLine_208f-SketchLine_29f-SketchArc_10_2r-SketchLine_207f-SketchLine_28f-SketchArc_9_2r-SketchLine_206f-SketchLine_27f-SketchArc_8_2r-SketchLine_205f-SketchLine_26f-SketchArc_7_2r-SketchLine_204f-SketchLine_25f-SketchArc_6_2r-SketchLine_203f-SketchLine_24f-SketchArc_5_2r-SketchLine_202f-SketchLine_23f-SketchArc_4_2r-SketchLine_201f-SketchLine_22f-SketchArc_3_2r-SketchLine_200f-SketchLine_20f-SketchArc_2_2r-SketchLine_21f-SketchLine_382f-SketchArc_1_2r")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_13"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_4_2r")], model.selection(), 30, 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
# Test reexecution after parameter change
Parameter_H.setValue(14)
model.addParameter(Part_1_doc, "DBody", "65")
Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/YOZ"), 89, False)
Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchLine_1 = Sketch_1.addLine(0, 20, 16.99998550401508, 20)
+SketchLine_1 = Sketch_1.addLine(0, 20, 17, 20)
SketchLine_1.setName("SketchLine_7")
SketchLine_1.result().setName("SketchLine_7")
SketchLine_2 = Sketch_1.addLine(20, 0, 0, 0)
SketchLine_3 = Sketch_1.addLine(0, 0, 0, 20)
SketchLine_3.setName("SketchLine_2")
SketchLine_3.result().setName("SketchLine_2")
-SketchLine_4 = Sketch_1.addLine(20, 16.99999846116062, 20, 0)
+SketchLine_4 = Sketch_1.addLine(20, 17, 20, 0)
SketchLine_4.setName("SketchLine_8")
SketchLine_4.result().setName("SketchLine_8")
SketchLine_5 = Sketch_1.addLine(20, 20, 20, 0)
SketchLine_8 = SketchProjection_2.createdFeature()
SketchLine_8.setName("SketchLine_6")
SketchLine_8.result().setName("SketchLine_6")
-SketchArc_1 = Sketch_1.addArc(17, 17, 20, 16.99999846116062, 16.99998550401508, 20, False)
+SketchArc_1 = Sketch_1.addArc(17, 17, 20, 17, 17, 20, False)
SketchConstraintCoincidence_5 = Sketch_1.setCoincident(SketchArc_1.startPoint(), SketchLine_4.startPoint())
SketchConstraintCoincidence_6 = Sketch_1.setCoincident(SketchArc_1.endPoint(), SketchLine_1.endPoint())
SketchConstraintTangent_1 = Sketch_1.setTangent(SketchArc_1.results()[1], SketchLine_1.result())
SketchConstraintDistance_1 = Sketch_1.setDistance(SketchLine_2.startPoint(), SketchLine_3.result(), 20)
SketchConstraintDistance_2 = Sketch_1.setDistance(SketchLine_3.endPoint(), SketchLine_2.result(), 20)
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_1r-SketchLine_2r-SketchLine_8r-SketchArc_1_2f")], model.selection("EDGE", "Sketch_1/Edge-SketchLine_2"), 0, 180)
-ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_7r-SketchLine_1r-SketchLine_2r-SketchLine_8r-SketchArc_1_2f")], model.selection(), 0, 25, [model.selection("SOLID", "Revolution_1_1")])
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_1r-SketchLine_8r-SketchArc_1_2f-SketchLine_7r")], model.selection("EDGE", "Sketch_1/SketchLine_2"), 0, 180)
+ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchLine_1r-SketchLine_8r-SketchArc_1_2f-SketchLine_7r")], model.selection(), 0, 25, [model.selection("SOLID", "Revolution_1_1")])
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchLine_9 = Sketch_2.addLine(0, 20, -17.00000285538278, 20)
+SketchLine_9 = Sketch_2.addLine(0, 20, -17, 20)
SketchLine_9.setName("SketchLine_13")
SketchLine_9.result().setName("SketchLine_13")
SketchLine_10 = Sketch_2.addLine(-20, 0, 0, 0)
SketchLine_10.setName("SketchLine_9")
SketchLine_10.result().setName("SketchLine_9")
-SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_2s-SketchProjection_1s-SketchLine_5s-SketchProjection_2s-SketchLine_6s-SketchLine_1e"))
+SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchLine_1_EndVertex"))
SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_10.endPoint(), SketchPoint_1.result())
SketchLine_11 = Sketch_2.addLine(0, 0, 0, 20)
SketchLine_11.setName("SketchLine_10")
SketchLine_11.result().setName("SketchLine_10")
-SketchLine_12 = Sketch_2.addLine(-20, 17.00000633266883, -20, 0)
+SketchLine_12 = Sketch_2.addLine(-20, 17, -20, 0)
SketchLine_12.setName("SketchLine_14")
SketchLine_12.result().setName("SketchLine_14")
SketchLine_13 = Sketch_2.addLine(-20, 20, -20, 0)
SketchConstraintVertical_3 = Sketch_2.setVertical(SketchLine_11.result())
SketchConstraintHorizontal_4 = Sketch_2.setHorizontal(SketchLine_14.result())
SketchConstraintVertical_4 = Sketch_2.setVertical(SketchLine_13.result())
-SketchArc_2 = Sketch_2.addArc(-17, 17, -17.00000285538278, 20, -20, 17.00000633266883, False)
+SketchArc_2 = Sketch_2.addArc(-17, 17, -17, 20, -20, 17, False)
SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchArc_2.startPoint(), SketchLine_9.endPoint())
SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchArc_2.endPoint(), SketchLine_12.startPoint())
SketchConstraintTangent_3 = Sketch_2.setTangent(SketchArc_2.results()[1], SketchLine_9.result())
SketchConstraintDistance_3 = Sketch_2.setDistance(SketchLine_10.startPoint(), SketchLine_11.result(), 20)
SketchConstraintDistance_4 = Sketch_2.setDistance(SketchLine_11.endPoint(), SketchLine_10.result(), 20)
model.do()
-ExtrusionFuse_2 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13f-SketchLine_9f-SketchLine_10f-SketchLine_14f-SketchArc_2_2f")], model.selection(), 0, 25, [model.selection("SOLID", "ExtrusionFuse_1_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_2_1/Modfied_8"))
+ExtrusionFuse_2 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_13r-SketchArc_2_2f-SketchLine_14f-SketchLine_9f-SketchLine_10f")], model.selection(), 0, 25, [model.selection("SOLID", "ExtrusionFuse_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionFuse_2_1/Modified_Face&ExtrusionFuse_2_1/From_Face"))
SketchLine_15 = Sketch_3.addLine(0, -20, -17.00000002635728, -20)
SketchLine_15.setName("SketchLine_19")
SketchLine_15.result().setName("SketchLine_19")
SketchLine_16 = Sketch_3.addLine(-20, 0, 0, 0)
SketchLine_16.setName("SketchLine_15")
SketchLine_16.result().setName("SketchLine_15")
-SketchPoint_2 = Sketch_3.addPoint(model.selection("VERTEX", "ExtrusionFuse_2_1/Modfied_9&ExtrusionFuse_2_1/Modfied_5&ExtrusionFuse_2_1/Modfied_8&ExtrusionFuse_2_1/Modfied_2"))
+SketchPoint_2 = Sketch_3.addPoint(model.selection("VERTEX", "[ExtrusionFuse_2_1/Generated_Face&Sketch_2/SketchLine_9][(ExtrusionFuse_2_1/Generated_Face&Sketch_2/SketchLine_9)(ExtrusionFuse_1_1/Generated_Face&Sketch_1/SketchLine_8)(ExtrusionFuse_2_1/Modified_Face&ExtrusionFuse_1_1/From_Face)][ExtrusionFuse_2_1/Modified_Face&ExtrusionFuse_2_1/From_Face][ExtrusionFuse_2_1/Modified_Face&ExtrusionFuse_1_1/From_Face]"))
SketchConstraintCoincidence_23 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchPoint_2.result())
SketchLine_17 = Sketch_3.addLine(0, 0, 0, -20)
SketchLine_17.setName("SketchLine_16")
SketchLine_17.result().setName("SketchLine_16")
-SketchLine_18 = Sketch_3.addLine(-20, -16.99998301947517, -20, 0)
+SketchLine_18 = Sketch_3.addLine(-20, -17, -20, 0)
SketchLine_18.setName("SketchLine_20")
SketchLine_18.result().setName("SketchLine_20")
SketchLine_19 = Sketch_3.addLine(-20, -20, -20, 0)
SketchConstraintVertical_5 = Sketch_3.setVertical(SketchLine_17.result())
SketchConstraintHorizontal_6 = Sketch_3.setHorizontal(SketchLine_20.result())
SketchConstraintVertical_6 = Sketch_3.setVertical(SketchLine_19.result())
-SketchArc_3 = Sketch_3.addArc(-17, -17, -20, -16.99998301947517, -17.00000002635728, -20, False)
+SketchArc_3 = Sketch_3.addArc(-17, -17, -20, -17, -17.00000002635728, -20, False)
SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchArc_3.startPoint(), SketchLine_18.startPoint())
SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchArc_3.endPoint(), SketchLine_15.endPoint())
SketchConstraintTangent_5 = Sketch_3.setTangent(SketchArc_3.results()[1], SketchLine_15.result())
SketchConstraintParallel_1 = Sketch_3.setParallel(SketchLine_17.result(), SketchLine_21.result())
SketchConstraintDistance_7 = Sketch_3.setDistance(SketchLine_21.startPoint(), SketchLine_18.result(), 3)
model.do()
-RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "Sketch_3/Edge-SketchLine_21"), 71, 0, [model.selection("SOLID", "ExtrusionFuse_2_1")])
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "RevolutionFuse_1_1/Modfied_4"))
-SketchLine_22 = Sketch_4.addLine(-3, -20, 17.00000452949485, -20)
+RevolutionFuse_1 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "Sketch_3/SketchLine_21"), 71, 0, [model.selection("SOLID", "ExtrusionFuse_2_1")])
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "RevolutionFuse_1_1/Modified_Face&ExtrusionFuse_1_1/From_Face"))
+SketchLine_22 = Sketch_4.addLine(-3, -20, 17, -20)
SketchLine_22.setName("SketchLine_26")
SketchLine_22.result().setName("SketchLine_26")
SketchLine_23 = Sketch_4.addLine(20, 0, -3, 0)
SketchLine_24 = Sketch_4.addLine(-3, 0, -3, -20)
SketchLine_24.setName("SketchLine_23")
SketchLine_24.result().setName("SketchLine_23")
-SketchLine_25 = Sketch_4.addLine(20, -17.00001580618423, 20, 0)
+SketchLine_25 = Sketch_4.addLine(20, -17, 20, 0)
SketchLine_25.setName("SketchLine_27")
SketchLine_25.result().setName("SketchLine_27")
SketchLine_26 = Sketch_4.addLine(20, -20, 20, 0)
SketchConstraintVertical_7 = Sketch_4.setVertical(SketchLine_24.result())
SketchConstraintHorizontal_8 = Sketch_4.setHorizontal(SketchLine_27.result())
SketchConstraintVertical_8 = Sketch_4.setVertical(SketchLine_26.result())
-SketchArc_4 = Sketch_4.addArc(17, -17, 17.00000452949485, -20, 20, -17.00001580618423, False)
+SketchArc_4 = Sketch_4.addArc(17, -17, 17, -20, 20, -17, False)
SketchConstraintCoincidence_38 = Sketch_4.setCoincident(SketchArc_4.startPoint(), SketchLine_22.endPoint())
SketchConstraintCoincidence_39 = Sketch_4.setCoincident(SketchArc_4.endPoint(), SketchLine_25.startPoint())
SketchConstraintTangent_7 = Sketch_4.setTangent(SketchArc_4.results()[1], SketchLine_22.result())
SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchLine_22.endPoint(), SketchLine_27.result())
SketchConstraintCoincidence_43 = Sketch_4.setCoincident(SketchLine_25.startPoint(), SketchLine_26.result())
SketchConstraintRadius_4 = Sketch_4.setRadius(SketchArc_4.results()[1], 3)
-SketchLine_28 = Sketch_4.addLine(model.selection("EDGE", "Sketch_3/Edge-SketchLine_15"))
+SketchLine_28 = Sketch_4.addLine(model.selection("EDGE", "Sketch_3/SketchLine_15"))
SketchConstraintCoincidence_44 = Sketch_4.setCoincident(SketchLine_24.startPoint(), SketchLine_28.result())
SketchConstraintDistance_8 = Sketch_4.setDistance(SketchLine_22.endPoint(), SketchLine_23.result(), 20)
SketchConstraintDistance_9 = Sketch_4.setDistance(SketchLine_28.endPoint(), SketchLine_25.result(), 20)
SketchConstraintParallel_2 = Sketch_4.setParallel(SketchLine_25.result(), SketchLine_29.result())
SketchConstraintDistance_11 = Sketch_4.setDistance(SketchLine_23.startPoint(), SketchLine_29.result(), 3)
model.do()
-RevolutionFuse_2 = model.addRevolutionFuse(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_26f-SketchLine_22f-SketchLine_23f-SketchLine_27f-SketchArc_4_2f")], model.selection("EDGE", "Sketch_4/Edge-SketchLine_29"), 0, 71, [model.selection("SOLID", "RevolutionFuse_1_1")])
+RevolutionFuse_2 = model.addRevolutionFuse(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_26r-SketchArc_4_2f-SketchLine_27f-SketchLine_22f-SketchLine_23f")], model.selection("EDGE", "Sketch_4/SketchLine_29"), 0, 71, [model.selection("SOLID", "RevolutionFuse_1_1")])
Sketch_5 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
SketchLine_30 = Sketch_5.addLine(0, 0, 0, 82)
SketchLine_31 = Sketch_5.addLine(model.selection("EDGE", "PartSet/OZ"))
SketchConstraintCoincidence_45 = Sketch_5.setCoincident(SketchLine_30.endPoint(), SketchLine_31.result())
-SketchLine_32 = Sketch_5.addLine(27.41618692363446, 77.00000000000001, 58.99998109391454, 77.00000000000001)
+SketchLine_32 = Sketch_5.addLine(27.41618692363446, 77, 58.99998109391454, 77)
SketchLine_32.setName("SketchLine_39")
SketchLine_32.result().setName("SketchLine_39")
SketchLine_33 = Sketch_5.addLine(0, 82, 20, 82)
SketchLine_34 = Sketch_5.addLine(65, 70.99999917134223, 65, 0)
SketchLine_34.setName("SketchLine_40")
SketchLine_34.result().setName("SketchLine_40")
-SketchLine_35 = Sketch_5.addLine(27.41618692363446, 77.00000000000001, 65, 77.00000000000001)
+SketchLine_35 = Sketch_5.addLine(27.41618692363446, 77, 65, 77)
SketchLine_35.setName("SketchLine_34")
SketchLine_35.result().setName("SketchLine_34")
SketchLine_35.setAuxiliary(True)
SketchConstraintDistance_12.setName("SketchConstraintDistance_14")
SketchConstraintDistance_13 = Sketch_5.setDistance(SketchLine_30.endPoint(), SketchLine_37.result(), 82)
SketchConstraintDistance_13.setName("SketchConstraintDistance_15")
-SketchArc_5 = Sketch_5.addArc(59, 70.99999999999999, 65, 70.99999917134223, 58.99998109391454, 77.00000000000001, False)
+SketchArc_5 = Sketch_5.addArc(59, 70.99999999999999, 65, 70.99999917134223, 58.99998109391454, 77, False)
SketchArc_5.setName("SketchArc_6")
SketchArc_5.result().setName("SketchArc_6")
SketchArc_5.results()[1].setName("SketchArc_6_2")
SketchConstraintCoincidence_55.setName("SketchConstraintCoincidence_62")
SketchConstraintRadius_5 = Sketch_5.setRadius(SketchArc_5.results()[1], 6)
SketchConstraintRadius_5.setName("SketchConstraintRadius_6")
-SketchArc_6 = Sketch_5.addArc(27.41619848709567, 84.99999999999999, 27.41618692363446, 77.00000000000001, 20, 82, True)
+SketchArc_6 = Sketch_5.addArc(27.41619848709567, 84.99999999999999, 27.41618692363446, 77, 20, 82, True)
SketchArc_6.setName("SketchArc_7")
SketchArc_6.result().setName("SketchArc_7")
SketchArc_6.results()[1].setName("SketchArc_7_2")
SketchConstraintDistance_15 = Sketch_5.setDistance(SketchLine_37.startPoint(), SketchLine_30.result(), "DBody")
SketchConstraintDistance_15.setName("SketchConstraintDistance_16")
model.do()
-RevolutionFuse_3 = model.addRevolutionFuse(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_30r-SketchLine_39r-SketchLine_32r-SketchLine_40r-SketchLine_38r-SketchArc_6_2f-SketchArc_7_2r")], model.selection("EDGE", "PartSet/OZ"), 45, 315, [model.selection("SOLID", "RevolutionFuse_2_1")])
+RevolutionFuse_3 = model.addRevolutionFuse(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_38r-SketchLine_40r-SketchArc_6_2f-SketchLine_39r-SketchArc_7_2r-SketchLine_32r-SketchLine_30r_wire")], model.selection("EDGE", "PartSet/OZ"), 45, 315, [model.selection("SOLID", "RevolutionFuse_2_1")])
Sketch_6 = model.addSketch(Part_1_doc, model.standardPlane("YOZ"))
SketchLine_38 = Sketch_6.addLine(19.99999999999999, 60, -20, 60)
SketchLine_38.setName("SketchLine_48")
SketchLine_41 = Sketch_6.addLine(20, 30, 19.99999999999999, 60)
SketchLine_41.setName("SketchLine_50")
SketchLine_41.result().setName("SketchLine_50")
-SketchLine_43 = Sketch_6.addLine(-19.99999999999998, 30.00000000000001, 20, 30.00000000000001)
+SketchLine_43 = Sketch_6.addLine(-20, 30, 20, 30)
SketchLine_43.setName("SketchLine_41")
SketchLine_43.result().setName("SketchLine_41")
SketchLine_43.setAuxiliary(True)
-SketchLine_42 = Sketch_6.addLine(-19.99999999999999, 60, -19.99999999999998, 30.00000000000001)
+SketchLine_42 = Sketch_6.addLine(-20, 60, -20, 30)
SketchLine_42.setName("SketchLine_44")
SketchLine_42.result().setName("SketchLine_44")
SketchLine_42.setAuxiliary(True)
SketchConstraintCoincidence_78.setName("SketchConstraintCoincidence_93")
SketchConstraintCoincidence_79 = Sketch_6.setCoincident(SketchLine_39.startPoint(), SketchLine_49.result())
SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_94")
-SketchPoint_3 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/Vertex-SketchLine_30s-SketchLine_31s-SketchLine_38e"))
+SketchPoint_3 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchLine_30_StartVertex"))
SketchConstraintDistance_16 = Sketch_6.setDistance(SketchLine_40.result(), SketchPoint_3.coordinates(), 20)
SketchConstraintDistance_16.setName("SketchConstraintDistance_18")
SketchConstraintDistance_17 = Sketch_6.setDistance(SketchPoint_3.coordinates(), SketchLine_41.result(), 20)
SketchLine_50 = Sketch_7.addLine(65, 23.09999999999939, 65, 23.00000523211526)
SketchLine_50.setName("SketchLine_61")
SketchLine_50.result().setName("SketchLine_61")
-SketchLine_51 = Sketch_7.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_35"))
+SketchLine_51 = Sketch_7.addLine(model.selection("EDGE", "Sketch_5/SketchLine_35"))
SketchLine_51.setName("SketchLine_54")
SketchLine_51.result().setName("SketchLine_54")
SketchLine_52 = Sketch_7.addLine(65, 23.09999999999939, 65, 20)
SketchLine_54.setAuxiliary(True)
SketchConstraintCoincidence_86 = Sketch_7.setCoincident(SketchLine_52.endPoint(), SketchLine_54.startPoint())
SketchConstraintCoincidence_86.setName("SketchConstraintCoincidence_96")
-SketchLine_55 = Sketch_7.addLine(model.selection("EDGE", "RevolutionFuse_3_1/Modfied_6&RevolutionFuse_3_1/Modfied_5"))
+SketchLine_55 = Sketch_7.addLine(model.selection("EDGE", "[RevolutionFuse_3_1/Modified_Face&Sketch_2/SketchLine_13][RevolutionFuse_3_1/Modified_Face&Sketch_1/SketchLine_7]"))
SketchLine_55.setName("SketchLine_56")
SketchLine_55.result().setName("SketchLine_56")
SketchConstraintCoincidence_87 = Sketch_7.setCoincident(SketchLine_54.endPoint(), SketchLine_55.result())
RevolutionFuse_4 = model.addRevolutionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection("EDGE", "PartSet/OZ"), 14.4, 14.4, [model.selection("SOLID", "ExtrusionCut_1_1")])
Sketch_8 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
SketchCircle_1 = Sketch_8.addCircle(0, 45, 12.5)
-SketchLine_60 = Sketch_8.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_30"))
+SketchLine_60 = Sketch_8.addLine(model.selection("EDGE", "Sketch_5/SketchLine_30"))
SketchLine_60.setName("SketchLine_63")
SketchLine_60.result().setName("SketchLine_63")
SketchConstraintCoincidence_99 = Sketch_8.setCoincident(SketchCircle_1.center(), SketchLine_60.result())
SketchConstraintCoincidence_99.setName("SketchConstraintCoincidence_109")
-SketchLine_61 = Sketch_8.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_38"))
+SketchLine_61 = Sketch_8.addLine(model.selection("EDGE", "Sketch_5/SketchLine_38"))
SketchLine_61.setName("SketchLine_64")
SketchLine_61.result().setName("SketchLine_64")
SketchConstraintDistance_22 = Sketch_8.setDistance(SketchCircle_1.center(), SketchLine_61.result(), 45)
SketchConstraintRadius_8 = Sketch_8.setRadius(SketchCircle_1.results()[1], 12.5)
SketchConstraintRadius_8.setName("SketchConstraintRadius_13")
model.do()
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchCircle_1_2f")], model.selection(), 100, 100, [model.selection("SOLID", "RevolutionFuse_4_1")])
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchCircle_1_2r")], model.selection(), 100, 100, [model.selection("SOLID", "RevolutionFuse_4_1")])
Sketch_9 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
SketchLine_62 = Sketch_9.addLine(0, 84, 0, -2)
SketchLine_62.setName("SketchLine_65")
SketchConstraintDistance_26.setName("SketchConstraintDistance_28")
SketchConstraintDistance_27 = Sketch_9.setDistance(SketchLine_72.endPoint(), SketchLine_63.result(), 15)
SketchConstraintDistance_27.setName("SketchConstraintDistance_29")
-SketchLine_76 = Sketch_9.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_32"))
+SketchLine_76 = Sketch_9.addLine(model.selection("EDGE", "Sketch_5/SketchLine_32"))
SketchLine_76.setName("SketchLine_75")
SketchLine_76.result().setName("SketchLine_75")
SketchConstraintDistance_28 = Sketch_9.setDistance(SketchLine_62.startPoint(), SketchLine_76.result(), 2)
SketchLine_77 = Sketch_10.addLine(64, 20, 89, 20)
SketchLine_77.setName("SketchLine_76")
SketchLine_77.result().setName("SketchLine_76")
-SketchPoint_4 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_3_1/Modfied_9&RevolutionFuse_2_1/Modfied_6&RevolutionFuse_3_1/Modfied_divided_22_1&RevolutionFuse_2_1/Modfied_11"))
+SketchPoint_4 = Sketch_10.addPoint(model.selection("VERTEX", "[RevolutionFuse_3_1/Modified_Face&Sketch_1/SketchLine_1&weak_name_2][RevolutionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8][RevolutionFuse_3_1/Modified_Face&Sketch_4/SketchLine_22&weak_name_2][RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27]"))
SketchConstraintCoincidence_122 = Sketch_10.setCoincident(SketchLine_77.startPoint(), SketchPoint_4.result())
SketchConstraintCoincidence_122.setName("SketchConstraintCoincidence_120")
-SketchPoint_5 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s-SketchLine_8e-SketchLine_4e"))
+SketchPoint_5 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"))
SketchConstraintCoincidence_123 = Sketch_10.setCoincident(SketchLine_77.endPoint(), SketchPoint_5.result())
SketchConstraintCoincidence_123.setName("SketchConstraintCoincidence_121")
SketchLine_78 = Sketch_10.addLine(64, -20, 89, -20)
SketchLine_78.setName("SketchLine_77")
SketchLine_78.result().setName("SketchLine_77")
-SketchPoint_6 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_3_1/Modfied_10&RevolutionFuse_1_1/Modfied_5&RevolutionFuse_3_1/Modfied_divided_21_1&RevolutionFuse_1_1/Modfied_10"))
+SketchPoint_6 = Sketch_10.addPoint(model.selection("VERTEX", "[RevolutionFuse_3_1/Modified_Face&Sketch_2/SketchLine_9&weak_name_2][RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14][RevolutionFuse_3_1/Modified_Face&Sketch_3/SketchLine_15&weak_name_2][RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20]"))
SketchConstraintCoincidence_124 = Sketch_10.setCoincident(SketchLine_78.startPoint(), SketchPoint_6.result())
SketchConstraintCoincidence_124.setName("SketchConstraintCoincidence_122")
-SketchPoint_7 = Sketch_10.addPoint(model.selection("VERTEX", "ExtrusionFuse_2_1/Modfied_7&ExtrusionFuse_2_1/Modfied_6&RevolutionFuse_3_1/Modfied_10&RevolutionFuse_1_1/Modfied_5"))
+SketchPoint_7 = Sketch_10.addPoint(model.selection("VERTEX", "[ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_1&weak_name_2][ExtrusionFuse_2_1/Modified_Face&Sketch_1/SketchLine_8][RevolutionFuse_3_1/Modified_Face&Sketch_2/SketchLine_9&weak_name_2][RevolutionFuse_1_1/Modified_Face&Sketch_2/SketchLine_14]"))
SketchConstraintCoincidence_125 = Sketch_10.setCoincident(SketchLine_78.endPoint(), SketchPoint_7.result())
SketchConstraintCoincidence_125.setName("SketchConstraintCoincidence_123")
-SketchArc_10 = Sketch_10.addArc(89.00000104846708, 1.669244441022778e-015, 89, -20, 89, 20, False)
+SketchArc_10 = Sketch_10.addArc(89, 0, 89, -20, 89, 20, False)
SketchArc_10.setName("SketchArc_13")
SketchArc_10.result().setName("SketchArc_13")
SketchArc_10.results()[1].setName("SketchArc_13_2")
SketchConstraintCoincidence_129.setName("SketchConstraintCoincidence_127")
SketchConstraintTangent_19 = Sketch_10.setTangent(SketchArc_11.results()[1], SketchLine_78.result())
SketchConstraintTangent_19.setName("SketchConstraintTangent_24")
-SketchPoint_8 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_3_1/Modfied_divided_21_1&RevolutionFuse_1_1/Modfied_10&RevolutionFuse_3_1/Modfied_8"))
+SketchPoint_8 = Sketch_10.addPoint(model.selection("VERTEX", "[RevolutionFuse_3_1/Modified_Face&Sketch_3/SketchLine_15&weak_name_2][RevolutionFuse_1_1/Generated_Face&Sketch_3/SketchLine_20][RevolutionFuse_3_1/Modified_Face&RevolutionFuse_1_1/To_Face]"))
SketchConstraintCoincidence_130 = Sketch_10.setCoincident(SketchArc_11.endPoint(), SketchPoint_8.result())
SketchConstraintCoincidence_130.setName("SketchConstraintCoincidence_128")
SketchArc_12 = Sketch_10.addArc(64.00001789135865, 23.01137360115889, 64, 20, 61.15622559702543, 22.02080994708722, True)
SketchConstraintCoincidence_131.setName("SketchConstraintCoincidence_129")
SketchConstraintTangent_20 = Sketch_10.setTangent(SketchArc_12.results()[1], SketchLine_77.result())
SketchConstraintTangent_20.setName("SketchConstraintTangent_25")
-SketchPoint_9 = Sketch_10.addPoint(model.selection("VERTEX", "RevolutionFuse_3_1/Modfied_divided_22_1&RevolutionFuse_2_1/Modfied_11&RevolutionFuse_3_1/Modfied_7"))
+SketchPoint_9 = Sketch_10.addPoint(model.selection("VERTEX", "[RevolutionFuse_3_1/Modified_Face&Sketch_4/SketchLine_22&weak_name_2][RevolutionFuse_2_1/Generated_Face&Sketch_4/SketchLine_27][RevolutionFuse_3_1/Modified_Face&RevolutionFuse_2_1/From_Face]"))
SketchConstraintCoincidence_132 = Sketch_10.setCoincident(SketchArc_12.endPoint(), SketchPoint_9.result())
SketchConstraintCoincidence_132.setName("SketchConstraintCoincidence_130")
SketchLine_79 = Sketch_10.addLine(61.15622559702543, 22.02080994708722, 59.81204392543111, 22.0208099470871)
SketchConstraintParallel_3 = Sketch_10.setParallel(SketchLine_78.result(), SketchLine_81.result())
SketchConstraintParallel_4 = Sketch_10.setParallel(SketchLine_77.result(), SketchLine_79.result())
SketchConstraintPerpendicular_1 = Sketch_10.setPerpendicular(SketchLine_80.result(), SketchLine_77.result())
-SketchPoint_10 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_6/Vertex-SketchPoint_3"))
+SketchPoint_10 = Sketch_10.addPoint(model.selection("VERTEX", "Sketch_6/SketchPoint_3"))
SketchMultiRotation_1_objects = [SketchArc_10.results()[1], SketchLine_77.result(), SketchLine_78.result(), SketchArc_12.results()[1], SketchLine_79.result(), SketchLine_80.result(), SketchLine_81.result(), SketchArc_11.results()[1]]
SketchMultiRotation_1 = Sketch_10.addRotation(SketchMultiRotation_1_objects, SketchPoint_10.coordinates(), 120, 3)
[SketchArc_13, SketchArc_14, SketchLine_82, SketchLine_83, SketchLine_84, SketchLine_85, SketchArc_15, SketchArc_16, SketchLine_86, SketchLine_87, SketchLine_88, SketchLine_89, SketchLine_90, SketchLine_91, SketchArc_17, SketchArc_18] = SketchMultiRotation_1.rotated()
SketchArc_13.result().setName("SketchArc_16")
SketchArc_13.results()[1].setName("SketchArc_16_2")
model.do()
-ExtrusionFuse_3 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_10/Face-SketchArc_16_2f-SketchLine_81r-SketchLine_82f-SketchArc_17_2r-SketchLine_83f-SketchLine_84f-SketchLine_85r-SketchArc_18_2r"), model.selection("FACE", "Sketch_10/Face-SketchArc_19_2f-SketchLine_86r-SketchLine_87f-SketchArc_20_2r-SketchLine_88f-SketchLine_89f-SketchLine_90r-SketchArc_21_2r")], model.selection(), 20, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+ExtrusionFuse_3 = model.addExtrusionFuse(Part_1_doc, [model.selection("FACE", "Sketch_10/Face-SketchArc_16_2f-SketchLine_81r-SketchArc_17_2r-SketchLine_83f-SketchLine_84f-SketchLine_85r-SketchArc_18_2r-SketchLine_82f"), model.selection("FACE", "Sketch_10/Face-SketchArc_19_2f-SketchLine_86r-SketchArc_20_2r-SketchLine_88f-SketchLine_89f-SketchLine_90r-SketchArc_21_2r-SketchLine_87f")], model.selection(), 20, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
Sketch_11 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchCircle_2 = Sketch_11.addCircle(89, 0, 6)
-SketchPoint_11 = Sketch_11.addPoint(model.selection("VERTEX", "Sketch_2/Vertex-SketchPoint_1-SketchLine_10s-SketchLine_9e"))
+SketchPoint_11 = Sketch_11.addPoint(model.selection("VERTEX", "Sketch_2/SketchLine_90_EndVertex"))
SketchConstraintCoincidence_139 = Sketch_11.setCoincident(SketchCircle_2.center(), SketchPoint_11.result())
SketchConstraintCoincidence_139.setName("SketchConstraintCoincidence_137")
SketchConstraintRadius_11 = Sketch_11.setRadius(SketchCircle_2.results()[1], 6)
[SketchCircle_4, SketchCircle_5, SketchCircle_6, SketchCircle_7] = SketchMultiRotation_2.rotated()
model.do()
RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection("EDGE", "PartSet/OZ"), 0, 360, [model.selection("SOLID", "ExtrusionFuse_3_1")])
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_11/Wire-SketchCircle_4_2f"), model.selection("WIRE", "Sketch_11/Wire-SketchCircle_3_2f"), model.selection("WIRE", "Sketch_11/Wire-SketchCircle_5_2f")], model.selection(), 30, -15, [model.selection("SOLID", "RevolutionCut_1_1")])
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_11/Wire-SketchCircle_2_2f"), model.selection("FACE", "Sketch_11/Face-SketchCircle_6_2f"), model.selection("WIRE", "Sketch_11/Wire-SketchCircle_7_2f")], model.selection(), 30, 2, [model.selection("SOLID", "ExtrusionCut_3_1")])
+ExtrusionCut_3_objects_1 = [model.selection("WIRE", "Sketch_11/Face-SketchCircle_4_2f-SketchCircle_6_2r_wire"), model.selection("WIRE", "Sketch_11/Face-SketchCircle_3_2f-SketchCircle_2_2r_wire"), model.selection("WIRE", "Sketch_11/Face-SketchCircle_5_2f-SketchCircle_7_2r_wire")]
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_3_objects_1, model.selection(), 30, -15, [model.selection("SOLID", "RevolutionCut_1_1")])
+ExtrusionCut_4_objects_1 = [model.selection("WIRE", "Sketch_11/Face-SketchCircle_2_2r_wire"), model.selection("FACE", "Sketch_11/Face-SketchCircle_6_2f"), model.selection("WIRE", "Sketch_11/Face-SketchCircle_7_2f_wire")]
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_4_objects_1, model.selection(), 30, 2, [model.selection("SOLID", "ExtrusionCut_3_1")])
# Test reexecution after parameter change
Parameter_R.setValue(5)
SketchConstraintDistance_7 = Sketch_1.setDistance(SketchLine_5.startPoint(), SketchLine_2.result(), 32, False)
SketchConstraintDistance_7.setName("SketchConstraintDistance_9")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_14r-SketchArc_2_2r")], model.selection(), 12, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_14r-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchArc_2_2r-SketchLine_12r-SketchLine_11r-SketchLine_10r_wire")], model.selection(), 12, 0)
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOZ"))
SketchArc_3 = Sketch_2.addArc(54, 6, 54, 12, 54, 0, True)
-SketchLine_13 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_13&Extrusion_1_1/To_Face_1"))
+SketchLine_13 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"))
SketchLine_13.setName("SketchLine_15")
SketchLine_13.result().setName("SketchLine_15")
SketchConstraintCoincidence_19 = Sketch_2.setCoincident(SketchArc_3.startPoint(), SketchLine_13.result())
SketchConstraintCoincidence_19.setName("SketchConstraintCoincidence_23")
-SketchLine_14 = Sketch_2.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchLine_14 = Sketch_2.addLine(model.selection("EDGE", "Sketch_1/SketchLine_1"))
SketchLine_14.setName("SketchLine_16")
SketchLine_14.result().setName("SketchLine_16")
SketchConstraintCoincidence_20 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_14.result())
SketchConstraintCoincidence_20.setName("SketchConstraintCoincidence_24")
-SketchLine_15 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_13&Extrusion_1_1/Generated_Face_12"))
+SketchLine_15 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]"))
SketchLine_15.setName("SketchLine_17")
SketchLine_15.result().setName("SketchLine_17")
SketchConstraintTangent_1 = Sketch_2.setTangent(SketchArc_3.results()[1], SketchLine_15.result())
SketchConstraintCoincidence_26 = Sketch_2.setCoincident(SketchArc_3.endPoint(), SketchLine_20.endPoint())
SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_30")
model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_3_2r-SketchLine_18r-SketchLine_19r-SketchLine_20r-SketchLine_21r-SketchLine_22r")], model.selection(), 7, 15, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_9"))
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_22r-SketchLine_21r-SketchLine_20r-SketchLine_19r-SketchLine_18r-SketchArc_3_2r")], model.selection(), 7, 15, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14"))
SketchLine_21 = Sketch_3.addLine(28, -6, -4.270492394552598, -6)
SketchLine_21.setName("SketchLine_23")
SketchLine_21.result().setName("SketchLine_23")
SketchLine_21.setAuxiliary(True)
-SketchLine_22 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/Generated_Face_9"))
+SketchLine_22 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14]"))
SketchLine_22.setName("SketchLine_24")
SketchLine_22.result().setName("SketchLine_24")
SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_21.startPoint(), SketchLine_22.result())
SketchConstraintMiddle_2 = Sketch_3.setMiddlePoint(SketchLine_34.result(), SketchPoint_4.coordinates())
SketchConstraintCoincidence_52 = Sketch_3.setCoincident(SketchPoint_4.coordinates(), SketchLine_21.result())
SketchConstraintCoincidence_52.setName("SketchConstraintCoincidence_56")
-SketchLine_35 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&ExtrusionCut_1_1/Modfied_3"))
+SketchLine_35 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_5]"))
SketchLine_35.setName("SketchLine_37")
SketchLine_35.result().setName("SketchLine_37")
SketchConstraintCoincidence_53 = Sketch_3.setCoincident(SketchLine_25.startPoint(), SketchLine_35.result())
SketchConstraintCoincidence_53.setName("SketchConstraintCoincidence_57")
SketchConstraintLength_10 = Sketch_3.setLength(SketchLine_24.result(), 31)
SketchConstraintLength_10.setName("SketchConstraintLength_11")
-SketchLine_36 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_5"))
+SketchLine_36 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9]"))
SketchLine_36.setName("SketchLine_38")
SketchLine_36.result().setName("SketchLine_38")
SketchConstraintCoincidence_54 = Sketch_3.setCoincident(SketchLine_30.startPoint(), SketchLine_36.result())
SketchConstraintCoincidence_54.setName("SketchConstraintCoincidence_58")
SketchConstraintEqual_2 = Sketch_3.setEqual(SketchLine_30.result(), SketchLine_25.result())
model.do()
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_32f-SketchLine_33f-SketchLine_34f-SketchLine_35f"), model.selection("FACE", "Sketch_3/Face-SketchLine_26f-SketchLine_27f-SketchLine_28f-SketchLine_29f")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_1"))
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_32f-SketchLine_33f-SketchLine_34f-SketchLine_35f"), model.selection("FACE", "Sketch_3/Face-SketchLine_26f-SketchLine_27f-SketchLine_28f-SketchLine_29f")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face"))
SketchLine_37 = Sketch_4.addLine(0.4324637622511017, 3.581086955422081, 1.55585595716119, 2.812450190483599)
SketchLine_37.setName("SketchLine_39")
SketchLine_37.result().setName("SketchLine_39")
-SketchLine_38 = Sketch_4.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_1&Extrusion_1_1/Generated_Face_2"))
+SketchLine_38 = Sketch_4.addLine(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_11]"))
SketchLine_38.setName("SketchLine_40")
SketchLine_38.result().setName("SketchLine_40")
SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchLine_37.startPoint(), SketchLine_38.result())
SketchLine_41.setName("SketchLine_43")
SketchLine_41.result().setName("SketchLine_43")
model.do()
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_2"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_5&ExtrusionCut_3_1/Modfied_3&Extrusion_1_1/Generated_Face_1"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_3&Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_7"), model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_5&ExtrusionCut_2_1/Modfied_5&ExtrusionCut_3_1/Modfied_3"))
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/From_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+Plane_4 = model.addPlane(Part_1_doc, model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10]"), model.selection("VERTEX", "[ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]"), model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_4&ExtrusionCut_2_1/To_Face_2)][ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face]"))
Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchArc_4 = Sketch_5.addArc(25, -7.50002056854448, 22, -7.5, 28, -7.5, True)
SketchPoint_5 = Sketch_5.addPoint(22, -7.5)
SketchConstraintHorizontal_11 = Sketch_5.setHorizontal(SketchLine_51.result())
SketchConstraintHorizontal_11.setName("SketchConstraintHorizontal_12")
model.do()
-Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "ExtrusionCut_3_1/Modfied_3"), 6, True)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face"), 6, True)
Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_2"), 3, True)
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2f-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), 3, 0, [model.selection("SOLID", "ExtrusionCut_3_1")])
-ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2f-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), model.selection("FACE", "Plane_3"), 0, model.selection("FACE", "Plane_2"), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
-Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_4_1/Modfied_6"))
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2r-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), 3, 0, [model.selection("SOLID", "ExtrusionCut_3_1")])
+ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2r-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), model.selection("FACE", "Plane_3"), 0, model.selection("FACE", "Plane_2"), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_4_1/Modified_Face&Extrusion_1_1/To_Face"))
SketchArc_5 = Sketch_6.addArc(46, 0, 45.5, 0, 46.5, 0, False)
SketchLine_53 = Sketch_6.addLine(0, 0, 54, 0)
SketchLine_53.setName("SketchLine_55")
SketchLine_56.setName("SketchLine_58")
SketchLine_56.result().setName("SketchLine_58")
model.do()
-ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_14r-SketchArc_2_2r"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_5_1")])
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_2_1/Modfied_8"))
+ExtrusionFuse_1 = model.addExtrusionFuse(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_14r-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchArc_2_2r-SketchLine_12r-SketchLine_11r-SketchLine_10r"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_5_1")])
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "(ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_27)(ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_26)(ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_4&ExtrusionCut_2_1/To_Face_2)(ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_28)"))
SketchLine_64 = Sketch_7.addLine(50.25, -4.5, 31.25, -4.5)
SketchLine_64.setName("SketchLine_76")
SketchLine_64.result().setName("SketchLine_76")
SketchConstraintRadius_7.setName("SketchConstraintRadius_10")
model.do()
ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection(), 0, 20, [model.selection("SOLID", "ExtrusionFuse_1_1")])
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_6_1/Modfied_10"))
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "(ExtrusionFuse_1_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchLine_76)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchArc_15_2)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchLine_80)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchArc_17_2)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchLine_79)(ExtrusionFuse_1_1/Modified_Face&Extrusion_1_1/To_Face)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10)"))
SketchPoint_12 = Sketch_8.addPoint(54, 0)
SketchPoint_13 = Sketch_8.addPoint(54, 0)
SketchConstraintRigid_7 = Sketch_8.setFixed(SketchPoint_13.result())
SketchConstraintCoincidence_142.setName("SketchConstraintCoincidence_145")
model.do()
ExtrusionCut_7 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_8")], model.selection(), 10, 0, [model.selection("SOLID", "ExtrusionCut_6_1")])
-Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_7_1/Modfied_14"))
+Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_7_1/Modified_Face&Extrusion_1_1/To_Face"))
SketchLine_94 = Sketch_9.addLine(21, 4.163450069699051, 21, 0)
SketchLine_94.setName("SketchLine_107")
SketchLine_94.result().setName("SketchLine_107")
Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_2"), 4, False)
Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_2"), 4, True)
ExtrusionCut_8 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection(), model.selection("FACE", "Plane_5"), 0, model.selection("FACE", "Plane_4"), 0, [model.selection("SOLID", "ExtrusionCut_7_1")])
-Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_8_1/Modfied_5"))
+Sketch_10 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_8_1/Modified_Face&Sketch_1/SketchLine_1"))
SketchCircle_1 = Sketch_10.addCircle(12, 6, 1)
SketchConstraintRadius_9 = Sketch_10.setRadius(SketchCircle_1.results()[1], 1)
SketchPoint_24 = Sketch_10.addPoint(0, 6)
SketchConstraintCoincidence_174.setName("SketchConstraintCoincidence_178")
SketchConstraintDistance_17 = Sketch_10.setDistance(SketchLine_105.result(), SketchCircle_1.center(), 12, False)
model.do()
-ExtrusionCut_9 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_10/Wire-SketchCircle_1_2f")], model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_8_1")])
+ExtrusionCut_9 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_10/Face-SketchCircle_1_2r_wire")], model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_8_1")])
model.do()
Part_2 = model.addPart(partSet)
Part_2_doc = Part_2.document()
SketchConstraintDistance_24 = Sketch_11.setDistance(SketchLine_111.startPoint(), SketchLine_108.result(), 32, False)
SketchConstraintDistance_24.setName("SketchConstraintDistance_9")
model.do()
-Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_14r-SketchArc_2_2r")], model.selection(), 12, 0)
+Extrusion_2 = model.addExtrusion(Part_2_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_14r-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchArc_2_2r-SketchLine_12r-SketchLine_11r-SketchLine_10r_wire")], model.selection(), 12, 0)
Sketch_12 = model.addSketch(Part_2_doc, model.standardPlane("XOZ"))
SketchArc_26 = Sketch_12.addArc(54, 6, 54, 12, 54, 0, True)
-SketchLine_119 = Sketch_12.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_13&Extrusion_1_1/To_Face_1"))
+SketchLine_119 = Sketch_12.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"))
SketchLine_119.setName("SketchLine_15")
SketchLine_119.result().setName("SketchLine_15")
SketchConstraintCoincidence_193 = Sketch_12.setCoincident(SketchArc_26.startPoint(), SketchLine_119.result())
SketchConstraintCoincidence_193.setName("SketchConstraintCoincidence_23")
-SketchLine_120 = Sketch_12.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchLine_120 = Sketch_12.addLine(model.selection("EDGE", "Sketch_1/SketchLine_1"))
SketchLine_120.setName("SketchLine_16")
SketchLine_120.result().setName("SketchLine_16")
SketchConstraintCoincidence_194 = Sketch_12.setCoincident(SketchArc_26.endPoint(), SketchLine_120.result())
SketchConstraintCoincidence_194.setName("SketchConstraintCoincidence_24")
-SketchLine_121 = Sketch_12.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_13&Extrusion_1_1/Generated_Face_12"))
+SketchLine_121 = Sketch_12.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]"))
SketchLine_121.setName("SketchLine_17")
SketchLine_121.result().setName("SketchLine_17")
SketchConstraintTangent_16 = Sketch_12.setTangent(SketchArc_26.results()[1], SketchLine_121.result())
SketchConstraintCoincidence_200 = Sketch_12.setCoincident(SketchArc_26.endPoint(), SketchLine_126.endPoint())
SketchConstraintCoincidence_200.setName("SketchConstraintCoincidence_30")
model.do()
-ExtrusionCut_10 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_3_2r-SketchLine_18r-SketchLine_19r-SketchLine_20r-SketchLine_21r-SketchLine_22r")], model.selection(), 7, 15, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_13 = model.addSketch(Part_2_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_9"))
+ExtrusionCut_10 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_22r-SketchLine_21r-SketchLine_20r-SketchLine_19r-SketchLine_18r-SketchArc_3_2r")], model.selection(), 7, 15, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_13 = model.addSketch(Part_2_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14"))
SketchLine_127 = Sketch_13.addLine(28, -6, -4.270492394552598, -6)
SketchLine_127.setName("SketchLine_23")
SketchLine_127.result().setName("SketchLine_23")
SketchLine_127.setAuxiliary(True)
-SketchLine_128 = Sketch_13.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/Generated_Face_9"))
+SketchLine_128 = Sketch_13.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14]"))
SketchLine_128.setName("SketchLine_24")
SketchLine_128.result().setName("SketchLine_24")
SketchConstraintCoincidence_201 = Sketch_13.setCoincident(SketchLine_127.startPoint(), SketchLine_128.result())
SketchConstraintMiddle_10 = Sketch_13.setMiddlePoint(SketchLine_140.result(), SketchPoint_28.coordinates())
SketchConstraintCoincidence_226 = Sketch_13.setCoincident(SketchPoint_28.coordinates(), SketchLine_127.result())
SketchConstraintCoincidence_226.setName("SketchConstraintCoincidence_56")
-SketchLine_141 = Sketch_13.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_9&ExtrusionCut_1_1/Modfied_3"))
+SketchLine_141 = Sketch_13.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_14][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_5]"))
SketchLine_141.setName("SketchLine_37")
SketchLine_141.result().setName("SketchLine_37")
SketchConstraintCoincidence_227 = Sketch_13.setCoincident(SketchLine_131.startPoint(), SketchLine_141.result())
SketchConstraintCoincidence_227.setName("SketchConstraintCoincidence_57")
SketchConstraintLength_27 = Sketch_13.setLength(SketchLine_130.result(), 31)
SketchConstraintLength_27.setName("SketchConstraintLength_11")
-SketchLine_142 = Sketch_13.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_5"))
+SketchLine_142 = Sketch_13.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9]"))
SketchLine_142.setName("SketchLine_38")
SketchLine_142.result().setName("SketchLine_38")
SketchConstraintCoincidence_228 = Sketch_13.setCoincident(SketchLine_136.startPoint(), SketchLine_142.result())
SketchConstraintCoincidence_228.setName("SketchConstraintCoincidence_58")
SketchConstraintEqual_5 = Sketch_13.setEqual(SketchLine_136.result(), SketchLine_131.result())
model.do()
-ExtrusionCut_11 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_32f-SketchLine_33f-SketchLine_34f-SketchLine_35f"), model.selection("FACE", "Sketch_3/Face-SketchLine_26f-SketchLine_27f-SketchLine_28f-SketchLine_29f")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Sketch_14 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_1"))
+ExtrusionCut_11 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_32f-SketchLine_33f-SketchLine_34f-SketchLine_35f"), model.selection("FACE", "Sketch_3/Face-SketchLine_26f-SketchLine_27f-SketchLine_28f-SketchLine_29f")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Sketch_14 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face"))
SketchLine_143 = Sketch_14.addLine(0.4324637622511017, 3.581086955422081, 1.55585595716119, 2.812450190483599)
SketchLine_143.setName("SketchLine_39")
SketchLine_143.result().setName("SketchLine_39")
-SketchLine_144 = Sketch_14.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_1&Extrusion_1_1/Generated_Face_2"))
+SketchLine_144 = Sketch_14.addLine(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_11]"))
SketchLine_144.setName("SketchLine_40")
SketchLine_144.result().setName("SketchLine_40")
SketchConstraintCoincidence_229 = Sketch_14.setCoincident(SketchLine_143.startPoint(), SketchLine_144.result())
SketchLine_147.setName("SketchLine_43")
SketchLine_147.result().setName("SketchLine_43")
model.do()
-ExtrusionCut_12 = model.addExtrusionCut(Part_2_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_2"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-Plane_9 = model.addPlane(Part_2_doc, model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_5&ExtrusionCut_3_1/Modfied_3&Extrusion_1_1/Generated_Face_1"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_3&Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_7"), model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_5&ExtrusionCut_2_1/Modfied_5&ExtrusionCut_3_1/Modfied_3"))
+ExtrusionCut_12 = model.addExtrusionCut(Part_2_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/From_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+Plane_9 = model.addPlane(Part_2_doc, model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10]"), model.selection("VERTEX", "[ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]"), model.selection("VERTEX", "[ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1][(ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_1)(ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face)(ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_4&ExtrusionCut_2_1/To_Face_2)][ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face]"))
Sketch_15 = model.addSketch(Part_2_doc, model.selection("FACE", "Plane_1"))
SketchArc_27 = Sketch_15.addArc(25, -7.50002056854448, 22, -7.5, 28, -7.5, True)
SketchPoint_29 = Sketch_15.addPoint(22, -7.5)
SketchConstraintHorizontal_33 = Sketch_15.setHorizontal(SketchLine_157.result())
SketchConstraintHorizontal_33.setName("SketchConstraintHorizontal_12")
model.do()
-Plane_10 = model.addPlane(Part_2_doc, model.selection("FACE", "ExtrusionCut_3_1/Modfied_3"), 6, True)
+Plane_10 = model.addPlane(Part_2_doc, model.selection("FACE", "ExtrusionCut_3_1/Modified_Face&Extrusion_1_1/To_Face"), 6, True)
Plane_11 = model.addPlane(Part_2_doc, model.selection("FACE", "Plane_2"), 3, True)
-ExtrusionCut_13 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2f-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), 3, 0, [model.selection("SOLID", "ExtrusionCut_3_1")])
-ExtrusionCut_14 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2f-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), model.selection("FACE", "Plane_3"), 0, model.selection("FACE", "Plane_2"), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
-Sketch_16 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_4_1/Modfied_6"))
+ExtrusionCut_13 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2r-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), 3, 0, [model.selection("SOLID", "ExtrusionCut_3_1")])
+ExtrusionCut_14 = model.addExtrusionCut(Part_2_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_4_2r-SketchLine_52f-SketchLine_53f-SketchLine_54f")], model.selection(), model.selection("FACE", "Plane_3"), 0, model.selection("FACE", "Plane_2"), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
+Sketch_16 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_4_1/Modified_Face&Extrusion_1_1/To_Face"))
SketchArc_28 = Sketch_16.addArc(46, 0, 45.5, 0, 46.5, 0, False)
SketchLine_159 = Sketch_16.addLine(0, 0, 54, 0)
SketchLine_159.setName("SketchLine_55")
SketchLine_162.setName("SketchLine_58")
SketchLine_162.result().setName("SketchLine_58")
model.do()
-ExtrusionFuse_2 = model.addExtrusionFuse(Part_2_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchLine_10r-SketchLine_11r-SketchLine_12r-SketchLine_14r-SketchArc_2_2r"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_5_1")])
-Sketch_17 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_2_1/Modfied_8"))
+ExtrusionFuse_2 = model.addExtrusionFuse(Part_2_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchLine_14r-SketchLine_7f-SketchArc_1_2f-SketchLine_8f-SketchLine_9f-SketchArc_2_2r-SketchLine_12r-SketchLine_11r-SketchLine_10r"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_5_1")])
+Sketch_17 = model.addSketch(Part_2_doc, model.selection("FACE", "(ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_27)(ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_26)(ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_4&ExtrusionCut_2_1/To_Face_2)(ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_28)"))
SketchLine_170 = Sketch_17.addLine(50.25, -4.5, 31.25, -4.5)
SketchLine_170.setName("SketchLine_76")
SketchLine_170.result().setName("SketchLine_76")
SketchConstraintRadius_16.setName("SketchConstraintRadius_10")
model.do()
ExtrusionCut_15 = model.addExtrusionCut(Part_2_doc, [model.selection("COMPOUND", "Sketch_7")], model.selection(), 0, 20, [model.selection("SOLID", "ExtrusionFuse_1_1")])
-Sketch_18 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_6_1/Modfied_10"))
+Sketch_18 = model.addSketch(Part_2_doc, model.selection("FACE", "(ExtrusionFuse_1_1/Modified_Face&Extrusion_1_1/From_Face)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchLine_76)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchArc_15_2)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchLine_80)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchArc_17_2)(ExtrusionCut_6_1/Generated_Face&Sketch_7/SketchLine_79)(ExtrusionFuse_1_1/Modified_Face&Extrusion_1_1/To_Face)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10)"))
SketchPoint_36 = Sketch_18.addPoint(54, 0)
SketchPoint_37 = Sketch_18.addPoint(54, 0)
SketchConstraintRigid_20 = Sketch_18.setFixed(SketchPoint_37.result())
SketchConstraintCoincidence_316.setName("SketchConstraintCoincidence_145")
model.do()
ExtrusionCut_16 = model.addExtrusionCut(Part_2_doc, [model.selection("COMPOUND", "Sketch_8")], model.selection(), 10, 0, [model.selection("SOLID", "ExtrusionCut_6_1")])
-Sketch_19 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_7_1/Modfied_14"))
+Sketch_19 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_7_1/Modified_Face&Extrusion_1_1/To_Face"))
SketchLine_200 = Sketch_19.addLine(21, 4.163450069699051, 21, 0)
SketchLine_200.setName("SketchLine_107")
SketchLine_200.result().setName("SketchLine_107")
Plane_12 = model.addPlane(Part_2_doc, model.selection("FACE", "Plane_2"), 4, False)
Plane_13 = model.addPlane(Part_2_doc, model.selection("FACE", "Plane_2"), 4, True)
ExtrusionCut_17 = model.addExtrusionCut(Part_2_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection(), model.selection("FACE", "Plane_5"), 0, model.selection("FACE", "Plane_4"), 0, [model.selection("SOLID", "ExtrusionCut_7_1")])
-Sketch_20 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_8_1/Modfied_5"))
+Sketch_20 = model.addSketch(Part_2_doc, model.selection("FACE", "ExtrusionCut_8_1/Modified_Face&Sketch_1/SketchLine_1"))
SketchCircle_2 = Sketch_20.addCircle(12, 6, 1)
SketchConstraintRadius_18 = Sketch_20.setRadius(SketchCircle_2.results()[1], 1)
SketchPoint_48 = Sketch_20.addPoint(0, 6)
SketchConstraintCoincidence_348.setName("SketchConstraintCoincidence_178")
SketchConstraintDistance_34 = Sketch_20.setDistance(SketchLine_211.result(), SketchCircle_2.center(), 12, False)
model.do()
-ExtrusionCut_18 = model.addExtrusionCut(Part_2_doc, [model.selection("WIRE", "Sketch_10/Wire-SketchCircle_1_2f")], model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_8_1")])
+ExtrusionCut_18 = model.addExtrusionCut(Part_2_doc, [model.selection("WIRE", "Sketch_10/Face-SketchCircle_1_2r_wire")], model.selection(), 0, 0.75, [model.selection("SOLID", "ExtrusionCut_8_1")])
model.do()
-Rotation_1 = model.addRotation(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("EDGE", "Part_1/ExtrusionCut_9_1/Modfied_1&ExtrusionCut_7_1/Modfied_19"), 180)
-Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Rotation_1/")], model.selection("FACE", "Rotation_1/ExtrusionCut_5_1/Modfied_5"), model.selection("FACE", "Part_1/ExtrusionCut_5_1/Modfied_5"), False, True)
-Rotation_2 = model.addRotation(partSet, [model.selection("COMPOUND", "Placement_1/")], model.selection("EDGE", "Part_1/ExtrusionCut_5_1/Modfied_5&ExtrusionCut_8_1/Modfied_3"), 7)
+Rotation_1 = model.addRotation(partSet, [model.selection("COMPOUND", "Part_2/")], model.selection("EDGE", "Part_1/[ExtrusionCut_9_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_7_1/Modified_Face&Extrusion_1_1/From_Face]"), 180)
+Placement_1 = model.addPlacement(partSet, [model.selection("COMPOUND", "Rotation_1/")], model.selection("FACE", "Rotation_1/ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_9"), model.selection("FACE", "Part_1/ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_9"), False, True)
+Rotation_2 = model.addRotation(partSet, [model.selection("COMPOUND", "Placement_1/")], model.selection("EDGE", "Part_1/[ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_9][ExtrusionCut_8_1/Modified_Face&Sketch_3/SketchLine_35]"), 7)
Rotation_2.result().setColor(255, 85, 0)
model.end()
SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], 2.3)
SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_5.result(), SketchLine_9.startPoint())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchLine_10f-SketchLine_11f-SketchLine_12f-SketchLine_13f-SketchLine_4f-SketchLine_8f-SketchLine_9f-SketchArc_1_2r-SketchArc_2_2f")], model.selection(), "307/2.", "307/2.")
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchLine_10f-SketchArc_1_2r-SketchLine_11f-SketchLine_4f-SketchLine_13f-SketchArc_2_2f-SketchLine_12f-SketchLine_8f-SketchLine_9f_wire")], model.selection(), "307/2.", "307/2.")
Extrusion_1.setName("Profil")
Extrusion_1.result().setName("Extrusion_1_1")
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_12"))
SketchLine_14 = Sketch_2.addLine(149.5, -2.3, 153.5, -2.3)
-SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"))
+SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_12][Extrusion_1_1/To_Face]"))
SketchConstraintCoincidence_24 = Sketch_2.setCoincident(SketchLine_14.endPoint(), SketchPoint_1.result())
SketchLine_15 = Sketch_2.addLine(153.5, -2.3, 153.5, 7.7)
SketchLine_16 = Sketch_2.addLine(153.5, 7.7, 149.5, 7.7)
SketchConstraintLength_5.setName("SketchConstraintLength_6")
SketchConstraintDistance_2 = Sketch_2.setDistance(SketchLine_16.endPoint(), SketchLine_21.result(), 299)
SketchConstraintEqual_1 = Sketch_2.setEqual(SketchLine_16.result(), SketchLine_20.result())
-SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1"))
+SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_12][Extrusion_1_1/From_Face]"))
SketchPoint_2.setName("SketchPoint_4")
SketchPoint_2.result().setName("SketchPoint_4")
SketchConstraintCoincidence_34 = Sketch_2.setCoincident(SketchLine_19.startPoint(), SketchPoint_2.coordinates())
SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_39")
model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_6"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
ExtrusionCut_1.setName("Decoupe_Angle")
ExtrusionCut_1.result().setName("ExtrusionCut_1_1")
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_2"))
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8"))
SketchLine_22 = Sketch_3.addLine(153.5, -10.3, 153.5, -8.3)
SketchLine_22.setName("SketchLine_29")
SketchLine_22.result().setName("SketchLine_29")
-SketchPoint_3 = Sketch_3.addPoint(model.selection("VERTEX", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_1_1/Modfied_1&Extrusion_1_1/Generated_Face_2"))
+SketchPoint_3 = Sketch_3.addPoint(model.selection("VERTEX", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8]"))
SketchPoint_3.setName("SketchPoint_5")
SketchPoint_3.result().setName("SketchPoint_5")
SketchConstraintCoincidence_35 = Sketch_3.setCoincident(SketchLine_22.startPoint(), SketchPoint_3.result())
SketchConstraintCoincidence_35.setName("SketchConstraintCoincidence_40")
-SketchLine_23 = Sketch_3.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_1&Extrusion_1_1/Generated_Face_2"))
+SketchLine_23 = Sketch_3.addLine(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8]"))
SketchLine_23.setName("SketchLine_30")
SketchLine_23.result().setName("SketchLine_30")
SketchConstraintCoincidence_36 = Sketch_3.setCoincident(SketchLine_22.endPoint(), SketchLine_23.result())
SketchConstraintLength_6.setName("SketchConstraintLength_8")
SketchConstraintAngle_1 = Sketch_3.setAngleBackward(SketchLine_24.result(), SketchLine_25.result(), 45)
SketchConstraintAngle_1.setName("SketchConstraintAngle_2")
-SketchLine_26 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_8"))
+SketchLine_26 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/SketchLine_8"))
SketchLine_26.setName("SketchLine_34")
SketchLine_26.result().setName("SketchLine_34")
SketchConstraintMirror_1_objects = [SketchLine_22.result(), SketchLine_25.result(), SketchLine_24.result()]
ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_4")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_1_1")])
ExtrusionCut_2.setName("Chamfrein_1")
ExtrusionCut_2.result().setName("ExtrusionCut_2_1")
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_5"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_13"))
SketchLine_30 = Sketch_4.addLine(-149.5, 10.3, -149.5, 8.3)
SketchLine_30.setName("SketchLine_35")
SketchLine_30.result().setName("SketchLine_35")
-SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "ExtrusionCut_1_1/Modfied_11&ExtrusionCut_1_1/Modfied_5&ExtrusionCut_1_1/Modfied_6"))
+SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_21][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_13][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_4]"))
SketchPoint_4.setName("SketchPoint_6")
SketchPoint_4.result().setName("SketchPoint_6")
SketchConstraintCoincidence_42 = Sketch_4.setCoincident(SketchLine_30.startPoint(), SketchPoint_4.result())
SketchConstraintCoincidence_42.setName("SketchConstraintCoincidence_43")
-SketchLine_31 = Sketch_4.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_11&ExtrusionCut_1_1/Modfied_5"))
+SketchLine_31 = Sketch_4.addLine(model.selection("EDGE", "[ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchLine_21][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_13]"))
SketchLine_31.setName("SketchLine_36")
SketchLine_31.result().setName("SketchLine_36")
SketchConstraintCoincidence_43 = Sketch_4.setCoincident(SketchLine_30.endPoint(), SketchLine_31.result())
SketchLine_38.result().setName("SketchLine_43")
SketchLine_38.setAuxiliary(True)
SketchConstraintHorizontal_10 = Sketch_4.setHorizontal(SketchLine_38.result())
-SketchProjection_1 = Sketch_4.addProjection(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_2"))
+SketchProjection_1 = Sketch_4.addProjection(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face]"), False)
SketchLine_39 = SketchProjection_1.createdFeature()
SketchLine_39.setName("SketchLine_44")
SketchLine_39.result().setName("SketchLine_44")
model.do()
Sketch_4.setName("Sketch_5")
Sketch_4.result().setName("Sketch_5")
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_5")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_7"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_3"))
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_5")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_11"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_12"))
SketchLine_40 = Sketch_5.addLine(152.2999838762584, -21.04999053274691, 153.5, -21.04999053274714)
SketchLine_40.setName("SketchLine_58")
SketchLine_40.result().setName("SketchLine_58")
SketchLine_41 = Sketch_5.addLine(152.2999838292651, -45.04999053274704, 153.5, -45.04999053274702)
SketchLine_41.setName("SketchLine_57")
SketchLine_41.result().setName("SketchLine_57")
-SketchLine_42 = Sketch_5.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"))
+SketchLine_42 = Sketch_5.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/To_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_12]"))
SketchLine_42.setName("SketchLine_46")
SketchLine_42.result().setName("SketchLine_46")
SketchLine_43 = Sketch_5.addLine(150.8, -45.04999053274702, 153.5, -45.04999053274702)
SketchLine_55.setAuxiliary(True)
SketchConstraintCoincidence_66 = Sketch_5.setCoincident(SketchPoint_5.coordinates(), SketchLine_55.startPoint())
SketchConstraintCoincidence_66.setName("SketchConstraintCoincidence_71")
-SketchLine_56 = Sketch_5.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_1_1/Modfied_9"))
+SketchLine_56 = Sketch_5.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][ExtrusionCut_1_1/Modified_Face&Sketch_1/SketchLine_10]"))
SketchLine_56.setName("SketchLine_55")
SketchLine_56.result().setName("SketchLine_55")
SketchConstraintCoincidence_67 = Sketch_5.setCoincident(SketchLine_55.endPoint(), SketchLine_56.result())
model.do()
Sketch_5.setName("Sketch_6")
Sketch_5.result().setName("Sketch_6")
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_6/Wire-SketchArc_9_2f-SketchArc_10_2f-SketchLine_73r-SketchLine_74r-SketchLine_75r-SketchLine_76r"), model.selection("WIRE", "Sketch_6/Wire-SketchLine_58f-SketchLine_61f-SketchLine_60f-SketchLine_51f-SketchArc_4_2f-SketchArc_5_2f"), model.selection("WIRE", "Sketch_6/Wire-SketchLine_57f-SketchLine_47f-SketchLine_62f-SketchLine_63f-SketchArc_3_2f-SketchArc_6_2f")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_3_1")])
-Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_4_1/Modfied_1"))
+ExtrusionCut_4_objects_1 = [model.selection("WIRE", "Sketch_6/Face-SketchArc_9_2f-SketchLine_74r-SketchArc_10_2f-SketchLine_75r-SketchLine_73r-SketchLine_76r_wire"), model.selection("WIRE", "Sketch_6/Face-SketchLine_58r-SketchLine_51f-SketchLine_60f-SketchArc_5_2f-SketchLine_61f-SketchArc_4_2f_wire"), model.selection("WIRE", "Sketch_6/Face-SketchLine_57f-SketchLine_47f-SketchLine_62f-SketchArc_6_2f-SketchLine_63f-SketchArc_3_2f_wire")]
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_4_objects_1, model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_3_1")])
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_4_1/Modified_Face&Sketch_1/SketchLine_12"))
SketchArc_11 = Sketch_6.addArc(44.89, -23.55, 43.89, -23.55, 44.89, -22.55, False)
SketchArc_12 = Sketch_6.addArc(44.89, -13.55, 44.89, -14.55, 43.89, -13.55, False)
SketchArc_13 = Sketch_6.addArc(5.89, -13.55, 6.89, -13.55, 5.89, -14.55, False)
SketchLine_80.setName("SketchLine_85")
SketchLine_80.result().setName("SketchLine_85")
SketchConstraintDistance_12 = Sketch_6.setDistance(SketchLine_79.startPoint(), SketchLine_80.result(), 5.89)
-SketchLine_81 = Sketch_6.addLine(model.selection("EDGE", "Sketch_6/Edge-SketchLine_54"))
+SketchLine_81 = Sketch_6.addLine(model.selection("EDGE", "Sketch_6/SketchLine_54"))
SketchLine_81.setName("SketchLine_86")
SketchLine_81.result().setName("SketchLine_86")
SketchConstraintDistance_13 = Sketch_6.setDistance(SketchLine_76.endPoint(), SketchLine_81.result(), 5.3)
model.do()
Sketch_6.setName("Sketch_7")
Sketch_6.result().setName("Sketch_7")
-ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_7/Wire-SketchArc_20_2f-SketchArc_21_2f-SketchArc_22_2f-SketchArc_23_2f-SketchLine_91r-SketchLine_92f-SketchLine_93r-SketchLine_94f"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_52_2f-SketchArc_53_2f-SketchArc_56_2f-SketchArc_57_2f-SketchLine_114r-SketchLine_115f-SketchLine_116r-SketchLine_121f"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_44_2f-SketchArc_45_2f-SketchArc_48_2f-SketchArc_49_2f-SketchLine_107f-SketchLine_113f-SketchLine_117r-SketchLine_123r"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_16_2f-SketchArc_17_2f-SketchArc_18_2f-SketchArc_19_2f-SketchLine_87f-SketchLine_88f-SketchLine_89r-SketchLine_90r"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_11_2f-SketchArc_12_2f-SketchArc_14_2f-SketchLine_81f-SketchLine_82r-SketchLine_83f-SketchLine_84r-SketchArc_15_2f"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_36_2f-SketchArc_38_2f-SketchArc_40_2f-SketchArc_41_2f-SketchLine_108r-SketchLine_119r-SketchLine_127f-SketchLine_129f"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_37_2f-SketchArc_39_2f-SketchArc_42_2f-SketchArc_43_2f-SketchLine_118r-SketchLine_120f-SketchLine_122r-SketchLine_130f"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_24_2f-SketchArc_25_2f-SketchArc_26_2f-SketchArc_27_2f-SketchLine_98f-SketchLine_100r-SketchLine_101f-SketchLine_103r"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_30_2f-SketchArc_31_2f-SketchArc_34_2f-SketchArc_35_2f-SketchLine_95f-SketchLine_96r-SketchLine_97f-SketchLine_105r"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_46_2f-SketchArc_47_2f-SketchArc_50_2f-SketchArc_51_2f-SketchLine_124f-SketchLine_125r-SketchLine_126f-SketchLine_128r"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_54_2f-SketchArc_55_2f-SketchArc_58_2f-SketchArc_59_2f-SketchLine_109f-SketchLine_110r-SketchLine_111r-SketchLine_112f"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_28_2f-SketchArc_29_2f-SketchArc_32_2f-SketchArc_33_2f-SketchLine_99r-SketchLine_102f-SketchLine_104f-SketchLine_106r")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_4_1")])
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_5_1/Modfied_1"))
+ExtrusionCut_5_objects_1 = [model.selection("WIRE", "Sketch_7/Face-SketchArc_20_2f-SketchLine_93r-SketchArc_21_2f-SketchLine_91r-SketchArc_23_2f-SketchLine_94f-SketchArc_22_2f-SketchLine_92f_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_52_2f-SketchLine_116r-SketchArc_53_2f-SketchLine_115f-SketchArc_57_2f-SketchLine_121f-SketchArc_56_2f-SketchLine_114r_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_44_2f-SketchLine_117r-SketchArc_45_2f-SketchLine_113f-SketchArc_49_2f-SketchLine_107f-SketchArc_48_2f-SketchLine_123r_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_16_2f-SketchLine_90r-SketchArc_17_2f-SketchLine_88f-SketchArc_19_2f-SketchLine_87f-SketchArc_18_2f-SketchLine_89r_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_11_2r-SketchLine_83f-SketchArc_12_2f-SketchLine_82r-SketchArc_14_2f-SketchLine_84r-SketchArc_15_2f-SketchLine_81f_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_36_2f-SketchLine_119r-SketchArc_38_2f-SketchLine_129f-SketchArc_41_2f-SketchLine_127f-SketchArc_40_2f-SketchLine_108r_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_37_2f-SketchLine_130f-SketchArc_42_2f-SketchLine_122r-SketchArc_43_2f-SketchLine_118r-SketchArc_39_2f-SketchLine_120f_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_24_2f-SketchLine_103r-SketchArc_26_2f-SketchLine_98f-SketchArc_27_2f-SketchLine_101f-SketchArc_25_2f-SketchLine_100r_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_30_2f-SketchLine_105r-SketchArc_34_2f-SketchLine_97f-SketchArc_35_2f-SketchLine_95f-SketchArc_31_2f-SketchLine_96r_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_46_2f-SketchLine_124f-SketchArc_50_2f-SketchLine_125r-SketchArc_51_2f-SketchLine_128r-SketchArc_47_2f-SketchLine_126f_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_54_2f-SketchLine_112f-SketchArc_58_2f-SketchLine_110r-SketchArc_59_2f-SketchLine_111r-SketchArc_55_2f-SketchLine_109f_wire"), model.selection("WIRE", "Sketch_7/Face-SketchArc_28_2f-SketchLine_102f-SketchArc_29_2f-SketchLine_104f-SketchArc_33_2f-SketchLine_99r-SketchArc_32_2f-SketchLine_106r_wire")]
+ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_5_objects_1, model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_4_1")])
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_5_1/Modified_Face&Sketch_1/SketchLine_12"))
SketchLine_126 = Sketch_7.addLine(-153.5, -37.05, -152.3, -37.05)
SketchLine_126.setName("SketchLine_135")
SketchLine_126.result().setName("SketchLine_135")
SketchLine_127 = Sketch_7.addLine(-150.8, -38.55, -150.8, -43.55)
SketchLine_127.setName("SketchLine_138")
SketchLine_127.result().setName("SketchLine_138")
-SketchPoint_10 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_6/Vertex-SketchLine_67s-SketchLine_68e-SketchLine_69e"))
+SketchPoint_10 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_6/SketchLine_67_StartVertex"))
SketchPoint_10.setName("SketchPoint_12")
SketchPoint_10.result().setName("SketchPoint_12")
SketchLine_128 = Sketch_7.addLine(-150.8, -45.05, -153.5, -45.05)
SketchConstraintVertical_15 = Sketch_7.setVertical(SketchLine_129.result())
SketchConstraintHorizontal_19 = Sketch_7.setHorizontal(SketchLine_132.result())
SketchConstraintVertical_16 = Sketch_7.setVertical(SketchLine_131.result())
-SketchPoint_11 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_6/Vertex-SketchLine_70s-SketchLine_72s-SketchLine_71e"))
+SketchPoint_11 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_6/SketchLine_70_StartVertex"))
SketchPoint_11.setName("SketchPoint_13")
SketchPoint_11.result().setName("SketchPoint_13")
SketchConstraintCoincidence_118 = Sketch_7.setCoincident(SketchLine_132.endPoint(), SketchPoint_11.result())
Sketch_7.setName("Sketch_8")
Sketch_7.result().setName("Sketch_8")
ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_8")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_5_1")])
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_6_1/Modfied_2"))
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_6_1/Modified_Face&Sketch_1/SketchLine_10"))
SketchLine_134 = Sketch_8.addLine(0.85, 50.75, -0.85, 50.75)
SketchLine_134.setName("SketchLine_139")
SketchLine_134.result().setName("SketchLine_139")
SketchConstraintCoincidence_149 = Sketch_8.setCoincident(SketchArc_62.startPoint(), SketchLine_134.endPoint())
SketchConstraintCoincidence_149.setName("SketchConstraintCoincidence_159")
SketchConstraintCoincidence_150 = Sketch_8.setCoincident(SketchArc_62.center(), SketchLine_137.result())
-SketchLine_140 = Sketch_8.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_6_1/Modfied_2"))
+SketchLine_140 = Sketch_8.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Sketch_1/SketchLine_1][ExtrusionCut_6_1/Modified_Face&Sketch_1/SketchLine_10]"))
SketchLine_140.setName("SketchLine_145")
SketchLine_140.result().setName("SketchLine_145")
SketchConstraintDistance_18 = Sketch_8.setDistance(SketchLine_140.result(), SketchPoint_12.coordinates(), 6)
model.do()
Sketch_8.setName("Sketch_9")
Sketch_8.result().setName("Sketch_9")
-ExtrusionCut_7 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_9/Face-SketchLine_147f-SketchLine_148f-SketchArc_64_2f-SketchArc_65_2f"), model.selection("FACE", "Sketch_9/Face-SketchLine_139f-SketchLine_141f-SketchArc_63_2f-SketchArc_62_2f"), model.selection("FACE", "Sketch_9/Face-SketchArc_66_2f-SketchArc_67_2f-SketchLine_149r-SketchLine_150r")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_6_1")])
+ExtrusionCut_7 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_9/Face-SketchLine_147f-SketchArc_65_2f-SketchLine_148f-SketchArc_64_2f"), model.selection("FACE", "Sketch_9/Face-SketchLine_139r-SketchArc_62_2f-SketchLine_141f-SketchArc_63_2f"), model.selection("FACE", "Sketch_9/Face-SketchArc_66_2f-SketchLine_150r-SketchArc_67_2f-SketchLine_149r")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_6_1")])
model.do()
# Test reexecution after parameter change
[SketchArc_5, SketchArc_6, SketchLine_6, SketchLine_7, SketchLine_8, SketchArc_7, SketchArc_8] = SketchConstraintMirror_1.mirrored()
SketchConstraintRadius_2 = Sketch_1.setRadius(SketchArc_2.results()[1], "dint/2")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchArc_2_2r-SketchArc_3_2r-SketchArc_4_2f-SketchArc_5_2r-SketchArc_6_2f-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchArc_7_2r-SketchArc_8_2f")], model.selection(), 35, 35)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchArc_3_2r-SketchLine_3f-SketchLine_4f-SketchLine_5f-SketchArc_4_2f-SketchArc_2_2r-SketchArc_5_2r-SketchArc_6_2f-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchArc_7_2r-SketchArc_8_2f")], model.selection(), 35, 35)
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
SketchArc_9 = Sketch_2.addArc(0, 106, 0, 78, 0, 134, True)
SketchConstraintRadius_3 = Sketch_2.setRadius(SketchArc_9.results()[1], 28)
SketchConstraintCoincidence_16 = Sketch_2.setCoincident(SketchArc_9.startPoint(), SketchLine_11.startPoint())
SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchArc_9.endPoint(), SketchLine_11.endPoint())
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_9_2f-SketchLine_11f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchArc_9_2r-SketchLine_11f")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_1_1")])
Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/YOZ"))
SketchLine_12 = Sketch_3.addLine(0, 106, -4, 106)
SketchLine_16.result().setName("SketchLine_17")
SketchConstraintCoincidence_22 = Sketch_3.setCoincident(SketchArc_10.endPoint(), SketchLine_16.result())
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_12f-SketchLine_13f-SketchArc_10_2f-SketchLine_17r-SketchLine_18r")], model.selection(), "172/2", "172/2")
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_12r-SketchLine_13f-SketchArc_10_2f-SketchLine_17r-SketchLine_18r_wire")], model.selection(), "172/2", "172/2")
Cut_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_1_1")], [model.selection("SOLID", "Extrusion_2_1")])
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_10"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"))
SketchLine_18 = Sketch_4.addLine(-65, 16, -65, -16)
SketchLine_18.setName("SketchLine_19")
SketchLine_18.result().setName("SketchLine_19")
SketchConstraintTangent_6 = Sketch_4.setTangent(SketchLine_21.result(), SketchArc_11.results()[1])
SketchConstraintTangent_7 = Sketch_4.setTangent(SketchArc_12.results()[1], SketchLine_20.result())
model.do()
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_4/Wire-SketchArc_11_2f-SketchArc_12_2f-SketchLine_21f-SketchLine_22r")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face_12"), 0)
-MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1")], model.selection("EDGE", "Extrusion_1_1/To_Face_1&Extrusion_1_1/Generated_Face_12"), -130, 2)
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_4/Face-SketchArc_11_2f-SketchLine_21f-SketchArc_12_2f-SketchLine_22r_wire")], model.selection(), model.selection(), 0, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3"), 0)
+LinearCopy_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1")], model.selection("EDGE", "[Extrusion_1_1/To_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3]"), -130, 2)
Cut_3 = model.addCut(Part_1_doc, [model.selection("SOLID", "Cut_2_1")], [model.selection("COMPOUND", "LinearCopy_1_1")])
model.do()
SketchConstraintLength_9 = Sketch_3.setLength(SketchLine_84.result(), "2*R_fillet")
SketchConstraintLength_10 = Sketch_3.setLength(SketchLine_83.result(), "2*R_fillet")
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "PartSet/Sketch_1")], model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_1"), 360, 0)
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face_1"))
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "PartSet/Sketch_1")], model.selection("EDGE", "PartSet/Sketch_1/SketchLine_1"), 360, 0)
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Revolution_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_8"))
SketchPoint_4 = Sketch_4.addPoint(model.selection("VERTEX", "PartSet/Origin"))
SketchLine_86 = Sketch_4.addLine(0, -13.49999999999519, 3.1, -13.49999999999519)
SketchLine_87 = Sketch_4.addLine(model.selection("EDGE", "PartSet/OZ"))
SketchConstraintCoincidence_62 = Sketch_4.setCoincident(SketchPoint_6.coordinates(), SketchLine_89.result())
SketchConstraintDistance_6 = Sketch_4.setDistance(SketchPoint_6.coordinates(), SketchLine_86.result(), 24.5)
model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face&PartSet/Sketch_1/SketchLine_3"), 0, model.selection(), 0, [model.selection("SOLID", "Revolution_1_1")])
RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection("EDGE", "PartSet/OX"), 0, 360, [model.selection("SOLID", "ExtrusionCut_1_1")])
ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 0, 5, [model.selection("SOLID", "RevolutionCut_1_1")])
model.do()
SketchConstraintRadius_11 = Sketch_1.setRadius(SketchArc_13.results()[1], 6.25)
SketchConstraintTangent_14 = Sketch_1.setTangent(SketchLine_6.result(), SketchArc_8.results()[1])
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_2_2r-SketchArc_3_2f-SketchArc_4_2r-SketchArc_5_2r-SketchArc_6_2r-SketchLine_3r-SketchLine_4f-SketchArc_7_2r-SketchCircle_1_2r-SketchCircle_2_2r-SketchArc_8_2f-SketchArc_9_2f-SketchArc_10_2r-SketchLine_6r-SketchArc_11_2f-SketchLine_7f-SketchArc_12_2f-SketchArc_13_2r-SketchArc_14_2f-SketchArc_15_2f-SketchArc_16_2r")], model.selection(), 0, 2)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_8_2f-SketchLine_7f-SketchArc_11_2f-SketchArc_13_2r-SketchArc_12_2f-SketchArc_14_2f-SketchArc_15_2f-SketchArc_16_2r-SketchArc_9_2f-SketchArc_10_2r-SketchLine_6r-SketchCircle_1_2r-SketchArc_3_2f-SketchArc_5_2r-SketchArc_4_2r-SketchArc_2_2r-SketchLine_3r-SketchArc_7_2r-SketchLine_4f-SketchArc_6_2r-SketchCircle_2_2r")], model.selection(), 0, 2)
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
-SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_7"))
+SketchPoint_1 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchArc_7"))
SketchArc_17 = Sketch_2.addArc(-24.92, -4.314010717669617e-016, -24.92, 7.500000000006299, -24.92, -7.500000000006299, True)
SketchConstraintCoincidence_41 = Sketch_2.setCoincident(SketchPoint_1.result(), SketchArc_17.center())
-SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_8_2s-SketchLine_6s"))
-SketchPoint_3 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/Vertex-SketchArc_6-SketchArc_8"))
+SketchPoint_2 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchArc_8_2_StartVertex"))
+SketchPoint_3 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchArc_6"))
SketchArc_18 = Sketch_2.addArc(-34.92, 0, -34.91999999999937, 7.500000000006299, -34.92003434105975, -7.500000000006299, False)
SketchConstraintCoincidence_42 = Sketch_2.setCoincident(SketchPoint_3.result(), SketchArc_18.center())
SketchConstraintCoincidence_43 = Sketch_2.setCoincident(SketchPoint_2.result(), SketchArc_18.startPoint())
SketchConstraintHorizontal_5 = Sketch_2.setHorizontal(SketchLine_9.result())
SketchConstraintTangent_15 = Sketch_2.setTangent(SketchLine_8.result(), SketchArc_17.results()[1])
SketchConstraintTangent_16 = Sketch_2.setTangent(SketchArc_17.results()[1], SketchLine_9.result())
-SketchPoint_4 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/Edge-SketchCircle_2_2__cc"))
+SketchPoint_4 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchCircle_2_2__cc"))
SketchCircle_3 = Sketch_2.addCircle(-7.5, 18.75, 8.125)
SketchConstraintCoincidence_48 = Sketch_2.setCoincident(SketchPoint_4.result(), SketchCircle_3.center())
-SketchArc_19 = Sketch_2.addArc(model.selection("EDGE", "Sketch_1/Edge-SketchArc_9_2"))
+SketchArc_19 = Sketch_2.addArc(model.selection("EDGE", "Sketch_1/SketchArc_9_2"))
SketchConstraintEqual_1 = Sketch_2.setEqual(SketchCircle_3.results()[1], SketchArc_19.results()[1])
-SketchPoint_5 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/Edge-SketchCircle_1_2__cc"))
+SketchPoint_5 = Sketch_2.addPoint(model.selection("VERTEX", "Sketch_1/SketchCircle_1_2__cc"))
SketchCircle_4 = Sketch_2.addCircle(0, 0, 8.75)
SketchConstraintCoincidence_49 = Sketch_2.setCoincident(SketchPoint_5.result(), SketchCircle_4.center())
SketchConstraintRadius_12 = Sketch_2.setRadius(SketchCircle_4.results()[1], "17.5/2")
model.do()
-Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_8"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_17_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"), model.selection("EDGE", "Sketch_2/Edge-SketchArc_18_2"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_6_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_1/Edge-SketchArc_7_2"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_4")])
-Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_3_2"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_2_2")])
-Face_3 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchCircle_4_2"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2")])
+Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchLine_8"), model.selection("EDGE", "Sketch_2/SketchArc_17_2"), model.selection("EDGE", "Sketch_2/SketchLine_9"), model.selection("EDGE", "Sketch_2/SketchArc_18_2"), model.selection("EDGE", "Sketch_1/SketchArc_6_2"), model.selection("EDGE", "Sketch_1/SketchLine_3"), model.selection("EDGE", "Sketch_1/SketchArc_7_2"), model.selection("EDGE", "Sketch_1/SketchLine_4")])
+Face_2 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_3_2"), model.selection("EDGE", "Sketch_1/SketchCircle_2_2")])
+Face_3 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/SketchCircle_4_2"), model.selection("EDGE", "Sketch_1/SketchCircle_1_2")])
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Face_1_1"), model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_3_1")], model.selection(), 2, 0)
Boolean_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1"), model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2"), model.selection("SOLID", "Extrusion_2_3")], [])
model.do()
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_5.result(), 32)
SketchConstraintTangent_8 = Sketch_1.setTangent(SketchArc_4.results()[1], SketchLine_6.result())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchLine_3f-SketchLine_5r-SketchLine_6r-SketchArc_1_2f-SketchArc_2_2f-SketchArc_3_2f-SketchArc_4_2f")], model.selection(), 76, 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchLine_7 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_3_2f-SketchLine_3f-SketchArc_4_2f-SketchLine_6r-SketchArc_2_2f-SketchLine_5r-SketchArc_1_2f-SketchLine_1r")], model.selection(), 76, 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchLine_7 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/To_Face]"))
SketchLine_7.setName("SketchLine_8")
SketchLine_7.result().setName("SketchLine_8")
SketchLine_8 = Sketch_2.addLine(21, 45.99999999998655, 20.99999999998684, 0)
SketchLine_8.setName("SketchLine_9")
SketchLine_8.result().setName("SketchLine_9")
SketchLine_8.setAuxiliary(True)
-SketchLine_9 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1"))
+SketchLine_9 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/To_Face]"))
SketchLine_9.setName("SketchLine_10")
SketchLine_9.result().setName("SketchLine_10")
SketchConstraintCoincidence_17 = Sketch_2.setCoincident(SketchLine_8.startPoint(), SketchLine_9.result())
SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_18")
-SketchLine_10 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/To_Face_1"))
+SketchLine_10 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/To_Face]"))
SketchLine_10.setName("SketchLine_11")
SketchLine_10.result().setName("SketchLine_11")
SketchConstraintCoincidence_18 = Sketch_2.setCoincident(SketchLine_8.endPoint(), SketchLine_10.result())
SketchConstraintCoincidence_18.setName("SketchConstraintCoincidence_19")
SketchConstraintMiddle_1 = Sketch_2.setMiddlePoint(SketchLine_8.startPoint(), SketchLine_9.result())
SketchConstraintMiddle_2 = Sketch_2.setMiddlePoint(SketchLine_8.endPoint(), SketchLine_10.result())
-SketchLine_11 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/To_Face_1"))
+SketchLine_11 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/To_Face]"))
SketchLine_11.setName("SketchLine_12")
SketchLine_11.result().setName("SketchLine_12")
SketchPoint_1 = Sketch_2.addPoint(20.99999999999342, 22.99999999999327)
SketchConstraintRadius_3 = Sketch_2.setRadius(SketchCircle_2.results()[1], 2.5)
SketchConstraintDistance_3 = Sketch_2.setDistance(SketchLine_12.result(), SketchCircle_4.center(), 8)
model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchCircle_1_2f"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_2_2r"), model.selection("WIRE", "Sketch_2/Wire-SketchCircle_3_2f")], model.selection(), 0, 15, [model.selection("SOLID", "Extrusion_1_1")])
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")], model.selection(), model.selection("FACE", "Extrusion_1_1/From_Face_1"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r_wire"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_1_2f-SketchCircle_2_2r-SketchCircle_3_2r-SketchCircle_4_2r_wire_2"), model.selection("WIRE", "Sketch_2/Face-SketchCircle_3_2f_wire")], model.selection(), 0, 15, [model.selection("SOLID", "Extrusion_1_1")])
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_4_2f")], model.selection(), model.selection("FACE", "Extrusion_1_1/From_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
Sketch_3 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
SketchCircle_5 = Sketch_3.addCircle(20.99999999999342, 22.99999999999327, 19)
SketchConstraintRadius_4 = Sketch_3.setRadius(SketchCircle_5.results()[1], 19)
SketchLine_13.setName("SketchLine_14")
SketchLine_13.result().setName("SketchLine_14")
SketchLine_13.setAuxiliary(True)
-SketchLine_14 = Sketch_3.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&Extrusion_1_1/Generated_Face_5"))
+SketchLine_14 = Sketch_3.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"))
SketchLine_14.setName("SketchLine_15")
SketchLine_14.result().setName("SketchLine_15")
SketchConstraintCoincidence_26 = Sketch_3.setCoincident(SketchLine_13.startPoint(), SketchLine_14.result())
SketchConstraintCoincidence_26.setName("SketchConstraintCoincidence_27")
-SketchLine_15 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_2_1/Modfied_2"))
+SketchLine_15 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face]"))
SketchLine_15.setName("SketchLine_16")
SketchLine_15.result().setName("SketchLine_16")
SketchConstraintCoincidence_27 = Sketch_3.setCoincident(SketchLine_13.endPoint(), SketchLine_15.result())
SketchLine_16.setName("SketchLine_17")
SketchLine_16.result().setName("SketchLine_17")
SketchLine_16.setAuxiliary(True)
-SketchLine_17 = Sketch_3.addLine(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&Extrusion_1_1/Generated_Face_3"))
+SketchLine_17 = Sketch_3.addLine(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"))
SketchLine_17.setName("SketchLine_18")
SketchLine_17.result().setName("SketchLine_18")
SketchConstraintCoincidence_28 = Sketch_3.setCoincident(SketchLine_16.startPoint(), SketchLine_17.result())
SketchConstraintCoincidence_28.setName("SketchConstraintCoincidence_29")
-SketchLine_18 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_3"))
+SketchLine_18 = Sketch_3.addLine(model.selection("EDGE", "Sketch_1/SketchLine_3"))
SketchLine_18.setName("SketchLine_19")
SketchLine_18.result().setName("SketchLine_19")
SketchConstraintCoincidence_29 = Sketch_3.setCoincident(SketchLine_16.endPoint(), SketchLine_18.result())
SketchConstraintDistance_4 = Sketch_3.setDistance(SketchCircle_6.center(), SketchCircle_7.center(), 16)
SketchConstraintDistance_5 = Sketch_3.setDistance(SketchCircle_6.center(), SketchLine_16.result(), 8)
model.do()
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2f-SketchCircle_6_2r-SketchCircle_7_2r")], model.selection(), 15, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_5_2r-SketchCircle_7_2r-SketchCircle_6_2r")], model.selection(), 15, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
ExtrusionCut_3.result().setName("ExtrusionCut_3_1")
-Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_3"))
-SketchProjection_1 = Sketch_4.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&Extrusion_1_1/Generated_Face_2"))
+Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5"))
+SketchProjection_1 = Sketch_4.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2]"), False)
SketchLine_19 = SketchProjection_1.createdFeature()
SketchLine_19.setName("SketchLine_20")
SketchLine_19.result().setName("SketchLine_20")
-SketchProjection_2 = Sketch_4.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_5&Extrusion_1_1/Generated_Face_4"))
+SketchProjection_2 = Sketch_4.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"), False)
SketchLine_20 = SketchProjection_2.createdFeature()
SketchLine_20.setName("SketchLine_21")
SketchLine_20.result().setName("SketchLine_21")
SketchLine_21 = Sketch_4.addLine(4.999999999999999, -28, 37, -28)
SketchLine_21.setName("SketchLine_22")
SketchLine_21.result().setName("SketchLine_22")
-SketchLine_22 = Sketch_4.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_3"))
+SketchLine_22 = Sketch_4.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5]"))
SketchLine_22.setName("SketchLine_23")
SketchLine_22.result().setName("SketchLine_23")
SketchConstraintCoincidence_34 = Sketch_4.setCoincident(SketchLine_21.startPoint(), SketchLine_22.result())
SketchConstraintCoincidence_34.setName("SketchConstraintCoincidence_35")
-SketchLine_23 = Sketch_4.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_4"))
+SketchLine_23 = Sketch_4.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_5][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_2_2]"))
SketchLine_23.setName("SketchLine_24")
SketchLine_23.result().setName("SketchLine_24")
SketchConstraintCoincidence_35 = Sketch_4.setCoincident(SketchLine_21.endPoint(), SketchLine_23.result())
SketchConstraintMiddle_11 = Sketch_4.setMiddlePoint(SketchLine_27.startPoint(), SketchLine_19.result())
SketchConstraintMiddle_12 = Sketch_4.setMiddlePoint(SketchLine_25.result(), SketchLine_27.startPoint())
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_22r-SketchLine_25f-SketchLine_26f-SketchLine_27r-SketchArc_5_2f-SketchArc_6_2f-SketchArc_7_2f-SketchArc_8_2f")], model.selection(), 2, 17)
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_1"))
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchArc_5_2f-SketchLine_26f-SketchArc_6_2f-SketchLine_25f-SketchArc_8_2f-SketchLine_27r-SketchArc_7_2f-SketchLine_22r")], model.selection(), 2, 17)
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face"))
SketchLine_28 = Sketch_5.addLine(5.000000000000001, -46, 37.00000000000001, -46)
SketchLine_28.setName("SketchLine_29")
SketchLine_28.result().setName("SketchLine_29")
SketchConstraintVertical_3 = Sketch_5.setVertical(SketchLine_31.result())
SketchConstraintEqual_8 = Sketch_5.setEqual(SketchLine_29.result(), SketchLine_28.result())
SketchConstraintEqual_9 = Sketch_5.setEqual(SketchLine_31.result(), SketchLine_30.result())
-SketchLine_32 = Sketch_5.addLine(model.selection("EDGE", "Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_1"))
+SketchLine_32 = Sketch_5.addLine(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_4/SketchLine_26][Extrusion_2_1/To_Face]"))
SketchLine_32.setName("SketchLine_33")
SketchLine_32.result().setName("SketchLine_33")
SketchConstraintDistance_7 = Sketch_5.setDistance(SketchLine_30.endPoint(), SketchLine_32.result(), 2)
-SketchLine_33 = Sketch_5.addLine(model.selection("EDGE", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/To_Face_1"))
+SketchLine_33 = Sketch_5.addLine(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_4/SketchLine_27][Extrusion_2_1/To_Face]"))
SketchLine_33.setName("SketchLine_34")
SketchLine_33.result().setName("SketchLine_34")
SketchConstraintDistance_8 = Sketch_5.setDistance(SketchLine_31.startPoint(), SketchLine_33.result(), 2)
-SketchLine_34 = Sketch_5.addLine(model.selection("EDGE", "Extrusion_2_1/Generated_Face_1&Extrusion_2_1/To_Face_1"))
+SketchLine_34 = Sketch_5.addLine(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_4/SketchLine_22][Extrusion_2_1/To_Face]"))
SketchLine_34.setName("SketchLine_35")
SketchLine_34.result().setName("SketchLine_35")
SketchConstraintDistance_9 = Sketch_5.setDistance(SketchLine_29.startPoint(), SketchLine_34.result(), 2)
-SketchLine_35 = Sketch_5.addLine(model.selection("EDGE", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/To_Face_1"))
+SketchLine_35 = Sketch_5.addLine(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_4/SketchLine_25][Extrusion_2_1/To_Face]"))
SketchLine_35.setName("SketchLine_36")
SketchLine_35.result().setName("SketchLine_36")
SketchConstraintDistance_10 = Sketch_5.setDistance(SketchLine_28.startPoint(), SketchLine_35.result(), 2)
SketchConstraintMiddle_16 = Sketch_5.setMiddlePoint(SketchLine_37.endPoint(), SketchLine_35.result())
SketchConstraintDistance_12 = Sketch_5.setDistance(SketchCircle_8.center(), SketchLine_37.result(), 8)
model.do()
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_5/Wire-SketchLine_29f-SketchLine_30r-SketchLine_31r-SketchLine_32r-SketchArc_9_2f-SketchArc_10_2f-SketchArc_11_2f-SketchArc_12_2f")], model.selection(), 0, 15, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "ExtrusionCut_3_1")])
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_5/Face-SketchLine_29r-SketchArc_12_2f-SketchLine_32r-SketchArc_11_2f-SketchLine_30r-SketchArc_9_2f-SketchLine_31r-SketchArc_10_2f-SketchCircle_9_2r-SketchCircle_8_2r_wire")], model.selection(), 0, 15, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "ExtrusionCut_3_1")])
ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchCircle_8_2f"), model.selection("FACE", "Sketch_5/Face-SketchCircle_9_2f")], model.selection(), 0, 20, [model.selection("SOLID", "ExtrusionCut_4_1"), model.selection("SOLID", "ExtrusionCut_4_2")])
Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "PartSet/YOZ"))
SketchLine_38 = Sketch_6.addLine(-59, 44, -59, 2)
SketchConstraintLength_4 = Sketch_6.setLength(SketchLine_43.result(), 20)
SketchConstraintLength_5 = Sketch_6.setLength(SketchLine_44.result(), 15)
SketchConstraintLength_6 = Sketch_6.setLength(SketchLine_39.result(), 42)
-SketchProjection_3 = Sketch_6.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/Generated_Face_6"))
+SketchProjection_3 = Sketch_6.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2]"), False)
SketchLine_46 = SketchProjection_3.createdFeature()
SketchLine_46.setName("SketchLine_47")
SketchLine_46.result().setName("SketchLine_47")
-SketchProjection_4 = Sketch_6.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_1_1/Modfied_1"))
+SketchProjection_4 = Sketch_6.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_2_2)(ExtrusionCut_1_1/Generated_Face&Sketch_2/SketchCircle_1_2)]"), False)
SketchLine_47 = SketchProjection_4.createdFeature()
SketchLine_47.setName("SketchLine_48")
SketchLine_47.result().setName("SketchLine_48")
-SketchProjection_5 = Sketch_6.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/Generated_Face_6"))
+SketchProjection_5 = Sketch_6.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2]"), False)
SketchLine_48 = SketchProjection_5.createdFeature()
SketchLine_48.setName("SketchLine_49")
SketchLine_48.result().setName("SketchLine_49")
SketchConstraintDistance_13 = Sketch_6.setDistance(SketchLine_38.endPoint(), SketchLine_46.result(), 2)
SketchConstraintDistance_14 = Sketch_6.setDistance(SketchLine_38.startPoint(), SketchLine_47.result(), 17)
model.do()
-ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_5"), -2, model.selection(), -2, [model.selection("SOLID", "ExtrusionCut_5_2")])
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"))
+ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_6")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"), -2, model.selection(), -2, [model.selection("SOLID", "ExtrusionCut_5_2")])
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1"))
SketchLine_49 = Sketch_7.addLine(0, -22.99999999998656, -76, -22.99999999998655)
SketchLine_49.setName("SketchLine_50")
SketchLine_49.result().setName("SketchLine_50")
SketchLine_49.setAuxiliary(True)
-SketchLine_50 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_3_1/Modfied_2"))
+SketchLine_50 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_2_2)(ExtrusionCut_3_1/Generated_Face&Sketch_3/SketchCircle_5_2)]"))
SketchLine_50.setName("SketchLine_51")
SketchLine_50.result().setName("SketchLine_51")
SketchConstraintCoincidence_74 = Sketch_7.setCoincident(SketchLine_49.startPoint(), SketchLine_50.result())
SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_75")
-SketchPoint_3 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_2/Vertex-SketchLine_13s"))
+SketchPoint_3 = Sketch_7.addPoint(model.selection("VERTEX", "Sketch_2/SketchLine_13_StartVertex"))
SketchConstraintCoincidence_75 = Sketch_7.setCoincident(SketchLine_49.endPoint(), SketchPoint_3.result())
SketchConstraintCoincidence_75.setName("SketchConstraintCoincidence_76")
SketchConstraintMiddle_17 = Sketch_7.setMiddlePoint(SketchLine_49.startPoint(), SketchLine_50.result())
SketchLine_51.setName("SketchLine_52")
SketchLine_51.result().setName("SketchLine_52")
SketchLine_51.setAuxiliary(True)
-SketchLine_52 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_4_2/Modfied_3"))
+SketchLine_52 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2]"))
SketchLine_52.setName("SketchLine_53")
SketchLine_52.result().setName("SketchLine_53")
SketchConstraintCoincidence_76 = Sketch_7.setCoincident(SketchLine_51.startPoint(), SketchLine_52.result())
SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_77")
-SketchLine_53 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/Generated_Face_1"))
+SketchLine_53 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"))
SketchLine_53.setName("SketchLine_54")
SketchLine_53.result().setName("SketchLine_54")
SketchConstraintCoincidence_77 = Sketch_7.setCoincident(SketchLine_51.endPoint(), SketchLine_53.result())
SketchConstraintCoincidence_79.setName("SketchConstraintCoincidence_80")
SketchConstraintRadius_8 = Sketch_7.setRadius(SketchCircle_10.results()[1], 17)
model.do()
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_7/Wire-SketchCircle_10_2f")], model.selection(), 16, 0)
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_3_1/To_Face_1"))
-SketchProjection_6 = Sketch_8.addProjection(model.selection("EDGE", "Sketch_2/Edge-SketchLine_9"))
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_7/Face-SketchCircle_10_2f_wire")], model.selection(), 16, 0)
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_3_1/To_Face"))
+SketchProjection_6 = Sketch_8.addProjection(model.selection("EDGE", "Sketch_2/SketchLine_9"), False)
SketchLine_54 = SketchProjection_6.createdFeature()
SketchLine_54.setName("SketchLine_55")
SketchLine_54.result().setName("SketchLine_55")
-SketchProjection_7 = Sketch_8.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_3_1/Modfied_2"))
+SketchProjection_7 = Sketch_8.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_2_2)(ExtrusionCut_3_1/Generated_Face&Sketch_3/SketchCircle_5_2)]"), False)
SketchLine_55 = SketchProjection_7.createdFeature()
SketchLine_55.setName("SketchLine_56")
SketchLine_55.result().setName("SketchLine_56")
SketchConstraintCoincidence_83 = Sketch_8.setCoincident(SketchLine_57.result(), SketchPoint_5.coordinates())
SketchConstraintCoincidence_83.setName("SketchConstraintCoincidence_84")
SketchConstraintPerpendicular_1 = Sketch_8.setPerpendicular(SketchLine_57.result(), SketchLine_56.result())
-SketchProjection_8 = Sketch_8.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_1&ExtrusionCut_4_2/Modfied_3"))
+SketchProjection_8 = Sketch_8.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2]"), False)
SketchLine_58 = SketchProjection_8.createdFeature()
SketchLine_58.setName("SketchLine_59")
SketchLine_58.result().setName("SketchLine_59")
-SketchProjection_9 = Sketch_8.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/Generated_Face_1"))
+SketchProjection_9 = Sketch_8.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1]"), False)
SketchLine_59 = SketchProjection_9.createdFeature()
SketchLine_59.setName("SketchLine_60")
SketchLine_59.result().setName("SketchLine_60")
SketchConstraintDistance_16 = Sketch_8.setDistance(SketchCircle_11.center(), SketchCircle_12.center(), 16)
model.do()
Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchCircle_11_2f"), model.selection("FACE", "Sketch_8/Face-SketchCircle_12_2f")], model.selection(), 17, 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "ExtrusionCut_3_1/Modfied_2"), 38, True)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_3_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_3)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_1_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2)(Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6)(ExtrusionCut_4_2/Modified_Face&Sketch_1/SketchArc_2_2)(ExtrusionCut_3_1/Generated_Face&Sketch_3/SketchCircle_5_2)"), 38, True)
Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchLine_60 = Sketch_9.addLine(-14, -36.99999999998992, 0, -36.99999999998992)
SketchLine_60.setName("SketchLine_61")
SketchLine_64.setName("SketchLine_65")
SketchLine_64.result().setName("SketchLine_65")
SketchLine_64.setAuxiliary(True)
-SketchPoint_6 = Sketch_9.addPoint(model.selection("VERTEX", "Sketch_8/Vertex-SketchPoint_5"))
+SketchPoint_6 = Sketch_9.addPoint(model.selection("VERTEX", "Sketch_8/SketchPoint_5"))
SketchConstraintCoincidence_92 = Sketch_9.setCoincident(SketchLine_64.result(), SketchPoint_6.coordinates())
SketchConstraintCoincidence_92.setName("SketchConstraintCoincidence_93")
SketchConstraintHorizontal_13 = Sketch_9.setHorizontal(SketchLine_64.result())
SketchConstraintCoincidence_93 = Sketch_9.setCoincident(SketchLine_62.startPoint(), SketchLine_64.result())
SketchConstraintCoincidence_93.setName("SketchConstraintCoincidence_94")
-SketchLine_65 = Sketch_9.addLine(model.selection("EDGE", "Sketch_7/Edge-SketchLine_52"))
+SketchLine_65 = Sketch_9.addLine(model.selection("EDGE", "Sketch_7/SketchLine_52"))
SketchLine_65.setName("SketchLine_66")
SketchLine_65.result().setName("SketchLine_66")
SketchConstraintCoincidence_94 = Sketch_9.setCoincident(SketchLine_60.endPoint(), SketchLine_65.result())
SketchConstraintCoincidence_94.setName("SketchConstraintCoincidence_95")
model.do()
-RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection("EDGE", "Sketch_9/Edge-SketchLine_65"), 360, 0, [model.selection("SOLID", "Extrusion_3_1")])
+RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("COMPOUND", "Sketch_9")], model.selection("EDGE", "Sketch_9/SketchLine_65"), 360, 0, [model.selection("SOLID", "Extrusion_3_1")])
model.do()
from GeomAPI import GeomAPI_Shape
SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_1.result(), SketchArc_6.endPoint(), "(h4-d_diff)*coeff")
SketchConstraintLength_2 = Sketch_1.setLength(SketchLine_10.result(), "d1*coeff")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1f-SketchArc_1_2f-SketchLine_3f-SketchArc_2_2r-SketchLine_4f-SketchArc_3_2r-SketchLine_5f-SketchArc_4_2f-SketchLine_6f-SketchLine_7r-SketchLine_8r-SketchArc_5_2r-SketchLine_9r-SketchArc_6_2f-SketchLine_10r-SketchArc_7_2f-SketchLine_11r-SketchArc_8_2r-SketchLine_12r-SketchLine_13r")], model.selection(), "epaisseur_plat*coeff", 0)
-Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), "d2*coeff", True)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchLine_3f-SketchArc_2_2r-SketchLine_4f-SketchArc_3_2r-SketchLine_5f-SketchArc_4_2f-SketchLine_6f-SketchLine_13r-SketchLine_12r-SketchArc_8_2r-SketchLine_11r-SketchArc_7_2f-SketchLine_10r-SketchArc_6_2f-SketchLine_9r-SketchArc_5_2r-SketchLine_8r-SketchLine_7r_wire")], model.selection(), "epaisseur_plat*coeff", 0)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7"), "d2*coeff", True)
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_7&Extrusion_1_1/Generated_Face_6"), False)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_7_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10]"), False)
SketchLine_14 = SketchProjection_1.createdFeature()
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_8&Extrusion_1_1/To_Face_1"), False)
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_11][Extrusion_1_1/To_Face]"), False)
SketchLine_15 = SketchProjection_2.createdFeature()
SketchLine_16 = Sketch_2.addLine(-24.99999999999999, -35.00000000000001, -31.24999999999999, -35.00000000000001)
SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchAPI_Line(SketchLine_14).endPoint(), SketchLine_16.startPoint())
SketchConstraintRadius_4 = Sketch_2.setRadius(SketchArc_12.results()[1], "r3*coeff")
SketchConstraintDistance_13 = Sketch_2.setDistance(SketchArc_10.startPoint(), SketchLine_19.result(), "d8*coeff")
model.do()
-Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Wire-SketchLine_16r-SketchArc_9_2f-SketchLine_17r-SketchArc_10_2f-SketchLine_18r-SketchLine_19r-SketchLine_20r-SketchArc_11_2r-SketchLine_21r-SketchArc_12_2r-SketchLine_22r-SketchLine_23f")], model.selection(), "d6*coeff", 0)
-Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face_3"))
+Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_2/Face-SketchLine_23f-SketchLine_22r-SketchArc_12_2r-SketchLine_21r-SketchArc_11_2r-SketchLine_20r-SketchLine_19r-SketchLine_18r-SketchArc_10_2f-SketchLine_17r-SketchArc_9_2f-SketchLine_16r_wire")], model.selection(), "d6*coeff", 0)
+Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_17"))
SketchLine_24 = Sketch_3.addLine(46.25, 22.91561885925604, 51.3, 20.00000000000001)
-SketchLine_25 = Sketch_3.addLine(model.selection("EDGE", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/To_Face_1"))
+SketchLine_25 = Sketch_3.addLine(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_17][Extrusion_2_1/To_Face]"))
SketchLine_26 = Sketch_3.addLine(51.3, 20.00000000000001, 62.50000000000001, 20.00000000000001)
SketchConstraintCoincidence_42 = Sketch_3.setCoincident(SketchLine_24.endPoint(), SketchLine_26.startPoint())
SketchLine_27 = Sketch_3.addLine(62.50000000000001, 20.00000000000001, 62.5, -4.999999999999999)
SketchConstraintVertical_13 = Sketch_3.setVertical(SketchLine_33.result())
SketchConstraintVertical_14 = Sketch_3.setVertical(SketchLine_31.result())
SketchConstraintAngle_1 = Sketch_3.setAngleComplementary(SketchLine_26.result(), SketchLine_24.result(), "angle")
-SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_4"))
+SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_18][Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_10_2]"), False)
SketchLine_34 = SketchProjection_3.createdFeature()
-SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_1"))
+SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_2_1/Generated_Face&Sketch_2/SketchArc_9_2][Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_16]"), False)
SketchLine_35 = SketchProjection_4.createdFeature()
SketchConstraintCoincidence_51 = Sketch_3.setCoincident(SketchLine_28.endPoint(), SketchLine_34.result())
SketchConstraintDistance_15 = Sketch_3.setDistance(SketchLine_31.result(), SketchLine_33.endPoint(), "(d6-d5)*coeff")
SketchConstraintDistance_17 = Sketch_3.setDistance(SketchLine_26.result(), SketchAPI_Line(SketchLine_35).startPoint(), "h2*coeff")
SketchConstraintLength_4 = Sketch_3.setLength(SketchLine_26.result(), "d7*coeff")
model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_24r-SketchLine_26r-SketchLine_27r-SketchLine_28r-SketchLine_29r")], model.selection(), model.selection("FACE", "Extrusion_2_1/Generated_Face_6"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_2_1")])
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_30r-SketchLine_31r-SketchLine_32r-SketchLine_33r")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face_1"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
-Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), "d3*coeff", True)
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_29r-SketchLine_28r-SketchLine_27r-SketchLine_26r-SketchLine_24r")], model.selection(), model.selection("FACE", "Extrusion_2_1/Generated_Face&Sketch_2/SketchLine_19"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_2_1")])
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchLine_33r-SketchLine_32r-SketchLine_31r-SketchLine_30r")], model.selection(), model.selection("FACE", "Extrusion_1_1/To_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7"), "d3*coeff", True)
Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2"))
-SketchProjection_5 = Sketch_4.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/To_Face_1"))
+SketchProjection_5 = Sketch_4.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_9][Extrusion_1_1/To_Face]"), False)
SketchLine_36 = SketchProjection_5.createdFeature()
-SketchProjection_6 = Sketch_4.addProjection(model.selection("EDGE", "ExtrusionCut_2_1/Modfied_8&ExtrusionCut_2_1/Modfied_9"))
+SketchProjection_6 = Sketch_4.addProjection(model.selection("EDGE", "[ExtrusionCut_2_1/Modified_Face&Sketch_2/SketchLine_23][ExtrusionCut_2_1/Generated_Face&Sketch_3/SketchLine_31]"), False)
SketchLine_37 = SketchProjection_6.createdFeature()
-SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/Generated_Face_5"))
+SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_6_2]"), False)
SketchLine_38 = SketchProjection_7.createdFeature()
SketchLine_39 = Sketch_4.addLine(-25, -35.00000000000001, -31.24999999999999, -35.00000000000001)
SketchConstraintCoincidence_55 = Sketch_4.setCoincident(SketchAPI_Line(SketchLine_37).startPoint(), SketchLine_39.startPoint())
SketchConstraintDistance_19 = Sketch_4.setDistance(SketchLine_41.endPoint(), SketchLine_40.result(), "epaisseur*coeff")
SketchConstraintDistance_20 = Sketch_4.setDistance(SketchLine_41.startPoint(), SketchLine_39.result(), "h2")
model.do()
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_4/Wire-SketchLine_39r-SketchArc_13_2f-SketchLine_40r-SketchLine_41r-SketchLine_42r-SketchArc_14_2r-SketchLine_43r-SketchLine_44f")], model.selection(), 0, "e1*coeff")
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"))
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_4/Face-SketchLine_44f-SketchLine_43r-SketchArc_14_2r-SketchLine_42r-SketchLine_41r-SketchLine_40r-SketchArc_13_2f-SketchLine_39r_wire")], model.selection(), 0, "e1*coeff")
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_2/SketchLine_18"))
SketchCircle_1 = Sketch_5.addCircle(70, 17.5, 3.125)
-SketchLine_45 = Sketch_5.addLine(model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5&ExtrusionCut_1_1/Modfied_4"))
+SketchLine_45 = Sketch_5.addLine(model.selection("EDGE", "[ExtrusionCut_1_1/Modified_Face&Sketch_2/SketchLine_19][ExtrusionCut_1_1/Modified_Face&Sketch_2/SketchLine_18]"))
SketchConstraintDistance_21 = Sketch_5.setDistance(SketchCircle_1.center(), SketchLine_45.result(), "d9*coeff")
-SketchProjection_8 = Sketch_5.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_12&Extrusion_1_1/Generated_Face_11"))
+SketchProjection_8 = Sketch_5.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_13]"))
SketchLine_46 = SketchProjection_8.createdFeature()
-SketchProjection_9 = Sketch_5.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_20&Extrusion_1_1/Generated_Face_1"))
+SketchProjection_9 = Sketch_5.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]"), False)
SketchLine_47 = SketchProjection_9.createdFeature()
SketchConstraintDistance_22 = Sketch_5.setDistance(SketchCircle_1.center(), SketchLine_47.result(), "d1*coeff")
SketchConstraintRadius_7 = Sketch_5.setRadius(SketchCircle_1.results()[1], "r_trou")
model.do()
-ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchCircle_1_2f")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modfied_6"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
-Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_6"))
+ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchCircle_1_2r")], model.selection(), model.selection("FACE", "ExtrusionCut_1_1/Modified_Face&Sketch_2/SketchLine_20"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+Sketch_6 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10"))
SketchCircle_2 = Sketch_6.addCircle(70, -17.5, 5)
-SketchLine_48 = Sketch_6.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_6&Extrusion_1_1/To_Face_1"))
-SketchProjection_10 = Sketch_6.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1"))
+SketchLine_48 = Sketch_6.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10][Extrusion_1_1/To_Face]"))
+SketchProjection_10 = Sketch_6.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_8][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]"), False)
SketchLine_49 = SketchProjection_10.createdFeature()
SketchConstraintDistance_23 = Sketch_6.setDistance(SketchCircle_2.center(), SketchLine_49.result(), "d1*coeff")
SketchConstraintDistance_23.setName("SketchConstraintDistance_24")
SketchConstraintRadius_8 = Sketch_6.setRadius(SketchCircle_2.results()[1], "r_trou2")
-SketchLine_50 = Sketch_6.addLine(model.selection("EDGE", "Sketch_1/Edge-SketchLine_10"))
+SketchLine_50 = Sketch_6.addLine(model.selection("EDGE", "Sketch_1/SketchLine_10"))
SketchConstraintDistance_24 = Sketch_6.setDistance(SketchCircle_2.center(), SketchLine_50.result(), "d_trou")
SketchConstraintDistance_24.setName("SketchConstraintDistance_25")
model.do()
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchCircle_2_2f")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_16"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_12"))
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchCircle_2_2r")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_4"), 0, model.selection(), 0, [model.selection("SOLID", "Extrusion_1_1")])
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"))
SketchLine_51 = Sketch_7.addLine(110, 21.46600893000899, 110, 7.22841614740048)
SketchLine_51.setAuxiliary(True)
-SketchLine_52 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_12&Extrusion_1_1/Generated_Face_11"))
+SketchLine_52 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_13]"))
SketchConstraintCoincidence_65 = Sketch_7.setCoincident(SketchLine_51.startPoint(), SketchLine_52.result())
SketchConstraintCoincidence_66 = Sketch_7.setCoincident(SketchLine_51.endPoint(), SketchLine_52.result())
-SketchLine_53 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_1_1/From_Face_1&Extrusion_1_1/Generated_Face_12"))
+SketchLine_53 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_1_1/From_Face][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"))
SketchArc_15 = Sketch_7.addArc(102.5, 7.22841614740048, 110, 7.22841614740048, 104.5, 0, True)
SketchConstraintCoincidence_67 = Sketch_7.setCoincident(SketchLine_51.endPoint(), SketchArc_15.startPoint())
SketchConstraintTangent_29 = Sketch_7.setTangent(SketchLine_51.result(), SketchArc_15.results()[1])
SketchLine_56 = Sketch_7.addLine(110, 12.5, 0, 12.5)
SketchLine_56.setAuxiliary(True)
SketchConstraintCoincidence_73 = Sketch_7.setCoincident(SketchLine_56.startPoint(), SketchLine_52.result())
-SketchLine_57 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_20&Extrusion_1_1/Generated_Face_1"))
+SketchLine_57 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_1][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_7]"))
SketchConstraintCoincidence_74 = Sketch_7.setCoincident(SketchLine_56.endPoint(), SketchLine_57.result())
SketchConstraintMiddle_1 = Sketch_7.setMiddlePoint(SketchLine_56.endPoint(), SketchLine_57.result())
SketchConstraintMiddle_2 = Sketch_7.setMiddlePoint(SketchLine_56.startPoint(), SketchLine_52.result())
-SketchProjection_11 = Sketch_7.addProjection(model.selection("EDGE", "Extrusion_1_1/To_Face_1&ExtrusionCut_4_1/Modfied_2"))
+SketchProjection_11 = Sketch_7.addProjection(model.selection("EDGE", "[Extrusion_1_1/To_Face][ExtrusionCut_4_1/Modified_Face&Sketch_1/SketchLine_4]"), False)
SketchLine_58 = SketchProjection_11.createdFeature()
SketchLine_59 = Sketch_7.addLine(55.00000000000002, 0, 55.00000000000002, 25)
SketchLine_59.setAuxiliary(True)
SketchConstraintMirror_2 = Sketch_7.addMirror(SketchLine_59.result(), SketchConstraintMirror_2_objects)
[SketchArc_17, SketchLine_63, SketchLine_64, SketchArc_18, SketchLine_65, SketchLine_66] = SketchConstraintMirror_2.mirrored()
model.do()
-ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_7/Wire-SketchArc_16_2r-SketchLine_61f-SketchLine_62r"), model.selection("FACE", "Sketch_7/Face-SketchArc_18_2r-SketchLine_65f-SketchLine_66r"), model.selection("FACE", "Sketch_7/Face-SketchArc_17_2r-SketchLine_64r-SketchLine_66r"), model.selection("WIRE", "Sketch_7/Wire-SketchArc_15_2r-SketchLine_54f-SketchLine_55r")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_10"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
+ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_7/Face-SketchLine_61f-SketchLine_62r-SketchArc_16_2r_wire"), model.selection("FACE", "Sketch_7/Face-SketchLine_65f-SketchLine_66r-SketchArc_18_2r"), model.selection("FACE", "Sketch_7/Face-SketchLine_63f-SketchLine_64r-SketchArc_17_2r"), model.selection("WIRE", "Sketch_7/Face-SketchLine_54f-SketchLine_55r-SketchArc_15_2r_wire")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_12"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_4_1")])
Boolean_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_5_1")], [model.selection("SOLID", "Extrusion_3_1"), model.selection("SOLID", "ExtrusionCut_3_1")])
model.do()
SketchConstraintCoincidence_10 = Sketch_1.setCoincident(SketchCircle_2.center(), SketchLine_3.result())
SketchConstraintCoincidence_10.setName("SketchConstraintCoincidence_11")
SketchConstraintEqual_1 = Sketch_1.setEqual(SketchArc_1.results()[1], SketchArc_2.results()[1])
-SketchArc_3 = Sketch_1.addArc(9.077705920073647e-31, -3.860574861749558e-31, 15.46247221747307, -11.0413745939477, 18.89444362769119, -2, False)
+SketchArc_3 = Sketch_1.addArc(0, 0, 15.46247221747307, -11.0413745939477, 18.89444362769119, -2, False)
SketchArc_3.setName("SketchArc_7")
SketchArc_3.result().setName("SketchArc_7")
SketchArc_3.results()[1].setName("SketchArc_7_2")
SketchConstraintCoincidence_11 = Sketch_1.setCoincident(SketchPoint_1.coordinates(), SketchArc_3.center())
SketchConstraintCoincidence_11.setName("SketchConstraintCoincidence_54")
-SketchArc_4 = Sketch_1.addArc(3.497294868556922e-32, 3.186289860391258e-33, 18.89444362769119, 2, 15.46247221747308, 11.04137459394768, False)
+SketchArc_4 = Sketch_1.addArc(0, 0, 18.89444362769119, 2, 15.46247221747308, 11.04137459394768, False)
SketchArc_4.setName("SketchArc_8")
SketchArc_4.result().setName("SketchArc_8")
SketchArc_4.results()[1].setName("SketchArc_8_2")
SketchConstraintCoincidence_14 = Sketch_1.setCoincident(SketchArc_3.startPoint(), SketchArc_6.startPoint())
SketchConstraintCoincidence_14.setName("SketchConstraintCoincidence_57")
SketchConstraintTangent_2 = Sketch_1.setTangent(SketchArc_3.results()[1], SketchArc_6.results()[1])
-SketchLine_4 = Sketch_1.addLine(17.5, 15, 37.99999999999999, 15)
+SketchLine_4 = Sketch_1.addLine(17.5, 15, 38, 15)
SketchLine_4.setName("SketchLine_42")
SketchLine_4.result().setName("SketchLine_42")
SketchConstraintCoincidence_15 = Sketch_1.setCoincident(SketchArc_5.endPoint(), SketchLine_4.startPoint())
SketchLine_6.result().setName("SketchLine_45")
SketchConstraintCoincidence_17 = Sketch_1.setCoincident(SketchArc_4.startPoint(), SketchLine_6.startPoint())
SketchConstraintCoincidence_17.setName("SketchConstraintCoincidence_61")
-SketchLine_7 = Sketch_1.addLine(37.99999999999999, 15, 38.00000000000001, 5.505556372308819)
+SketchLine_7 = Sketch_1.addLine(38, 15, 38, 5.505556372308819)
SketchLine_7.setName("SketchLine_46")
SketchLine_7.result().setName("SketchLine_46")
SketchConstraintCoincidence_18 = Sketch_1.setCoincident(SketchLine_4.endPoint(), SketchLine_7.startPoint())
SketchConstraintHorizontal_5.setName("SketchConstraintHorizontal_14")
SketchConstraintVertical_1 = Sketch_1.setVertical(SketchLine_7.result())
SketchConstraintVertical_1.setName("SketchConstraintVertical_7")
-SketchLine_8 = Sketch_1.addLine(40, 17, 40, -17.00000000000001)
+SketchLine_8 = Sketch_1.addLine(40, 17, 40, -17)
SketchLine_8.setName("SketchLine_47")
SketchLine_8.result().setName("SketchLine_47")
SketchLine_8.setAuxiliary(True)
SketchConstraintRadius_6.setName("SketchConstraintRadius_13")
SketchConstraintDistance_6 = Sketch_1.setDistance(SketchLine_4.endPoint(), SketchLine_8.result(), "2*coeff")
SketchConstraintDistance_6.setName("SketchConstraintDistance_19")
-SketchArc_7 = Sketch_1.addArc(40, 2.220450266386716e-15, 34.49444362769118, 2, 38.00000000000001, 5.505556372308819, True)
+SketchArc_7 = Sketch_1.addArc(40, 0, 34.49444362769118, 2, 38, 5.505556372308819, True)
SketchArc_7.setName("SketchArc_11")
SketchArc_7.result().setName("SketchArc_11")
SketchArc_7.results()[1].setName("SketchArc_11_2")
SketchConstraintCoincidence_22.setName("SketchConstraintCoincidence_66")
SketchConstraintCoincidence_23 = Sketch_1.setCoincident(SketchLine_6.endPoint(), SketchArc_7.startPoint())
SketchConstraintCoincidence_23.setName("SketchConstraintCoincidence_67")
-SketchArc_8 = Sketch_1.addArc(40.00000000000001, -2.652239435709897e-15, 34.49444362769118, -2, 37.95784774655168, -5.490060577298436, False)
+SketchArc_8 = Sketch_1.addArc(40, 0, 34.49444362769118, -2, 37.95784774655168, -5.490060577298436, False)
SketchArc_8.setName("SketchArc_12")
SketchArc_8.result().setName("SketchArc_12")
SketchArc_8.results()[1].setName("SketchArc_12_2")
SketchConstraintRadius_8.setName("SketchConstraintRadius_15")
SketchConstraintDistance_8 = Sketch_1.setDistance(SketchCircle_5.center(), SketchLine_2.result(), "4*coeff")
SketchConstraintDistance_8.setName("SketchConstraintDistance_22")
-SketchLine_10 = Sketch_1.addLine(17.5, -15, 34.00000000000001, -15)
+SketchLine_10 = Sketch_1.addLine(17.5, -15, 34, -15)
SketchLine_10.setName("SketchLine_43")
SketchLine_10.result().setName("SketchLine_43")
SketchConstraintCoincidence_31 = Sketch_1.setCoincident(SketchArc_6.endPoint(), SketchLine_10.startPoint())
SketchConstraintCoincidence_31.setName("SketchConstraintCoincidence_73")
-SketchArc_10 = Sketch_1.addArc(34.00000000000001, -13.48076923076937, 34.00000000000001, -15, 35.51437699680511, -13.35942492012782, False)
+SketchArc_10 = Sketch_1.addArc(34, -13.48076923076937, 34, -15, 35.51437699680511, -13.35942492012782, False)
SketchArc_10.setName("SketchArc_14")
SketchArc_10.result().setName("SketchArc_14")
SketchArc_10.results()[1].setName("SketchArc_14_2")
SketchLine_12.setName("SketchLine_50")
SketchLine_12.result().setName("SketchLine_50")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_4_2f-SketchLine_6r-SketchLine_10f-SketchArc_2_2f")], model.selection(), "h_p*coeff", 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchCircle_2_2"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_4_2f-SketchLine_10f-SketchArc_2_2f-SketchLine_6r-SketchArc_8_2f-SketchArc_9_2r-SketchLine_42f-SketchLine_46f-SketchArc_11_2f-SketchLine_45r-SketchArc_15_2r-SketchArc_16_2f-SketchLine_51f-SketchArc_17_2f-SketchLine_52r-SketchLine_50r-SketchCircle_11_2r-SketchArc_22_2f-SketchArc_21_2r-SketchLine_55f-SketchArc_20_2r-SketchArc_19_2f-SketchLine_54r-SketchArc_18_2f-SketchLine_53r-SketchArc_7_2f-SketchLine_44f-SketchArc_12_2f-SketchLine_48f-SketchArc_13_2f-SketchArc_14_2r-SketchLine_43r-SketchArc_10_2r-SketchCircle_1_2r-SketchCircle_2_2r_wire")], model.selection(), "h_p*coeff", 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
+SketchProjection_1 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchCircle_2_2"))
SketchCircle_6 = SketchProjection_1.createdFeature()
SketchCircle_6.setName("SketchCircle_5")
SketchCircle_6.result().setName("SketchCircle_5")
SketchCircle_6.results()[1].setName("SketchCircle_5_2")
-SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchCircle_4_2"))
+SketchProjection_2 = Sketch_2.addProjection(model.selection("EDGE", "Sketch_1/SketchCircle_4_2"))
SketchCircle_7 = SketchProjection_2.createdFeature()
SketchCircle_7.setName("SketchCircle_6")
SketchCircle_7.result().setName("SketchCircle_6")
SketchConstraintRadius_9.setName("SketchConstraintRadius_6")
model.do()
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_2")], model.selection(), "10*coeff", 0)
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_3_2f")], model.selection(), "p_trou1*coeff", 0, [model.selection("SOLID", "Extrusion_1_1")])
-ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_1_2r")], model.selection(), "p2_trou1*coeff", 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchCircle_3_2f_wire")], model.selection(), "p_trou1*coeff", 0, [model.selection("SOLID", "Extrusion_1_1")])
+ExtrusionCut_2 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_4_2f-SketchLine_10f-SketchArc_2_2f-SketchLine_6r-SketchArc_8_2f-SketchArc_9_2r-SketchLine_42f-SketchLine_46f-SketchArc_11_2f-SketchLine_45r-SketchArc_15_2r-SketchArc_16_2f-SketchLine_51f-SketchArc_17_2f-SketchLine_52r-SketchLine_50r-SketchCircle_11_2r-SketchArc_22_2f-SketchArc_21_2r-SketchLine_55f-SketchArc_20_2r-SketchArc_19_2f-SketchLine_54r-SketchArc_18_2f-SketchLine_53r-SketchArc_7_2f-SketchLine_44f-SketchArc_12_2f-SketchLine_48f-SketchArc_13_2f-SketchArc_14_2r-SketchLine_43r-SketchArc_10_2r-SketchCircle_1_2r-SketchCircle_2_2r_wire_7")], model.selection(), "p2_trou1*coeff", 0, [model.selection("SOLID", "ExtrusionCut_1_1")])
ExtrusionCut_3 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_4_2f")], model.selection(), "p_trou2*coeff", 0, [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "ExtrusionCut_2_1")])
-ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_2_2r")], model.selection(), "p2_trou*coeff", 0, [model.selection("SOLID", "ExtrusionCut_3_2")])
+ExtrusionCut_4 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchArc_4_2f-SketchLine_10f-SketchArc_2_2f-SketchLine_6r-SketchArc_8_2f-SketchArc_9_2r-SketchLine_42f-SketchLine_46f-SketchArc_11_2f-SketchLine_45r-SketchArc_15_2r-SketchArc_16_2f-SketchLine_51f-SketchArc_17_2f-SketchLine_52r-SketchLine_50r-SketchCircle_11_2r-SketchArc_22_2f-SketchArc_21_2r-SketchLine_55f-SketchArc_20_2r-SketchArc_19_2f-SketchLine_54r-SketchArc_18_2f-SketchLine_53r-SketchArc_7_2f-SketchLine_44f-SketchArc_12_2f-SketchLine_48f-SketchArc_13_2f-SketchArc_14_2r-SketchLine_43r-SketchArc_10_2r-SketchCircle_1_2r-SketchCircle_2_2r_wire_8")], model.selection(), "p2_trou*coeff", 0, [model.selection("SOLID", "ExtrusionCut_3_2")])
Plane_4 = model.addPlane(Part_1_doc, model.selection("FACE", "PartSet/XOY"), "22.5*coeff", False)
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), "45*coeff", True)
Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_2"))
-SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/Generated_Face_1"))
+SketchProjection_3 = Sketch_3.addProjection(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchArc_4_2][Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6]"), False)
SketchLine_18 = SketchProjection_3.createdFeature()
SketchLine_18.setName("SketchLine_4")
SketchLine_18.result().setName("SketchLine_4")
-SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_6"))
+SketchProjection_4 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_6"))
SketchLine_19 = SketchProjection_4.createdFeature()
SketchLine_19.setName("SketchLine_5")
SketchLine_19.result().setName("SketchLine_5")
SketchConstraintDistance_14 = Sketch_3.setDistance(SketchLine_23.result(), SketchLine_25.startPoint(), "2.5*coeff")
SketchConstraintDistance_14.setName("SketchConstraintDistance_12")
model.do()
-Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchLine_9r-SketchLine_12r-SketchLine_14r-SketchLine_26r-SketchLine_27r-SketchLine_28r")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_3"), 0, model.selection(), 0)
+Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchLine_14r-SketchLine_27r-SketchLine_26r-SketchLine_28r-SketchLine_12r-SketchLine_9r-SketchCircle_8_2r_wire")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_10"), 0, model.selection(), 0)
Smash_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_3_1")], [model.selection("SOLID", "ExtrusionCut_4_1")])
-ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_3/Wire-SketchCircle_8_2f")], model.selection(), 10, 0, [model.selection("SOLID", "Smash_1_1_1")])
+ExtrusionCut_5 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_3/Face-SketchCircle_8_2f_wire")], model.selection(), 10, 0, [model.selection("SOLID", "Smash_1_1_1")])
ExtrusionCut_6 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_3/Face-SketchCircle_8_2f")], model.selection(), 10, 0, [model.selection("SOLID", "ExtrusionCut_5_1_1")])
Sketch_4 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
SketchProjection_7 = Sketch_4.addProjection(model.selection("EDGE", "PartSet/OY"))
SketchConstraintLength_10 = Sketch_4.setLength(SketchLine_36.result(), 12.975642079145)
SketchConstraintLength_10.setName("SketchConstraintLength_7")
model.do()
-Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_4/Wire-SketchLine_19f-SketchLine_20f-SketchLine_24f-SketchLine_21f-SketchLine_22f-SketchLine_23f")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), 0, model.selection(), 0)
+Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_4/Face-SketchLine_19f-SketchLine_20f-SketchLine_21f-SketchLine_22f-SketchLine_23f-SketchLine_24f-SketchCircle_9_2r_wire")], model.selection(), model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_6"), 0, model.selection(), 0)
Smash_2 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_4_1")], [model.selection("COMPSOLID", "ExtrusionCut_6_1")])
ExtrusionCut_7 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchCircle_9_2f")], model.selection(), 0, 10, [model.selection("SOLID", "Smash_2_1_3")])
ExtrusionCut_8 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchCircle_9_2f")], model.selection(), 0, 10, [model.selection("SOLID", "ExtrusionCut_7_1_1")])
-Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Smash_2_1_3/Modified_Face_1"))
+Sketch_5 = model.addSketch(Part_1_doc, model.selection("FACE", "Smash_2_1_3/Modified_Face&Extrusion_1_1/From_Face"))
SketchPoint_3 = Sketch_5.addPoint(model.selection("VERTEX", "PartSet/Origin"))
SketchPoint_3.setName("SketchPoint_2")
SketchPoint_3.result().setName("SketchPoint_2")
SketchLine_39.result().setName("SketchLine_31")
SketchConstraintDistance_17 = Sketch_5.setDistance(SketchLine_37.result(), SketchLine_38.startPoint(), "epaisseur*coeff")
SketchConstraintDistance_17.setName("SketchConstraintDistance_13")
-SketchArc_19 = Sketch_5.addArc(2.175718373563154e-31, -6.039735315912772e-31, -13.96424004376904, 17, -13.964240043769, -17, False)
+SketchArc_19 = Sketch_5.addArc(0, 0, -13.964240043769, 17, -13.964240043769, -17, False)
SketchArc_19.setName("SketchArc_5")
SketchArc_19.result().setName("SketchArc_5")
SketchArc_19.results()[1].setName("SketchArc_5_2")
SketchConstraintCoincidence_59 = Sketch_5.setCoincident(SketchArc_19.endPoint(), SketchLine_37.startPoint())
SketchConstraintCoincidence_59.setName("SketchConstraintCoincidence_40")
model.do()
-Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchLine_29r-SketchLine_30r-SketchArc_5_2r-SketchLine_32r")], model.selection(), 0, "22*coeff")
+Extrusion_5 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_5/Face-SketchArc_5_2r-SketchLine_30r-SketchLine_32r-SketchLine_29r")], model.selection(), 0, "22*coeff")
Sketch_6_origin = GeomAPI_Pnt(0, 0, 0)
Sketch_6_norm = GeomAPI_Dir(0, 1, 0)
Sketch_6_dirx = GeomAPI_Dir(1, 0, 0)
SketchLine_41 = Sketch_6.addLine(-32, -17, -32, 17)
SketchLine_41.setName("SketchLine_33")
SketchLine_41.result().setName("SketchLine_33")
-SketchPoint_4 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/Vertex-SketchLine_32s-SketchLine_29e"))
+SketchPoint_4 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchLine_29_EndVertex"))
SketchPoint_4.setName("SketchPoint_3")
SketchPoint_4.result().setName("SketchPoint_3")
SketchConstraintCoincidence_60 = Sketch_6.setCoincident(SketchLine_41.startPoint(), SketchPoint_4.result())
SketchConstraintCoincidence_60.setName("SketchConstraintCoincidence_41")
-SketchPoint_5 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/Vertex-SketchLine_30s-SketchLine_32e"))
+SketchPoint_5 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchLine_30_StartVertex"))
SketchPoint_5.setName("SketchPoint_4")
SketchPoint_5.result().setName("SketchPoint_4")
SketchConstraintCoincidence_61 = Sketch_6.setCoincident(SketchLine_41.endPoint(), SketchPoint_5.result())
SketchConstraintCoincidence_61.setName("SketchConstraintCoincidence_42")
-SketchPoint_6 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/Vertex-SketchPoint_2-SketchArc_5-SketchLine_31s"))
+SketchPoint_6 = Sketch_6.addPoint(model.selection("VERTEX", "Sketch_5/SketchPoint_2"))
SketchPoint_6.setName("SketchPoint_5")
SketchPoint_6.result().setName("SketchPoint_5")
-SketchLine_42 = Sketch_6.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_30"))
+SketchLine_42 = Sketch_6.addLine(model.selection("EDGE", "Sketch_5/SketchLine_30"))
SketchLine_42.setName("SketchLine_34")
SketchLine_42.result().setName("SketchLine_34")
-SketchLine_43 = Sketch_6.addLine(model.selection("EDGE", "Sketch_5/Edge-SketchLine_29"))
+SketchLine_43 = Sketch_6.addLine(model.selection("EDGE", "Sketch_5/SketchLine_29"))
SketchLine_43.setName("SketchLine_35")
SketchLine_43.result().setName("SketchLine_35")
SketchArc_20 = Sketch_6.addArc(0, 0, -20.32855135026245, 17, -20.32855135026245, -17, False)
SketchConstraintRadius_13 = Sketch_6.setRadius(SketchArc_20.results()[1], "r1*coeff")
SketchConstraintRadius_13.setName("SketchConstraintRadius_10")
model.do()
-Extrusion_6 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchLine_33r-SketchArc_6_2r-SketchLine_36r-SketchLine_37f")], model.selection(), "77*coeff-h_p*coeff", 0)
-Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_6_1/Generated_Face_1"))
+Extrusion_6 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_6/Face-SketchLine_36r-SketchArc_6_2r-SketchLine_37f-SketchLine_33r")], model.selection(), "77*coeff-h_p*coeff", 0)
+Sketch_7 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_6_1/Generated_Face&Sketch_6/SketchLine_33"))
SketchLine_46 = Sketch_7.addLine(37, -8.881784197001252e-16, -22, 1.665334536937735e-15)
SketchLine_46.setName("SketchLine_38")
SketchLine_46.result().setName("SketchLine_38")
SketchLine_46.setAuxiliary(True)
-SketchLine_47 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_6_1/Generated_Face_1&Extrusion_6_1/To_Face_1"))
+SketchLine_47 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_6_1/Generated_Face&Sketch_6/SketchLine_33][Extrusion_6_1/To_Face]"))
SketchLine_47.setName("SketchLine_39")
SketchLine_47.result().setName("SketchLine_39")
SketchConstraintCoincidence_69 = Sketch_7.setCoincident(SketchLine_46.startPoint(), SketchLine_47.result())
SketchConstraintCoincidence_69.setName("SketchConstraintCoincidence_50")
-SketchLine_48 = Sketch_7.addLine(model.selection("EDGE", "Extrusion_5_1/Generated_Face_2&Extrusion_5_1/From_Face_1"))
+SketchLine_48 = Sketch_7.addLine(model.selection("EDGE", "[Extrusion_5_1/Generated_Face&Sketch_5/SketchLine_32][Extrusion_5_1/From_Face]"))
SketchLine_48.setName("SketchLine_40")
SketchLine_48.result().setName("SketchLine_40")
SketchConstraintCoincidence_70 = Sketch_7.setCoincident(SketchLine_46.endPoint(), SketchLine_48.result())
SketchConstraintRadius_14 = Sketch_7.setRadius(SketchCircle_11.results()[1], "r3")
SketchConstraintRadius_14.setName("SketchConstraintRadius_12")
model.do()
-ExtrusionCut_9 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_7/Wire-SketchCircle_10_2f")], model.selection(), 0, "10*coeff", [model.selection("SOLID", "Extrusion_6_1")])
-ExtrusionCut_10 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_7_2r-SketchArc_10_2f-SketchLine_44r-SketchArc_12_2r-SketchArc_13_2r-SketchLine_48r-SketchLine_43f-SketchArc_14_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_11_2f"), model.selection("WIRE", "Sketch_1/Wire-SketchLine_50f-SketchArc_15_2f-SketchArc_16_2r-SketchLine_51r-SketchArc_17_2r-SketchLine_52f"), model.selection("FACE", "Sketch_1/Face-SketchLine_53f-SketchArc_18_2r-SketchLine_54f-SketchArc_19_2r-SketchArc_20_2f-SketchLine_55r-SketchArc_21_2f-SketchArc_22_2r"), model.selection("FACE", "Sketch_1/Face-SketchArc_8_2r-SketchArc_9_2f-SketchLine_42r-SketchLine_45f-SketchLine_46r-SketchArc_11_2r")], model.selection(), model.selection("FACE", "ExtrusionCut_3_2/Modfied_1"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_8_1_2")])
-Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_9_1/Modfied_1"))
+ExtrusionCut_9 = model.addExtrusionCut(Part_1_doc, [model.selection("WIRE", "Sketch_7/Face-SketchCircle_10_2f_wire")], model.selection(), 0, "10*coeff", [model.selection("SOLID", "Extrusion_6_1")])
+ExtrusionCut_10_objects_1 = [model.selection("WIRE", "Sketch_1/Face-SketchArc_10_2f-SketchLine_43f-SketchArc_14_2f-SketchArc_13_2r-SketchLine_48r-SketchArc_12_2r-SketchLine_44r-SketchArc_7_2r_wire"), model.selection("FACE", "Sketch_1/Face-SketchCircle_11_2f"), model.selection("WIRE", "Sketch_1/Face-SketchLine_50f-SketchLine_52f-SketchArc_17_2r-SketchLine_51r-SketchArc_16_2r-SketchArc_15_2f_wire"), model.selection("FACE", "Sketch_1/Face-SketchLine_53f-SketchArc_18_2r-SketchLine_54f-SketchArc_19_2r-SketchArc_20_2f-SketchLine_55r-SketchArc_21_2f-SketchArc_22_2r"), model.selection("FACE", "Sketch_1/Face-SketchLine_45f-SketchArc_11_2r-SketchLine_46r-SketchLine_42r-SketchArc_9_2f-SketchArc_8_2r")]
+ExtrusionCut_10 = model.addExtrusionCut(Part_1_doc, ExtrusionCut_10_objects_1, model.selection(), model.selection("FACE", "ExtrusionCut_3_2/Modified_Face&Extrusion_1_1/To_Face"), 0, model.selection(), 0, [model.selection("SOLID", "ExtrusionCut_8_1_2")])
+Sketch_8 = model.addSketch(Part_1_doc, model.selection("FACE", "ExtrusionCut_9_1/Modified_Face&Sketch_6/SketchLine_33"))
SketchLine_50 = Sketch_8.addLine(37, 14.80042035331162, 37, -14)
SketchLine_50.setName("SketchLine_56")
SketchLine_50.result().setName("SketchLine_56")
SketchLine_50.setAuxiliary(True)
-SketchLine_51 = Sketch_8.addLine(model.selection("EDGE", "ExtrusionCut_9_1/Modfied_1&Extrusion_6_1/To_Face_1"))
+SketchLine_51 = Sketch_8.addLine(model.selection("EDGE", "[ExtrusionCut_9_1/Modified_Face&Sketch_6/SketchLine_33][Extrusion_6_1/To_Face]"))
SketchLine_51.setName("SketchLine_57")
SketchLine_51.result().setName("SketchLine_57")
SketchConstraintCoincidence_73 = Sketch_8.setCoincident(SketchLine_50.startPoint(), SketchLine_51.result())
SketchConstraintCoincidence_73.setName("SketchConstraintCoincidence_81")
SketchConstraintCoincidence_74 = Sketch_8.setCoincident(SketchLine_50.endPoint(), SketchLine_51.result())
SketchConstraintCoincidence_74.setName("SketchConstraintCoincidence_82")
-SketchLine_52 = Sketch_8.addLine(model.selection("EDGE", "Extrusion_6_1/Generated_Face_4&ExtrusionCut_9_1/Modfied_1"))
+SketchLine_52 = Sketch_8.addLine(model.selection("EDGE", "[Extrusion_6_1/Generated_Face&Sketch_6/SketchLine_36][ExtrusionCut_9_1/Modified_Face&Sketch_6/SketchLine_33]"))
SketchLine_52.setName("SketchLine_58")
SketchLine_52.result().setName("SketchLine_58")
-SketchArc_21 = Sketch_8.addArc(34, -14, 37, -14, 34.00000001126211, -17, True)
+SketchArc_21 = Sketch_8.addArc(34, -14, 37, -14, 33.9999999583228, -17, True)
SketchArc_21.setName("SketchArc_23")
SketchArc_21.result().setName("SketchArc_23")
SketchArc_21.results()[1].setName("SketchArc_23_2")
SketchConstraintCoincidence_76 = Sketch_8.setCoincident(SketchLine_52.result(), SketchArc_21.endPoint())
SketchConstraintCoincidence_76.setName("SketchConstraintCoincidence_84")
SketchConstraintTangent_7 = Sketch_8.setTangent(SketchArc_21.results()[1], SketchLine_52.result())
-SketchLine_53 = Sketch_8.addLine(34.00000002238511, -17, 37, -17)
+SketchLine_53 = Sketch_8.addLine(34, -17, 37, -17)
SketchLine_53.setName("SketchLine_59")
SketchLine_53.result().setName("SketchLine_59")
SketchConstraintCoincidence_77 = Sketch_8.setCoincident(SketchArc_21.endPoint(), SketchLine_53.startPoint())
SketchConstraintCoincidence_80.setName("SketchConstraintCoincidence_88")
SketchConstraintRadius_15 = Sketch_8.setRadius(SketchArc_21.results()[1], "3*coeff")
SketchConstraintRadius_15.setName("SketchConstraintRadius_16")
-SketchLine_55 = Sketch_8.addLine(model.selection("EDGE", "Sketch_7/Edge-SketchLine_38"))
+SketchLine_55 = Sketch_8.addLine(model.selection("EDGE", "Sketch_7/SketchLine_38"))
SketchLine_55.setName("SketchLine_61")
SketchLine_55.result().setName("SketchLine_61")
SketchConstraintMirror_2_objects = [SketchArc_21.results()[1], SketchLine_54.result(), SketchLine_53.result()]
SketchArc_22.result().setName("SketchArc_24")
SketchArc_22.results()[1].setName("SketchArc_24_2")
model.do()
-ExtrusionCut_11 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchArc_23_2r-SketchLine_59f-SketchLine_60r"), model.selection("WIRE", "Sketch_8/Wire-SketchArc_24_2r-SketchLine_62f-SketchLine_63r")], model.selection(), 0, "100*coeff", [model.selection("SOLID", "ExtrusionCut_9_1")])
-Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_5_1/Generated_Face_1"))
+ExtrusionCut_11 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_8/Face-SketchLine_59f-SketchLine_60r-SketchArc_23_2r"), model.selection("WIRE", "Sketch_8/Face-SketchLine_62f-SketchLine_63r-SketchArc_24_2r_wire")], model.selection(), 0, "100*coeff", [model.selection("SOLID", "ExtrusionCut_9_1")])
+Sketch_9 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_5_1/Generated_Face&Sketch_5/SketchLine_29"))
SketchLine_58 = Sketch_9.addLine(-32, -19, -32, -3.575047476349699)
SketchLine_58.setName("SketchLine_64")
SketchLine_58.result().setName("SketchLine_64")
SketchLine_58.setAuxiliary(True)
-SketchLine_59 = Sketch_9.addLine(model.selection("EDGE", "Extrusion_5_1/Generated_Face_1&Extrusion_5_1/Generated_Face_2"))
+SketchLine_59 = Sketch_9.addLine(model.selection("EDGE", "[Extrusion_5_1/Generated_Face&Sketch_5/SketchLine_32][Extrusion_5_1/Generated_Face&Sketch_5/SketchLine_29]"))
SketchLine_59.setName("SketchLine_65")
SketchLine_59.result().setName("SketchLine_65")
SketchConstraintCoincidence_81 = Sketch_9.setCoincident(SketchLine_58.startPoint(), SketchLine_59.result())
SketchConstraintCoincidence_81.setName("SketchConstraintCoincidence_89")
SketchConstraintCoincidence_82 = Sketch_9.setCoincident(SketchLine_58.endPoint(), SketchLine_59.result())
SketchConstraintCoincidence_82.setName("SketchConstraintCoincidence_90")
-SketchLine_60 = Sketch_9.addLine(model.selection("EDGE", "Extrusion_5_1/Generated_Face_1&Extrusion_5_1/From_Face_1"))
+SketchLine_60 = Sketch_9.addLine(model.selection("EDGE", "[Extrusion_5_1/Generated_Face&Sketch_5/SketchLine_29][Extrusion_5_1/From_Face]"))
SketchLine_60.setName("SketchLine_66")
SketchLine_60.result().setName("SketchLine_66")
SketchArc_23 = Sketch_9.addArc(-29, -19, -32, -19, -29.00002201340376, -22, False)
SketchConstraintRadius_16 = Sketch_9.setRadius(SketchArc_23.results()[1], "3*coeff")
SketchConstraintRadius_16.setName("SketchConstraintRadius_17")
model.do()
-ExtrusionCut_12 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_9/Face-SketchArc_25_2r-SketchLine_67f-SketchLine_68f")], model.selection(), 0, "100*coeff", [model.selection("SOLID", "Extrusion_5_1")])
+ExtrusionCut_12 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_9/Face-SketchLine_67f-SketchLine_68f-SketchArc_25_2r")], model.selection(), 0, "100*coeff", [model.selection("SOLID", "Extrusion_5_1")])
model.do()
from GeomAPI import GeomAPI_Shape
# checking for parametric update
Parameter_Epaisseur.setValue(33.9)
model.do()
-model.testResultsVolumes(Part_1, [118105.9369682])
+model.testResultsVolumes(Part_1, [122133.938213185])
Parameter_Epaisseur.setValue(34)
model.do()
model.testResultsVolumes(Part_1, [118190.673218984])
model.testNbSubShapes(Revolution_1, GeomAPI_Shape.VERTEX, [228])
model.testResultsVolumes(Revolution_1, [29055.346994571114919381216168404])
-Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), True)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Sketch_1/SketchPoint_2"), True)
Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Plane_1"))
-SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_2"), False)
+SketchProjection_3 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchPoint_2"), False)
SketchPoint_3 = SketchProjection_3.createdFeature()
-SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "Revolution_1_1/Generated_Face_28"), False)
+SketchProjection_4 = Sketch_2.addProjection(model.selection("EDGE", "([Revolution_1_1/Generated_Face&Sketch_1/SketchArc_1_2][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7])([Revolution_1_1/Generated_Face&Sketch_1/SketchLine_7][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_8])"), False)
SketchLine_36 = SketchProjection_4.createdFeature()
SketchCircle_1 = Sketch_2.addCircle(14.5, 0, 2.25)
SketchConstraintCoincidence_38 = Sketch_2.setCoincident(SketchPoint_3.result(), SketchCircle_1.center())
model.testNbSubShapes(ExtrusionCut_1, GeomAPI_Shape.VERTEX, [264])
model.testResultsVolumes(ExtrusionCut_1, [28943.115000463178148493170738220])
-Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "Revolution_1_1/Generated_Face_14&Revolution_1_1/Generated_Face_15")], "Fillet1")
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "[Revolution_1_1/Generated_Face&Sketch_1/SketchLine_21][Revolution_1_1/Generated_Face&Sketch_1/SketchLine_20]")], "Fillet1")
# check Fillet_1
model.testNbResults(Fillet_1, 1)
model.testNbSubResults(Fillet_1, [0])
model.testNbSubShapes(Fillet_1, GeomAPI_Shape.VERTEX, [272])
model.testResultsVolumes(Fillet_1, [28340.280766451105591841042041779])
-Fillet_2 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_4"), model.selection("FACE", "Revolution_1_1/Generated_Face_6"), model.selection("FACE", "Revolution_1_1/Generated_Face_8"), model.selection("FACE", "Revolution_1_1/Generated_Face_10")], "Fillet2")
+Fillet_2 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_31"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_29"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_27"), model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_25")], "Fillet2")
# check Fillet_2
model.testNbResults(Fillet_2, 1)
model.testNbSubResults(Fillet_2, [0])
model.testNbSubShapes(Fillet_2, GeomAPI_Shape.VERTEX, [336])
model.testResultsVolumes(Fillet_2, [28339.715350479829794494435191154])
-Fillet_3 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_16")], "Fillet3")
+Fillet_3 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_19")], "Fillet3")
# check Fillet_3
model.testNbResults(Fillet_3, 1)
model.testNbSubResults(Fillet_3, [0])
model.testNbSubShapes(Fillet_3, GeomAPI_Shape.VERTEX, [352])
model.testResultsVolumes(Fillet_3, [28338.609830057110229972749948502])
-Fillet_4 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_24")], "Fillet3")
+Fillet_4 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_11")], "Fillet3")
# check Fillet_4
model.testNbResults(Fillet_4, 1)
model.testNbSubResults(Fillet_4, [0])
model.testNbSubShapes(Fillet_4, GeomAPI_Shape.VERTEX, [368])
model.testResultsVolumes(Fillet_4, [28347.280717884430487174540758133])
-Fillet_5 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face_26")], "Fillet2")
+Fillet_5 = model.addFillet(Part_1_doc, [model.selection("FACE", "Revolution_1_1/Generated_Face&Sketch_1/SketchLine_9")], "Fillet2")
# check Fillet_5
model.testNbResults(Fillet_5, 1)
model.testNbSubResults(Fillet_5, [0])
SketchConstraintCoincidence_44 = Sketch_3.setCoincident(SketchLine_42.endPoint(), SketchLine_37.startPoint())
SketchProjection_5 = Sketch_3.addProjection(model.selection("EDGE", "PartSet/OX"), False)
SketchLine_43 = SketchProjection_5.createdFeature()
-SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_33"), False)
+SketchProjection_6 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_33"), False)
SketchLine_44 = SketchProjection_6.createdFeature()
-SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_33"), False)
+SketchProjection_7 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_33"), False)
SketchLine_45 = SketchProjection_7.createdFeature()
-SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_33"), False)
+SketchProjection_8 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_33"), False)
SketchLine_46 = SketchProjection_8.createdFeature()
-SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_32"), False)
+SketchProjection_9 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_32"), False)
SketchLine_47 = SketchProjection_9.createdFeature()
-SketchProjection_10 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_32"), False)
+SketchProjection_10 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_32"), False)
SketchLine_48 = SketchProjection_10.createdFeature()
-SketchProjection_11 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_32"), False)
+SketchProjection_11 = Sketch_3.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_32"), False)
SketchLine_49 = SketchProjection_11.createdFeature()
SketchConstraintVertical_13 = Sketch_3.setVertical(SketchLine_37.result())
SketchConstraintVertical_14 = Sketch_3.setVertical(SketchLine_39.result())
SketchConstraintVertical_16 = Sketch_4.setVertical(SketchLine_55.result())
SketchConstraintVertical_17 = Sketch_4.setVertical(SketchLine_58.result())
SketchConstraintHorizontal_11 = Sketch_4.setHorizontal(SketchLine_56.result())
-SketchProjection_13 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_24s-SketchLine_23e"), False)
+SketchProjection_13 = Sketch_4.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_23_EndVertex"), False)
SketchPoint_4 = SketchProjection_13.createdFeature()
SketchConstraintDistanceHorizontal_17 = Sketch_4.setHorizontalDistance(SketchAPI_Point(SketchPoint_4).coordinates(), SketchLine_52.endPoint(), "Drill2_Loc")
SketchConstraintDistanceHorizontal_18 = Sketch_4.setHorizontalDistance(SketchLine_54.startPoint(), SketchLine_54.endPoint(), "Drill2_InnerRadius")
-SketchProjection_14 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_20"), False)
+SketchProjection_14 = Sketch_4.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_20"), False)
SketchLine_59 = SketchProjection_14.createdFeature()
SketchConstraintAngle_6 = Sketch_4.setAngle(SketchLine_57.result(), SketchLine_56.result(), 45)
SketchConstraintMirror_2 = Sketch_4.addMirror(SketchLine_53.result(), [SketchLine_59.result()])
# check Sketch_4
model.checkSketch(Sketch_4, 0)
-RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_52r-SketchLine_54r-SketchLine_55r-SketchLine_56f-SketchLine_57f-SketchLine_58f-SketchArc_2_2f")], model.selection("EDGE", "Sketch_4/Edge-SketchLine_52"), 360, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
+RevolutionCut_1 = model.addRevolutionCut(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchLine_56f-SketchLine_57f-SketchLine_58f-SketchArc_2_2f-SketchLine_55r-SketchLine_54r-SketchLine_52r")], model.selection("EDGE", "Sketch_4/SketchLine_52"), 360, 0, [model.selection("SOLID", "ExtrusionCut_2_1")])
# check RevolutionCut_1
model.testNbResults(RevolutionCut_1, 1)
model.testNbSubResults(RevolutionCut_1, [0])
Sketch_5 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchLine_61 = Sketch_5.addLine(63.5, 10.5, 64, 10.5)
SketchLine_61.setAuxiliary(True)
-SketchProjection_15 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_1/Edge-SketchLine_7"), False)
+SketchProjection_15 = Sketch_5.addProjection(model.selection("EDGE", "Sketch_1/SketchLine_7"), False)
SketchLine_62 = SketchProjection_15.createdFeature()
SketchConstraintCoincidence_58 = Sketch_5.setCoincident(SketchLine_61.startPoint(), SketchLine_62.result())
SketchConstraintCoincidence_59 = Sketch_5.setCoincident(SketchAPI_Line(SketchLine_62).endPoint(), SketchLine_61.endPoint())
model.testNbSubShapes(Result, GeomAPI_Shape.VERTEX, [732])
model.testResultsVolumes(Result, [14144.443128843522572424262762070])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Plug/Modified_Face_27_1"), model.selection("FACE", "Plug/Modified_Face_26_1"), model.selection("FACE", "Plug/Modified_Face_28_1"), model.selection("FACE", "Plug/Modified_Face_32_1")])
-Group_1.result().setColor(68, 68, 68)
-# check Group_1
-model.checkGroup(Group_1, GeomAPI_Shape.FACE)
-
model.do()
# change parameters of the model
model.testNbSubShapes(Result, GeomAPI_Shape.VERTEX, [728])
model.testResultsVolumes(Result, [23373.503259112552768783643841743])
-model.checkGroup(Group_1, GeomAPI_Shape.FACE)
-
model.end()
assert(model.checkPythonDump())
model.testNbSubShapes(Extrusion_1, GeomAPI_Shape.VERTEX, [2160])
model.testResultsVolumes(Extrusion_1, [10398.453966298400700907222926617])
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face_1"))
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/To_Face"))
SketchCircle_3 = Sketch_2.addCircle(0, 0, 4.5)
SketchLine_125 = Sketch_2.addLine(0, 0, -24.375, 0)
SketchLine_125.setAuxiliary(True)
SketchConstraintDistance_5 = Sketch_1.setDistance(SketchLine_10.startPoint(), SketchLine_22.result(), 1, True)
SketchConstraintRadius_4 = Sketch_1.setRadius(SketchArc_6.results()[1], 15)
model.do()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_2r-SketchArc_1_2r-SketchLine_3r-SketchArc_2_2r-SketchArc_3_2f-SketchLine_8f-SketchLine_10f-SketchArc_5_2f-SketchLine_12f-SketchArc_6_2r-SketchLine_14r-SketchLine_16r-SketchArc_7_2r-SketchLine_17r-SketchLine_18r-SketchLine_20f-SketchArc_8_2f-SketchLine_23r-SketchArc_10_2f-SketchLine_24r")], model.selection("EDGE", "PartSet/OX"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_8f-SketchLine_10f-SketchLine_24r-SketchLine_23r-SketchArc_8_2f-SketchLine_19r-SketchLine_18r-SketchLine_17r-SketchArc_7_2r-SketchLine_16r-SketchArc_10_2f-SketchLine_12f-SketchArc_5_2f-SketchArc_6_2r-SketchLine_14r-SketchArc_3_2f-SketchArc_2_2r-SketchLine_3r-SketchArc_1_2r-SketchLine_2r")], model.selection("EDGE", "PartSet/OX"), 360, 0)
Sketch_2 = model.addSketch(Part_1_doc, model.defaultPlane("YOZ"))
SketchCircle_1 = Sketch_2.addCircle(0, 120, 7.5)
SketchLine_24 = Sketch_2.addLine(model.selection("EDGE", "PartSet/OZ"))