Using SelKeyValue command for BIM purposes

Hi everyone,

I have a building (meshes) and I have about 10 Layers corresponding to different results sets. But I also want to be able to filter the vsible meshes by groups corresponding to different parts of the building (for instance floor1, floor2, …)

As I have about 50 location groups, using layers will result in 10x50 layers and I would like to avoid this. So my idea is to attribute each mesh a groupLocation variable and alllow the user to select what he wants to see (using a CheckListBox and the selKeyValueCommand).

The problem is I can not find the rhino.SelKeyValue() command in rhinoScript Editor. Can anyone help ? I can have a rhino6 version if needed (which does include this command). Or I can try and make use of plug-ins like Tabl_, Elefront, Human ? What is the best solution ?

BR,
Tanguy

SelKeyValue is a Rhino native command, not a Rhinoscript function. It is not in Rhino V5 either, it was added in V6.

1 Like

Is there any way I can acess this command ? For instance from the command line ?

PS : I also see that plug-ins like Tabl_, Elefront, Human offer such functions as SelKeyValue… Can I for instance go on with attributing values from RhinoScript using SetUserText() and then use one of these plug-ins in order to select/filter objects by attributes ?

If you’re in V5, this command does not exist… What are you trying to do? There is GetUserText and GetDocumentUserText as well as SetUserText and SetDocumentUserText.

There are all the methods under “User Data Methods” in Rhinoscript - see the Help for details.

Thank you. Well I read these sections but I do need a functio equivalent to SelKeyValue…

My problem is I have a building (meshes) and I have about 10 Layers corresponding to different results sets. But I also want to be able to filter the vsible meshes by groups corresponding to different parts of the building (for instance floor1, floor2, …)

As I have about 50 location groups, using layers will result in 10x50 layers and I would like to avoid this. So my idea is to attribute each mesh a groupLocation variable and alllow the user to select what he wants to see (using a CheckListBox and the selKeyValueCommand).

I can have a rhino6 version if needed… Or I can try and make use of plug-ins like Tabl_, Elefront, Human ? What is the best solution ?

If the data is stored as user text on an object, you can simply loop through objects, use GetUsetText(obj) and see if it matches your criteria. Otherwise there is probably more you can do via RhinoCommon and various object attributes. I don’t know anything about GH plug-ins.

Thank you. So I can program my SelKeyValue function using GetUserText(obj)… this should work ! Thanks

PS : at the end of this function I will set the successfull objects visibility to True I Guess and hide the rest…

Just one question : Is there a hierarchy between layer visibility and Object visibility ? How do I go back simply to all objects of the layers being visible ? Using ObjectsByLayer() and then…

Rhino 5 has a fast RhinoCommon method to do the search, no need to loop, eg:

scriptcontext.doc.Objects.FindByUserString(key, value, caseSensitive)

Note that Rhino 5 had a bug, it searches assignments made to the attributes OK, but not to the geometry. As long as you use the Rhino command _SetUserText _AttachTo=Attributes or

rs.SetUserText(obj_id, key, value, attach_to_geometry=False)

method there is no problem.
_
c.

1 Like

Thank you Clément. In my case I am using VBscript so I don’t have access to all of RhinoSDK… This is why Hevetosaur adivised me the loop on GetUserText() to produce my own “ObjectByUserAttribute” function.

Hi @tanguy.prevost, OK. I thought you’re after a RhinoCommon based solution as the thread is annotated above with “rhinocommon”.

_
c.