How to cut Solid with Terrain Surface

I am thinking of using Geometry.Split to cut Solid from a terrain Surface.
However, it is not possible to cut out Solid. How can I resolve this issue?
I would be very grateful if you could tell me.
I have also attached the relevant files for your review.


Geometry_Split.dyn (61.5 KB)
コリドーedit_GD.dwg (1.9 MB)

Are you trying to split the terrain or the solid?

I would like to divide Solid into two parts.

So splitting solids is both slow and difficult at the moment. What is the goal/intent once you have the solid split? I’m conscious of time/speed due to including the Data.Remember node and the file name on the DWG indicating you might be moving to a Generative Design workflow, and such calculations are not optimal for that type of process.

1 Like

not sure but agree with Jacob solid split can be heavy on huge topo…probably something here, but as you can see your topo isnt 100 % watertight

EDIT : see now its for c3d…hehehe goodmorning :wink:

Revit_lbjNNezFn0

3 Likes

The ultimate goal is to determine the shape of the cut slope using soil volume calculations in Generative Design.
I intend to establish indicators other than soil volume.

I was hoping to cut out Solid with Terrain and Corridor Surfaces to get the soil volume.
If not this way, what is the best way?

The goal of generative design isn’t ‘this is the final number’, but ‘this option is better relative to that one because it performs better on this metric’.

So in your case I’d want to say ‘this design has less grading required’, not ‘this design has N units of soil to move’.

One easy way to do this is to leverage VASA - think of each voxel as a dump truck work of earthwork (though your exact size may be more or less. Also note that you can’t use Civil 3D in ‘defining the corridor’ - be more abstract. Generative Design is the layer of trace you put over the topologic map in the conference room, not the final construction documents.

@s.iwasaki this isn’t in a Civil 3D context, but the concepts might help a good bit.

By converting the Dynamo mesh to a MeshToolkit mesh we can leverage the boolean tools there, which opens a bunch of possiblities, such as (somewhat) accurate volume calculations. In my sample dataset (from Forma) I am able to calculate the volume of about 450m x 450m of terrain in ~7.5 seconds by way of two Mesh.BooleanDifference nodes (so stuff which should be excessively slow).

This Python should help convert to a MeshToolkit mesh.
########################################
############## Properties ##############
########################################
__author__ = 'Jacob Small'
__version__ = '0.1.0'
__description__ = "Convert a Dynamo mesh element to a mesh toolkit element"
__DynamoBuilds__ = "2.18"
__ReleaseNotes__ = "none"
__Dependancies__ = "Mesh Toolkit"
__Copyright__ = "2024, Autodesk Inc."
__license__ = "Apache 3.0"



########################################
### Configure the Python environment ###
########################################
### standard imports ###
import sys #add the sys class to the Python environment so we can work with the sys objects
import clr #add the CLR (common language runtime) class to the Python environment so we can work with .net libraries
import math #add the Math class to the Python environment so we can do math stuff
import random #add the Random module to the Python environment so we can impersonate a squirrel

### basic Dynamo imports ###
clr.AddReference('ProtoGeometry') #add the Dynamo geometry library to the CLR
from Autodesk.DesignScript import Geometry as DG #add the Dynamo geometry class using the alias DG, to ensure no overlap between class calls in Revit or Dynamo
import Autodesk.Dynamo.MeshToolkit as TM #import the mesh toolkit package as TM to prevent namespace collision
from collections import defaultdict #import the defaultdict class so we can use stuff other than strings as keys to a dictionary



########################################
########### code starts here ###########
########################################
### inputs from dynamo ###
mesh = IN[0] #the Dynamo mesh from the Dynamo environment
positions = mesh.VertexPositions #get the points from the mesh

### build a dictionary with each position as a key ###
positionDict = defaultdict() #build a new defaultdict object
for i in positions: positionDict[i] = None #add each point as a new key

### set the index of each position to it's sequence ###
j = 0 #set j to 0
for key in positionDict.keys(): #for each key in the positionDict
    positionDict[key] = j #set the key's value to the current value of j
    j+=1 #increment j by 1

### generate the index groups ###
indexGroups = [] #create a new list of idnex groups
for faceIndex in mesh.FaceIndices: #for each face index
    indexGroups.append(positionDict[positions[faceIndex.A]]) #get the original mesh's index for index A from the dictioanry and append the value to the list of index groups
    indexGroups.append(positionDict[positions[faceIndex.B]]) #get the original mesh's index for index B from the dictioanry and append the value to the list of index groups
    indexGroups.append(positionDict[positions[faceIndex.C]]) #get the original mesh's index for index C from the dictioanry and append the value to the list of index groups

### generate the list of points ###
pnts = [i for i in positionDict.keys()] #get each key from the positinoDict as a list

### create the toolkit mesh ###
tkMesh = TM.Mesh.ByVerticesAndIndices(pnts, indexGroups) #build mesh toolkit mesh

### return the results to the Dynamo environment ###
OUT = tkMesh #send the toolkit mesh to Dynamo

As an added bonus you can color the surfaces of mesh toolkit objects by vertex, which should make displaying edited topography much easier in the context of generative design.