Retrieve the geometry of an entity


1.) How can I use the geometry of an entity, (e.g. points, and planes). In other words, I would like to measure the distance between each point, line and plane of an entity and another point.

2.) How can I retireve the color of an entity by using Ruby?

Retrieve the color of an entity

I am trying to link you over to your other topic about layers, where you asked the same question, but I am bungling the link. Anyway, please have a read over there…


(a) Planes in SketchUp are abstract and infinate. (They are represented by arrays.) You really mean faces, so we will talk about those.

Faces and Edges (the primitives of SketchUp,) have and often share Vertices. You can get the 3D position of a vertex (a Sketchup::Vertex instance,) via it’s position getter method.

There are several getter methods in the Sketchup::Edge class to get the object’s vertices, ie, .start, .end, and .vertices.

For the Sketchup::Face class there is also a .vertices method.
But faces also have an outer loop of edges, and can have one or more inner loops (holes in the face.) You can retrieve Sketchup::Loop objects, via a faces .outer_loop and .loop methods.

In the Loop class there is also a .vertices method.

Getting the position of a vertex, returns a Geom::Point3d instance object.
You can use it’s distance method to return a Length class instance between it, and a given point.

So say you have two references to edge objects, e1 and e2:
d1 = e1.start.position.distance( e2.start.position )


Thanks a lot! I already read it. Most helpful!!!