Change color of elements depending on distance from crane

My self and a colleague have been tasked with coming up with a way of using dynamo to colour elements depending on the distance they are away from a model of a crane. We are currently in the process of coming up with ideas as to what is the best way to go about this…

The outcome would need to be a all the element are different collars depending on their distance from the crane e.g. if it was<= 20m - element would be blue, if the element was 21m to 30m the element would be red etc…

The distances would need to be variables as they would change with crane to crane…

Has anyone done anything similar? or does anyone have any ideas about the best way to produce this in dynamo?

Any help on this would be greatly appreciated,

 

Thanks in advance!!

 

Tom

That’s not incredibly difficult to do. If you look at the example files there is one called Core Attractor that can help you get started.

I have seen something similar, perhaps from julienbenoit

File: crane.dyn

Revit file: Crane.rvt

20150918-2

3

1 Like

Guys,

 

Thanks for the advice and examples files… massive help! cheers!

<span class=“author-link”><span style=“color: #428bca; font-size: small;”>Vikram Subbaiah</span></span>,

is there away we could edit it so that the distances dont need to be uniform e.g. 0-49m red, 49.1 to 60 Blue,60.1 to 70 Green? ( collors dont mater, they are just examples!)

<span class=“author-link”><span style=“color: #428bca; font-size: small;”>Cheers </span></span>

Tom

1 Like

Tom, You could set the value of Crane Distance Increment to 10000 (or 10, if the Revit units are in m)

You will get lists of elements grouped as {0-10, 10-20,20-30,30-40,40-50,50-60…)

Before coloring you could combine the first five .

A few other alterations might need to be made, but that may be a better approach.

I’ll try to get back to it later and see if I can provide a more flexible approach.

 

it works fine with your model. however when iuse it in one of our models i get the following error …

 

Warning: StructuralFraming.get_Location operation failed.
The location of the structural element is not a valid curve.

 

Any ideas?

1 Like

Try substituting the first line in the code block with this…

l1=(elm.Geometry()).Centroid();

However, doing this will result in the script taking longer to execute.

This works well, thank you for your help much apreciated!!!

is it posible to use the ‘select elements’ node? rarther than pick the family type. i have tried and keep getting the following area …

Warning: Asked to convert non-convertible types
Internal error, please report: Dereferencing a non-pointer. (3f47aacd)

it would also be good if you could manualy set the colors depending on the distance, would this be possible?

 

Tom

1 Like

As Select Model Elements doesn’t seem to have an option to edit (add/remove) the selected elements, ensure that only 3D geometry that you want to select is visible in the view.

I suspect the error is due to some 2D elements being selected.

Here is a file in which you can specify the colors. But you’ll need to ensure that your list of colors is long enough. The longer the better. I’ve created a list of 10 colors in the attached sample.

File: crane.dyn

20150919-1

 

 

A variation of the above with a legend…

File: crane.dyn

20150919-2

Your help has been great thanks…

Do you know what the following warning might mean?

Warning: No function called Centroid on a Autodesk.DesignScript.Geometry.Line that takes __array could be found
The value used in a range expression must be a number
List.DropItems operation failed.
Value cannot be null.
Parameter name: source
List.DropItems operation failed.

 

Thanks in adavance

 

Tom
Value cannot be null.

1 Like

That error is mostly because you have included some 2D geometry (lines) in your selection.

It may be a good idea to clean up the view by ensuring that only the 3D elements you intend to select are visible.

However, the below version just might work even if you include some 2D elements.

File: crane.dyn

20150919-4

That did the trick thank you… it works great, one last thing is it posible the make the range always start at zero? the range seems to be starting at the closest element to zero rarther than zero.

 

Crane

1 Like

Change these two lines under Legend (remove ,1)

lg1=Math.Round(i1);

lg2=Math.Round(i2);

The numbers though are relative to the position of the crane from the elements.

You can control the intervals, but the start distance depends on the position of the crane.

Thanks for your help with this,
on a couple of occasions items that are the same distance from the crane but on different floors are coming through as different colours. do you know why this might be happening
03

1 Like

This should solve that problem

File: crane.dyn

20150921-1

Interesting topic.

What if there were 2 or more cranes?

Maybe as an addition on this topic:
What if you want to show the max. weight of an element against the max reach of a crane??
That would be an interesting thing to show.

 

1 Like

This would be very good…

Im using it on a tower crane so the max lifting load changes depending on the distace from the centre of the crane, but if it is possible that would be good.

 

Tom

Actually, the version in which elements on different floors were colored differently, had distances measured from the center of the vertical axis of the crane :slight_smile:

The latest version has distances measured from the central vertical axis.

In any case, the maximum load bit can be accommodated. Should be quite easy, if I haven’t misunderstood the idea.