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

    Reporting component geometry data into Ruby Console

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 274 Views 3 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
      robintb
      last edited by

      A basic question I'ms sure this is but I can't figure out how to do it:

      I have a component I have created (its a basic shape) that I wish to use in several sketchup models. I want to report the geometric data into the ruby console e.g. its centre point (in terms of x,y,z) once I have placed it into the model. How can I do this, given that the component has a specific name e.g. R1?

      Many thanks for your help. Much appreciated

      Robin

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        Hi Robin, I started working on a script that shows model info right on the screen and down in the bottom left corner. Here is a link

        http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=16837

        It could be adapted to also display the center of the a component if that is what you'd like. Check it out and see if that would be helpful.

        Also, this script it just a minor variation of the "Query" tool that comes with SketchUp.

        Chris

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • R Offline
          robintb
          last edited by

          thanks for your help Chris, meant to reply sooner

          but I want to see a list of components in ruby, ultimately so I can calculate the distance between two defined objects. I want to do this using code rather than measuring the distance as I ultimately want to apply a separate calculation based on the distance.

          I was hoping it would take the form of:

          List the components in ruby, say component_1 and component_2, listed as

          component_1 [5,1,2]
          component_2 [10,12,3]
          etc

          then I can use these points in space to do a variety of mathematical calculations

          Thanks

          Robin

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            Try component_instance.transformation.to_a - it returns a 16 item array that has all of the stuff you need like scaling rotation and location. You really need to use all of these to compare distances between components etc as they might be rotated, scaled etc as well as moved in XYZ...

            The 16 item array has items 12,13,14 == x,y,z

            .

            TIG

            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