sketchucation logo sketchucation
    • Login
    ℹ️ GoFundMe | Our friend Gus Robatto needs some help in a challenging time Learn More

    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.
    • honoluludesktopH Offline
      honoluludesktop
      last edited by

      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
      • thomthomT Offline
        thomthom
        last edited by

        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
        • honoluludesktopH Offline
          honoluludesktop
          last edited by

          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
          • thomthomT Offline
            thomthom
            last edited by

            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
            • honoluludesktopH Offline
              honoluludesktop
              last edited by

              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
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement