Rename Design Check Alignment/Profile

Hello, everyone!
Can anyone please give me the directions of nodes that can rename a Design Check either in Alignment and Profile toolspace? Once it’s created with an expression, it is impossible to rename it without creating another one and setting it in each set of Design Check using the native interface.

Hi @ricaerrido,

Here’s some quick code for you to try. I haven’t tested very thoroughly, so use at your own risk.

IN[0] = old design check set name
IN[1] = new design check set name

import sys
import clr


from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *

from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

adoc = Application.DocumentManager.MdiActiveDocument
cdoc = CivilApplication.ActiveDocument

def set_design_check_set_name(oldName, newName):
	global adoc
	global cdoc
	if not oldName or not newName:
	with adoc.LockDocument():
	    with adoc.Database as db:
	        with db.TransactionManager.StartTransaction() as t:
	            # Change this to ProfileDesignCheckSets if you want to rename a profile design check
	            oid = cdoc.Styles.AlignmentDesignCheckSets[oldName]
	            checkSet = t.GetObject(oid, OpenMode.ForWrite)
	            checkSet.Name = newName
	return checkSet

OUT = set_design_check_set_name(IN[0], IN[1])
1 Like

It’s up to me, thanks.


Is that right to input IN[0] and IN[1] as strings, right?

Are you using Civil 3D 2022?


Actually nevermind, I just realized that this isn’t what you were looking for. The code above is to rename a design check set, not a single design check. As far as I know it’s not possible to rename a design check via the API because the name property is readonly.

Yes, that’s it. True (and sad) story.
Should I leave this opened here?

@mzjensen a solution I’ve been thinking of is this one:

IN[0] = old design check
IN[1] = new design check

read IN[0] expression
read IN[0] description
create IN[1] with IN[0] expression and description

loop inside sets
if contains IN[0], add IN[1]

delete IN[0]

Do you think it’s possible?

Yeah, I think that could work!

1 Like

Great. I still don’t have this level of knowledge with python, but I’m going to try.
Thank you!