sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Getting an object coordinates

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 206 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      rubenchov
      last edited by

      Hi all

      I am new at Sketchucation, and at programming Ruby too.

      I have a SU model, consisting of one big box and a servo. The servo is controlled by a slider (as used in sketchyphysics)

      I just want to be able to move the slider and store the position of the box (it can be the center) in a global variable.

      That's it

      Please help me but please write in the most simple way so I can understand.

      Thanks, I really appreciate your help

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        We stay away from using global variables in a shared objectspace like SketchUp Ruby.

        I will assumed the Box is made of grouped primitives:

        
        grp = Sketchup.active_model.entities.grep(Sketchup;;Group).find {|g| g.name="Box" }
        if grp
          @pos = grp.transformation.origin
        end
        

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement