Tuesday, November 28, 2023
Home3D ModelingCan't rework vertex! - Ruby API

Can’t rework vertex! – Ruby API


g.skp (63.5 KB)

g = Sketchup.active_model.choice[0]
vec = Geom::Vector3d.new(0,0,1.m)
tr = Geom::Transformation.new(vec)
vertices = g.entities.grep(Sketchup::Face).map(&:vertices).flatten.uniq
g.entities.transform_entities(tr,vertices)
g.entities.transform_by_vectors(vertices, [vec]*vertices.size)


Hello,

Attempt the next…

mannequin = Sketchup.active_model
entities = mannequin.active_entities
choice = mannequin.choice
vertices = choice.grep(Sketchup::Face).map(&:vertices).flatten.uniq

# Explode curves if any
vertices.every do |vertex|
  vertex.edges[0].explode_curve
finish

vec = Geom::Vector3d.new(0,0,1.m)
tr = Geom::Transformation.new(vec)
entities.transform_entities(tr, vertices)

It appears that evidently the tactic #transform_entities doesn’t work on vertices which are utilized in curves. That’s the reason I made certain to blow up the curves. I wish to know if it is a BUG or whether it is regular.



1 Like

It’s okay,however I don’t need explode the curve.

This labored for me …

g = Sketchup.active_model.choice[0]
vec = Geom::Vector3d.new(0,0,1.m)
tr = Geom::Transformation.new(vec)
ents = g.entities
vertices = ents.grep(Sketchup::Face).map(&:vertices).flatten.uniq
ents.transform_entities(tr, *vertices)

I’m unsure why transformaing the vertices doesn’t work. Maybe as a result of they share a softened edge ?

BTW: The within of the tube wants it’s floor reversed.



1 Like

I get the next error on the Ruby console:

“undefined methodology `entities’ for #Sketchup::Face:0x000001ae797f9968nDid you imply? entityID (Line 4)”

With my snippet above?

If, so do you’ve the entire group (and solely that) chosen ?

I’d counsel logging an API situation for this.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments