rs.ObjectName() doesn't work with strings containing curly braces in Rhino 6?

python
rhinoscriptsyntax

(Toivosawen) #1

This is my original post, more information in reply below.

(I’ve tried the following code in my newly installed copy of Rhino 6:

    import rhinoscriptsyntax as rs
    ...        
    line = rs.AddLine(point_a, point_b)
    name = "my line"
    rs.ObjectName(line, name)
    print rs.ObjectName(line)

Expected output:

my line

Actual output:

None

What gives?)


(Toivosawen) #2

After some further investigation, it seems the issue is related to curly parentheses, the following will work in Rhino 5 but not in Rhino 6:

import rhinoscriptsyntax as rs
...        
line = rs.AddLine(point_a, point_b)
name = "{my line}"
rs.ObjectName(line, name)
print rs.ObjectName(line)

#3

@toivosawen, @dale,

i can repeat that, not only in python script but also when entering curly braces in the Name field of the object properties in the Rhino UI. Both worked in Rhino 5.

_
c.


(Dale Fugier) #4

Hi @toivosawen, @clement,

I have logged this bug - thanks for reporting.

https://mcneel.myjetbrains.com/youtrack/issue/RH-44359

– Dale


(Toivosawen) #5

@dale

Thanks. It seems to be true for all kinds of parentheses.


(Dale Fugier) #6

Hi @toivosawen,

It turns out that curly and square brackets were not permitted in Rhino V5 names. You cannot put braces or brackets in a layer name. Howerver, there was a bug in the V5 object properties dialog that failed to check object names in some cases. In V6 all names go through the same name checker. The sentiment here is to make no changes in V6. The reason for the restriction is so command scripts containing names parse correctly.

Why do you need to use curly brackets in object names? What problem does this help you solve?

– Dale


#7

Hi @dale, the help file should mention naming conventions for object, layer, group and block names. This may be important for the new user text fields as well.

_
c.


(Toivosawen) #8

Hi @dale,

My team has been using the Name parameter of objects in Rhino 5 to store a JSON string (i.e. containing various braces) with some information about the object. This could be done using some arbitrary data parameter as well, but the advantage of using the Name parameter is that it will immediately show when hovering over the object in the viewport.

It’s merely a mild annoyance on our end, but it could possibly be of interest to have a “data” parameter which allows any string to be attached to an object, and have that show on-hover.

Cheers,
Toivo


(Dale Fugier) #9

HI @toivosawen,

You can attached user text to any object. And this text can contain any character(s) you want.

– Dale


(Dale Fugier) #10

@[quote=“clement, post:7, topic:55942”]
he help file should mention naming conventions for object, layer, group and block names
[/quote]

I agree - https://mcneel.myjetbrains.com/youtrack/issue/RH-44459

– Dale


(Toivosawen) #11

Yes, I am aware of this feature, but the advantage of using the Name for this (while hacky) was that it would show when hovering over an object.

Again, I agree that this is pretty much a non-issue. Good to see the reason cleared up so fast.

Cheers,
Toivo