Restructuring Data Format For Tags

I’m tagging door elements with a fix Point.X, but a varying Y. I ensure there is minimal overlap by adding ascending values to elements (element.location) if they have lie on the same Y coordinates. However I am unable to get the data back in the same format which I need to use for creating my tags.

I have uploaded an image and the output that would be needed. It is kind of a list issue, if anyone could help me out here. Thanks

You could use a “List.Count” on your “Math.Round” output

Then flatten the output of your codeblock and use a list.chop on the flattened output (with the “lengths” being the output of your “list.count” node.

But looking closer it looks like there have been some moving the lists around internally… this might be an issue.

Instead of having both GroupByKey inputs coming from your values, the list input should be the element. That way your element list stays aligned with your value list. You wouldn’t need AllIndicesOf anymore because your list order would match.

1 Like

Try Nick’s solution first!

Generally some clean-up might be nice as the graph seems very disorganized :slight_smile:

@Jonathan.Olesen. Yes I group all the similar Y values and add a varying length to it so that my tags will not overlap. But i’m having trouble putting the new values back in their position . I’m trying Nick solution atm . Thanks

@Nick_Boyts Need%20Help%202

I have tried your method, i’m not sure if you didn’t get my intention or I did not use the nodes correctly as you suggested. With your method, I do need to combine sublist of varying lengths back into the original structure, and I’m not sure how to do that reliably.

Essentially, I’m picking up elements Y points, and if they belong to the same coordinates, I adjust their values slightly so that I would not have tag overlapping.

I have already achieve what I wanted, but I did it with lots of nodes and ideally I don’t prefer that. This is the part to solve and I kindly know that I’m 1 or 2 nodes away from getting the intended output.

Thanks for the assistance.

I think you just need to keep list structure for your list levels on your Count node. This is what I had:

Yes, we end up with the same data format. In your “+” node,
{264,364} & {262,362} are in separate list, but I do need them combine {264,364,262,362}, same with {257} & {255}, I need them as {257,255}. What nodes or method do I need to be able to combine them back to the original data structure?

If you only need the same list structure you just need to flatten the sublists. If you need the same structure and order I would suggest rethinking how you manage your data. It’s usually best to move all your data forward in the same list structure/order rather than trying to revert back to a previous list structure/order.

@Nick_BoytsShorter%20VersionLonger%20Version

Hi Nick, thanks for your feedback. I know it’s a little untidy. but I do want to share with you what I have done thanks to your inputs. I uploaded the both the short and long solution to achieve the same goals that I intended.

** The only instruction that I didn’t listen to is putting the elements in the List Input Of GroupByKey. Not sure if you know, it is not possible to GroupByKey with Points extracted from Element.GetLocation. I need use Math.Round before I could group them. If you look closely at my Point.Y before I use Math.Round, you will notice that even though the element is on the same Y coordinate in Revit, it still creates a minor increase which stops me from grouping them.

Anyway that’s all I have, thank you for your contribution. I knew there would be a shorter way. :slight_smile: