Parallel Constraint Mis-Behaving

Parallel Constraint Mis-Behaving

Anonymous
Not applicable
1,467 Views
12 Replies
Message 1 of 13

Parallel Constraint Mis-Behaving

Anonymous
Not applicable

I have a segment of a polyline that is set to be parallel to another, but it changes to all sorts of angles when manipulating the block handles in the main drawing. Any help would be appreciated.

0 Likes
Accepted solutions (1)
1,468 Views
12 Replies
Replies (12)
Message 2 of 13

Libbya
Mentor
Mentor

Why are you using any constraints at all in your block?  It seems like it would all be accomplished more easily using only dynamic parameters and actions and you wouldn't need to deal with the inconsistent behavior of constraints.  

0 Likes
Message 3 of 13

Anonymous
Not applicable

Because I don't want to clutter the user interface with handles. I only want those 4 parameters to be accessible that are both independent and meant to be changed by the user for each instance of the block.

0 Likes
Message 4 of 13

Libbya
Mentor
Mentor

All of that is, IMO, more easily accomplished without using any constraints at all.  There is no need for any additional grips to be displayed using dynamic parameters/actions.  Those actions could certainly all be done using only 4 parameters and each would be independent.   

0 Likes
Message 5 of 13

Anonymous
Not applicable

How would you suggest getting all of my geometry to behave the way it should without geometric constraints? There are lines that should stay colinear, parallel or symmetric all over the place. Certain parts should adapt when the four basic parameters are changed, etc. All of the geometric constraints I am using are available through the block editor ribbon, so I assumed they were meant to be used.

0 Likes
Message 6 of 13

Libbya
Mentor
Mentor

Just because a tool is available for use doesn't mean that it is the best tool for the job.  Most toolboxes contain both hammers and screwdrivers but hammers aren't very useful for removing screws and screwdrivers aren't very useful for pounding in nails. 

 

Constraints are very useful at times when there is a dynamic change that cannot be made using dynamic parameters/actions but those situations are few and far between.  Making dynamic blocks using constraints when dynamic parameters/actions can perform the same function only causes issues.  Constraints are much less consistent in their behavior, require more cpu for processing changes, slow down Autocad more than dynamic parameters/actions, require more memory than dynamic parameters/actions, and usually require more time and effort to accomplish a specific task.  They remind me of trying to push a noodle from the back of it.  It squishes out every direction except the way you want it to go.  Dynamic parameters/actions are like grabbing the front of the noodle and pulling it as the noodle remains straight behind naturally.  As such, IMO constraints are best reserved as a last resort in dynamic blocks.  Your linework that needs to "stay colinear, parallel or symmetric" will do so naturally unless you add actions that cause it to become skewed.  Because of the inconsistent nature of the constraints in your block, I cannot determine exactly how the linework should be modified by each action.  Post examples of exactly what each grip should change and I will work up a screencast solution for you.  

Message 7 of 13

Anonymous
Not applicable

Thanks - I didn't want to start a fundamental discussen here. In fact, I'll gladly take your word for it that dynamic parameters and actions are better than constraints. But please have a look at my parameters manager. You will see some fairly involved interdependencies that I wouldn't know how to program with just action parameters and their actions (because I have been unable to reference action parameters as variables in the definitions of other paramters). Take, for example, the parameter "leadoffset", which is defined as such:

 

max((cgap5-cavx)/2.0,cmargin_in)

 

This is to say that the gold leads to either side of the central device should be flush with the inner edges of the bottom two large contact squares, but if the central device is made wider, they should move out of the way, leaving a gap of cmargin_in. If you like, I can demonstrate this in a screencast.

0 Likes
Message 8 of 13

Libbya
Mentor
Mentor

Please demonstrate or describe precisely how you would like each grip would affect the linework.  That demonstration could be a screencast or drawn examples, but should precisely describe how each action will affect the linework so that I do not waste a lot of my 'free' time working up an example that is not actually what you desire.  

0 Likes
Message 9 of 13

Libbya
Mentor
Mentor

You could even use a simplified version if you like as long as the example will be applicable to the finished block.

0 Likes
Message 10 of 13

Anonymous
Not applicable

Thanks for taking the time to help me. Here's a screencast (with audio) in which I try to explain the behaviour I want. I do not know my way about actions very well, and I have not found any good tutorials explaining them in detail (e.g. what the various selection rectangles actually do), so I'd be very grateful if you could give me some pointers as to how to implement what I want in the way you suggested.

 

Thanks,

Chris

0 Likes
Message 11 of 13

Libbya
Mentor
Mentor

I think you might have forgotten to attach the screencast.

0 Likes
Message 12 of 13

Anonymous
Not applicable

It seems I have ... sorry! Hope it's there this time. I missed the little button labelled "insert". I thought choosing it would be enough.

 

 

 

 

0 Likes
Message 13 of 13

Anonymous
Not applicable
Accepted solution

After studying how to use parameters and actions a little more, I managed to implement most of my functionality as recommended. I have done away with most of my geometrical constraints, but at least it is working.

 

A few key insights I had that helped me and might help others were:

  • When attaching a stretch action to a linear parameter, the stretch frame determines which part of the geometry moves how:
    • Any vertices within the frame will be moved.
    • Any vertices outside the frame will not be moved.
    • Consequently, line segments crossing the frame boundary will be stretched or compressed; if these segments are inline with the linear parameter, they will only change length; otherwise they will be skewed.
    • I do not know what happens to curved line segments, I have not tried these.
  • After drawing the stretch frame, you have to draw another selection frame. This determines which objects will be affected by the stretching. Usually you would draw it to coincide with the stretch frame (from bottom-right to top-left so as to select all objects it intersects with rather than just the objects that are fully contained within it). It may seem superfluous, as one would think that all necessary objects could have been selected by the coincident stretch frame. However, there are two important uses for the object selection:
    • If you have objects in the area that you do not want to move or stretch, you should deselect them at this point.
    • If you want another parameter that has chaining enabled to follow this action, you should add it to your selection (more below).
  • You do not have to cover all parts of the geometry that you want to stretch/move with your action with the first stretch frame you draw. If, for example, as in my case, an all-encompassing stretch frame would move vertices that you want to keep stationary, but you cannot deselect them in the object selection phase because they are part of an object that should be modified, you can add another stretch action to the same linear parameter, with a separate stretch frame.
  • You can chain parameters to each other. That way, when you move a handle on one parameter (the independent one), the others that are chained to this (the dependent ones) will follow.
    • It is best to create all the dependent parameters first. To do this, create a parameter, and its properties panel  (View > Properties), under Misc, set chain actions to Yes. Then attach a stretch (or whatever) action to it. Then add it to the list of objects when creating the action for the independent parameter. In case you have created that first, you will have to go back and modify the selection set of the relevant action on the independent parameter.
    • The dependent parameter will change in the same direction and by the same amount as the action it depends on, unless you edit the values in the Overrides section of its Properties:
      • The distance multiplier is the proportionality constant of the relative motion; a negative value will cause motion in the opposite direction.
      • The Angle offset changes the direction of motion. Set this to the angle that your dependent linear parameter has with respect to the independent one. In my case, I mainly used 90 and 270 degrees. 180 degrees is another way of causing opposing motion.
  • Linear parameters can have 0, 1 or 2 grips. Change this number in the Misc section of the properties.
    • 0 grips is useful for dependent parameters that should not be changed manually by the user of the block instance.
    • 1 grips is useful for parameters whose Base Location is at one end (Startpoint). Change this under Misc in the Properties. If you draw a linear parameter from vertex A to vertex B, then the Base Location will be at A (this point will remain stationary) and the handle will be at B. Positive change of the parameter value (the length of the segment) will mean that B moves away from A. Make the parameter work the other way around by selecting first B then A when creating it.
    • 2 grips are useful for parameters whose Base Location is the Midpoint. These will extend the geometry symmetrically about this point.
    • Each parameter requires at least one action. In addition, each grip requires at least one action whose selection set encloses the associated vertex (I believe). This means that for 2 grips on a linear parameter, you need one action for each, and they will go in opposite directions (bear this in mind when choosing an action to chain a dependent parameter to).

Hope this helps someone who might me in a similar situation as me.