Torus (Donut)

Okay this time around I’m not dealing with donut faces I’m actually trying to create a donut or more properly a torus with two circles and the followme method. Has anyone tried this before?

Donut example:

I sent you code using arcs [for more control] last time you asked?

john

1 Like

For some reason I thought this would be hard, here is my code:

        barradius = @Hbardia * 0.5

		xpos = @Pierdia * 0.5 - rebarclr
		ypos = 0
		zpos = 0 - rebarclr - 1.0
		
		grouph = Sketchup.active_model.active_entities.add_group
		entitiesh = grouph.entities

		centertorus = Geom::Point3d.new 0, 0, zpos
		torusradius = xpos
		toruscircle = entitiesh.add_circle centertorus, Z_AXIS, torusradius, 24

		group2 = Sketchup.active_model.active_entities.add_group
		entities2 = group2.entities

		centercircle = Geom::Point3d.new xpos, ypos, zpos
		barcircle = entities2.add_circle centercircle, Y_AXIS, barradius, @Numsegs_db
		barface = entities2.add_face(barcircle)
	
		barface.followme(toruscircle)
		grouph.erase!

Too easy!