Check if the current C4D version is >= R16 Version

On 12/10/2016 at 15:38, xxxxxxxx wrote:

Hello,

I wrote this script to check if the current version of Cinema 4D is greater or equal to R16.
can I improve this script or there is a better way of doing this?

import c4d  
  
def main() :  
  if int(str(c4d.GetC4DVersion())[:2]) >= 16 :  
      print "Greater than or equal to R16"  
  else :  
      print "Older than R16"  
  
if __name__=='__main__':  
  main()

Thanks

On 12/10/2016 at 16:15, xxxxxxxx wrote:

The number you get with GetC4DVersion() is the Cinema 4D version number multiplied by 1000.
So your check can be optimized like this:

if c4d.GetC4DVersion() >= 16000:
  # ...

Best,
Niklas

On 12/10/2016 at 16:22, xxxxxxxx wrote:

Thank you, I had not thought about that.
Best