question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Apply Multiple Constraints to the Same Part

See original GitHub issue

I’ve got a single servo that I’m trying to fully constrain in place in relation to a chassis. I’m not sure how to apply multiple constraints at once to a single part. If I do the following, only the first coincident constraint seems to be respected.

def make_constraints(self):
        return [
            Fixed(self.components['chassis'].mate_origin, CoordSystem()),
            Coincident(
                self.components['servo1'].mate_top,
                self.components['chassis'].mate_back
            ),
            Coincident(
                self.components['servo1'].mate_wings,
                self.components['chassis'].mate_left,
            )
        ]

Am I going about the constraints wrong? Is the constraints solver set up to handle more than one constraint on a single part? The toy car example doesn’t seem to address this.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jmwrightcommented, Jun 16, 2018

I’m familiar with how to select a plane that’s furthest along an axis (wp.faces(‘>Z’).plane), but how would you select those faces?

I’m using the direction Nth selectors on the robot, and they work pretty well. Have a look at line 41 in the file here. Notice the [2] string selector syntax. That selects the 3rd face away from the minimum X. 0 being the same as <X (I think).

0reactions
dcowdencommented, Jun 16, 2018

@fragmuffin

Selecting geometry is a key and difficult challenge I have thought a LOT about. It is actually why cadquery got it’s name… From the ability to query the model as the basis for future operations.

Imo, the most important feature that can lacks is the ability to select geometry by operation ID, and modification status (created, modified). In many cases I have encountered, the easiest way to select features is to tag a given operation, select faces it created, and then subselect on those.

I know this because I use OnShape a lot, and though they do not have a lot of the selectors cq has, they have operation Id selecting, and It works very very well.

I have been pushing for a cq 2.0 to be based on OCC directly, because it’s only at the OCC layer that it is possible to ask the cad kernel what it did to the model, rather than only give you the result. This is where the cq direct API comes in. At the direct API level , you can programmatically select the modified, created, and deletied bodies.

It might be possible for us to bolt some operation selection into 1.0, though. We could allow tagging workplanes, and passing a tag into all operations, which is stored on the stack. Then, at least you could target features that were created at a particular step maybe?

Read more comments on GitHub >

github_iconTop Results From Across the Web

sql - Add multiple constraints in one statement - Stack Overflow
This DDL will work: ALTER TABLE MEMBER ADD CONSTRAINT U_MEMBERID UNIQUE(MEMBER_ID), primary key ( ...
Read more >
Adding multiple constraints in a single table - GeeksforGeeks
We can create a table with more than one constraint in its columns. Following example shows how we can define different constraints on...
Read more >
Examples: Applying Multiple Constraints to Features - 2021
You can define multiple constraints as primary, secondary, or tertiary. For example, an assembly could require you to mate a feature with more...
Read more >
Multiple Constraint - an overview | ScienceDirect Topics
One way to tackle the problem is to evaluate both m 1 and m 2 for each member of the population, assign the...
Read more >
How can I apply multiple constraints or loads in a subcase?
1. Put multiple loads in one load collector, and include that one load collector in the subcase. The same method can be used...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found