@Edwin.Saez , Sorry for the delay. I just started a new job and I’ve been having less time/an adjustment period + other personal matters. Here is your solution. It will get the combined boundary of two selected surfaces and generate a grid based on the grid spacing input, so decrease the spacing if you want higher accuracy. Where surface 1 exists and surface 2 doesn’t, points on surface 1 will be returned for the new surface and vice versa. Where surface 1 and surface 2 overlaps, the point that is returned is the one with the lower z value. The script then creates a new surface named “combined_surface” and adds the verticies to generate the surface you intend to compare with surface 3. You may have to trim off triangulation or add a boundary manually. I couldn’t find the add surface boundary command exposed in the API.
@mzjensen Any intention to add “AddVertices” to tinSurface to camber? I wouldn’t of had to go into python if I had it available. I did notice that “AddVertices” was throwing an exception when the surface was empty. Not sure why. I just iterated with the “AddVertex” Method.
LowestElevationSurfaceCombo.dyn (162.1 KB)
LowestElevationSurfaceCombo-Post-Script.dwg (1002.5 KB)
LowestElevationSurfaceCombo-Pre-Script.dwg (957.5 KB)
(Result in green)
# Load the Python Standard and DesignScript Libraries
import sys
import clr
# Add Assemblies for AutoCAD and Civil3D
clr.AddReference('AcMgd')
clr.AddReference('AcCoreMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *
# Import references from Civil3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
# The inputs to this node will be stored as a list in the IN variables.
inputPoints = IN[0]
surface = IN[1]
verticesToAdd = [Point3d(inputPoint.X, inputPoint.Y, inputPoint.Z) for inputPoint in inputPoints]
adoc = Application.DocumentManager.MdiActiveDocument
editor = adoc.Editor
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
try:
shoot = "yay"
cdoc = CivilDocument.GetCivilDocument(db)
tinSurface = surface.InternalDBObject
tinSurface.UpgradeOpen()
for vertex in verticesToAdd:
tinSurface.AddVertex(vertex)
except:
shoot = "oops"
t.Commit()
pass
# Assign your output to the OUT variable.
OUT = tinSurface.AddVertices.__doc__, shoot, tinSurface, verticesToAdd