Closed jdegenstein closed 1 year ago
I retested this with the latest commit a few hours ago and I no longer get the error: Standard_NullObject: BRep_Tool:: TopoDS_Vertex hasn't gp_Pnt
that I was getting before. I still don't think the placement of the extrude is correct though, so I think this is half fixed, and luckily much easier to work around (since I can now manually correct the position and now I get valid geometry).
Correction, I can manually correct the position, but I now get warnings.warn(f"Unable to clean {self}")
which as I understand means that failed to clean. The issue is that it does not properly sew the 2nd body on top of first, leaving some gaps.
OK, I have done some more testing and simplified the above lengthy example:
from build123d import *
with BuildSketch() as vertwalls:
Rectangle(40,90)
with BuildPart() as mainp:
with BuildSketch() as main_sk:
Rectangle(50,100)
Extrude(amount=10)
topf = mainp.faces().sort_by(Axis.Z)[-1]
with BuildSketch(topf) as vertwalls2:
Add(vertwalls.sketch)
Extrude(amount=15)
show_object(mainp.part)
I believe that Add
does not properly respect the current location. With the above example, the "top face offset" is essentially applied twice leading to the floating box.
If we instead change BuildSketch
to Workplanes
we get this (also incorrect) result with the 2nd box starting from Plane.XY.
with BuildSketch() as vertwalls:
Rectangle(40,90)
with BuildPart() as mainp:
with BuildSketch() as main_sk:
Rectangle(50,100)
Extrude(amount=10)
topf = mainp.faces().sort_by(Axis.Z)[-1]
with Workplanes(topf) as vertwalls2:
Add(vertwalls.sketch)
Extrude(amount=15)
Finally if we eliminate the call to Add()
completely then we get the correct result:
with BuildPart() as mainp:
with BuildSketch() as main_sk:
Rectangle(50,100)
Extrude(amount=10)
topf = mainp.faces().sort_by(Axis.Z)[-1]
with BuildSketch(topf) as vertwalls:
Rectangle(40,90)
Extrude(amount=15)
The problem seems to be left-over from prior changes to sketch local/global - Add
should have used local_locations
(which used to be called just locations
) so this is the change:
- for location in LocationList._get_context().locations
+ for location in LocationList._get_context().local_locations
Now:
with BuildSketch() as vertwalls:
Rectangle(40, 90)
with BuildPart() as mainp:
with BuildSketch() as main_sk:
Rectangle(50, 100)
Extrude(amount=10)
topf = mainp.faces().sort_by(Axis.Z)[-1]
with BuildSketch(topf) as vertwalls2:
show_current_locations("In sketch")
show_current_workplanes("")
Add(vertwalls.sketch)
Extrude(amount=15)
generates:
and:
with BuildSketch() as vertwalls:
Rectangle(40, 90)
with BuildPart() as mainp:
with BuildSketch() as main_sk:
Rectangle(50, 100)
Extrude(amount=10)
topf = mainp.faces().sort_by(Axis.Z)[-1]
with Workplanes(topf) as vertwalls2:
Add(vertwalls.sketch)
Extrude(amount=15)
generates:
Closing the issue.
Workplane version doesn't seem to locate the face on the correct plane so the extrusions are different heights.
The changes to Add for BuildPart (2a0d9bb2461bd8ae792a3fc99b3435c5124354bd) now results in identical results for the two cases. Add is now able to use Locations as part of this change.
The part that is floating is 2x as high as I expected it to be. When I view
wallsAndPosts.sketch
it sits on top of the main part as expected, but when I extrude it -- it is in the position in the image. If I try and halve the offset toPlane.XY.offset(p_outerHeight/2)
then I get this error:Standard_NullObject: BRep_Tool:: TopoDS_Vertex hasn't gp_Pnt
.