sketchucation logo sketchucation
    • Login
    1. Home
    2. boom02
    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!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
    B
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Groups 1

    boom02

    @boom02

    0
    Reputation
    1
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    boom02 Unfollow Follow
    registered-users

    Latest posts made by boom02

    • Rotate a component before place it with a key imput

      I am trying to generate some geometry and then place it with model.place_component.
      I would like to mimic the function from Revit when you place a family if you press space, the family rotates and you place it rotated.
      Here is the code I am working with:
      ` #create geometry
      def geom(x,y,z,xc=0,yc=0,zc=0)

      group = Sketchup.active_model.entities.add_group
      face = group.entities.add_face [0,0,0],[x,0,0],[x,y,0],[0,y,0]
      face.reverse!
      face.pushpull(z)
      
      group.move! Geom::Transformation.new([xc,yc,zc])
      
      return group
      

      end

      #inputs
      w=500.mm
      d=100.mm
      h=100.mm
      repeat = false

      comp_to_place = geom(w,d,h)

      def_comp = comp_to_place.definition

      #place component
      model = Sketchup.active_model
      model.place_component(def_comp, repeat)
      #if user press space, cancel model place, rotate component, start model place again
      #delete place component that sits in 0,0,0`

      My idea to approach this challenge is to get the user input and when the user press space to cancel the model place, rotate the geometry and start a new model.place_component with the rotated geometry.
      Do you guys think this is the right way? And if yes how can I get the key press from the user? Thank you!

      posted in Developers' Forum
      B
      boom02