Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

How to prevent unintended/undesired constraints

jeff_mcafferjeff_mcaffer Member Posts: 79 ✭✭

This keeps happening to me and I just spent a bunch of time debugging — last straw…

When drawing a bunch of figures in a sketch, onshape offers interesting constraints to "snap" your line, circle, center… to nearby interesting points. This can be super useful. However, it can also result in unintended constraints that then bite you later. In my most recent episode, I was laying out a bunch of intersecting lines for later dimensioning/constraining. After about a hundred lines I started to refine/dimension the X direction. Great. Then I started on the Y and with, as far as I could see, almost no vertical constraints, I started getting resolution errors and a sea of red constraints. Apparently, somewhere along the way it just happened that one of the vertices was near the midpoint of a line. Unbeknownst to me a midpoint constraint was added.

Certainly I can improve my constraint debugging skills but it would be even better if I could avoid the problem altogether. Looking at the suggested constraints more carefully as I draw the lines helps though sometimes they're off screen (scroll during drawing). That feature is super useful so additional friction while drawing would be annoying. Perhaps some better debugging tools? Like "show me all the midpoint constraints" (midpoint and parallel seem to be the common problematic ones in my projects). Or a constraint resolution debugger/summary/explainer.

Or maybe I just need to get better? Is the right approach to draw random lines in the rough shape of what I want such that no constraints whatsoever are added (perhaps end point coincidence) and then go back and constrain everything? Seems laborious up front but at least I'd know exactly what constraints are there and why. What's your best practice?

Thanks for listening.

Best Answer

  • GregBrownGregBrown Member, Onshape Employees, csevp, pcbaevp Posts: 265
    Answer ✓

    If you keep the shift key pressed while placing a sketch element then the automatic constraint inferences will be ignored.

Answers

  • GregBrownGregBrown Member, Onshape Employees, csevp, pcbaevp Posts: 265
    Answer ✓

    If you keep the shift key pressed while placing a sketch element then the automatic constraint inferences will be ignored.

  • jeff_mcafferjeff_mcaffer Member Posts: 79 ✭✭

    Well, TIL. Thanks.

  • rick_randallrick_randall Member Posts: 385 ✭✭✭

    How did I miss that one. Thanks @GregBrown

  • matthew_stacymatthew_stacy Member Posts: 489 PRO

    "After about a hundred lines…"

    @jeff_mcaffer ,

    The statement above suggests that your sketch is perhaps a bit too complex and unwieldy. Consider breaking it down into multiple, simpler sketches. Similarly, break your model into many simple features rather that a single complex feature (e.g. don't add chamfers and fillets until the end of your feature tree. This approach will make your design much easier to debug and, in all likelihood, more robust.

    Onshape makes it very easy to reference geometry from previous sketches; and variables can be used to add another level of associativity.

  • jeff_mcafferjeff_mcaffer Member Posts: 79 ✭✭

    @matthew_stacy Thanks. That makes sense and I'm definitely guilty of overly complex sketches (I only recently discovered the wonders of "use"). Similarly working on the factoring of sketch, parts, and assemblies. That's one of the biggest learning curves I'm still on. Pointers to tutorials or info on how to think about factoring would be most welcomed.

    Having said that, it's pretty easy to need a sketch of dozens of lines. I did a quick review of some recent documents and found even a simple pattern of 12 tiles had 48 lines. Other parts had perimeters defined by 60-80 lines. Certainly, they could be broken up but that wouldn't be natural as the part just is that way. I think I just need to be more aware of what constraints onshape is opportunistically adding for me.

    I do think there are some potentially helpful debugging opportunities. For example, constraint filters or a "constraint explorer". "Show me constraints by":

    • type: show only constraints of a particular type. In my (limited) experience I fall afoul of midpoint and parallel constraints most often. Onshape seems eager to add those, and they are not necessarily what I'm thinking/seeing while drawing.
    • absolute vs relative: Show absolute constraints (e.g., horizontal or vertical). When you're trying to dimension an angle, and it just won't go…
    • relation degree: This would be harder but for any given sketch element there will be constraints that constraint it (directly) and ones that are more indirect. Imagine a "show me the Nth degree constraints for the selection". Depending on the constraint solver being used, that may be hard for the general case as stated but there may be some specific opportunities. Sort of like how Make transparent has a slider, pick and sketch element and view connectivity not in terms of physical geometry but rather logical constraints.

    I'm sure there are others.

    Anyway, I quite like onshape and the community is great so thanks for your insight.

Sign In or Register to comment.