myNotDumpedEntities.clear();
}
-const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity, bool theSaveNotDumped)
+const std::string& ModelHighAPI_Dumper::name(const EntityPtr& theEntity,
+ bool theSaveNotDumped,
+ bool theUseEntityName)
{
EntityNameMap::const_iterator aFound = myNames.find(theEntity);
if (aFound != myNames.end())
}
// obtain default name for the feature
- int aFullIndex = 0;
- NbFeaturesMap::const_iterator aFIt = myFeatureCount.begin();
- for (; aFIt != myFeatureCount.end(); ++aFIt) {
- std::map<std::string, int>::const_iterator aFound = aFIt->second.find(aKind);
- if (aFound != aFIt->second.end())
- aFullIndex += aFound->second;
+ if (theUseEntityName)
+ aDefaultName << aName;
+ else {
+ int aFullIndex = 0;
+ NbFeaturesMap::const_iterator aFIt = myFeatureCount.begin();
+ for (; aFIt != myFeatureCount.end(); ++aFIt) {
+ std::map<std::string, int>::const_iterator aFound = aFIt->second.find(aKind);
+ if (aFound != aFIt->second.end())
+ aFullIndex += aFound->second;
+ }
+ aDefaultName << aKind << "_" << aFullIndex;
}
- aDefaultName << aKind << "_" << aFullIndex;
// store names of results
saveResultNames(aFeature);
/// Returns name of specified entity
/// \param theEntity [in] named entity
/// \param theSaveNotDumped [in] if \c true, the entity should be stored as not dumped (will be dumped automatically)
+ /// \param theUseEntityName [in] if \c true, the entity name should be used "as is" without changing default name
/// \return name of the entity
MODELHIGHAPI_EXPORT
- const std::string& name(const EntityPtr& theEntity, bool theSaveNotDumped = true);
+ const std::string& name(const EntityPtr& theEntity, bool theSaveNotDumped = true, bool theUseEntityName = false);
/// Returns name of parent composite feature for specified entity
MODELHIGHAPI_EXPORT
{
FeaturePtr aBase = feature();
const std::string& aDocName = theDumper.name(aBase->document());
- const std::string& aParamName = theDumper.name(aBase, false);
+ const std::string& aParamName = theDumper.name(aBase, false, true);
AttributeStringPtr anExpr = aBase->string(ParametersPlugin_Parameter::EXPRESSION_ID());
AttributeStringPtr aComment = aBase->string(ParametersPlugin_Parameter::COMMENT_ID());
aStartPoint = geomDataAPI_Point2D(anOY.attribute("StartPoint"))
anEndPoint = geomDataAPI_Point2D(anOY.attribute("EndPoint"))
aStartPoint.setValue(0., 0.)
- anEndPoint.SetValue(0., 100.)
- anOY.selection("External").selectSubShape("EDGE", "OY")
+ anEndPoint.setValue(0., 100.)
+ anOYRes = modelAPI_Result(self.aDocument.objectByName("Construction", "OY"))
+ anOY.selection("External").setValue(anOYRes, anOYRes.shape())
+ anOY.execute()
refattrB.setObject(modelAPI_ResultConstruction(anOY.firstResult()))
value = aDistanceConstraint1.real("ConstraintValue")
value.setText("x1 + 10.0")
aStartPoint = geomDataAPI_Point2D(anOX.attribute("StartPoint"))
anEndPoint = geomDataAPI_Point2D(anOX.attribute("EndPoint"))
aStartPoint.setValue(0., 0.)
- anEndPoint.SetValue(100., 0.)
- anOX.selection("External").selectSubShape("EDGE", "OX")
+ anEndPoint.setValue(100., 0.)
+ anOXRes = modelAPI_Result(self.aDocument.objectByName("Construction", "OX"))
+ anOX.selection("External").setValue(anOXRes, anOXRes.shape())
+ anOX.execute()
refattrB.setObject(modelAPI_ResultConstruction(anOX.firstResult()))
value = aDistanceConstraint2.real("ConstraintValue")
value.setText("x1 + 20.0")
aStartPoint = geomDataAPI_Point2D(anOY.attribute("StartPoint"))
anEndPoint = geomDataAPI_Point2D(anOY.attribute("EndPoint"))
aStartPoint.setValue(0., 0.)
- anEndPoint.SetValue(0., 100.)
- anOY.selection("External").selectSubShape("EDGE", "OY")
+ anEndPoint.setValue(0., 100.)
+ anOYRes = modelAPI_Result(self.aDocument.objectByName("Construction", "OY"))
+ anOY.selection("External").setValue(anOYRes, anOYRes.shape())
+ anOY.execute()
refattrB.setObject(modelAPI_ResultConstruction(anOY.firstResult()))
valueX = aDistanceConstraint1.real("ConstraintValue")
valueX.setText("x1 + 10.0")
aStartPoint = geomDataAPI_Point2D(anOX.attribute("StartPoint"))
anEndPoint = geomDataAPI_Point2D(anOX.attribute("EndPoint"))
aStartPoint.setValue(0., 0.)
- anEndPoint.SetValue(100., 0.)
- anOX.selection("External").selectSubShape("EDGE", "OX")
+ anEndPoint.setValue(100., 0.)
+ anOXRes = modelAPI_Result(self.aDocument.objectByName("Construction", "OX"))
+ anOX.selection("External").setValue(anOXRes, anOXRes.shape())
+ anOX.execute()
refattrB.setObject(modelAPI_ResultConstruction(anOX.firstResult()))
valueY = aDistanceConstraint2.real("ConstraintValue")
valueY.setText("x1 + 20.0")
self.aCircleCenterX = valueX
self.aCircleCenterY = valueY
- sel.aCircleRadius = aRadiusConstraintAttr
+ self.aCircleRadius = aRadiusConstrAttr
self.assertEqual(self.anCircleCentr.x(), 160.)
self.assertEqual(self.anCircleCentr.y(), 170.)
class SketcherSetParallel(SketcherTestCase):
def runTest(self):
l1 = self.sketch.addLine(0, 0, 0, 1)
- l2 = self.sketch.addLine(0, 1, 1, 1)
+ l2 = self.sketch.addLine(0, 1, 1, 0)
self.sketch.setParallel(l1, l2)
model.do()