sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Using model.place_component my_definition

    Scheduled Pinned Locked Moved Plugins
    5 Posts 2 Posters 318 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.
    • 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