Skip Navigation LinksUsing-Constraints-in-Sketcher-Effectively

5/31/2012

Using Constraints in Sketcher Effectively 

In this NX A to Z article, I will go through the different types of constraints in Sketcher and how to use them effectively as well as how to deal with an over-constrained sketch.

Creating Sketches

The first thing to note about sketching in NX is that there are two different ways to sketch – Direct Sketch and Sketch in Task Environment.





When you use Direct Sketch, you use the commands on the Direct Sketch Toolbar from within the modeling application. Sketching in the Task Environment is more or less like switching to the Sketch application. The screenshots I will be showing will be in the Task Environment. Technically, there is no difference between using the Task Environment and using Direct Sketch; however, there is a difference in how you interact with the sketch. You can experiment with both and decide for yourself which you prefer. When you double click a sketch to edit it, it will just activate the Direct Sketch toolbar unless you change your preference on the Edit tab under Preferences->Modeling or in the Customer Defaults under the Sketch section as shown below. If you are editing a sketch with Direct Sketch, you can switch to the Task Environment by clicking the Open in Sketch Task Environment button on the Direct Sketch toolbar.





Whenever you create a sketch, NX defaults to the profile tool.





The profile tool allows you to quickly create a set of connected lines and arcs. Every time you click on the screen you specify the endpoint of the last line or arc and the start point of the next line or arc. The Object Type in the image determines whether you are drawing a line or an arc. When you draw an arc, a quadrant tool allows you to specify the orientation of the arc – just move the cursor to the center of the quadrant tool and then move it away from the center in the direction you want the arc to start.





The rest of the drawing tools in Sketcher are fairly intuitive so I won’t go into detail on them.

Inferred Constraints and Auto Dimensioning

When I create a sketch, I typically use the profile tool to roughly draw what I want and then proceed to dimension and constrain it until it is exactly what I want. The first part of this process – roughing in the sketch – can cause problems with dimensioning and constraining the sketch later if you don’t pay close attention to the constraints that NX is automatically creating while you are sketching.

There are a couple of things to note in the picture below. One is, when you are roughing in your sketch, pay attention to its size. You want to make sure that you are at least in the ballpark with the size of your rough sketch, because if you are not, when you start dimensioning it, you may have some lines or arcs reversing themselves and this makes locking down your sketch more difficult. The second thing to note is the inferred tangency indicator. This is telling me that if I place the end point of this line where the cursor is not, it will create a tangency constraint between the line and the arc. If I want these entities tangent, then that’s fine, but if not, then I need to move the endpoint to make sure this constraint is not created automatically. NX will “snap” sketched lines and arcs into these constrained conditions, so sometimes you need to move the endpoint a fair amount to avoid them being created.





There are a couple other ways to control the creation of inferred constraints. One is to turn them off entirely by deselecting the Create Inferred Constraints button as shown below. If you do this though, your sketch curves won’t even be connected at their endpoints, so this is not usually a good thing to do.





The other option is to choose which types of constraints are created. This is done by clicking the button next to the Create Inferred Constraints button to open the Inferred Constraints and Dimensions dialog. In here, you can specify which types of constraints you want NX to create automatically. Typically, the default settings work well if you just keep on eye on the constraints that are being created as you sketch, but sometimes it can be helpful to turn some of these off.





Keep in mind that if you have a lot of geometry in your part already, NX will try to constrain your sketch to this geometry as well. Sometimes it can be helpful to hide the geometry while you are sketching if you don’t want constraints to the existing geometry to be created.

Auto Dimensioning is a slightly different animal. The intent behind Auto Dimensions is that when combined with inferred constraints, they will automatically fully constrain your sketch right from the start. The advantage to this is that if you are not familiar with sketcher or some of the nuances of constraining a sketch, NX will do it for you and then you just have to change the numbers. The disadvantage, is that often times, when you are roughing in a sketch, Auto Dimensioning creates way more dimensions than you need, because you intend on adding additional constraints to the sketch after you finish roughing it in. The nice thing about Auto Dimensions is that they just go away if you explicitly create a conflicting constraint. Of course, you can turn Auto Dimensions on and off:

  • To turn it on or off for all files, there is a customer default. Select Sketch->Inferred Constraints and Dimensions from the tree view in the Customer Defaults dialog and then select the Dimensions tab.
  • To turn it on or off for all future sketches in the current part, go to Preferences ->Sketch while in Modeling.
  • To turn if off for the current sketch, go to Task->Sketch Style while in the Sketch Task Environment.

 

Managing Constraints

Once you have your profile roughed in, the next step is to explicitly create constraints and dimensions until your profile is finished. There is no right or wrong to fully constrain a sketch. If the sketch is fully constrained and it is how you want it, then you did it correctly. You don’t even have to necessarily fully constrain a sketch; however, can lead to unpredictable changes in the model later on. It can be somewhat daunting sometimes to figure out how to get a complicated profile fully constrained and dimensioned so that it meets the design intent. The best way to go about it in my experience is to think about the real-world relationship between the faces or edges that your sketch is going to create and apply that relationship to the sketch. If the real-world relationship is ambiguous, then you can probably use either a dimension or a constraint. Often times, real world relationships between different faces of a part are implied, so keep that in mind as well.

Something that will happen to everyone eventually is an over-constrained sketch. Sometimes it is something simple like placing the same dimension twice or adding a vertical constraint when you meant to add a horizontal constraint, but sometimes it can be more complicated and include several dimensions and constraints. The key to resolving conflicting is being able to see all of the constraints, so the first thing to do is select the Show All Constraints command as shown below (many constraints are hidden by default). Then, find the constraints and/or dimensions that are highlighted in red and delete what is incorrect.





You can use QuickPick to select constraints from the graphics window – just hold down the left mouse button over the constraint symbol.





You can also delete constraints from the Show/Remove Constraints dialog. If you open the dialog and then select the over-constrained geometry, all of the constraints associated with that geometry will be displayed.





That’s it for constraints. Good luck.

Dave Holland