improved xschem arc command (allow user parameters in addition to GUI plaecment)

This commit is contained in:
stefan schippers 2025-10-29 08:20:08 +01:00
parent 129e194bc5
commit 2763c6010f
4 changed files with 34 additions and 10 deletions

View File

@ -582,9 +582,10 @@ C {verilog_timescale.sym} 1050 -100 0 0 {name=s1 timestep="1ns" precision="1ns"
The optional 'level' integer specifies the hierarchy level the raw file refers to.
This is necessary if annotate_op is called from a sub schematic at a hierarchy
level &gt; 0 but simulation was done at top level (hierarchy 0, for example)</pre>
<li><kbd> arc</kbd></li><pre>
Start a GUI placement of an arc.
User should click 3 unaligned points to define the arc </pre>
<li><kbd> arc [x y r a b layer prop]</kbd></li><pre>
if arguments are given (center x and y, radius r, start angle a, end angle b, layer number)
place specified arc, otherwise start a GUI placement of an arc.
For GUI placement user should click 3 unaligned points to define the arc </pre>
<li><kbd> attach_labels [interactive]</kbd></li><pre>
Attach net labels to selected component(s) instance(s)
Optional integer 'interactive' (default: 0) is passed to attach_labels_to_inst().

View File

@ -367,14 +367,37 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
}
}
/* arc
* Start a GUI placement of an arc.
* User should click 3 unaligned points to define the arc */
/* arc [x y r a b layer prop]
* if arguments are given (center x and y, radius r, start angle a, end angle b, layer number)
* place specified arc, otherwise start a GUI placement of an arc.
* For GUI placement user should click 3 unaligned points to define the arc */
else if(!strcmp(argv[1], "arc"))
{
const char *prop = NULL;
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
xctx->ui_state |= MENUSTART;
xctx->ui_state2 = MENUSTARTARC;
if(argc > 8) {
prop = argv[8];
}
if(argc > 7) {
double x = atof(argv[2]);
double y = atof(argv[3]);
double r = atof(argv[4]);
double a = atof(argv[5]);
double b = atof(argv[6]);
int layer = atoi(argv[7]);
if(layer >= 0 && layer < cadlayers) {
store_arc(-1, x, y, r, a, b, layer, 0, prop);
set_modify(1);
Tcl_SetResult(interp, "1", TCL_STATIC);
} else {
Tcl_SetResult(interp, "0", TCL_STATIC);
}
} else {
xctx->ui_state |= MENUSTART;
xctx->ui_state2 = MENUSTARTARC;
Tcl_SetResult(interp, "1", TCL_STATIC);
}
}
/* attach_labels [interactive]

View File

@ -130,7 +130,7 @@ void check_polygon_storage(int c)
}
void store_arc(int pos, double x, double y, double r, double a, double b,
unsigned int rectc, unsigned short sel, char *prop_ptr)
unsigned int rectc, unsigned short sel, const char *prop_ptr)
{
int n, j;
const char *dash, *fill_ptr;

View File

@ -1503,7 +1503,7 @@ extern int storeobject(int pos, double x1,double y1,double x2,double y2,
extern void store_poly(int pos, double *x, double *y, int points,
unsigned int rectcolor, unsigned short sel, char *prop_ptr);
extern void store_arc(int pos, double x, double y, double r, double a, double b,
unsigned int rectcolor, unsigned short sel, char *prop_ptr);
unsigned int rectcolor, unsigned short sel, const char *prop_ptr);
extern void hier_psprint(char **res, int what);
extern int global_spice_netlist(int global, int alert);