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!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Moving a Line or Edge

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 651 Views 3 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.
    • medeekM Offline
      medeek
      last edited by

      I am trying to move an edge of a solid after I have push pulled it into shape and added an extra line, however the Transform! method does not seem to work:

                          h_pt1 = [xvalue, @Hx1, @Hy1]
      			h_pt2 = [xvalue, @Hx2, @Hy2]
      			h_pt3 = [xvalue, @Hx3, @Hy3]
      			h_pt4 = [xvalue, @Hx4, @Hy4]
      			h_pt5 = [xvalue, @Hx5, @Hy5]
      			h_pt6 = [xvalue, @Hx6, @Hy6]
      			h_pt7 = [xvalue, @Hx7, @Hy7]
      
      
      			group3 = @truss_component2.entities.add_group
      			entities3 = group3.entities
      			group3.description = "Hip Rafter"
      			group3.name = "Hip Rafter"
      
      			new_face3 = entities3.add_face h_pt1, h_pt2, h_pt3, h_pt4, h_pt5, h_pt6, h_pt7
      			new_face3.pushpull plydepth
      		
      			midline = xvalue + @Ply*0.5
      
      			lp1 = [midline, @Hx5, @Hy5]
      			lp2 = [midline, @Hx6, @Hy6]
      
      			linebottom = entities3.add_line lp1, lp2
      
      			# Translates to vertex of fascia
      			lb_trans = Geom::Transformation.new([0, -@Plyhalf, 0])
       			linebottom.transform! lb_trans
      

      Nathaniel P. Wilkerson PE
      Medeek Engineering Inc
      design.medeek.com

      1 Reply Last reply Reply Quote 0
      • sdmitchS Offline
        sdmitch
        last edited by

        An Edge is an entity and can not be transformed by .transform! use .transform_entities instead.

        mod = Sketchup.active_model
        ent = mod.active_entities
        sel = mod.selection
        vue = mod.active_view
        h_pt1 = [xvalue, @Hx1, @Hy1]
        h_pt2 = [xvalue, @Hx2, @Hy2]
        h_pt3 = [xvalue, @Hx3, @Hy3]
        h_pt4 = [xvalue, @Hx4, @Hy4]
        h_pt5 = [xvalue, @Hx5, @Hy5]
        h_pt6 = [xvalue, @Hx6, @Hy6]
        h_pt7 = [xvalue, @Hx7, @Hy7]
        
        
        group3 = @truss_component2.entities.add_group
        entities3 = group3.entities
        group3.description = "Hip Rafter"
        group3.name = "Hip Rafter"
        
        new_face3 = entities3.add_face h_pt1, h_pt2, h_pt3, h_pt4, h_pt5, h_pt6, h_pt7
        new_face3.pushpull plydepth
        
        midline = xvalue + @Ply*0.5
        
        lp1 = [midline, @Hx5, @Hy5]
        lp2 = [midline, @Hx6, @Hy6]
        
        linebottom = entities3.add_line lp1, lp2
        
        # Translates to vertex of fascia
        lb_trans = Geom;;Transformation.new([0, -@Plyhalf, 0])
        #linebottom.transform! lb_trans
        entities3.transform_entities(lb_trans,linebottom)
        
        

        Nothing is worthless, it can always be used as a bad example.

        http://sdmitch.blogspot.com/

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          As Sam says, transformations only apply to containers like component-instances, groups and images.
          A Point3d does not have a transformation, BUT you can use point.transform!(transformation) it relocate it.

          Basic entity objects - like vertices, edges and faces - have to be transformed using:
          objects_parent_entities.transform_entities(a_transformation, [array_of_objects])
          this works with any kind of transformation; or for a vector based 'translation':
          objects_parent_entities.transform_by_vectors([array_of_objects], [array_of_vectors])
          note that each object in the first array must have a matching vector in the second array...
          Also if you are using the these to move say vertices, don't also include some edges or faces which use those vertices - otherwise the vector transformation will be done twice, with unexpected consequences...

          TIG

          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