# Dimensions Sorted by Fractional Inch Value

First time poster with what is possibly an easy question.

I want to sort all the dimensions of a selected range (sheet / view / project / etc) by the fractional inch increment it is taken to.

Meaning I want to create separate lists for dimensions that are measurements of even inches; half inches, quarter inches, eights … etc down to the fractional precision the project is set to.
I dont need/want 1’-7 3/8" to be in a different list than 1’-7 5/8" (or 5’-1 1/8, 326’-7 7/8", 0’-6 5/8"); I just want to separate into which dimensions end in X/2" / X/4" / X/8" / X/16" etc…

I didnt see this or any related questions out there already, so let me know if you have any suggestions (or if its already been solved) If you have any questions or I need to make my request clearer, please let me know. Thank you in advance for any/all help you can provide.

Try rebuilding this:

2 Likes

Thank you VERY much for the help and quick reply. It works great as a proof of concept with one limitation. It errors out if I have a single dimension string with multiple lengths instead of ever length as a seperate dimension.

That’s because single string dimensions have their values stored differently. You wouldn’t be able to sort the values of that element into multiple groups anyway, but if you post a file with a single one of those and what you have tried via Dynamo one of the many dimensionn wizards may come to help out.

1 Like

My biggest issue is the best way to handle a dimension string containing multiple lengths. There are two parts to the problem; one logical and the other coding.

1. How to modify the reading of dim lengths from the above graphs to handle multiple length dim-strings
2. How to sort them. Since you cant color code portions of a multiple length dim-string individually, we have to choose a way to code it. I would like to group it by the smallest fraction present in the entrie string.

My smaller problem is how to best sort the output list to put the order and color-coding by largest to smallest fraction order; instead of groups being formed by what order it encounters the dimensions in. [ Or putting them in a preconfigured order /2", /4", … /256 "]

Thank you all in advance again for any light you can shed. I’m good with OOTB node; but the customs and packages still give me fits lol

1 Like

Been a long day at the office, so I haven’t had a chance to catch up on this. I’ll try again tomorrow but in the meantime…

For the first question you will likely need to pull the individual segments from the dimension. I don’t know of a node that does this OOTB, or in any publicly known package. That isn’t to say it doesn’t exist - just that I haven’t come across a need for it so it’s not in my mental rolodex. If you’d like to give it a shot on your own, you can refer to the Python code in this topic: Dimension segments from continuous linear dimension, and pull some other info from the Revit API documentation. Don’t worry if you’re new to this - it’s not too bad of a first task for a Python coding, as a lot of what you need is already out there - just a matter of retyping and assembling the parts you need.

For the second question you can use a List.SortByKey node after the List.GroupByKey method in my post. The list is the `Groups` output @L3 (might be 2? Hard to lace straight in my head after this day), and the Keys are `unique keys`output set @L1 (99% confident on that list level - pretty much can’t go wrong). I’ll try and have a look tomorrow, but if you get anywhere before then be sure to post it.

I started working on the Python aspect, just to refresh my Python; but I may have found a more efficient way for this graph.

The Rhythm Package seems to have some enhanced dimension string functionality including Dimensions.ValueString & Dimensions.DisplayValueString that I am looking at implementing.

1 Like

I’m working both ends of the problem; so while I was looking for a solution to the multistring dimension bust; I started on the hopefully simplier color/sort ordering.

I added a color reset group to prevent false-positives during testing while running the script repeatedly on the same (already colored) revit project.
I was already trying to insert a list.sortbykey; but was trying to put it BEFORE the groupbykey not AFTER. I havent been able to get the lacing correct as of yet (even with bruteforcing most of the combinations)