CPlane BUG

Hi McNeel Devs…

I wanted to report a possible bug involving named CPlanes.

If you set a CPlane and save it to the named CPlanes table, activate it, delete it and set the CPlane back to World Top in a viewport then run a python script to print out the active cplane’s name:

print scriptcontext.doc.ActiveDoc.Views.ActiveView.ActiveViewport.GetConstructionPlane().Name

The name will be that of the last named CPlane which was active, despite having deleted it out of the document’s named cplanes table.

This is not a bug.

The name of a construction plane is just that - a name. It is not a reference back to the named construction plane table. If you iterate through the named construction plane, you will see that “name” does not exist, as you’ve deleted it.

If you iterate through the named construction plane, you will see that “name” does not exist, as you’ve deleted it

Correct. But once the plane is deleted, I don’t understand why the standard world top cplane in an active viewport would have the deleted plane’s name when queried using

scriptcontext.doc.ActiveDoc.Views.ActiveView.ActiveViewport.GetConstructionPlane().Name

The “name” follows the cplane. You restored the cplane to the Top view. So it makes sense the Top view has a cplane named “name”…

Maybe I’m missing something… but that does not make sense to me!

If Name is a property of a ConstructionPlane object, how can a different ConstructionPlane (world top in this case) in an active viewport, have the same Name as a ConstructionPlane object which has been deleted out of the document altogether?

To me it would make sense that the standard world CPlanes’ names would be ‘Top’, ‘Front’, ‘Right’ etc…

also:

You restored the cplane to the Top view

No, I restored the CPlane to World Top in the active view. Different,no?

Set the Top view active and create a Name CPlane named “Banana”. Now switch to the Perspective view and restore that Named CPlane. Now, remove that Named CPlane. If you check the name of the Perspective view’s construction plane, it will be named “Banana”.

Of course it will be, because you haven’t changed the view’s CPlane yet. You missed a step to verify the problem!

 Now, remove that Named CPlane.

Then set the CPlane to World Top. (or any other standard cplane for that matter)

If you check the name of the Perspective view’s construction plane, it will [STILL] be named “Banana”.

CPlane World Top is not, technically, a Name CPlane - it does not set the Name field of the construction plane. This is why the name is still “Banana”…

Ah! But the problem here is not that the world CPlanes do not set the Name field of the ConstructionPlane.

It is the that a CPlane which no longer exists in the document sets the Name property of the world CPlanes!

It seems to me that it would be useful for the world CPlanes to have the Name field set as a read-only property of the ConstructionPlane (‘Top’, ‘Front’, ‘Right’, etc.).

Why is this a problem?

How would this be useful to you?

Well, in a nutshell, I am writing a script which requires being able to distinguish if the current construction plane in an active viewport is a named CPlane and then carry out some operations based on whether or not that particular named CPlane’s name has a specific format.

If the world CPlanes had no name that would be fine. If they had a read-only name that would also be fine. But the fact that they ‘inherit’ the names of deleted named CPlanes is difficult to deal with.

I’ve modified the CPlane -> World options to set the name of the cplane.

http://mcneel.myjetbrains.com/youtrack/issue/RH-29762

Thanks @dale!