Hi all,
how to generate the arched entry like figure1?
i used extrude(world.up.flatTop, archeight) , but can't generate an arch with the top on the same level(figure 2)
I can think of a few ways to build this arch in CGA but I would say having a simple 3D asset you can bring in with an i() operation would be way easier to fit into place.
As @DevinLavigne said, inserting a 3D asset for the arch is the easiest way. I would also recommend this.
But, if you really want to make it in cga, here's one way you could do it using extrude(world.up.flatTop, Height). This code does not include the top face when it aligns perfectly with the top of the arch since it looks like you don't need it in your example. However, if you want to add that face on top, then uncomment the code for CreateTopArchFace which is commented out below.
@Order(1)
@Range(min=0, max=20, stepsize=1, restricted=false)
attr Height = 10
@Order(2)
@Range(min=0, max=10, stepsize=1, restricted=false)
attr Arch_Height = Height
@Order(3)
@Range(min=3, max=100, stepsize=1, restricted=false)
attr Num_Segments = 16
Generate -->
primitiveCylinder(2*Num_Segments)
r(90, 0, 0)
s('1, scope.sz, 2*Arch_Height)
t(0, 0, '-0.5)
split(z) { ~1: Arch | ~1: NIL }
Arch -->
comp(f) { front: NIL | side= ArchFaces }
# CreateTopArchFace
ArchFaces -->
extrude(world.up.flatTop, Height)
# CreateTopArchFace -->
# case Height==Arch_Height:
# comp(f) { floor(Num_Segments/2)+2: TopArchFace. }
# else:
# NIL