Dynamic block with equally spaced objects

Dynamic block with equally spaced objects

jerome
Contributor Contributor
4,696 Views
23 Replies
Message 1 of 24

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?

Accepted solutions (3)
4,697 Views
23 Replies
Replies (23)
Message 2 of 24

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 24

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? 

 

(view in My Videos)

 

 

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 24

ojuris
Advisor
Advisor
Accepted solution

Try this

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

Message 5 of 24

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 24

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 24

jerome
Contributor
Contributor

Excellent - you guys are masters!  Thanks very much

0 Likes
Message 8 of 24

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 24

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 24

wbentleyTRFHX
Explorer
Explorer

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

0 Likes
Message 11 of 24

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 24

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

Message 13 of 24

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

Message 14 of 24

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!

Message 15 of 24

DHansenR9BX2
Observer
Observer

Great, this is what i needed.  I was wondering about the multiplier in the very beginning (and did not want to use constraints in autoCAD for many reasons). Really tossed me around until i read the whole post.  Awesome, works great.  Now to add other actions.  Now, hopefully I can remember this.  Thanks again!!

0 Likes
Message 16 of 24

JaredHaynes
Explorer
Explorer

I'd like to jump into this and make it a little more complicated 🙂

Is there a way to automatically space an array of objects with min & max values, so that as the block gets stretched and the array reaches it's max limit, it reverts to the min and populates the next object in the array.

I'm trying to figure out how to auto-space lines, say for example in a balustrade with vertical balusters, or tongue and groove panels in a door, where the width is variable, but I need the vertical geometry to maintain equal spacing

0 Likes
Message 17 of 24

j.palmeL29YX
Mentor
Mentor

@JaredHaynes wrote:

 

Is there a way to automatically space an array of objects with min & max values, so that as the block gets stretched and the array reaches it's max limit, it reverts to the min and ...


As far as I know that is not possible. You need an "algorithm" (a formula) to calculate the number of items to fill the Length overall. Hereby you must decide:

- do you want to calculate the minimal needed number of items so you don't exeed a maximal allowed distance between the items OR

- do you want to calculate the maximal allowed number of items so you don't fall below a minimal needed distance between the items OR

- do you want to calculate a number of items so the distance between the items is as close as possible to a given median value.

For each of this situation you will need another formula. The only what I could suggest: build a block which contains all three formula and the user must choose for each block reference which of the varians he wants to realize.

 

[EDIT:] See post#20 and #22 for an example how to realize that.

 

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 18 of 24

Ed__Jobe
Mentor
Mentor

@JaredHaynes wrote:

I'm trying to figure out how to auto-space lines, say for example in a balustrade with vertical balusters, or tongue and groove panels in a door, where the width is variable, but I need the vertical geometry to maintain equal spacing


This sentence seems counter to your previous statement, equal spacing vs. asking for variable distances between min and max. Also, the example of balustrades is not a good example. If you are using AutoCAD, you should be using a handrail object in ACA. Also, such examples rarely use odd spacing that is a factor of the total distance. They use standard spacing, e.g. 3", 4", 6". That's doable in a dynamic block. You can use a grip to prompt for the spacing. Then that could be centered within the desired distance.

Ed


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.
How to post your code.

EESignature

0 Likes
Message 19 of 24

JaredHaynes
Explorer
Explorer

Thanks for the responses Jürgen & Ed.

 

I'm not specifically looking for an ACA handrail, but more of a dynamic/parametric custom block, that I can use for panels in doors, louvre spacing, grilles, custom parking, custom rails... really anything I want to create outside of the normal as it might come about.

 

Essentially what I want to explore is creating a custom dynamic block, that operates in a similar manner to Revit's Parametric Families, or SketchUp's Dynamic Components, or the SketchUp plugin Profile Builder.

 

The idea is to create a block where I can set a start and end point that is variable, adjusted with a linear parameter and either stretch or array action. Contained between these points is my geometry or blocks, that populate between the 2 points when the parameter is lengthened. The population would be spaced equally, constrained by a max spacing. Perhaps stating a minimum distance is unnecessary.

 

For example:

  • If the linear parameter distance is set to 900, with a 300 max spacing, there would be 4 instances of the geometry/block (0, 300, 600, 900).
  • But if the parameter distance was 1100, there would be 5 instances (0, 275, 550, 825, 1100)... similarly before reaching the max spacing, if the parameter was 1199 there would be 5 instances (0, 299.75, 599.5, 899.25, 1199)
  • Once the parameter reaches 1201, the block would need to add another instance, and equally space the geometry/block (0, 240.2, 480.4, 720.6, 960.8, 1201)

Hope this helps give better understanding?

0 Likes
Message 20 of 24

j.palmeL29YX
Mentor
Mentor

@JaredHaynes wrote:

 

For example:

  • If the linear parameter distance is set to 900, with a 300 max spacing, there would be 4 instances of the geometry/block (0, 300, 600, 900).
  • But if the parameter distance was 1100, there would be 5 instances (0, 275, 550, 825, 1100)... similarly before reaching the max spacing, if the parameter was 1199 there would be 5 instances (0, 299.75, 599.5, 899.25, 1199)
  • Once the parameter reaches 1201, the block would need to add another instance, and equally space the geometry/block (0, 240.2, 480.4, 720.6, 960.8, 1201)

 

(view in My Videos)

 

 

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