sketchucation logo sketchucation
    • Login
    1. Home
    2. macumber
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    M
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 4
    • Posts 16
    • Groups 1

    macumber

    @macumber

    10
    Reputation
    1
    Profile views
    16
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    macumber Unfollow Follow
    registered-users

    Latest posts made by macumber

    • Check which plugins are enabled in Preferences->Extensions

      I am trying to check which plugins are enabled in the Preferences->Extensions menu. The following code seems like it should work to me (it asks for variables that are in the registry, the checked plugins have value 1 and the unchecked ones have value 0) but it doesn't work (at least on Windows with SU 7). Does anyone know if we are blocked from reading/writing to the Extensions preferences? Is there another way to check if another plugin is enabled?

      ObjectSpace.each_object(SketchupExtension) do |p|
      variable = "#{p.name}"
      puts variable
      puts Sketchup.read_default("Extensions", variable, nil)
      variable = "#{p.name}#{p.version}"
      puts variable
      puts Sketchup.read_default("Extensions", variable, nil)
      end

      Thanks a lot,
      Dan

      posted in Developers' Forum
      M
      macumber
    • RE: Example of Compiled Extension with SWIG and CMake

      After working with the SDK for a little while I don't think it can be wrapped as quickly as I first thought. I have to get back to work on my real tasks so the SDK wrap project will have to wait for a while. But I did make another example using SWIG with directors to show how to pass Ruby objects into C++ code. We are looking into this to implement Ruby observers for events that happen in our own C++ code.

      Hope this helps,
      Dan


      Rename to .zip and extract

      posted in Developers' Forum
      M
      macumber
    • RE: Example of Compiled Extension with SWIG and CMake

      I started a project to wrap the SDK for Ruby at:

      Link Preview Image
      Google Code Archive - Long-term storage for Google Code Project Hosting.

      favicon

      (code.google.com)

      I am just getting started now and focusing only on Windows but hopefully this could be extended pretty quickly. Let me know if you are interested in helping/using.

      Dan

      posted in Developers' Forum
      M
      macumber
    • RE: SketchUp Command Line: RubyStartup

      This is very interesting, thanks for sharing, are there other command line arguments to SketchUp? SketchUp.exe --help, /?, etc just launches the program...

      Dan

      posted in Developers' Forum
      M
      macumber
    • Example of Compiled Extension with SWIG and CMake

      Sounds like there was enough interest in compiled extensions at Basecamp that I whipped up this small example. We have found the recipe of CMake + SWIG to be very useful in making cross-platform extensions (or any C++ project). I have only tested this example on Windows, I may have to update it for Mac, let me know if you have any problems with it. A great idea floated around at Basecamp was to wrap the C++ SDK for file access with Ruby, that way developers could write Ruby scripts to access skp files from within SketchUp or at the command line. I would suggest CMake + SWIG as a route to do that. As a final note, if you really don't like the generated interfaces you can always wrap the generated wrapper code from SWIG with your own pure Ruby to your heart's content.

      The attached file is really a zip file, rename the file extension to .zip and extract.

      Hope this helps,
      Dan


      Rename to .zip and extract

      posted in Developers' Forum
      M
      macumber
    • OnChangeActiveModel observer

      I have been looking around for an observer to fire when the active_model changes but haven't had any luck. Is there such a thing?

      posted in Plugins
      M
      macumber
    • RE: Adding child group while parent group is active

      Well I guess I will have to get off my butt and post the answer to my own question:

      
      # clear everything out
      Sketchup.active_model.entities.clear!
      
      # add the parent group
      group1 = Sketchup.active_model.entities.add_group
      
      # set parent’s transformation
      group1.transformation = Geom;;Transformation.translation(Geom;;Point3d.new(10.m, 0, 0))
      
      # add some points to the parent group
      group1.entities.add_cpoint(Geom;;Point3d.new(0.m, 0.m, 0.m))
      group1.entities.add_cpoint(Geom;;Point3d.new(5.m, 5.m, 3.m))
      
      # add the child group
      group2 = group1.entities.add_group
      
      # set child’s transformation
      group2.transformation = Geom;;Transformation.translation(Geom;;Point3d.new(0, 10.m, 0))
      
      # add some points to the child group
      group2.entities.add_cpoint(Geom;;Point3d.new(0.m, 0.m, 0.m))
      group2.entities.add_cpoint(Geom;;Point3d.new(5.m, 5.m, 3.m))
      
      # group transformations are now correct
      puts Sketchup.active_model.active_path
      puts group1.transformation.to_a.join(', ')
      puts group2.transformation.to_a.join(', ')
      puts Sketchup.active_model.edit_transform.to_a.join(', ')
      
      # from top level
      active_path = nil
      group1.transformation = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 393.700787401575, 0.0, 0.0, 1.0]
      group2.transformation = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 393.700787401575, 0.0, 1.0]
      edit_transform = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
      
      # open group1
      active_path = [group1]
      group1.transformation = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
      group2.transformation = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 393.700787401575, 393.700787401575, 0.0, 1.0]
      edit_transform = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 393.700787401575, 0.0, 0.0, 1.0]
      
      # open group2
      active_path = [group1, group2]
      group1.transformation = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
      group2.transformation = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]
      edit_transform = [1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 393.700787401575, 393.700787401575, 0.0, 1.0]
      
      
      posted in Plugins
      M
      macumber
    • RE: Adding child group while parent group is active

      I guess a simple question is which component are you editing when you are editing group2 inside of group1? Are you editing group2, group1, or both?

      posted in Plugins
      M
      macumber
    • RE: Adding child group while parent group is active

      Thanks ThomThom, do you have any information explaining edit_transform in more detail? In my case I have group1 with group2 inside of it. I sort of understand what this does when the active_path is '[group1]'. However, what happens when the active path is '[group1, group2]'? What I'm really after is some documentation like:

      when active_path is '[]', group1.transformation returns xxx, group2.transformation returns yyy, active_model.edit_transform returns zzz
      when active_path is '[group1]', group1.transformation returns xxx, group2.transformation returns yyy, active_model.edit_transform returns zzz
      when active_path is '[group1, group2]', group1.transformation returns xxx, group2.transformation returns yyy, active_model.edit_transform returns zzz

      posted in Plugins
      M
      macumber
    • RE: C Extension on OSX crashes SU

      I checked and have a similar problem. I have only been testing my extension in SketchUp on Windows and IRB on Windows/Mac. I'm going to look into it too and will post anything I find here.

      Dan

      posted in Developers' Forum
      M
      macumber