• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

No constructor for Vertex object ?

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 3 Posters 398 Views
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.
  • D Offline
    Didier Bur
    last edited by 17 Jan 2011, 10:45

    Hi,
    Apparently there is no Vertex.new() method.
    How would you (if it is possible) create a vertex object otherwise than creating an edge that starts from this vertex.position ?
    Given v a vertex, v.position.set!(x,y,z) doesn't update the vertex too.

    My problem is that I have to move vertices at the "vertex level" to deform shapes and faces. Any idea ?

    DB

    1 Reply Last reply Reply Quote 0
    • T Offline
      thomthom
      last edited by 17 Jan 2011, 11:09

      Either one of these work - I use them for Vertex Tools:
      entities.transform_entities( transformation, array_of_vertices )
      entities.transform_by_vectors( array_of_vertices, array_of_vectors )

      It would have been convenient if Vertex had a transform! method, or a setter for position.

      @didier bur said:

      How would you (if it is possible) create a vertex object otherwise than creating an edge that starts from this vertex.position ?

      No way to create vertices. Probably because SketchUp doesn't have native vertex editing capabilities. Other software let yo create single unconnected vertices. But I'm not sure how much use it'd have in SketchUp.

      Thomas Thomassen β€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • D Offline
        Didier Bur
        last edited by 17 Jan 2011, 12:28

        @unknownuser said:

        Either one of these work - I use them for Vertex Tools

        πŸ‘ πŸ‘ 😍

        DB

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 17 Jan 2011, 13:00

          If you think about it a Vertex can't exist without an Edge !
          That's what a Vertex is - the .start/ .end of an Edge.
          Although there is a verts=face.vertices method it's effectively shorthand to verts=[]; face.edges.vertices.each{|v|verts << v if not verts.include?(v)} - a Face can't have Vertices without it having at least one Loop of Edges - as you know all too well... when you accidentally erase one such Edge the Face erases with it...

          So to add a new Vertex you need either to make a new Edge starting from the required vertex.position - then you'll have the new Vertex as newedge.start; or if you want a new Vertex on an existing Edge... here let's assume half way along it... then new_vertex=edge.split(0.5).start will add it.

          If you want the new Vertex to be associated with an existing Face then it must be on one of the face.outer_loop.edges [or any of the .edges from [ruby:1rgyg24s]face.loops[i][/ruby:1rgyg24s] if it's to be on the perimeter of a 'hole'].

          To make a new Vertex associated with a new Face you'll need three Vertices - the [ruby:1rgyg24s]face=entities.add_face(p0, p1, p3)[/ruby:1rgyg24s] will make a triangular Face from any three [ruby:1rgyg24s]Points[/ruby:1rgyg24s] [if there are more [ruby:1rgyg24s]Points[/ruby:1rgyg24s] they must be coplanar]... These three+ [ruby:1rgyg24s]Points[/ruby:1rgyg24s] can be made using vertex.position for an existing Vertex if you are adding to it, OR if new, using [ruby:1rgyg24s]Point3d[/ruby:1rgyg24s] where you want a new Vertex at that [ruby:1rgyg24s]Point[/ruby:1rgyg24s].

          As already explained the [ruby:1rgyg24s]entities.transform_entities(transformation, entsarray)[/ruby:1rgyg24s] and [ruby:1rgyg24s]entities.transform_by_vectors(entsarray, vecsarray)[/ruby:1rgyg24s] will transform [ruby:1rgyg24s]vertices[/ruby:1rgyg24s] en mass, if pass them as the [ruby:1rgyg24s]entsarray[/ruby:1rgyg24s]...

          TIG

          1 Reply Last reply Reply Quote 0
          • T Offline
            thomthom
            last edited by 17 Jan 2011, 13:18

            @tig said:

            If you think about it a Vertex can't exist without an Edge !

            No in SketchUp world - but you can create stand-alone vertices in 3DsMax.

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • T Offline
              TIG Moderator
              last edited by 17 Jan 2011, 13:25

              @thomthom said:

              @tig said:

              If you think about it a Vertex can't exist without an Edge !

              No in SketchUp world - but you can create stand-alone vertices in 3DsMax.

              I was talking "in Sketchup World"... where else are we?
              You can make a 'guide-point' in Sketchup - cpt=entities.add.cpoint(pt) but it isn't a vertex - cpt.position will return its Point3d though... cpoints don't 'stick' to anything so they are relatively useless as 'vertices' but can form useful 'markers for future vertices - like 3d-mesh made from a points cloud...

              TIG

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              1 / 1
              • First post
                1/6
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement