No constructor for Vertex object ?
-
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 ?
-
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
Vertexhad atransform!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.
-
-
If you think about it a
Vertexcan't exist without anEdge!
That's what aVertexis - the.start/.endof anEdge.
Although there is averts=face.verticesmethod it's effectively shorthand toverts=[]; face.edges.vertices.each{|v|verts << v if not verts.include?(v)}- aFacecan't haveVerticeswithout it having at least oneLoopofEdges- as you know all too well... when you accidentally erase one suchEdgetheFaceerases with it...So to add a new
Vertexyou need either to make a newEdgestarting from the requiredvertex.position- then you'll have the newVertexasnewedge.start; or if you want a newVertexon an existingEdge... here let's assume half way along it... thennew_vertex=edge.split(0.5).startwill add it.If you want the new
Vertexto be associated with an existingFacethen it must be on one of theface.outer_loop.edges[or any of the.edgesfrom [ruby:1rgyg24s]face.loops[i][/ruby:1rgyg24s] if it's to be on the perimeter of a 'hole'].To make a new
Vertexassociated with a newFaceyou'll need threeVertices- the [ruby:1rgyg24s]face=entities.add_face(p0, p1, p3)[/ruby:1rgyg24s] will make a triangularFacefrom 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 usingvertex.positionfor an existingVertexif you are adding to it, OR if new, using [ruby:1rgyg24s]Point3d[/ruby:1rgyg24s] where you want a newVertexat 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 said:
If you think about it a
Vertexcan't exist without anEdge!No in SketchUp world - but you can create stand-alone vertices in 3DsMax.
-
@thomthom said:
@tig said:
If you think about it a
Vertexcan't exist without anEdge!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...
Advertisement
