Hello,
i have a torus face and 4 edges that each edge share their vertexes positions with vertexes of other two edges (ie., they are a closed loop, prove if i create a compound of the 4 edges and use partition with it itself (without fuzzy!), it returns 4 edges and 4 vertexes).
the edges were projected over the torus face, with the execption of one of them that as it is over the seam of the torus face, when doing the projection it is horribly failing (wrong projection over torus seam · Issue #12 · SalomePlatform/geom · GitHub). for the ‘problematic’ edge, what i did instead of projecting it, is using the seam edge of the torus face, i use partition (without fuzzy!) over it using the two extreme vertexes of the edge that i wanted to ‘project’ and then keeping only the edge that would be the ‘projection’.
what I am looking to do is cut and keep only the inside of the torus face between these edges. so there is two approaches for this:
- use create face with build face 2nd option (face creation from surface bounded by wire)
pros:
- it gives ‘more or less’ the correct result, ie, what looks like the desired face
cons:
- it is using an approximation! (as when creating a wire there is a tolerance parameter where the 2. workflow it does not need at any point this tolerances) this is really problematic for me as I am looking to use the ‘exact’ edges (reason why i am not using fuzzy) as i need to merge it with other faces created with some of the same edges
- the ‘problematic’ edge (the one over the seam) results into several ‘small edges’ with a lot of vertex, obviously also problematic for previous reasons
- create a partition (without fuzzy!) of the original face and the projected edges (which one is the result of the cut of the seam instead of a projected object from the projection tool, as mentioned before) and then explode the partition result into faces and with some heuristics get the correct face
pros:
- there are no tolerances whats so ever
- it is using the edges and not the wire
cons:
- it is not working. this workflow has been working for any kind of cannonical type of faces without any issues, spheres, cylinders (ie., ‘SPHERE2D’,‘CYLINDER2D’) but with the ‘TORUS2D’ this is completly failing horrible.
so:
face +edges (with showing vertexes)
the resulting ‘parition’ of the face with the edges:
what I thought to do would be when I create the face (using method 2.) to check if it was ‘correctly’ created using:
if not geompy.CheckShape(newFace, theIsCheckGeom = 1, theReturnStatus = 0):
and if thats is true then fall back and use the 1. method, nevertheless this proved to be problematic as even the resulting strange face of the second image the output of CheckShape is still True. I thought this solution:
wire = geompy.MakeWire(edges, 1e-07)
[Xmin,Xmax, Ymin,Ymax, Zmin,Zmax] = geompy.BoundingBox(wire, True)
[Xmin_,Xmax_, Ymin_,Ymax_, Zmin_,Zmax_] = geompy.BoundingBox(newFace, True)
deltaX=Xmax-Xmin
deltaY=Ymax-Ymin
deltaZ=Zmax-Zmin
deltaX_=Xmax_-Xmin_
deltaY_=Ymax_-Ymin_
deltaZ_=Zmax_-Zmin_
flagToRecreate=not geompy.CheckShape(newFace, theIsCheckGeom = 1, theReturnStatus = 0)
if not(deltaX==0 and deltaX_==0):
errorX=abs(deltaX_-deltaX)/deltaX_*100
if errorX>FractionError:
flagToRecreate=True
if not(deltaY==0 and deltaY_==0):
errorY=abs(deltaY_-deltaY)/deltaY_*100
if errorY>FractionError:
flagToRecreate=True
if not(deltaZ==0 and deltaZ_==0):
errorZ=abs(deltaZ_-deltaZ)/deltaZ_*100
if errorZ>FractionError:
flagToRecreate=True
if flagToRecreate :
print('error or problem with the newFace created! creating it using entity and the wire of edges')
newFace = geompy.MakeFaceFromSurface(entity, wire)
this is a middle ground solution, but it is giving me a big issue, when doing in the TUI, SOMETIMES the geompy.MakeFaceFromSurface(entity, wire) keeps the ‘wrong’ side, but this does not happen in the GUI:
result from the TUI
this was obtained by doing:
wire = geompy.MakeWire(edges, 1e-07)
newFace = geompy.MakeFaceFromSurface(entity, wire)
geompy.addToStudy(entity,'face '+str(nFace))
geompy.addToStudy(wire,'wire of face '+str(nFace))
geompy.addToStudy(newFace,'newFace '+str(nFace))
nFace=19
neverthless if i take the object (‘face 19’ and ‘wire of face 19’) in the object browser and do:
→ build face → face creation from surface bounded by wire (2nd option) → select ‘face 19’ and ‘wire of face 19’ on the object browser and apply it I get the correct result:
so there is a clear discrepancy between the result from the TUI and the GUI
- how can I obtain the same result in the TUI?
- I am missing an option? flag?
- is there an extra step that is not done when doing
newFace = geompy.MakeFaceFromSurface(entity, wire)
?
in the information dialog of the object browser i have exactly the same thing for the result from the TUI and from the GUI:
I need to solve this as fast as I can as it is blocking my development, any inputs would be apreciated.