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
Vertex
had 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
Vertex
can't exist without anEdge
!
That's what aVertex
is - the.start
/.end
of anEdge
.
Although there is averts=face.vertices
method it's effectively shorthand toverts=[]; face.edges.vertices.each{|v|verts << v if not verts.include?(v)}
- aFace
can't haveVertices
without it having at least oneLoop
ofEdges
- as you know all too well... when you accidentally erase one suchEdge
theFace
erases with it...So to add a new
Vertex
you need either to make a newEdge
starting from the requiredvertex.position
- then you'll have the newVertex
asnewedge.start
; or if you want a newVertex
on an existingEdge
... here let's assume half way along it... thennew_vertex=edge.split(0.5).start
will add it.If you want the new
Vertex
to be associated with an existingFace
then it must be on one of theface.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 newFace
you'll need threeVertices
- the [ruby:1rgyg24s]face=entities.add_face(p0, p1, p3)[/ruby:1rgyg24s] will make a triangularFace
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 usingvertex.position
for an existingVertex
if you are adding to it, OR if new, using [ruby:1rgyg24s]Point3d[/ruby:1rgyg24s] where you want a newVertex
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 said:
If you think about it a
Vertex
can'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
Vertex
can'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