I need help creating a surface in a different .dwg file using Civil 3D/Dynamo 2026. I’m working with a .dxf file containing 3D faces and can create the surface from them in the current .dxf file, but I want it saved in a separate .dwg one.
Camber package has a node to Add3DFaces under TinSurface menu.
Under import/export menu (default dynamo nodes) you can find the File System nodes to work around with the files.
Thank you for your response. I am creating the TIN surfaces (in the current file) from 3D faces using the Python code below. Would it be too much to ask for your help in modifying the code so that I can generate the TIN surfaces in a different, pre-existing .dwg file?
# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('AutoCADNodes')
clr.AddReference('Civil3DNodes')
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
import Autodesk.AutoCAD.DynamoNodes as DA
import Autodesk.Civil.DynamoNodes as DC
adoc = Application.DocumentManager.MdiActiveDocument
cdoc = CivilApplication.ActiveDocument
def create_tin_by_faces(surfaceName, faces):
if surfaceName is None or faces is None:
return
if not isinstance(faces, list):
faces = [faces]
global adoc
global cdoc
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
surfId = TinSurface.Create(db, surfaceName)
surf = t.GetObject(surfId, OpenMode.ForWrite)
surfDwgObjs = surf.DrawingObjectsDefinition
faceIds = ObjectIdCollection()
for face in faces:
faceId = face.InternalObjectId
faceIds.Add(faceId)
surfDwgObjs.AddFrom3DFaces(faceIds, True, "")
t.Commit()
pass
return DC.Selection.SurfaceByName(surfaceName, DA.Document.Current)
OUT = create_tin_by_faces(IN[0], IN[1]),"Pass"
@JaLo I successfully selected a created surface by its name and saved it into a new .dwg file using the code below. However, I am wondering how I can save the surface into an existing .dwg document instead… any thoughts?
# Load the Python Standard and DesignScript Libraries
import sys
import clr
import os
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.