Extract surfaces solids

Hi
The below script doesn’t export the surfaces solids, Do you know what is missing ? it returns empty lists

ExtractSurfacesSolids.dyn (12.4 KB)

Regards

hi
try


Hi
What I want to achieve is extracting as many surfaces as available within the model to separated files ( file for each surface solids) … is that possible ?

Oh really
I have not tried it before
May this link help you

or using civil api
https://help.autodesk.com/view/CIV3D/2022/ENU/?guid=a928536c-2ef0-ca28-1903-b00359295053


if this task shall be done by a python coding, what does this node do then ?

I think I haven’t tried it
You need this link after that with some changes
To export to another drawing

hi
try

import clr
import System

clr.AddReference('AcMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')

from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *

from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
from Autodesk.Civil.DatabaseServices.Styles import *

adoc = Application.DocumentManager.MdiActiveDocument
civdoc = CivilApplication.ActiveDocument
 
SS = IN[0]
LL = IN[1]
LLYY = IN[2]

PATHTH = IN[3]

def create_catchment_label(SS,LL,LLYY,PATHTH):

	global adoc
	global civdoc
	
	II = -1
	
	output = []
	
	if not isinstance(SS, list):
		SS = [SS]
		
	if not isinstance(PATHTH, list):
		PATHTH = [PATHTH]


	with adoc.LockDocument():
	    with adoc.Database as db:
	        with db.TransactionManager.StartTransaction() as t:
				for c in SS:
					SurfaceId = c.InternalObjectId
					II +=1
					PATHTHi = PATHTH[II]
					obj = t.GetObject(SurfaceId, OpenMode.ForRead)
					if isinstance(obj, Surface):
						
						SolidQ = obj.CreateSolidsAtDepthToFile(LL,LLYY,1,PATHTHi )

						output.append([SolidQ,PATHTHi])  
				t.Commit()
	return output

OUT =create_catchment_label(IN[0],IN[1],IN[2],IN[3])

1 Like

It worked perfectly with simple surfaces but it returns this warning for the huge ones:

(Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 72, in
File “”, line 65, in Create_Catchment_Label
SystemError: Surface has too many triangles, no more than 100000 triangles allowed)

try
using Manual

Capture

I already use Manual

Oh really
I don’t know the problem
Can you attach an example drawing?
for experimentation

I uploaded it here due to big size

https://wetransfer.com/downloads/94c810f71ce80e34543e2b6aa1e48bd820220111093656/2cabad91da1a27f23ec8eac46f086a0c20220111093730/4689b8

Tried it through the program from the same thing
It does not work because the surface is too large

Therefore, it will not work with programming



Work with me when the size of the surface is small by setting borders

You can divide the surface into parts and then group them together in a plate

can you use TinSurfaceExtensions.Crop

1 Like

it works from the civil 3d built in command but takes a bit long time

let’s investigate if there is a coding line can overcome this

I got this issue exactly and used what @hosneyalaa suggested (cropping the surface). My workflow :

  • Crop the terrain surface temporarily
  • Use that to extract the solids
  • Delete the cropped surface so it will be completely transparent for the user

Normally it is the terrain surface that is too big. Personally I used the corridor surface perimeter with a small offset as the cropping object. It worked nicely

3 Likes