// TDataStd_IntPackedMap - indexes of edges in composite element (for construction)
// TDataStd_Integer - type of the selected shape (for construction)
// TDF_Reference - from ReferenceAttribute, the context
-
+#define DDDD 1
void Model_AttributeSelection::setValue(const ResultPtr& theContext,
const std::shared_ptr<GeomAPI_Shape>& theSubShape)
{
std::string aSelName = namingName();
if(!aSelName.empty())
TDataStd_Name::Set(selectionLabel(), aSelName.c_str()); //set name
-
+#ifdef DDDD
+ //####
+ //selectSubShape("FACE", "Extrusion_1/LateralFace_3");
+ //selectSubShape("FACE", "Extrusion_1/TopFace");
+#endif
myIsInitialized = true;
owner()->data()->sendAttributeUpdated(this);
}
{
TopoDS_Shape aSelection;
std::string::size_type n = theSubShapeName.rfind('/');
- if (n == std::string::npos) n = 1;
- std::string aSubString = theSubShapeName.substr(n);
+ if (n == std::string::npos) n = 0;
+ std::string aSubString = theSubShapeName.substr(n + 1);
n = aSubString.rfind('_');
if (n == std::string::npos) return aSelection;
aSubString = aSubString.substr(n+1);
const TopoDS_Shape findFaceByName(const std::string& theSubShapeName, std::shared_ptr<Model_Document> theDoc)
{
TopoDS_Shape aFace;
- const TDF_Label& aLabel = theDoc->findNamingName(theSubShapeName);
+ std::string::size_type n, nb = theSubShapeName.rfind('/');
+ if (nb == std::string::npos) nb = 0;
+ std::string aSubString = theSubShapeName.substr(nb + 1);
+ n = aSubString.rfind('_');
+ if (n != std::string::npos) {
+ std::string aSubStr2 = aSubString.substr(0, n);
+ aSubString = theSubShapeName.substr(0, nb + 1);
+ aSubString = aSubString + aSubStr2;
+ } else
+ aSubString = theSubShapeName;
+
+ const TDF_Label& aLabel = theDoc->findNamingName(aSubString);
if(aLabel.IsNull()) return aFace;
Handle(TNaming_NamedShape) aNS;
if(aLabel.FindAttribute(TNaming_NamedShape::GetID(), aNS)) {
}
return aFace;
}
+
+int ParseEdgeName(const std::string& theSubShapeName)
+{
+ int n = theSubShapeName.find('|');
+ if (n == std::string::npos) return 0;
+ std::string aName = theSubShapeName.substr(0, n); //name of face
+ std::string aSubString = theSubShapeName.substr(n + 1);
+ //...
+}
+// type ::= COMP | COMS | SOLD | SHEL | FACE | WIRE | EDGE | VERT
void Model_AttributeSelection::selectSubShape(const std::string& theType, const std::string& theSubShapeName)
{
if(theSubShapeName.empty() || theType.empty()) return;