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

    Manipulation entities in a group through Ruby?

    Scheduled Pinned Locked Moved Plugins
    4 Posts 3 Posters 292 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.
    • R Offline
      rvs1977
      last edited by

      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


      Get a Ruby

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

        You can get an array of the vertices of a face [or some edges etc] and move them using a vector transformation, in the form something like

        vertices = face.vertices
        vector = Geom;;Vector3d.new(0,0,1)
        ### this is 'up' 1"
        vectors = []
        vertices.length.times{vectors << vector}
        group.entities.transform_by_vectors(vertices, vectors)
        ### all of the face's vertices will move up 1"
        

        πŸ€“

        TIG

        1 Reply Last reply Reply Quote 0
        • OscarLokO Offline
          OscarLok
          last edited by

          @tig said:

          You can get an array of the vertices of a face [or some edges etc] and move them using a vector transformation, in the form something like

          vertices = face.vertices
          > vector = Geom;;Vector3d.new(0,0,1)
          > ### this is 'up' 1"
          > vectors = []
          > vertices.length.times{vectors << vector}
          > group.entities.transform_by_vectors(vertices, vectors)
          > ### all of the face's vertices will move up 1"
          

          πŸ€“

          Dear Tig

          I would like to know that can your script apply on a face with arc or circle edges with round hole inside the face, please?

          Thanks
          Oscar

          [b:dhgwcjdo][color=#0080BF:dhgwcjdo]JAYA Design & Renovation Sdn. Bhd.[/color:dhgwcjdo][/b:dhgwcjdo] [b:dhgwcjdo][color=#00BF40:dhgwcjdo]T[/color:dhgwcjdo][color=#00BC42:dhgwcjdo]h[/color:dhgwcjdo][color=#00B843:dhgwcjdo]e[/color:dhgwcjdo] [color=#00B247:dhgwcjdo]e[/color:dhgwcjdo][color=#00AE48:dhgwcjdo]x[/color:dhgwcjdo][color=#00AB4A:dhgwcjdo]p[/color:dhgwcjdo][color=#00A84C:dhgwcjdo]e[/color:dhgwcjdo][color=#00A44D:dhgwcjdo]r[/color:dhgwcjdo][color=#00A14F:dhgwcjdo]t[/color:dhgwcjdo] [color=#009A53:dhgwcjdo]i[/color:dhgwcjdo][color=#009754:dhgwcjdo]n[/color:dhgwcjdo] [color=#009058:dhgwcjdo]c[/color:dhgwcjdo][color=#008D59:dhgwcjdo]u[/color:dhgwcjdo][color=#008A5B:dhgwcjdo]s[/color:dhgwcjdo][color=#00865D:dhgwcjdo]t[/color:dhgwcjdo][color=#00835E:dhgwcjdo]o[/color:dhgwcjdo][color=#008060:dhgwcjdo]m[/color:dhgwcjdo][color=#007C62:dhgwcjdo]i[/color:dhgwcjdo][color=#007963:dhgwcjdo]z[/color:dhgwcjdo][color=#007565:dhgwcjdo]e[/color:dhgwcjdo][color=#007267:dhgwcjdo]d[/color:dhgwcjdo] [color=#006B6A:dhgwcjdo]o[/color:dhgwcjdo][color=#00686C:dhgwcjdo]f[/color:dhgwcjdo][color=#00656D:dhgwcjdo]f[/color:dhgwcjdo][color=#00616F:dhgwcjdo]i[/color:dhgwcjdo][color=#005E71:dhgwcjdo]c[/color:dhgwcjdo][color=#005B73:dhgwcjdo]e[/color:dhgwcjdo] [color=#005476:dhgwcjdo]s[/color:dhgwcjdo][color=#005178:dhgwcjdo]y[/color:dhgwcjdo][color=#004D79:dhgwcjdo]s[/color:dhgwcjdo][color=#004A7B:dhgwcjdo]t[/color:dhgwcjdo][color=#00477D:dhgwcjdo]e[/color:dhgwcjdo][color=#00437E:dhgwcjdo]m[/color:dhgwcjdo][color=#004080:dhgwcjdo].[/color:dhgwcjdo][/b:dhgwcjdo]

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

            http://rhin.crai.archi.fr/RubyLibraryDepot/plugin_details.php?id=412 has an example for making CHS and RHS sections where it draws the two loops and erases the inner one
            If you are sure that you will only have 2 faces to check - e.g. a grouped set of geometry that is perhaps two concentric circles with faces; and you want to erase the inner 'disc' to leave a 'ring' then use something like this after you have added the edges/faces

            
            group.entities.each{|e|
              e.erase! if e.class==Sketchup;;Face and e.loops[1]
            }
            ### i.e. the ring has two loops but the inner circle only has one...
            
            

            There are several ways to add faces to entities sets and also to check which is the inner face etc if an edge has two faces... πŸ€“

            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