You are well ahead of the game then. Especially if you have had exposure to Object Oriented Programming in weakly typed languages (Python for example.)
In my Ruby Learning Resources lists there is a link to primers for programmers coming from other languages.
It explains the similarities and differences. Re: Ruby From Other Languages
FYI, the snippets in the docs are notorious for errors. We report them but, correcting them is low priority.
Issues · SketchUp/api-issue-tracker
Error:
#<NoMethodError: undefined method `pushpull' for nil:NilClass>
This comes from not verifying that an entities.add
call has resulted in a valid Drawinglement
object.
In this scenario, the add_face
call using an ArcCurve
as the object. The result is nil
because the arc is not a closed curve object, … or some other error cannot create the arc.
You could instead perhaps use arc.edges.first.find_faces
, see: Edge#find_faces
This method returns an integer. To get the new face you must use the snapshot subtract pattern:
before = entities.grep(SketchUp::Face)
arc.edges.first.find_faces
new_faces = entities.grep(SketchUp::Face) - before
face = new_faces[0]
if face # nil check
# use the face reference
end
Actually they are in the XZ plane. If you paste just down to the first pushpull
statement the table top is created fine.