Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unconstrained assembly.solve() #592

Merged
merged 4 commits into from
Jan 21, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions cadquery/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,16 +400,17 @@ def solve(self) -> "Assembly":
constraints = []
for c in self.constraints:
constraints.append(((ents[c.objects[0]], ents[c.objects[1]]), c.toPOD()))

if not constraints == []:
adam-urbanczyk marked this conversation as resolved.
Show resolved Hide resolved
# instantiate the solver
solver = ConstraintSolver(locs, constraints, locked=[lock_ix])

# instantiate the solver
solver = ConstraintSolver(locs, constraints, locked=[lock_ix])

# solve
locs_new = solver.solve()
# solve
locs_new = solver.solve()

# update positions
for loc_new, n in zip(locs_new, ents):
self.objects[n].loc = loc_new
# update positions
for loc_new, n in zip(locs_new, ents):
self.objects[n].loc = loc_new

return self

Expand Down