I need to create a conic frustum in Ruby in SketchUp.
By hand in the GUI, this is easily accomplished by creating a circle, doing a push-pull to get a cylinder, and then choosing a point on the top of the cylinder and "move"ing it along the X-axis to adjust the top circular face radius.
Using the Ruby API, I can’t quite figure out how to grab the point on the top circular face and move it along the X-axis.
Here’s my code so far:
#Create cylinder
pt1 = Geom::Point3d.new(0, 0, heightToLayerBottom)
vt1 = Geom::Vector3d.new(0, 0, 1)
model.start_operation “Cylinder”
numSides = 96
edges = entities.add_circle(pt1, vt1, bottomRadius, numSides)
face = entities.add_face edges
layerHeight = -layerHeight if( face.normal.dot(Z_AXIS) < 0 ) #Guarantees this goes “up” the Z-axis
face.pushpull layerHeight
Now, however, I don’t know how to proceed. I need to get the top face, get the point on this face that intersects with the X-axis, and then move this point along the X-axis a predetermined distance to change the diameter of the top face.
For this case, I will always have a bottom and top face circle centered at (0,0) for X and Y, with a vertical (Z) push-pull cylinder.
Can anyone help?
Thanks,
Madeleine.