For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Trying to find out what is wrong with my Brep shapes

Keith Sloan's picture
Forums: 

Okay I am trying to find out what is wrong with my Brep shapes.

The error shows up when I try a Boolean Subtraction in my FreeCAD application.

Attached is a screen shot of the boolean hierarchy and the objects which I saved as brep files
subtraction.png

In FreeCAD a check geometry just reveals fatal error on boolean or Boolean operation fails.

Is there a good tool for checking Brep shapes in Linux, Salome perhaps. Don't want to try
and install without a recommendation.

Thanks in anticipation

Attachments: 
Sergey Slyadnev's picture

The attached shapes seem to be empty. Are you sure you have correctly dumped them to BREP?

DBRep_DrawableShape

CASCADE Topology V1, (c) Matra-Datavision
Locations 0
Curve2ds 0
Curves 0
Polygon3D 0
PolygonOnTriangulations 0
Surfaces 0
Triangulations 0

TShapes 0

Keith Sloan's picture

Well if they are empty then that would explain why the boolean subtraction fails.
I will gp check both

Keith Sloan's picture

Shapes are indeed null, so have to find the bug that means this is the case.

Thanks for your help.

What did you use to list details? Drawexe?

Sergey Slyadnev's picture

This time just opened the files in Notepad wink

Keith Sloan's picture

Okay was not saving at the right stage. FreeCAD object created but Shape not created until
execute function called.

Attached are Brep's for the basic shapes concerned.

Still have to work out how I can save before and after of boolean

Attachments: 
Sergey Slyadnev's picture

Can you check if for the attached shapes a Boolean Operation works better? I had to remove manually degenerated faces with non-closed contours and then stictch the remaining faces to make the input BReps watertight.

Attachments: 
Keith Sloan's picture

I can import these Breps and a boolean subtraction works fine.

The problem is these shapes were created by API and I need to correct the code
so I am assuming from your comments I have some  faces that are not closed

for s in range(0,len(sections)-1) :
           xOffset1   = sections[s][1]
           yOffset1   = sections[s][2]
           zPosition1 = sections[s][3]
           sf1        = sections[s][4]
           xOffset2   = sections[s+1][1]
           yOffset2   = sections[s+1][2]
           zPosition2 = sections[s+1][3]
           sf2        = sections[s+1][4]
           print("polyList")
           for p in polyList :
              print(p)
              vb=FreeCAD.Vector(p[0]*sf1+xOffset1, p[1]*sf1+yOffset1,zPosition1)
              #vb=FreeCAD.Vector(-20, p[1]*sf1+yOffset1,zPosition1)
              vt=FreeCAD.Vector(p[0]*sf2+xOffset2, p[1]*sf2+yOffset2,zPosition2)
              #vt=FreeCAD.Vector(20, p[1]*sf2+yOffset2,zPosition2)
              baseList.append(vb)
              topList.append(vt)
           # close polygons
           baseList.append(baseList[0])
           topList.append(topList[0])
           # deal with base face w1 = Part.makePolygon(baseList)
           f1 = Part.Face(w1)
           #f1.reverse()
           faces_list.append(f1)
           print("base list")
           print(baseList)
           print("Top list")
           print(topList)
           # deal with side faces
           # remember first point is added to end of list
           for i in range(0,len(baseList)-1) :
               sideList = []
               sideList.append(baseList[i])
               sideList.append(baseList[i+1])
               sideList.append(topList[i+1])
               sideList.append(topList[i])
               # Close SideList polygon
                sideList.append(baseList[i])
                print("sideList")
                print(sideList)
                w1 = Part.makePolygon(sideList)
                f1 = Part.Face(w1)
                faces_list.append(f1)
          # deal with top face
          w1 = Part.makePolygon(topList)
          f1 = Part.Face(w1)
          faces_list.append(f1)
          print("Faces List")
          print(faces_list)
          shell=Part.makeShell(faces_list)
          #solid=Part.Solid(shell).removeSplitter()
           solid=Part.Solid(shell)
           print("Valid Solid : "+str(solid.isValid()))
            if solid.Volume < 0:
                solid.reverse()             
       solid.exportBrep("/tmp/"+fp.Label+".brep")
       fp.Shape = solid
      

Keith Sloan's picture

Okay the Brep for the failed boolean subtraction attached.

Keith Sloan's picture

Okay I loaded one of the breps from 50002.zip into FreeCAD and did a check geometry
it reports 8 vertex which is correct. 13 edges where as I think there should be 12. Face 7 and
wires 7 where as there should be 6.

Thanks for your help I now have more to go on.

Keith Sloan's picture

Code now fixed.

Thanks again