SketchUp script clips #2: Creating geometry
In this section, we’ll start creating scripted geometry in SketchUp. In this and all following posts, I’ll approach SketchUp scripting in a pragmatic way. This means that I don’t think every step in the process should be scripted – after all, I am not writing a plugin. I’ll only script what can’t efficiently be modeled by hand and I’ll use standard SketchUp modeling tools to finish up a project.
Before you get going, make sure you have read the first installment of this series and have the latest version of the Ruby Code Editor installed.
Creating geometry is pretty easy with the SketchUp Ruby API. In essence, you will be adding to the collection of entities in the current model. To do this, you can use any of these methods of the entities object:
Entities (Parent: Object)
.[] .add_3d_text .add_arc .add_circle
.add_cline .add_cpoint .add_curve
.add_edges .add_face
.add_faces_from_mesh .add_group
.add_image .add_instance .add_line
.add_ngon .add_observer .add_text
.at .clear! .count .each .erase_entities
.fill_from_mesh .intersect_with .length
.model .parent .remove_observer
.transform_by_vectors
.transform_entities
![[as]](http://www.alexschreyer.net/blog/wp-content/themes/alex-2009/img/as.png)



