add command "xschem selected_rect" to get {layer index} list of selected rectangle objects
This commit is contained in:
parent
25ac9d7e40
commit
e85792aee7
|
|
@ -1495,6 +1495,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
|
|||
<li><kbd> select_inside x1 y1 x2 y2 [sel]</kbd></li><pre>
|
||||
Select all objects inside the indicated area
|
||||
if [sel] is set to '0' do an unselect operation </pre>
|
||||
<li><kbd> selected_rect</kbd></li><pre>
|
||||
Return list of {color index} of selected rects </pre>
|
||||
<li><kbd> selected_set [what]</kbd></li><pre>
|
||||
Return a list of selected instance names
|
||||
If what is not given or set to 'inst' return list of selected instance names
|
||||
|
|
|
|||
|
|
@ -1582,11 +1582,11 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
if(c >=0 && c < cadlayers) {
|
||||
Tcl_SetResult(interp, my_itoa(xctx->lines[c]),TCL_VOLATILE);
|
||||
} else {
|
||||
Tcl_SetResult(interp, "xschem get rects n: layer number out of range", TCL_STATIC);
|
||||
Tcl_SetResult(interp, "xschem get lines n: layer number out of range", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
} else {
|
||||
Tcl_SetResult(interp, "xschem get rects n: give a layer number", TCL_STATIC);
|
||||
Tcl_SetResult(interp, "xschem get lines n: give a layer number", TCL_STATIC);
|
||||
return TCL_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
@ -5372,6 +5372,26 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
||||
/* selected_rect
|
||||
* Return list of {color index} of selected rects */
|
||||
else if(!strcmp(argv[1], "selected_rect"))
|
||||
{
|
||||
int n, i, c, first = 1;
|
||||
char cstr[40];
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
rebuild_selected_array();
|
||||
for(n=0; n < xctx->lastsel; ++n) {
|
||||
if(xctx->sel_array[n].type == xRECT) {
|
||||
i = xctx->sel_array[n].n;
|
||||
c = xctx->sel_array[n].col;
|
||||
my_snprintf(cstr, S(cstr), "%d", c);
|
||||
if(first == 0) Tcl_AppendResult(interp, " ", NULL);
|
||||
Tcl_AppendResult(interp, "{", cstr, " ", my_itoa(i), "}", NULL);
|
||||
first = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* selected_set [what]
|
||||
* Return a list of selected instance names
|
||||
* If what is not given or set to 'inst' return list of selected instance names
|
||||
|
|
|
|||
Loading…
Reference in New Issue