diff --git a/doc/xschem_man/developer_info.html b/doc/xschem_man/developer_info.html index fff9e54d..deb50625 100644 --- a/doc/xschem_man/developer_info.html +++ b/doc/xschem_man/developer_info.html @@ -1495,6 +1495,8 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
  • select_inside x1 y1 x2 y2 [sel]
  •     Select all objects inside the indicated area
        if [sel] is set to '0' do an unselect operation 
    +
  • selected_rect
  • +  Return list of {color index} of selected rects 
  • 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
    diff --git a/src/scheduler.c b/src/scheduler.c
    index 4ddc0175..62fbdbe6 100644
    --- a/src/scheduler.c
    +++ b/src/scheduler.c
    @@ -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