sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Moving a curved face/surface

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 1 Posters 4.8k Views 1 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.
    • F Offline
      Frankn
      last edited by

      As the title says, how do I move the curved face/surface? I'm able to iterate and get the individual faces and I tried

      face[0].pushpull distance
      

      within the loop but the faces take off in different directions.

      I tried

      face[0].transform!(Geom;;Transformation.new([0, distance, 0]))
      

      but that doesn't work.

      I also tried adding the faces to selection and doing something with that but I can't get anything to work.

      Thanks...

      curved face.jpg

      1 Reply Last reply Reply Quote 0
      • F Offline
        Frankn
        last edited by

        Found this post which helped me find the solution...
        https://forums.sketchup.com/t/transform-a-model-vertex-by-vertex/38771/7

        Here's the code I'm using with some notes... if something can be improved or changed please let me know? I can also add the code to iterate the faces if needed?

        Basically you need the vertices of all the faces you want to move and each vertex needs a cooresponding vector to be moved to. That way you can pass the 2 arrays to

        transform_by_vectors(vertices, vectors)
        

        . Andif you're using sub components like I am, make sure you're in the correct entities context (not sure I'm using all the proper terminology here) oe else you get a mess as a result.

        Like Tig explained in the post I shared...

        @unknownuser said:

        ... if every vector has a separate vector-transformation you need to pass two full arrays - in one go!

                        
        vectors=[]  //array of position to move vertices
        vertices=[] //array of face vertices from the individual faces that make up the surface
        
        vertices.flatten!  //in my case I need to flatten the array
        vertices.uniq!     //make sure there are no duplicate vertex
        
        vertices.each{|vector|
          position=vector.position.clone    
          position.x +=distance
          vectors.push vector.position.vector_to(position)
        }
                                        
        component_entity.transform_by_vectors(vertices, vectors)
        
        

        Hopefully this helps others out because it wasn't easy to find or understand... but it works!

        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