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

    Get an origin point inside a Dynamic Component

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 391 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.
    • D Offline
      dagobo
      last edited by

      Hi all,

      I want to get the coordinates of an origin point inside my Dynamic Component.

      I created a Dynamic Component composed of three sub components.
      Every sub component has an origin point and axis to get oriented in a different way.

      I want to get the origin point position of one of the sub component in order to use it in my Ruby code.

      I actually want to draw a line from this origin point to the point of the mouse's current location, inside of a onMouseMove method within my Tool Ruby code.

      Does anybody know an answer ?

      Thank you every one,

      Marie

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

        Try transformation origin - for the nested-dc's instance and the container-dc's instance...
        Perhaps with adjustments for their relative placements too...
        http://code.google.com/apis/sketchup/docs/ourdoc/transformation.html#origin

        TIG

        1 Reply Last reply Reply Quote 0
        • D Offline
          dagobo
          last edited by

          But will the Point3D returned by the transformation method be the same point I decided for the origin of my sub component when I created it in SketchUp ? (in SketchUp : right-clic on the component, "Modify axes")

          And if I named the sub component ("Light_Beam") of my component ("Light"), could I get directly the sub component from the selection ?

          Instead of writing :

          selection=Sketchup.active_model.selection
          sub_component = selection[0].definition.entities[2].definition.instances[0]

          to get my sub component, and then get the origin point with sub_component.transformation.origin

          The [] method is said not to be very efficient in the Google SketchUp Ruby API. And I don't want to use the .each method as I want to get only one sub component I named.

          1 Reply Last reply Reply Quote 0
          • D Offline
            dagobo
            last edited by

            I tested it and it is actually the good origin point which is returned by the .origin method.
            I need to call the method for the nested component as I decided another point for the container component's origin.

            And I will use a for loop to get the right subcomponent (with the right name).

            Thanks a lot !

            Marie

            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