Index of path item - one path

Hello, how do you solve the one path tree issue when there is a one selected path from tree and You need to know it’s index?
For one geometry I have in the input few paths (and then my solution works fine) but for some others I have just one path - and then my path is always [0;X]
I need to know and there flattering and surify don’t work.

Index of path issue.gh (29.1 KB)
Do You have any solution, please?

Below is the same part of script but for for different inputs:

Your images don’t match your GH code at all :interrobang:

  • Your geometry is internalized to component inputs so not easily accessible.
  • Your description and GH code doesn’t make any sense to me.

:man_facepalming: :roll_eyes: :-1:

could you please go a couple of steps back in your definition, and try to explain the very final goal you are trying to achieve by isolating those paths?

Far as I know Deconstruct Path isn’t giving you the index of an item, it’s just deconstructing the paths into numbers (see the help).

Thank You for answer
@ftzuk
yes I am looking for the index of path (not index of an item).
The thing is how to find just one number (without 0) when there is just one path - the script works parametrically for different inputs and in general Deconstruct Path works perfectly but not in the case when there is just one path as an input.
If I would cull 0 values of indices the script will not name me the first item from input list

Sorry for writing not clear.

I send attached wider part of the script

The goal is to rename boxes based of the intersection with hatches from inserted pdfs into Rhino. Works fine if there are a few boxes laying on one type of hatch.
But for some hatches I have just one box laying on a hatch (surfaces in attached script) and then both the naming and separating the right branch with box (here taking only 10, not 0 and 10) generate issues.

I don’t have idea how to make uniform solution for both situations - many box (many paths) and for just one box as an input (one path in data tree).

Index of path issue_2.gh (566.1 KB)

Both your examples only have one path so I’m not really sure what you’re asking. Not quite sure what you mean by ‘index of path’.

The upper tree in here have four paths, the bottom one have just one:

as an “index of path” i mean numbers 12,13,14,15 and 10 (without 0) - don’t know if that’s proper name, but hope meaning is understandable :slight_smile:

Can’t see that because geometry is missing.

Sorry, here it should work:
Index of path issue_2.gh (566.1 KB)

Surify does work:

Dear @KN111

Not sure if i understand your question completely.
Therefor this is more a guess:

remove the flattening of the Deconstruct Path Indices output. (green scribble)

adding an additional List Item getting index -1 (always the last element) will give you the last integer of the indices. (green scribble)

depending on what s your next step: flatten the Item output of the new List Item. (blue scribble)

the path {1;2;3;4}
will be deconstructed to 1,2,3,4
list item -1 will return 4

this will also work for
{99} → 99 → 99

hope this helps - kind regards -tom

Right, thank You!!
I don’t know how wrongly I have checked it ytd :man_facepalming: but surify solves the issue :slightly_smiling_face: