As of late I have developed a number if DYN’s that essentially have all boiled down to one string of operations:
- Grab all elements of Category/Type
- TRUE/FALSE dependant upon whether or not the element is located within a predefined arbitrary Zone
- If FALSE: Do Nothing
- If TRUE: Set Element’s Parameter Value to [new value]
I thought it may be useful to start a thread with the intent to discuss the various ways you can complete these operations using Dynamo.
Initially I had simply created various Views that were cropped down to the dimensions of the intended ‘Area/Zone’. I would utilize the views by using the ‘[get all elements of type in view]’. This worked great until I reviewed the resulting content.
All of my zones are neighboring at least two other zones. This created an issue when elements crossed from one zone to another zone. My script would end up selecting the same element twice with each run of the script. Below is a visual example of this happening, the dashed line is the Northern border of one Zone and the Southern border of another Zone.
I had actually utilized this revision of my script for a while, but eventually the lack of accuracy had bugged me too much. So I wanted to improve this aspect.
I utilized Bounding Boxes, specifically the Bounding Box’ Centroid.
I configured the dimensions of the Zones’ Views via Scope Boxes in Revit, then I would apply the appropriate Scope Box to each View (under the Views’ “Extents” category of Parameters.) I found that I can translate a Revit Scope Box into a Dynamo Bounding Box.
Using the “BoundingBox.Property” Node from the Clockwork package, you can visualize the Centroid of any Bounding Box, among other things. You can also utilize the “BoundingBox.MidPoint” Node (Springs Package) to output only the MidPoint (Centroid) of a Bounding Box. The later is the method I settled upon.
After retrieving the Centroids of Selected elements I was able to then feed those [Points], and the Scope Box’s [Bounding Box] into the “BoundingBox.Contains” node to get a list of Boolean values.
After collecting this data it was fairly straightforward: Get Indecise of [TRUE] from the aforementioned Boolean List, then employ the “[Synthesize_SP].List.ItemAtIndex+” node to retrieve only the appropriate elements from the initial list of elements.
Feed that list of ‘filtered’ elements into an assembly of OoTB nodes (Ending with the “Element.SetParameterByyName” Node) to set the '[Notes]" Parameter with a new [Value].
I went a bit further than necassary and utilized [Count] to get the numerical length of the Filtered elements, and fed that value into a dialog op-up message box, so to inform the user of the amount and type of elements that have been processed. I personally like the “UI.UserMessage” Node from the Rhythm package.
I’m interested to see what other users think of my methods, or if anyone else have used a different method to come to the same result.
Let me know, as well, if this is not the right place to post this little write up. I thought it may induce some interesting discussions. Thanks for reading!