Civil 3D Tin Volume Surface Color Range

Hello - I’m new to dynamo and trying to figure out if I can create a color range to override the surface style for a tin volume surface.

Essentially, I want to automate the cut/fill map process with the standards I use regularly. Usually, I use 255, 200, 200 as my 0 to -1 cut color and then use a darker red for each increment of increased cut. For the fill values I do the same with shades of blue (0 to 1 is 200, 200, 255, 1 to 2 is 190, 190, 255, and so on). Is there a way to automate this in dynamo?

Thanks in advance!

@Paolo_Emilio_Serra1 do you have any recommendations on this? I’m assuming this time of process would need a Python script to automate, but could the color range nodes be linked into this at all? I appreciate all of your help!

like this?

Yes you can do it in Python, you need to override the Analysis property of the Surface and set a collection of SurfaceAnalysisElevationData with the values you want.

here is an example (it doesn’t do exactly what you want but close enough)

You can also use a Dynamo Color range as an input.

2 Likes

Yes, that’s it! Thank you, this is very helpful! I’ll give this a try and let you know when I reach a solution.

Hi Paolo,
I’ve been testing your script. Could you please help me how cdoc is defined? I tried it as cdoc = CivilApplication.ActiveDocument, but I have this error:
Thanks in advance!
image

Are you 100% sure you have the exact same code I wrote? I’m calling “GetGeneralProperties()” not “GeneralProperties”

Thank you very much. It was bad calling exactly as wou wrote. There were some another warnings and error. Some of them I solved by adding: import math and from Autodesk.AutoCAD.Colors import *

At this moment I can¨t solve this NameError. Could you please give me any hint here?
image

1 Like

I added from System import Array and it works now.

1 Like

@Drbohlav Could you drop here python code. It will help others who is trying to help you.

After some investigation it does not work for minel, which is between -1 and 0.

 gp = surface.GetGeneralProperties()
                minel = gp.MinimumElevation
                maxel = gp.MaximumElevation
                
                saed = []

interval = .25
                cut = int(math.ceil((-1 - minel) / interval)) if minel < -1 else None
                fill = int(math.ceil((maxel - 1) / interval)) if maxel > 1 else None
                
                if cut is not None:
                    a = 200 / cut
                    
                    for i in range(cut + 1):
                        saed.append(SurfaceAnalysisElevationData(-1 - (cut - i) * interval, -1 - (cut - i - 1) * interval, Color.FromRgb(255,i * a, i * a)))
                
                        
                if fill is not None:
                    a = 200 / fill
                    for i in range(fill + 1):
                        saed.append(SurfaceAnalysisElevationData(i * interval, 1 + i * interval, Color.FromRgb(200 - i * a, 200 - i * a, 255)))

The Color range then look like this (intervals -0.75 to 0.00 and 0.00 to 0.25 are missing, step in fill is 1m not interval = 0.25):