Can someone verify that the Python method CurrentDimStyle is valid?


#1

I have a dimension style that I named “Ringo”. When I use the CurrentDimStyle method in Python it is returning this:

function CurrentDimStyle at 0x000000000000002B

Can someone check this and see if it is broken or is it me doing something wrong?

Here is the code:

import rhinoscriptsyntax as rs
strDimStyle = rs.CurrentDimStyle
print strDimStyle

You could also test this (and see the same results):

import rhinoscriptsyntax as rs
print rs.CurrentDimStyle

Thanks,

Dan


#2

Hi Dan.

Rhinoscript functions still use parenthesis, even when no parameter is supplied or when default parameter values are used instead: rs.CurrentDimStyle()


#3

Yes, of course. Thanks for reminding me. I kind of figured it was me. :slight_smile:

Dan


(Steve Baer) #4

Yep, you were setting a variable to a function. A very cool concept once you understand what it is doing, but also a pretty easy to hit mistake for user migrating from RhinoScript.

Just to open the variable as a function “can of worms” and make your head explode :smiling_imp:

import rhinoscriptsyntax as rs
func = rs.CurrentDimStyle

strDimStyle = func()
print strDimStyle

or

def add(x,y):
  return x+y
def subtract(x,y):
  return x-y

myfunc = add
print myfunc(6,2)
myfunc = subtract
print myfunc(6,2)

hmm…


#5

My head already hurts! I’m a little late to the Python party and sometimes I just want to go home! :smiley:

Dan