Simple Extension for Mac
-
@olilej said:
I've been playing around with C Extension recently and I would like to know how if there is an equivalent of is_a? ruby function in C level.
If you have the CHM... you can click on the method description, and the C source will popup:
(Also works for online version, but the source link must be clicked directly, and is only visible when the mouse is hovering over the method description.)

-
So it looks like there are some macros defined in C, to make life easier ... CLASS_OF(), RCLASS_SUPER(), etc.
-
-
Great, my goal is to make sure I'm dealing with a Entity in order to access its attributes.
Here is the code I've come up with.
VALUE result = rb_obj_is_kind_of(obj, rb_path2class("Sketchup;;Entity")); if (Qtrue == result){ VALUE rval = rb_funcall(obj, rb_intern("get_attribute"), 2, rb_str_new2("dynamic_attributes"), rb_str_new2("...")); ... } -
Only
Sketchup::ComponentDefinitionandSketchup::ComponentInstancewill have dictionaries with that special name.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement