Hi
I'm using this to parse a number of text files extracted from Excel, I cannot give the code away yet since it is part of a constraint initiative my company is working on for the benefit of Danish electronics developement companies.
Basically I've got 2 procedures, one to assign spacing and physical cset to a netclass and another procedure to create netclass 2 netclass constraints. The 2 procedures are below. You just need a header and a footer for the script file.
use file, script to record a script where you do what you want and then you just need to save data to a script and then replay it, example below
tmp_file = axlDMOpenFile("ALLEGRO_SCRIPT", "tmp", "w")
fprintf(tmp_file "scriptmode +i +n +w +c\n")
fprintf(tmp_file "setwindow pcb\n")
fprintf(tmp_file "done\n")
fprintf(tmp_file "cmgr\n")
fprintf(tmp_file "setwindow cmgr\n")
fprintf(tmp_file "cm newView ( worksheet 55:Physical \"56:Physical Constraint Set\" \"57:All Layers\" \"58:All Layers\" )\n")
fprintf(tmp_file "cm newView ( worksheet 55:Physical 61:Net \"62:All Layers\" \"63:All Layers\" )\n")
fprintf(tmp_file "cm newView ( worksheet 78:Spacing \"79:Spacing Constraint Set\" \"80:All Layers\" 81:Line )\n")
fprintf(tmp_file "cm newView ( worksheet 78:Spacing 94:Net \"95:All Layers\" 96:Line )\n")
fprintf(tmp_file "cm scope Design \"%s\"\n" axlCurrentDesign())
ns_map_cset2netclass(spacingCset recordid physicalCset)
fprintf(tmp_file "cm exit\n")
fprintf(tmp_file "setwindow pcb\n")
axlDMClose(tmp_file)
axlShell("replay tmp")
if( isFile( "tmp.scr") then deleteFile("tmp.scr"))
; -------- arg1 = spacing Cset name, arg2 = Netclassname, arg3 = Physical Cset name
procedure( ns_map_cset2netclass( arg1 arg2 arg3)
let((nc_domains)
nc_domains = '(spacing physical)
axlNetClassCreate(arg2 nc_domains)
fprintf(tmp_file "cm startTransaction ( Design \"%s\" ) ( \"Net Class\" \"%s\" ) TS_DEFER\n" axlCurrentDesign() arg2)
fprintf(tmp_file "cm add ( \"Net Class\" \"%s\" ) to ( \"Spacing CSet\" \"%s\" )\n" arg2 arg1)
fprintf(tmp_file "cm commitTransaction ( Design \"%s\" ) ( \"Net Class\" \"%s\" ) TS_DEFER\n" axlCurrentDesign() arg2)
fprintf(tmp_file "cm startTransaction ( Design \"%s\" ) ( \"Net Class\" \"%s\" ) TS_DEFER\n" axlCurrentDesign() arg2)
fprintf(tmp_file "cm add ( \"Net Class\" \"%s\" ) to ( \"Physical CSet\" \"%s\" )\n" arg2 arg3)
fprintf(tmp_file "cm commitTransaction ( Design \"%s\" ) ( \"Net Class\" \"%s\" ) TS_DEFER\n" axlCurrentDesign() arg2)
)
); end procedure
; -------- arg1 = col_name, arg2 = row_name, arg3 = Spacing Cset name
procedure( ns_netclass2netclass( arg1 arg2 arg3)
let((nc_domains)
nc_domains = '(spacing physical)
axlNetClassCreate(arg2 nc_domains)
fprintf(tmp_file "cm create \"Net Class-Class\" ( Design \"%s\" ) \"%s:%s\" \"%s\" \"%s\"\n" axlCurrentDesign() arg1 arg2 arg2 arg1)
fprintf(tmp_file "cm startTransaction ( Design \"%s\" ) ( \"Net Class-Class\" \"%s:%s\" ) TS_DEFER\n" axlCurrentDesign() arg1 arg2)
fprintf(tmp_file "cm add ( \"Net Class-Class\" \"%s:%s\" ) to ( \"Spacing CSet\" \"%s\" )\n" arg1 arg2 arg3)
fprintf(tmp_file "cm commitTransaction ( Design \"%s\" ) ( \"Net Class-Class\" \"%s:%s\" ) TS_DEFER\n" axlCurrentDesign() arg1 arg2)
)
); end procedure
Best regards
Ole