sketchucation logo sketchucation
    • 登入
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🔌 Smart Spline | Fluid way to handle splines for furniture design and complex structures. Download

    Simple Extension for Mac

    已排程 已置頂 已鎖定 已移動 Developers' Forum
    25 貼文 6 Posters 1.7k 瀏覽 6 Watching
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Dan RathbunD 離線
      Dan Rathbun
      最後由 編輯

      @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.)

      Object_kind_of.png

      💭

      I'm not here much anymore.

      1 條回覆 最後回覆 回覆 引用 0
      • Dan RathbunD 離線
        Dan Rathbun
        最後由 編輯

        So it looks like there are some macros defined in C, to make life easier ... CLASS_OF(), RCLASS_SUPER(), etc.

        I'm not here much anymore.

        1 條回覆 最後回覆 回覆 引用 0
        • Dan RathbunD 離線
          Dan Rathbun
          最後由 編輯

          • Pragmatic Programmer: Extending Ruby 1.9

          I'm not here much anymore.

          1 條回覆 最後回覆 回覆 引用 0
          • O 離線
            olilej
            最後由 編輯

            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("..."));
            	...
            }
            
            1 條回覆 最後回覆 回覆 引用 0
            • Dan RathbunD 離線
              Dan Rathbun
              最後由 編輯

              Only Sketchup::ComponentDefinition and Sketchup::ComponentInstance will have dictionaries with that special name.

              I'm not here much anymore.

              1 條回覆 最後回覆 回覆 引用 0
              • 1
              • 2
              • 2 / 2
              • 第一個貼文
                最後的貼文
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement