Dynamic block with equally spaced objects

Dynamic block with equally spaced objects

jerome
Contributor Contributor
2,006 Views
13 Replies
Message 1 of 14

Dynamic block with equally spaced objects

jerome
Contributor
Contributor

Hello.  I wonder if anyone can help me?  I'm trying to create a dynamic block where, when I stretch it, the two 'inner objects' remain equally spaced. The attached block 'TRY' shows two ends in red with two inner objects in red. When I stretch the overall, distance 1, I need distances 2, 3 & 4 to be equal.

 

Is this possible and could somebody show me how to do it please?

0 Likes
Accepted solutions (3)
2,007 Views
13 Replies
Replies (13)
Message 2 of 14

j.palmeL29YX
Mentor
Mentor

The description of the functionality is not yet complete. 

What shall happen with the Distances2..4, if you stretch the Distance1? 

What shall happen if you sretch the Distances2...4? 

We need more information about what you want to achieve. 

 

 

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 3 of 14

j.palmeL29YX
Mentor
Mentor
Accepted solution

One possible interpretation  can be: the width of all four red rectangles is fixed and stretching the Distance1 stretches the Distances2...4 (and only these) equally. 

Is that what you want? 

 

 

 

A first attempt attached. 

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 4 of 14

ojuris
Advisor
Advisor
Accepted solution

Try this

May be this is little bit simpler than @j.palmeL29YX 

Message 5 of 14

jerome
Contributor
Contributor

All of the examples worked exactly as I was hoping so, thanks to both of you for your replies.  Jurgen's blocks were easier for me to understand how it was done (with the 'equal' constraints)

 

To push my luck a little - is it possible to have this same block but where the number of inner (narrower) rectangles can be can be user-defined?  ie, I'm showing two at the moment but if I wanted 4 (not a problem if this is too much - what you've given me so far is excellent)

 

Thanks again

0 Likes
Message 6 of 14

j.palmeL29YX
Mentor
Mentor
Accepted solution

@jerome wrote:

... is it possible


 

Of course 🙂

As long as the number of variants is not too large (2 or 3 or 4 or 5 inner objects) I'd do it with different Visibility States as you can see in the attached file, which includes (besides some other old blocks) the new block "TRY 2-5". 

 

HTH

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 7 of 14

jerome
Contributor
Contributor

Excellent - you guys are masters!  Thanks very much

0 Likes
Message 8 of 14

wbentleyTRFHX
Explorer
Explorer

Hello, I have come across this thread and curious if you could help me out on my similar situation? I looked at your blocks but I am confused how the parameters and actions make your block work. I have attached my similar situation and curious if you could help me get the block to be correct. I have two traffic arrows and could like them to stay centered in their lane as the total road width gets larger with a linear parameter. So for example if the road was 40' wide, there would be 10' between the edge of the lane and the midpoint of the traffic arrow, another 10' from the arrow midpoint to the road centerline, another 10' from the road centerline to the next arrow midpoint, and finally 10' from the midpoint of the arrow to the edge of the traffic lane. It is pretty simple, just not sure how to get it to work. I have attached my block.

 

Thanks

0 Likes
Message 9 of 14

h_s_walker
Mentor
Mentor

@wbentleyTRFHX One stretch action and a couple of move actions with multipliers will do what you want. See the image below and the attached drawing

h_s_walker_0-1741622091093.png

 

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

Message 10 of 14

wbentleyTRFHX
Explorer
Explorer

Thank you for this! Definitely much easier than I thought.

0 Likes
Message 11 of 14

travisES8WV
Observer
Observer

Hi Jurgen, 

 

Your solution is perfect, but after opening it up, I still can't figure it out what you've done. Do you know of any tutorials that explain using the equal constraint to create the equal spacing between objects that are moved/stretched?

 

I had originally done what Ojuris offered as a solution but if you space the thirds at .6666 and .3333 it technically does not stay perfectly even the more you move or stretch the original item because its a recurring decimal.

 

Thanks, Travis. 

0 Likes
Message 12 of 14

j.palmeL29YX
Mentor
Mentor

@travisES8WV wrote:

... if you space the thirds at .6666 and .3333 it technically does not stay perfectly  


If you type 2/3 and 1/3 (instead of 0.6666 and 0.3333) AutoCAD uses its own internal accuracy for calculating the factor and the result will be correct (as long as you don't stretch to the outer limit of our sun system  😉 ). 

 

quotient.png

 

 

FYI: You can always use this notation x/y for quotients as long as x and y are integers and less than 32768.

 

 

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 13 of 14

j.palmeL29YX
Mentor
Mentor

 


@travisES8WV wrote:

 

Your solution is perfect,


 

Not really 😞 .

Because of some disadvantages you should try to avoid using constraints in dynamic blocks as long a possible and use Dynamic Parameters and Actions instead. Only if there is no solution with Dyn. Parameters and Actions you may consider the use of constraints. But doing so - this is one of the disadvantages - you must define the block completely using constraints. A mix of constraints with dyn. parameters/actions is not to suggest and will fail (in most cases).

 

If you are new to using constraints (and are interested in), first read in the help about Parametric. 

 

Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 14 of 14

travisES8WV
Observer
Observer

oh wow, the 1/3 and 2/3 input actually worked. That's all i needed so i don't have any need or use for constraints. 

Thanks so much, you're a legend!

0 Likes