Matching Path Name to name of component

Hi all,
I have a long list of components that I need to use and I would like to map the name of the component to the Path Name. For example, a Geometry named “546” will have the Path Name “546.” Is there a way to automate the mapping of the name to the path name?

Thank you

So a specific parameter references a single Rhino object, and you want the name of the Rhino object to also be the user name of the parameter?

Your screenshot shows that parameter references two objects, should their names be concatenated?

Not the name of the object, the name of the Path - 439 matches {439} in the screenshot. By default the Path Name is {0}, I would like to make the Path Name match the component name (in this case 439). I hope I’m not confusing anyone since I’m not that versed in GH terminology…

If I have understood correctly, you can do this manually using Path Mapper.

For something more automated I think you may have to script something. I had a quick look using Python, piecing together parts of code I found in other forum pages (links below).

Right now I’m not too sure how to make this work for multiple component inputs, so at the moment its just one component input per Python script.

CompNameToPath.gh (11.4 KB)

Forum links:


2 Likes

If i understand your question correctly, something like this seems to do the trick?

With the exception of the ghpython component, the rest are native GH components.
ghpython component set to sdk mode, input x set to list access

from ghpythonlib.componentbase import executingcomponent as component


class MyComponent(component):
    def RunScript(self, x):
        a = []
        for i in self.Params.Input[0].Sources:
            a.append(i.NickName)
        return a

Rhino 6, (not sure if sdk mode was in rhino 5…I don’t think it was?)

1 Like