Hey guys i am building a city and i want to make a loopcut into every single building from the bottom in the exact same point! Lets say i want every building to have a loopcut at 3 m from ground ...do ihave to do it in every building manually or there is a quicker way?
-
$\begingroup$ maybe use the knife? K to activate, Z to cut through, C to cut horizontally... $\endgroup$– moonbootsMar 19, 2021 at 15:54
-
$\begingroup$ the only problem with that is that the city is not on a flat surface! so everything is in different heights! i was looking something less tedious than having to go building by building separately! $\endgroup$– alexkarMar 19, 2021 at 16:17
-
$\begingroup$ my bad I thought that it was possible to cut several objects at once with th knife $\endgroup$– moonbootsMar 19, 2021 at 16:20
-
$\begingroup$ its ok mate thanks anyway! $\endgroup$– alexkarMar 19, 2021 at 16:41
-
1$\begingroup$ It may still be possible with the knife. If no building's bottom is above another buildings top. - Then: Do what moonboots suggested in the first comment and cut all buildings, but at an arbitrary height. Then press g twice and slide all loops to the bottom. (Make sure auto merge is turned off) And finally press g, z, 3 to move all loops up by 3m. $\endgroup$– michaelhMar 19, 2021 at 17:18
2 Answers
Bmesh script.
Script to bisect each selected mesh globally 3 units above its bounding box lower corner.
Edit height = 3
to adjust.
Test script, select any or all of the objects to bisect, in OBJECT mode and press run script.
import bpy
from bpy import context
from mathutils import Vector
import bmesh
# global coordinates
height = 3
plane_no = (0, 0, 1)
meshes = set()
bm = bmesh.new()
for ob in context.selected_objects:
if ob.type != 'MESH':
continue
me = ob.data
if me in meshes:
continue
meshes.add(me)
bm.from_mesh(me)
mw = ob.matrix_world
bbox = [mw @ Vector(b) for b in ob.bound_box]
h = (bbox[1] - bbox[0])
if h.length > height:
print(f"Cutting {ob.name}")
print(h, h.normalized(), bbox[0])
mwi = mw.inverted()
bbox[0].z += height
bmesh.ops.bisect_plane(
bm,
geom=sum((bm.faces[:], bm.edges[:]), []),
plane_no=plane_no,
plane_co=mwi @ bbox[0],
)
bm.to_mesh(me)
me.update()
bm.clear()
bm.free()
-
-
$\begingroup$ Def not the master of the quick illustration. Find peek can be slippery took 3 goes to get that bad one, wanted to switch into edit mode .. must have swiped a lamp.. $\endgroup$ Mar 19, 2021 at 17:20
-
$\begingroup$ my problem is A)Many buildings are combined as one object B)i have a terrain that has different heights! so i want each edge in the z axis to be subdivided so that te distance from the ground will be x $\endgroup$– alexkarMar 19, 2021 at 17:30
-
$\begingroup$ Please edit any extra detail (like this) into question. Maybe a pic or two too. $\endgroup$ Mar 19, 2021 at 19:18
Sounds like a good place for the Bisect tool, here, from the T toolbar, all objects selected, and all faces selected in Edit mode:
Settings adjusted in its F9 panel. (I'm cutting at 1m)
EDIT: To achieve this via the UI, if all the buildings start at different heights:
- Open a Timeline, and stash all the objects' locations as a keyframe. (With all selected, I, key Locations)
- On another frame, Header menu > Object > Align Objects > Negative Sides, in Z. Other alignments, too, if that makes the tool easier to use. (Key again, if you like.)
- Proceed to Bisect, as above, in Edit mode.
- Delete the 'aligned' key, if you've made one. The buildings will jump back to their original positions.
-
$\begingroup$ i dont have a plane as a terrain! my terrain is uniformed with hills so i cant bisect from a plane! (if i try to bisect i get wired angle results) $\endgroup$– alexkarMar 19, 2021 at 16:41
-
$\begingroup$ In that case, you should probably consider finalizing your modeling process on the buildings before scattering them on your terrain. $\endgroup$– fmotion1Mar 19, 2021 at 16:50
-
$\begingroup$ if i add a loop cut i each building can i somehow manage each selected point afterwards to be a specific distance from the bottom? $\endgroup$– alexkarMar 19, 2021 at 17:08
-
1
-
1$\begingroup$ "Toyed moy 'orse to a gaap in the 'edge, aan, when oi kem baak, there it was, gone!". etc. :D $\endgroup$– Robin Betts ♦Mar 19, 2021 at 19:23