yorik wrote: ↑Fri Jul 28, 2017 5:05 pm
Of course this would only work for very controllable objects like a box. But imagine an extrusion could also easily define a BaseFace
<snip>
(FilletBetweenFilletOfFilletBetweenAFaceAndAnotherFace, whatever form it would take)
<snip>
Not a very usable idea in itself, but maybe it can give you further ideas..
@yorik, i"m not sure if I follow your logic here. Or perhaps I have done a poor job explaining how the system I've described (and prototyped in Python) works. It seems that when you refer to a "Topological Name", you are looking for a
descriptive name that let's you find the given topological entity. In a very simple case of a Cube, a given Edge would be named "EdgeOfTopAndFrontFace" in the system you've described.
However, naming Edges does not need to be so complicated: indeed, the name of the Edge does not need to have a description of the faces that make it up. Rather, any given Edge simply needs to know the "name"s of the two faces that make it up.
Let's go back to my example from earlier:
Code: Select all
SolidTopoNamer::SolidTopoNamer(TopodDS_Solid aSolid){
i = 0;
std::vector<TopoDS_Face> faces = HelperClass.getFaces(aSolid);
for (auto&& face : faces){
this->addFace(face);
}
Notice in the constructor for SolidTopoNamer, there is no mention of a "top" face, "bottom" face, etc. Rather, a simple list of all the faces is taken and given a unique name - "Face1" through "Face6" in this case, based on how the `getName` method works. This solid could just as easily have been a 10-sided shape (dodecahedron?), it would not have made a difference, all that matters is that we give each face a name.
Now, suppose you want to fillet the Edge between the "top" and "front" face. That's fine, all you need to remember is that you have filleted "the Edge between Face1 and Face2".
So, in this simple SolidTopoNamer example, there might be a method 'SolidTopoNamer::nameEdge(TopoDS_Edge anEdge);' which similarly names edges as requested. the "nameEdge" method might look something like
Code: Select all
void SolidNamer::nameEdge(TopoDS_Edge anEdge){
std::vector<std::string> parentFaceNames;
// Again, excuse the pseudocode.
for (face in mySolid.faceNames){
for (edge in face.Edges){
if (edge.IsSame(anEdge)){
parentFaceNames.push_back(face.getName())
}
}
}
// edgeNames is a key-value list where each value is a pair of FaceNames. In
// python, it'd be a dictionary that looks something like this:
// edgeNames = {"Edge001": ['Face1', Face2'],
// "Edge002": ["Face1', "Face3"],etc..>}
this->addEdge(parentFaceNames);
}
TopoDS_Edge SolidNamer::getEdge(std::string edgeName){
// first, find the two faces that make up this edge
std::pair<std::string> parentFaceNames = GetValuesFormEdgeNamesDataStructure();
// Then, it is a simple matter of finding the one Edge that these two edges
// have in common
for (edge1 in face1.edges){
for (edge2 in face2.edges){
if (edge1.IsSame(edge2)){
return edge1;
}
}
}
}
Does this make my approach a bit more clear? Again, it's not really important
where the entity you want a name for is, all that really matters is that you know how to find it. Also, this is why it is import for `SolidNamer` to have methods such as `ModifyFace` and `AddFace`. If one of its named Faces changes, it needs to know so that the next time `getEdge` is called it is checking the correct object.