I will try to make a proposal for how we can use BRepOffsetAPI_DraftAngle to add the draft to the pad before it is fused/cut from the baseshape
Now I tried it. It was straight-forward to implement a proof of concept.
I simply inserted this code at the end of the pad execute, just before the fuse or the cut.
Code: Select all
double angle = 10.0*3.14/180.0; // hardcoded 10 degrees just for proof of concept
gp_Pln neutralPlane; // TODO: we need to define the plane from the support face. For now we hardcode XY plane
BRepOffsetAPI_DraftAngle mkDraft;
mkDraft.Init(prism); // prism is the shape that normal pad has made.
TopExp_Explorer xp;
for (xp.Init(prism, TopAbs_FACE); xp.More(); xp.Next())
{
TopoDS_Face face = TopoDS::Face(xp.Current());
// get the face normal
double umin, umax, vmin, vmax;
BRepTools::UVBounds(face,umin, umax, vmin, vmax);
Handle(Geom_Surface) aSurface = BRep_Tool::Surface(face);
GeomLProp_SLProps props(aSurface, umin, vmin, 1, 0.01);
gp_Dir normal = props.Normal();
if (std::fabs(normal*dir) > 1e-10)
continue;
mkDraft.Add(face, dir, angle, neutralPlane);
}
mkDraft.Build();
prism = mkDraft.Shape();
- Screenshot_20220111_224511.png (65.13 KiB) Viewed 1666 times
It works as expected. Inner and outer wires are supported automatically. The straight faces are planar and the circle genrated a cone shape. No BSpline.
keep in mind that we now have custom directions for pads an pockets so it's not sufficient to check if they are perpendicular, or are tapered pads only allowed for the normal direction?
Yes, indeed. It does not seem to work for arbitrary direction.
Appendix:
Something else that does not work is to extrude splines. How ironic