Raise Surface

Hi there,

I want to share a small Python (node) script to use for raising (or lowering) a TIN surface in Civil 3D, because this function node is not available yet in the current versions of available packages.
The input is a TIN surface and a number as delta Elevation for raising (+) or lowering (-) this surface.

Best way to use this is to make a custom node of it. See attachment.

Have fun.
Thx for the support @mzjensen and @geert.drijfhout :wink:

import System
import clr

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 import *

adoc = Application.DocumentManager.MdiActiveDocument

surface = IN[0]
deltaElevation = IN[1]

def RaiseSurface(surface, deltaElevation):
	
	global adoc
	
	with adoc.LockDocument():
	    with adoc.Database as db:
	        with db.TransactionManager.StartTransaction() as t:
	            surfId = surface.InternalObjectId
	            surf = surfId.GetObject(OpenMode.ForWrite)
	            
	            surf.RaiseSurface(deltaElevation)
	            t.Commit()
	            
	            pass
	return surface

OUT = RaiseSurface(surface, deltaElevation)

RaiseSurface.dyf (7.5 KB)

2 Likes

Hi
Can you use Object.Transform

2 Likes

Nice work! @hosneyalaa: Elegant solution wich adds the raise / lower to the surface definition. That makes the edit transparent and editable afterwards.

Iโ€™ll be using this for sure, eg hatch exisiting pavement in section views.

1 Like

He is the best Use the mothed
It has more flexibility in modification

@hosneyalaa Briljant! Never thought of that to use it this way. Thanks!

@hosneyalaa : I stand corrected, didn โ€˜t realize the node worked the same way. Thanks!