sketchucation logo sketchucation
    • Login
    1. Home
    2. rvs1977
    3. Posts
    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
    R
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 16
    • Posts 53
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: [request] Oceanwave simulator with buoyance

      I look for animated waves with buoyance build into sketchyphysics... that would be perfect, but I guess its hard to get.

      posted in Plugins
      R
      rvs1977
    • [request] Oceanwave simulator with buoyance

      Is there a oceanwavegeneratorplugin? In sketchyphysic there is buoyance, but no waves. I really
      need it πŸ˜„

      regards rvs

      posted in Plugins
      R
      rvs1977
    • Manipulation entities in a group through Ruby?

      Hi! 😎

      Is it possible to move edges or faces in a group through Ruby??....
      So far a have only succeeded with the .pushpull method.

      -RVS

      posted in Plugins
      R
      rvs1977
    • RE: [Question-difficulty 4/5] Group.transform!

      well thanks TIG! πŸ˜„

      I will study the script and hopefully get it πŸŽ‰

      posted in Plugins
      R
      rvs1977
    • [Question-difficulty 4/5] Group.transform!

      Hi all.

      This one I have messed around with, for more than a week now, and is at the point to give up 😳

      My task is to make a tool that rotate a group in the direction of the mousepointer. It has turned out to be a difficult task because, it doesn't seems to be a way of keeping track of the group direction.

      The problem using t= Geom::Transformation.rotation (point, Z_AXIS, delta_angle) and group.transform! t )is the delta_angle. Using this method it adds the angle to the previous angle.

      This is what I have tried: (runable from the RCE)

      
      class YV_tool
        def initialize
          @mod = Sketchup.active_model 
          @ent = @mod.entities    
          @state = 0
      
          inches = 1
          @mm = inches.to_mm
      
            
           @pts = []
           @pts[0] = [0,0,0]
           @pts[1] = [108/@mm,0,0]
           @pts[2] = [108/@mm,224/@mm,0]
           @pts[3] = [0,224/@mm,0]
        
        end # initialize
      
        def activate 
        end 
      
        def onMouseMove(flags, x, y, view) 
           ip = Sketchup;;InputPoint.new
           ip.pick view, x,y
           ip = ip.position 
      
           if (@state == 0) # Create Wall_group 
            @yv_group = @ent.add_group
            yv_face = @yv_group.entities.add_face @pts 
            yv_face.pushpull -10
            
            wall_edge = @yv_group.entities.add_line ([0,0,0], [1000/@mm,0,0])
            @yv_group_vector = wall_edge.line
             
            point = Geom;;Point3d.new ip 
            new_transform = Geom;;Transformation.new point  
            @yv_group.transformation = new_transform
            @state = 1
          end
          if (@state == 1) # group follow mousemove
            Sketchup.status_text = "@state = 1 ; Inputpoint; ", ip, "@yv_group_vector; ", @yv_group_vector  
            point = Geom;;Point3d.new ip 
            new_transform = Geom;;Transformation.new (point)
            @yv_group.transformation =  new_transform
          end
          if (@state == 2) # onLMouseButton place group in choosen position
            Sketchup.status_text = "@state = 2 ; Inputpoint; ", ip 
            point = Geom;;Point3d.new ip 
            new_transform = Geom;;Transformation.new (point)
            @yv_group.transformation =  new_transform
            @ip1 = ip
           
            @vec1 = Geom;;Vector3d.new X_AXIS
            @state = 3      
          end
          if (@state == 3) # Rotating and stretching
            vec2 = @ip1.vector_to (ip)
            v1 = @vec1.angle_between X_AXIS
            
            v2 = vec2.angle_between X_AXIS
            #Sketchup.status_text = "@state = 3 ; v1; ", v1, " v2; ", v2, " @vec1; ",  @vec1
              #1 calulate delta_v if mousemove is counterclockwice and if vec1 and vec2 is in quadrant 1 or 2 of the unitcircle  
              if ((v2>v1)  && ((vec2.x >= 0 && vec2.y > 0)  && (@vec1.x >= 0 && @vec1.y > 0)  || (vec2.x <=0 && vec2.y > 0) && (@vec1.x >= 0 && @vec1.y > 0 ) || (vec2.x <= 0 && vec2.y > 0) && (@vec1.x <= 0 && @vec1.y > 0)))
               delta_v = v2-v1
               #Sketchup.status_text = "@state = 3 ; ; v2>v1 ; Delta_v; ", delta_v 
              end
      
              #2 calulate delta_v if mousemove is counterclockwice and if vec1 and vec2 is in quadrant 3 or 4 of the unitcircle  
              if ((v1>v2)  && ((@vec1.x <= 0 && @vec1.y < 0)  && (vec2.x <= 0 && vec2.y < 0)  || (@vec1.x <=0 && @vec1.y < 0) && (vec2.x >= 0 && vec2.y < 0 ) || (@vec1.x >= 0 && @vec1.y < 0) && (vec2.x >= 0 && vec2.y < 0)))
               delta_v = v1-v2
               #Sketchup.status_text = "@state = 3 ; ; v1>v2 ; Delta_v; ", delta_v 
              end
            
              #3 calulate delta_v if mousemove is clockwice and if vec1 and vec2 is in quadrant 1 or 2 of the unitcircle
              if ((v1>v2)  && ((@vec1.x <= 0 && @vec1.y > 0)  && (vec2.x <= 0 && vec2.y > 0)  || (@vec1.x <=0 && @vec1.y > 0) && (vec2.x >= 0 && vec2.y > 0 ) || (@vec1.x >= 0 && @vec1.y > 0) && (vec2.x >= 0 && vec2.y > 0)))
               delta_v = v2-v1
               #Sketchup.status_text = "@state = 3 ; ; v1>v2 ; Delta_v; ", delta_v 
              end
      
              #4 calulate delta_v if mousemove is clockwice and if vec1 and vec2 is in quadrant 3 or 4 of the unitcircle 
              if ((v2>v1)  && ((vec2.x <= 0 && vec2.y < 0)  && (@vec1.x <= 0 && @vec1.y < 0)  || (vec2.x <=0 && vec2.y < 0) && (@vec1.x >= 0 && @vec1.y < 0 ) || (vec2.x >= 0 && vec2.y < 0) && (@vec1.x >= 0 && @vec1.y < 0)))
               delta_v = v1-v2
               #Sketchup.status_text = "@state = 3 ; ; v2>v1 ; Delta_v; ", delta_v 
              end
      
      
            @vec1 = vec2
              
            t_yv = Geom;;Transformation.rotation (@ip1, Z_AXIS, delta_v)
            @yv_group.transform! t_yv
              
           t_old = @yv_group.transformation
           Sketchup.status_text = "@state = 3 ; Transformation ", t_old
      
          end
        end # onMouseMove
        
        def onLButtonDown (flags, x, y, view)
          if (@state == 3)
            @state = 4
          end
      
          if (@state == 1)
            @state = 2
          end
        end # onLButtonDown
      
        def reset
          @state = 0
        end
      end # class YV_tool
       
           yvtool = YV_tool.new 
           Sketchup.active_model.select_tool yvtool
      
      
      

      As you can see, the group turn around, but not directly at the mousepointer.

      I hope someone can come up with some ideas. πŸ˜‰ Until then I will keep fighting...

      Thanks in advance
      -RVS

      posted in Plugins
      R
      rvs1977
    • RE: Saving selection to file, and placing on the mouse pointer.

      How to attach a group to the mousepointer:

      First, I think, you have to use the "Tool"-class, because in this class you have the onMouseMove-method.
      (see also \plugins\examples\linetool.rb - it shows in detail how to use the tool-class)

      
      class My_tool
        def initialize # a good place to put variables. Notice the "@". It means you can see the variable
                       # in the whole My_tool class. If no "@" it would only be visible inside the def.
          @mod = Sketchup.active_model 
          @ent = @mod.entities    
          @state = 0
               
           @pts = []
           @pts[0] = [0,0,0]
           @pts[1] = [10,0,0]
           @pts[2] = [10,20,0]
           @pts[3] = [0,20,0] 
           
        end 
      
        def activate  # activates the tool    
        end 
      
        def onMouseMove(flags, x, y, view) 
           ip = Sketchup;;InputPoint.new
           ip.pick view, x,y
           ip = ip.position 
      
           if (@state == 0) # Create Wall_group 
            @my_group = @ent.add_group
            my_face = @my_group.entities.add_face @pts 
            my_face.pushpull -10
            
            # ip is the input point from the mouse, converted to a 3d point 
            point = Geom;;Point3d.new ip 
            new_transform = Geom;;Transformation.new point  
            @my_group.transformation = new_transform
            @state = 1
          end
          if (@state == 1) # @my_group follow mousemove
            Sketchup.status_text = "@state = 1 ; Inputpoint; ", ip
            point = Geom;;Point3d.new ip 
            new_transform = Geom;;Transformation.new (point)
            @my_group.transformation =  new_transform
          end
      
          if (@state == 2) # onLMouseButton place @my_group in choosen position
            Sketchup.status_text = "@state = 2 ; Inputpoint; ", ip 
            point = Geom;;Point3d.new ip 
            new_transform = Geom;;Transformation.new (point)
            @my_group.transformation =  new_transform
            @ip1 = ip
            UI.messagebox "that should do it, Honolulu ;) - Press space to exit"
            @state = 3      
          end
           
        end # onMouseMove
        
        def onLButtonDown (flags, x, y, view)
          if (@state == 1)
            @state = 2
          end
        end # onLButtonDown
        
      end # class My_tool
      #------------------------------------
      #------------------------------------
      # Here you activate the defined tool in your program...
      
           mytool = My_tool.new 
           Sketchup.active_model.select_tool mytool
      
      

      Regards RVS πŸ˜„

      posted in Plugins
      R
      rvs1977
    • RE: [Question] on transformation.rotation

      Great, thanks TIG!

      Now it works 😍

      posted in Developers' Forum
      R
      rvs1977
    • [Question] on transformation.rotation

      Hi all SUdudes... πŸ˜„

      I have a problem rotating a component instance around itself from a chosen inputpoint.
      the component instance have been added, and then I want to rotate it:

      
      ......
      ip.pick view, x, y
      point = ip.position
      vector = Geom;;Vector3d.new 0,0,1
      angle = 2
      t= Geom;;Transformation.rotation point, vector, angle
      yv_instance.transformation = t  
      
      

      I expected it to rotate around the point with the vector and rotate it 2 radians. BUT instead of rotating it around itself, it rotates around the ip-point and 0,0,0... hmmm hope you understand.

      the question is: How do I rotate a component around itself??? ❓

      tnx in advance πŸ˜„

      posted in Developers' Forum
      R
      rvs1977
    • RE: [plugin] Ruby Code Editor - UPDATED to v3.0 3/4/2013

      looks great!

      I discovered a strange behavior with my (danish)keyboard. When I want to
      make brackets [ ], it opens a small textarea inside the console.
      The textareabox appears when I push the AltGr key. When I enter numbers
      and press Enter, it submits it at the top op the console???

      anyone seen that too?

      posted in Plugins
      R
      rvs1977
    • RE: [Question] how to add entities to componentdefinitions

      Thanks to both of you.
      It pretty much answer all my questions for now! πŸ˜„

      btw, SU and ruby combined makes me breathless. I got a tons of ideas, but only
      beginning to learn.

      posted in Developers' Forum
      R
      rvs1977
    • [Question] how to add entities to componentdefinitions

      Hi all

      as a beginner, I have a simple question I guess πŸ˜„

      Im looking how to "intialize" entities into a component at startup.
      As far as I know its possible to use something like componetdefintions??

      For instance I want to make a reusable box I can use again and again.
      I dont want it to load it from a file.

      tnx in advance

      RVS

      posted in Developers' Forum
      R
      rvs1977
    • RE: [Request] Sketchyphysics: Waving water?

      I get it... but I was looking for "something better" πŸ˜„
      RVS

      posted in Plugins
      R
      rvs1977
    • [Request] Sketchyphysics: Waving water?

      Hi!

      In SkPh, is it possible to make waving water?
      For instance, if I want to make a sailing ship in the waves...

      Thx in advance 😎
      -RVS

      posted in Plugins
      R
      rvs1977
    • 1
    • 2
    • 3
    • 3 / 3