Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Tree traversal based initialization for assembly solving#1890

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
lenianiva wants to merge10 commits intoCadQuery:master
base:master
Choose a base branch
Loading
fromlenianiva:assembly/solver

Conversation

@lenianiva
Copy link
Contributor

@lenianivalenianiva commentedAug 28, 2025
edited
Loading

Resolves#1868

This PR adds an optional initializer, which traverses through the constraint graph and locally solves every constraint with no degree of freedom. The traversal starts at fixed constraints. This provides a starting point for the solver to work with. If the constraint graph is a forest in which each tree has at most one fixed root, and each constraint has zero degree of freedom (e.g. axis with degree 0 or 180, or point), then this solves the constraints exactly.

Try this out:

importcadqueryasCqdefmk_marker()->Cq.Solid:returnCq.Solid.makeSphere(2)defmk_cube()->Cq.Solid:returnCq.Solid.makeBox(1.5,1.6,1.7)a= (Cq.Assembly()    .add(mk_marker(),name="m1",loc=Cq.Location(-1,0,0))    .add(mk_marker(),name="m2",loc=Cq.Location(0,1,0))    .add(mk_marker(),name="m3",loc=Cq.Location(0,0,1))    .add(mk_cube(),name="cube",loc=Cq.Location(0,0,0))    .constrain("m1","m2","Point")    .constrain("m2","m3","Point")    .constrain("m3","cube@faces@<Z","Point")    .solve(verbosity=5,tree_initialize=True))

withtree_initialize, the number of iteration drops from 11 to (...)

  • Implement tree traversal
  • Map each constraint point back to the object's location

@lenianivalenianiva marked this pull request as ready for reviewAugust 31, 2025 05:15
@lenianivalenianiva marked this pull request as draftAugust 31, 2025 18:34
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

A faster assembly solver

1 participant

@lenianiva

[8]ページ先頭

©2009-2025 Movatter.jp