Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
What am I not understanding (equal constraint 2 lines cannot be solved)
james_sleeman
Member, Developers Posts: 21 ✭✭
Constraints have been driving me crazy lately, sometimes you add what I would think to be a valid and innocuous constraint and BAM everything goes overdefined/unsolved, even if that constraint is exactly what is already pictured.
For example, here is a video showing two lines, of equal length, one happens to be horizontal and one vertical. I remove the dimensions, and instead select them both and mark as equal, they already are equal but I want to ensure they remain so and track each other, but nope, that don't work.
https://youtu.be/NCW9Re5YvQc
Surely if I add a constraint such as that, it shouldn't error out like that, both lines are unconstrained in length before I try the equality, I can freely grab and drag the free end of either one to make them bigger, or smaller, or whatever, so why can I manually drag them equal, but onshape can't constrain them equal.
This is just one example, I run into this sort of thing so often not just with equality or lines, it's maddening, sometimes even just moving an unconstrained thing will suddenly turn half a sketch red.
Am I missing something here? Is this a problem that other people are experiencing?
For example, here is a video showing two lines, of equal length, one happens to be horizontal and one vertical. I remove the dimensions, and instead select them both and mark as equal, they already are equal but I want to ensure they remain so and track each other, but nope, that don't work.
https://youtu.be/NCW9Re5YvQc
Surely if I add a constraint such as that, it shouldn't error out like that, both lines are unconstrained in length before I try the equality, I can freely grab and drag the free end of either one to make them bigger, or smaller, or whatever, so why can I manually drag them equal, but onshape can't constrain them equal.
This is just one example, I run into this sort of thing so often not just with equality or lines, it's maddening, sometimes even just moving an unconstrained thing will suddenly turn half a sketch red.
Am I missing something here? Is this a problem that other people are experiencing?
0
Best Answer
-
mahir Member, Developers Posts: 1,309 ✭✭✭✭✭After opening your document, I see why you're frustrated. It "should" work the way it was sketched, but solving systems of constraints is a complicated process, and depending on how cleanly constraints are applied, the process can fail. Keeping your constraints as simple as possible will yield better results. There will always be a way to break the system, but why do that if it can be avoided?
5
Answers
As has been mentioned, I believe it has to do with the number of constraints that are added to your sketch. I found that I didn’t have to add any extra constraints to the sketch myself. All I had to do was sketch the segments, add a couple dimensions, and then I could fully define the sketch, including the line segments that are giving you problems. Here’s what I did in steps:
1. Sketch two lines along the vertical axis. The longer line extends to the first arc, and the second lines make up the width of the three arcs (which will make sense in the next step).
2. Draw three arcs using the “Center Point Arc” command. Make sure the center arc connects to the midpoint of the line at the top.
3. Draw two lines along the horizontal axis. One connects to the first arc, then the second line connects all three arcs.
4. Draw the line segments on the top left.
5. Draw the line segments on the bottom right.
6. Add the two line segments that you’ve been having problems with.
7. Convert the lines to construction, as you showed in your original video.
8. By this point, I haven’t added any constraints manually. The ones shown so far were added automatically as I sketched. Now add a few dimensions.
9. Now you can dimension the line segment on the top left, and make the one on the bottom right equal to it.
That should work for your sketch! Hopefully you can build off of it from this point and make something great!
Content Services Manager, SolidProfessor
Interested in improving your CAD skills?
www.solidprofessor.com
Nope, without the dimensions the free-end of both lines can be dragged independantly, as you can see they are therefore not by definition equal.
I certainly appreciate your efforts but basically you are suggesting "just start the sketch again and build it with different (potentially automatically defined) constraints". This ignores the manner in which the sketch was built up in the first place, in this case it was from a photographic reference (deleted from the sketch), but I've encountered this sort of issue in sketches that have taken hours, or been worked on over long periods of time. Usually it's possible by trial-and-error to delete a red constraint (more or less at random) see if it helps, and if not, undo and try deleting another one.
The sketch in this example just isn't complicated and doesn't have many constraints so it was a good one to post about since at least as a lay-man, I would not have expected to see this sort of surprising problem with it. Most of the constraints in it were automatically added, some of the line end points were constrained manually to be horizontal or vertical to one another.
NB: In this example, it seems if I delete the concentric constraint between the middle arc and the outermost arc and replace it with a radius dimension (leaving the arc itself unchanged as currently represented, just changing therefore the type of constraint on it) I can then define those two line segments equal - it is not at all clear to me WHY the fact that those arcs are required to be concentric has anything to do with the lengths of those two lines, especially when the lines are already equal (but not constrained so) with those arcs having the concentric constraint.
The blue line hanging off the right of another sketch (a progression of the first one fwiw), who's only constraint is with one end point coincident with another point which happens to be 15mm below some other point, I want to make it horizontal by applying horizontal constraint, it's almost totally unconstrained at this point so what could possibly go wrong...
OnShape does not agree.
Here's an example of a simplified approach.
https://cad.onshape.com/documents/57f6ae7b674ab710a56b3686/w/da4fbcfb74a427aa56bf80b1/e/4429d6539600ad393b8f4f04
Thanks, I found various ways to solve the problems in this case. In the horizontal line issue above for example, I removed the 15mm dimension on the line it was connected to, created another construction line not connected to anything, gave it a 15mm dimension, and set those two lines to be equal, which had exactly the same net-effect of constraining a line to 15mm but didn't create the unsolvability, 2 constraints solvable, 1 constraint not. Weird.
Then later I had some other problems and ended up adjusting that sketch so it was solvable and fully constrained but incomplete in so far as the design goals and creating a second sketch on the same plane referencing the points of the first sketch so I could continue on. This works ok for my needs.
I've also had a weird one where just dragging a line's endpoint caused it to become overdefined, but that's rare.
It's definitely a bug, but one thing that I've found (as others have mentioned) is to try simplify the sketch as much as possible - use one line instead of multiple collinear lines, fewer constraints, etc. That usually reduces the likelihood of this happening.
You have a midpoint constraint that is fighting the 16.5 or R43 dimensions - on their own they are OK together, but computers work to a finite tolerance so anything that slightly upsets the apple cart and the system doesn't know which constraints to solve - you may have added the midpoint constraint without even knowing it, but it's not a bug. There's also a point there that you can get rid of.
https://youtu.be/Q00skjoa-Lc
I mean, I hear what you're saying I think, that this is probably a fundamental limitation to do with floating point rounding, resolution, interpolation, the general complexity of constraint solving or whatever and not regard a bug to be fixed, but you have to admit, it's unpleasantly surprising from a user's perspective to see this happen.
I'm submitting these to support, but thought I'd commiserate since I found this post while looking for guidance.
Here's one where an under-defined portion of the sketch blows up when I dimension a vertex that can be dragged around (so should be able to be constrained with the indicated dimension).
Here's another fun one where just adding a sketch point as coincident to a line in a fully defined sketch blows everything up.