Python / RhinoCommon deprication messages

rhinocommon
python

#1

Hi @piac,

are deprication messages still enabled in RH6 (6.5.18111.2181, 21.04.2018) ?

I did not see any come up after testing 30 scripts to be ported for V6. The most i got from:

scriptcontext.doc.Layers.FindByFullPath(str_path, ignoreDeletedLayers)

It looks like the ignoreDeletedLayers option has been added so it accepts a boolean value instead of -1 as it’s been in V5. Just want to make sure i am not missing something.
_
c.


(Giulio Piacentino) #2

Hi Clement,

a lot of care has been put into making sure that RhinoScript in V6 does not use obsolete methods. I tested over 183 methods to make the compliant.

About the methods you talk about (that is RhinoCommon); one is actually obsolete and there is now an alternative.

FindByFullPath: string, bool

Obsolete (compiler warning) in 6.2

FindByFullPath: string, int

int notFoundReturnValue
Supported in: 6.2

The reason is that deleted layers no longer have names, and some negative values are actually valid default layers in some cases. Therefore some larger negative values are needed to test a negative value (int.MinValue is a good general notFoundReturnValue, while -1 is good if NullOrDefaultLayerInCaseOfLayerErrors is wanted.)

I hope this helps,

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#3

Thank you Giulio,

in regards to FindByFullPath using the boolean value, i’d like to understand if it is save to leave it unchanged in scripts which should run in V5 and V6. I can of course add conditional code for each Rhino version but if it is not required i could do something else. In Rhino V6 SR5 i did not get the deprication message for this method. (i had this before SR2)

_
c.


(Giulio Piacentino) #4

None of this code changed after Rhino 6 SR0. It must be something else.

It’s safe and only meaningful if you use True as Boolean value. Deleted layers (and all deleted model components in V6) have no name, thus they will always be ignored.

Giulio


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com


#6

Thank you Giulio, that is good news :slight_smile:

_
c.