2
$\begingroup$

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?

$\endgroup$
9
  • $\begingroup$ maybe use the knife? K to activate, Z to cut through, C to cut horizontally... $\endgroup$
    – moonboots
    Mar 19 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$
    – alexkar
    Mar 19 at 16:17
  • $\begingroup$ my bad I thought that it was possible to cut several objects at once with th knife $\endgroup$
    – moonboots
    Mar 19 at 16:20
  • $\begingroup$ its ok mate thanks anyway! $\endgroup$
    – alexkar
    Mar 19 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$
    – michaelh
    Mar 19 at 17:18
7
$\begingroup$

Bmesh script.

enter image description here

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()
$\endgroup$
4
  • $\begingroup$ bF to the rescue :D $\endgroup$ Mar 19 at 17:15
  • $\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$
    – batFINGER
    Mar 19 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$
    – alexkar
    Mar 19 at 17:30
  • $\begingroup$ Please edit any extra detail (like this) into question. Maybe a pic or two too. $\endgroup$
    – batFINGER
    Mar 19 at 19:18
4
$\begingroup$

Sounds like a good place for the Bisect tool, here, from the T toolbar, all objects selected, and all faces selected in Edit mode:

enter image description here

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:

  1. Open a Timeline, and stash all the objects' locations as a keyframe. (With all selected, I, key Locations)
  2. 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.)
  3. Proceed to Bisect, as above, in Edit mode.
  4. Delete the 'aligned' key, if you've made one. The buildings will jump back to their original positions.
$\endgroup$
8
  • $\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$
    – alexkar
    Mar 19 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$
    – Jay
    Mar 19 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$
    – alexkar
    Mar 19 at 17:08
  • 1
    $\begingroup$ "Whale oil beef hooked" $\endgroup$
    – batFINGER
    Mar 19 at 19:18
  • 1
    $\begingroup$ "Toyed moy 'orse to a gaap in the 'edge, aan, when oi kem baak, there it was, gone!". etc. :D $\endgroup$ Mar 19 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.