Continuing the discussion from Hatch centroid definition:
@KirkWM here’s some Python code if you want to create actual Catchment labels instead of MText.
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.DatabaseServices.Styles import *
adoc = Application.DocumentManager.MdiActiveDocument
civdoc = CivilApplication.ActiveDocument
catchment = IN[0]
labelStyleName = IN[1]
def create_catchment_label(catchment,styleName):
global adoc
global civdoc
output = []
if not isinstance(catchment, list):
catchment = [catchment]
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
for c in catchment:
catchmentId = c.InternalObjectId
obj = t.GetObject(catchmentId, OpenMode.ForRead)
if isinstance(obj, Catchment):
labelStyleId = civdoc.Styles.LabelStyles.CatchmentLabelStyles.AreaLabelStyles[styleName]
label = CatchmentLabel.Create(catchmentId,labelStyleId)
output.append(t.GetObject(label,OpenMode.ForRead))
t.Commit()
return output
OUT = create_catchment_label(IN[0],IN[1])