Well if they are empty then that would explain why the boolean subtraction fails.
I will gp check both
03Author
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?
04Commenter-1
This time just opened the files in Notepad Archived image: wink
05Author
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
06Commenter-1
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.
07Author
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
08Author
Okay the Brep for the failed boolean subtraction attached.
09Author
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.