Wish: Switch to a CPlane that shares the selected object's name

I wonder if it’s possible to make a command (default Rhino command, or macro, or plug-in) that will activate a custom CPlane that shares the same name as a pre-selected object? For example, if I select a single object called “Battery 3” and I already have a saved CPlane named “Battery 3”, I would like to click on some magic icon so that Rhino will immediately activate the “Battery 3” CPlane. Of course, if there is no CPlane that has the same name as the selected objects, Rhino should not do anything.

I have plenty of saved CPlanes and searching for a specific one though _-NamedCPlane _Visible _Visible _Toggle _Enter _Enter is slow and cumbersome compared to the solution I propose above.

I’m aware of the '_MPlane command, but it does not do what is needed. On top of that, it destroys the History of already built objects, such like extrusions made from curves. Lastly, I already have way too many files with hundreds of CPlanes inside and it will take a huge amount of time to repeat everything by assigning MPlanes to each object.

There is no native command to do that.
If you’ve gone to the effort of manually naming objects, and creating named CPlanes with the same name, I suspect a script of some sort could be created to do what you want. I don’t have those scripting skills.
Part of designing that script would need include what should happen if you select an unnamed object, or what should happen if no saved CPlane exists with the same object name.

1 Like

That’s correct, as I mentioned above, if Rhino is unable to find a coincidence between the selected object and a saved CPlane, then it should not do anything. The same goes for when two or more objects are selected simultaneously. I suppose that this script should work only when a single named object is selected.

Hi Bobi - see how this works, quick & dirty…
CPlaneFromObjectName.py (774 Bytes)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"
@Rhino_Bulgaria - updated with the script as a file.

-Pascal

1 Like

Hi Pascal, could you tell me how to run this script in Rhino? Should I use RhinoScript or PythonScript to create a saved script before I’m able to run it? I forgot what was necessary to do that. :slight_smile:

Wow, that works perfectly fine, exactly the way I expected! Thank you for the quick solution, @pascal ! :slight_smile: This is a huge time saver!
Is it possible to this script to switch to the proper axis icon of the CPlane, too? I noticed that it leaves the last used CPlane axis icon intact.

Hi Bobi… I’ll have to think about that … later. - it seems unlikely but I don’t know - the icon in the vp corresponds to the highlighted item in the named CPlane list, I don’t know if I can control that.

-Pascal

1 Like

I just created a dedicated topic regarding the axis icon that “refuses” to disappear even after closing the “Named CPlanes” panel. Maybe I don’t know how to do it, or it’s really impossible to hide it manually? :slight_smile: “MPlane” has that option, though.