CadQuery / CadQuery/cadquery

Refactor Face.makeFromWires

Open
#693 0 comments 0 reactions 0 assignees View on GitHub
OCC feature selectors
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

- [ ] Make it faster, e.g.
```python
face_builder = BRepBuilderAPI_MakeFace(outerWire.wrapped, True)

for w in innerWires:
face_builder.Add(w.wrapped)

face_builder.Build()
face = face_builder.Face()

from OCP.TopTools import TopTools_DataMapOfShapeListOfShape
from OCP.ShapeBuild import ShapeBuild_ReShape

mapwires = TopTools_DataMapOfShapeListOfShape()
ctx = ShapeBuild_ReShape()

fixer = ShapeFix_Face(face)
fixer.SetContext(ctx)
fixer.FixOrientation(mapwires)
fixer.FixSplitFace(mapwires)
#fixer.FixMissingSeam()
#fixer.Perform()
ts = TopoDS_Shape()
res = ctx.Value(ts)

hist = ctx.History()
if hist.HasModified():
res = hist.Modified(face).Last()
else:
res = fixer.Face()
```
- [ ] Check performance on a large (e.g. 30x30) array of holes
- [ ] Investigate if `sortWiresByBuildOrder` is really needed
- [ ] Throw a meaningful error
- [ ] Catch the error in relevant places (see below)

As mentioned in https://github.com/CadQuery/cadquery/pull/688#issuecomment-800512021, there is catch all exception in AreaNthSelector. `Face.makeFromWires` needs a bit of work and after that hopefully we can narrow down this try statement.

https://github.com/CadQuery/cadquery/blob/d5ce1321ca100c1d0b23968c09a8a8abb72ab986/cadquery/selectors.py#L539-L541

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.