• Login
sketchucation logo sketchucation
  • Login
๐Ÿค‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Using model.place_component my_definition

Scheduled Pinned Locked Moved Plugins
5 Posts 2 Posters 294 Views
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.
  • H Offline
    honoluludesktop
    last edited by 14 Oct 2010, 19:44

    When I use the following to place an instance,

    repeat = false model.place_component my_definition, repeat

    the definition attaches itself to the mouse pointer by the model's origin. This is a problem when the component is off screen. How do I place the definition so that the corner of its bounding box is on the tip of the mouse pointer?

    I can move a_instance to the model's origin by:

    bb=a_instance.bounds point = Geom::Point3d.new -bb.corner(0)[0],-bb.corner(0)[1],-bb.corner(0)[2] t = Geom::Transformation.new point a_instance.move! t

    but that doesn't solve my problem since model.place_component my_definition uses its original location in the model. Erasing, and replacing my_definition (after it is relocated) seems to be the way to go, however I have not been successful doing so. Any suggestios that I can explore?

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 14 Oct 2010, 20:12

      Doesn't it use the insertion point of the component?

      Thomas Thomassen โ€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • H Offline
        honoluludesktop
        last edited by 14 Oct 2010, 20:28

        Sigh....Now how come I couldn't find that method by myself? Thanks:

        bb=my_instance.bounds my_definition.insertion_point = Geom::Point3d.new bb.corner(0)[0],bb.corner(0)[1],bb.corner(0)[2]

        1 Reply Last reply Reply Quote 0
        • T Offline
          thomthom
          last edited by 14 Oct 2010, 21:02

          Isn't his enough:
          bb=my_instance.bounds my_definition.insertion_point = bb.corner(0)

          โ“

          Thomas Thomassen โ€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • H Offline
            honoluludesktop
            last edited by 14 Oct 2010, 21:09

            It is...Thanks. Guess it always worth a second look after I make something work the first time. I'll bet my code could shed 25% of its weight if I knew what I was doing ๐Ÿ˜•

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

            Advertisement