Hello everyone,
I can’t edit a surface imported with LandXML. For example, I’m creating Python code to set the maximum side length of a triangle to 10 m, but nothing changes on the Civil 3D screen. How do I create the Python script? Can you help me?
global adoc # Check input values ifc3d_surfaceisNoneorlengthis None: return c3d_surface # Lock the active document with adoc.LockDocument(): # Start database transaction with adoc.Databaseas db: with db.TransactionManager.StartTransaction() as trans: # Get ObjectId from the Civil 3D surface element surface_id = c3d_surface.InternalObjectId # Open the surface for writing civil_surface = trans.GetObject(surface_id,OpenMode.ForWrite) # Check that the object is a Civil 3D Surface ifisinstance(civil_surface, Surface): # Get surface build options build_options = civil_surface.BuildOptions # Enable maximum triangle length build_options.UseMaximumTriangleLength = True # Set maximum triangle length build_options.MaximumTriangleLength =float(length) # Rebuild the surface civil_surface.Rebuild() # Commit changes trans.Commit() return c3d_surface
#Inputs:
Civil_3D_Surface = IN[0] Triangle_Length = IN[1]
OUT = update_surface_length(Civil_3D_Surface, Triangle_Length)