Please or 注册 to create posts and topics.

如何在电线杆顶部安装平屋顶 - City Engine CGA 规则

How to place a flat roof on top of poles- City Engine CGA rules

大家好

我正在 City Engine 中创建车棚 CGA 规则。这个车棚看起来像一张桌子,请帮忙制定这个 CGA 规则,我希望车顶能固定在杆子上,而不是像那样发生位移。

以下是我目前所做的:

Rule 1:
TidimaloMaphoto_0-1744104674808.png

// Attributes

attr carportWidth = 5.0 // Width of the carport

attr carportDepth = 3.0 // Depth of the carport

attr carportHeight = 0.2 // Thickness of carport roof

attr poleHeight = 2.0 // Height of poles

attr poleWidth = 0.1 // Thickness of poles

attr carportColor = "#313333" // Color for roof and poles

 

// Start Rule

Footprint -->

s('1, 0, '1) // Normalize size (1x1 base)

PlaceCornerPoles // Place poles first

t(0, poleHeight, 0) // Move up to top of poles

Roof // Add roof directly at top of poles

 

// Roof definition

Roof -->

color(carportColor)

s(carportWidth, carportHeight, carportDepth)

center(y)

primitiveCube()

 

// Place poles at the four corners (aligned to roof corners)

PlaceCornerPoles -->

CornerPole(0, 0)

CornerPole(carportWidth, 0)

CornerPole(0, carportDepth)

CornerPole(carportWidth, carportDepth)

 

// Corner pole placement (centered on corner point)

CornerPole(xPos, zPos) -->

t(xPos - poleWidth/2, 0, zPos - poleWidth/2)

Pole

 

// Pole definition

Pole -->

color(carportColor)

s(poleWidth, poleHeight, poleWidth)

center(y)

primitiveCube()

Rule 2:

TidimaloMaphoto_1-1744104939094.png 

// Attributes

attr carportheight = 2.0 // Height of carport roof

attr poleheight = 2.0 // Height of support poles

attr polewidth = 0.1 // Thickness of poles

attr carportColor = "#313333" // Color for both roof and poles

 

// Start Rule

Footprint -->

s('1, 0, '1) // Normalize size (1x1 base)

extrude(carportheight)

comp(f) { top: Roof | side: NIL }

PlaceCornerPoles

 

// Roof definition

Roof -->

color(carportColor)

 

// Place poles at the four corners

PlaceCornerPoles -->

CornerPole(0, 0)

CornerPole(0, 1)

CornerPole(1, 0)

CornerPole(1, 1)

 

// Corner pole placement

CornerPole(xPos, zPos) -->

t(xPos, 0, zPos)

Pole

 

// Pole definition

Pole -->

s(polewidth, poleheight, polewidth)

center(y)

primitiveCube()

color(carportColor)

我采用了不同的方法,创建了两个分支。一个用于屋顶,一个用于柱子,并且各自独立工作。

version "2024.1"

attr poleWidth = 0.5
attr carportHeight = 10
attr slabHeight = 1
attr carportColor = "#313333"

scale_on_X = scope.sx - 2 * poleWidth
scale_on_Z = scope.sz - 2 * poleWidth 

plot -->
	color(carportColor)
	Poles
	Roof
	
Poles -->
	s( scale_on_X , '1, scale_on_Z )
	center(xz)
	extrude(carportHeight)
	comp(e){vertical: Edge}
	
Edge -->
	center(xz)
	rotateScope(90,90,0)
	primitiveCylinder(12, poleWidth, carportHeight)
	
Roof -->
	extrude(carportHeight)
	comp(f){top: Slab}
	
Slab -->
	extrude(slabHeight)

 

我采用了不同的方法,创建了两个分支。一个用于屋顶,一个用于柱子,并且各自独立工作。

version "2024.1"

attr poleWidth = 0.5
attr carportHeight = 10
attr slabHeight = 1
attr carportColor = "#313333"

scale_on_X = scope.sx - 2 * poleWidth
scale_on_Z = scope.sz - 2 * poleWidth 

plot -->
	color(carportColor)
	Poles
	Roof
	
Poles -->
	s( scale_on_X , '1, scale_on_Z )
	center(xz)
	extrude(carportHeight)
	comp(e){vertical: Edge}
	
Edge -->
	center(xz)
	rotateScope(90,90,0)
	primitiveCylinder(12, poleWidth, carportHeight)
	
Roof -->
	extrude(carportHeight)
	comp(f){top: Slab}
	
Slab -->
	extrude(slabHeight)

非常感谢 。
我调整了一些参数,形状就完美了。

TidimaloMaphoto_0-1744273320472.png

 

非常感谢 
我调整了一些参数,形状就完美了。 

TidimaloMaphoto_0-1744273320472.png