Creating Curved Surfaces


#1

I think I’ve finally been bested by the complicated geometry and the limitations of SketchUp or perhaps my ability to model within SketchUp.

Notice the raised panel shutters for an arched windows shown below:

To create the raised panel effect I will draw the three outlines and then use the transform_entities method to move the edges into the plane. The problem is when I try this with a curved outline(s) as shown SketchUp does not know how to handle the curved planes/surfaces being created.

View model here:

The only other way I can think of for creating this geometry is to use the follow me method and then doing a boolean subtraction, which I have not tried yet.

My code is:

def raised_panel_shutter_arc (x1, x2, z1, z2, startangle, center_pt2, y0, paneledge, depth, entities1)

	i1 = 0.625
	i2 = 1.625

	normal1 = Geom::Vector3d.new 0,-1,0
	xaxis1 = Geom::Vector3d.new 1,0,0
	rout = (x2 - x1) + paneledge
	rmid = (x2 - x1) + paneledge - i1
	rin = (x2 - x1) + paneledge - i2

	# Outer Face

	psi1 = asin(paneledge/rout)
	edgemod1 = paneledge/(tan(psi1))
	startangleout = startangle - psi1
	endangleout = psi1

	x2mod1 = @Wshttx1 + edgemod1
	z2mod1 = @pt1ym + edgemod1
	
	edgearray1 = entities1.add_arc center_pt2, xaxis1, normal1, rout, startangleout, endangleout, 12
	edge1 = edgearray1[0]
	arccurve1 = edge1.curve

	line1 = entities1.add_line [x1, y0, z1] , [x1, y0, z2mod1]
	line2 = entities1.add_line [x2mod1, y0, z1] , [x1, y0, z1]
						
	halfround_path1 = line1.all_connected
	outer_face = entities1.add_face(halfround_path1)


	# Mid Face

	psi2 = asin((paneledge+i1)/rmid)
	edgemod2 = (paneledge+i1)/(tan(psi2))
	startanglemid = startangle - psi2
	endanglemid = psi2

	x2mod2 = @Wshttx1 + edgemod2
	z2mod2 = @pt1ym + edgemod2

	x1mod2 = x1 + i1
	z1mod2 = z1 + i1
	
	edgearray2 = entities1.add_arc center_pt2, xaxis1, normal1, rmid, startanglemid, endanglemid, 12
	edge2 = edgearray2[0]
	arccurve2 = edge2.curve

	line3 = entities1.add_line [x1mod2, y0, z1mod2] , [x1mod2, y0, z2mod2]
	line4 = entities1.add_line [x2mod2, y0, z1mod2] , [x1mod2, y0, z1mod2]
						
	halfround_path2 = line3.all_connected
	mid_face = entities1.add_face(halfround_path2)


	# Inner Face

	psi3 = asin((paneledge+i2)/rin)
	edgemod3 = (paneledge+i2)/(tan(psi3))
	startanglein = startangle - psi3
	endanglein = psi3

	x2mod3 = @Wshttx1 + edgemod3
	z2mod3 = @pt1ym + edgemod3
	
	x1mod3 = x1 + i2
	z1mod3 = z1 + i2
	
	edgearray3 = entities1.add_arc center_pt2, xaxis1, normal1, rin, startanglein, endanglein, 12
	edge3 = edgearray3[0]
	arccurve3 = edge3.curve

	line5 = entities1.add_line [x1mod3, y0, z1mod3] , [x1mod3, y0, z2mod3]
	line6 = entities1.add_line [x2mod3, y0, z1mod3] , [x1mod3, y0, z1mod3]
						
	halfround_path3 = line5.all_connected
	inner_face = entities1.add_face(halfround_path3)

	line7 = entities1.add_line [x1, y0, z1] , [x1mod2, y0, z1mod2]
	line7b = entities1.add_line [x1mod2, y0, z1mod2] , [x1mod3, y0, z1mod3]

	line8 = entities1.add_line [x1, y0, z2mod1] , [x1mod2, y0, z2mod2]
	line9 = entities1.add_line [x1mod2, y0, z2mod2] , [x1mod3, y0, z2mod3]

	line10 = entities1.add_line [x2mod1, y0, z1] , [x2mod2, y0, z1mod2]
	line11 = entities1.add_line [x2mod2, y0, z1mod2] , [x2mod3, y0, z1mod3]


	lineslist = [line3, line4, edge2]

	trans = Geom::Transformation.new([0,-depth,0])
	entities1.transform_entities(trans, lineslist)

end

#2

If it’s any consolation, you’d get funky geometry if you try to move the edges in using Move with Auto-fold, too.

If you have a vertical segment at the bottom corner of the arc and a horizontal one at the top, though, at least with Move and Auto-fold, the geometry works out the way you might want it. Maybe you can code that.


#3

How did you get it to do this? and what is auto-fold?


#4

Figured out the auto-fold option, never noticed that before. I don’t know how to toggle auto-fold in the API, I guess I will need to try the follow me route and see if I can get that to work.


#5

Of course I did this all manually. I drew a circle and rotated it so sides are parallel to the red axis (at the top and bottom) and sides parallel to the blue axis at the left and right sides. Then I quartered the circle with a couple of edges drawn with the Line tool and then erasing the 3/4 of the circle I didn’t need. Thickness with Push/Pull, Offset to create the edges of the frame and the edge of the raised panel’s field. Between them is what will be the bottom of the V-groove.

I selected the edges for the bottom of the groove, got the Move tool and held Alt to invoke Auto-fold. Then I just moved the selection to create the groove. Auto Fold is what makes the required creases as in this example.


#6

I can’t tell you about Autofold in the API. Sorry.

FWIW, it’s not very likely that a real frame and panel assembly would look like this anyway. It’s probably workable for a representation but it’s not quite true to life.


#7

I think if you just write a code to move the line loop, then it will automatically auto-fold. When modeling, you just need to move the line loop to activate auto-fold. No need to press auto-fold, using the arrow key to choose an axes to inference will work fine.


#8

Can you elaborate on this? What do you see?


#9

I would just created a jumbled mess. I’ve since replaced that code with a follow me routine that seems to work much better.