Hi.
I'm trying to generate basic building blocks from complex footprints. This works in general (BasicShape_1), but I'd like to refine it a bit. I used convexify to remove smaller extrusions and now I'd like to use the leftover bulk with the cube function.. however, sometimes I end up with multiple parts (see image below, green blocks), meaning I can't use that method. Is there a way to combine them?
Also is there a way to force "normal" behavior after splitting? When I scale the cube on the splits, the x-axis points up. Rotating fixes that, but I expect this won't work the same everywhere.
script:
version "2014.0" // ADJUSTMENT ATTRIBUTES attr Roof_Angle = 33 attr Ground_Height = 1.0 attr Floor_Height = 2.8 attr Building_Height = Ground_Height + (aog*Floor_Height) // ATTRIBUTES attr daf = 0 attr aog = 0 attr Building_Width = 0 attr Building_Depth = 0 Lot--> set(Building_Width, scope.sx) set(Building_Depth, scope.sz) BasicShape_2 BasicShape_1 --> i("builtin:cube") s(Building_Width,Building_Height,Building_Depth) color(0,0,1) set(material.opacity,0.15) BasicShape_2 --> color(0,1,0) convexify(scope.sx) comp(f){all: SubShapes} SubShapes --> case scope.sx <= 3: color(1,0,0) else: color(0,1,0) cleanupGeometry(all,1) BuildCube_ BuildCube --> i("builtin:cube") s(Building_Width,Building_Height,Building_Depth) set(material.opacity,0.18) print(Building_Width)
could you scale in one direction so it's more square to prevent two cubes being used or use the split operation to trim off either end so, again, you end up with a square?
or maybe workout the threshhold at which you get two cubes and insert a different object instead?
have you tried the alignScopeTo... operations to fix the up direction?
I tried a few things.. the closest I can get to this so far is this, but the ChopChop variable change isn't recognized by "BuildCube" so the scaling's off.
BasicShape_3 -->
color(0,1,0)
convexify(scope.sx)
comp(f){
0: CutOff |
1: SubShapes
}
CutOff -->
set(ChopChop, scope.sx)
print(ChopChop)
SubShapes -->
case scope.sx <= 3:
color(1,0,0)
else:
color(0,1,0)
cleanupGeometry(all,1)
BuildCube
BuildCube -->
rotateScope(90,0,270)
#alignScopeToAxes()
i("builtin:cube")
s(scope.sx,Building_Height,Building_Depth-ChopChop)
set(material.opacity,0.18)
print(Building_Width)
print(Building_Width-ChopChop)
What's the benefit of using BuiltinCube?
The way I would do what I think you're doing is to use innerRect() followed by extrude().
As far as I can tell, the cube is easier to manipulate. innerRect would produce a rectangle somewhere inside the lot and I'd need to translate, rotate and scale it.
Wouldn't aligning scope to longest edge fix that in almost all cases?