Skip to content

Commit 917d918

Browse files
Option to control verbosity of assembly solver (#1198)
* Option to control verbosity of assembly solver * Convert to single line * black fix Co-authored-by: AU <[email protected]>
1 parent 24c21d5 commit 917d918

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cadquery/assembly.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def constrain(self, *args, param=None):
346346

347347
return self
348348

349-
def solve(self) -> "Assembly":
349+
def solve(self, verbosity: int = 0) -> "Assembly":
350350
"""
351351
Solve the constraints.
352352
"""
@@ -412,7 +412,7 @@ def solve(self) -> "Assembly":
412412
solver = ConstraintSolver(locs, constraints, locked=locked, scale=scale)
413413

414414
# solve
415-
locs_new, self._solve_result = solver.solve()
415+
locs_new, self._solve_result = solver.solve(verbosity)
416416

417417
# update positions
418418

cadquery/occ_impl/solver.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,9 @@ def _build_transform(self, T: ca.MX, R: ca.MX) -> gp_Trsf:
657657

658658
return rv
659659

660-
def solve(self) -> Tuple[List[Location], Dict[str, Any]]:
660+
def solve(self, verbosity: int = 0) -> Tuple[List[Location], Dict[str, Any]]:
661+
662+
suppress_banner = "yes" if verbosity == 0 else "no"
661663

662664
opti = self.opti
663665

@@ -709,7 +711,8 @@ def solve(self) -> Tuple[List[Location], Dict[str, Any]]:
709711
"nlp_scaling_method": "none",
710712
"honor_original_bounds": "yes",
711713
"bound_relax_factor": 0,
712-
"print_level": 5,
714+
"print_level": verbosity,
715+
"sb": suppress_banner,
713716
"print_timing_statistics": "no",
714717
"linear_solver": "mumps",
715718
},

0 commit comments

Comments
 (0)