this is my 2nd post i m very exited to learn dynamo.
I M TRYING TO RENAME ELEMENTS LIKE BEAM,COLUMN etc…
as you can see in this script, it can convert element id to Mark value.
so if i place first beam it will convert beam Mark value B1, 2ND BEAM name B2.etc…
True, and your answer is excellent, as always. But different approaches could be useful anyway. I just wonder something here: waiting for an explanation over what has been done before on the topic and why it is not working in the issue that is submitted could possibly be interesting in such a forum, but it’s just an idea, maybe not very functional in fact…
Both selecting by model line and grouping/sorting by location work for this. The “best” approach likely depends on the type of work you are doing and on the user base your script will be run by.
The advantage of the select by line method are that you can quickly adjust the manor in which the selected items work. It also means that a non-rectilinear building is able to be automated to some extent. The draw back is that the workflow requires a user draw the line first, and that user has to have an understanding of not only the what the intended goal but also how the script works.
The advantage of the group and sort method is that the results will always be consistent based on the design - that is the order is only controlled by the geometric layout and it doesn’t allow for any user overrides. This might lead to odd results when buildings have off beams on 45 degree angles, or beams which span multiple bays so they show up in the opposite order you wanted. If you specialize in suburban retail box stores then that’s likely not a problem. But if you’re doing urban infill on sites that are non- rectilinear your results could be undesirable.
@Kulkul I have different sizes of beam in drawing. so i cant use “family type”. so i need to use “categories” and “all element of category”.
and i think its beam so i cant get “point.x or point.y” value. see below image
The FamilyInstance.Location says that it’s producing a point, but if you watch the result you will see it is producing a line. This makes sense as beams in revit are line based not point based. As a result you are feeding a line into a node that is asking for a point. Try pulling the results of the FamilyInstance.Location node into a Curve.Startpoint and Curve.Endpoint nodes. Then feed those into your Point.X node.
These types of issues are rather common. It helps to watch your graph (either via watch nodes or by pulling down the results) as you go along to help you find these types of errors.
First up, you will want to get the Point.Y for the curve start point - replace the Point.X with it.
Then pass both Point.Y nodes into an == node. This will return a true value for beams that have the same Y value for their start and end points - which happen to be beams along the X axis. These beams need to be listed before the Y axis beams.
Run the results of the original All Elements of Category node into the list input on a List.FilterByBoolMask node, and the results of the == node into the bool input. You now have two lists - one for the X value beams (in output in the bool mask nodes) and one for the Y axis (out output in the bool mask nodes).
Try that and see if you can think of a way to group the list of X value beams by pulling some of the y values as you did before, and then sort those lists by pulling some X values as you did before. You’ll then have to flatten the list so it’s only one level deep. Lacing will matter at a few points. Then you want to repeat the process for the list of Y axis beams the same way you worked out the X axis beams. Then join the lists together. Renumbering will then be simple. Remember you want to keep working with the elements as you do the sort and group efforts on the list.
This is a somewhat ambitious first script to learn… Good luck, and if you get stuck make another post. Once you get a good start on it we can discuss making it more efficient (you need to learn how to walk before you can run right?)
Good attempt. I had to work in studio not revit attached at the moment as I’m automating some cleanup on 38,000 curtain panel families tonight, so I didn’t have the revit nodes in my graph, and I’m on version 0.9.2 so things might look a little different for you, but you should be able to get you where you want to be with this map. If you have questions ask.
You’re feeding the Curve.StartPoint node a revit object when it expects a curve, so there is no end point to get.
You resolved this on the previous curve.startpoint by inserting a FamilyInstance.Location node between the elements (the Object.Identity nodes) and the Curve.StartPoint nodes. The same thing will work here.
I didn’t have to deal with this added node as I was in sandbox and pulling curves instead of revit elements as my base data. This is why I have the pink group of nodes at the start of my graph.