mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-14 20:33:30 +01:00
assign debug symbols to being solved parameters
This commit is contained in:
parent
e20b7e892f
commit
5043b681d7
8 changed files with 46 additions and 28 deletions
|
|
@ -12,7 +12,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'Coincident',
|
||||
shortName: 'Coincident Constraint',
|
||||
shortName: 'Coincident',
|
||||
kind: 'Constraint',
|
||||
description: 'Point Coincident',
|
||||
selectionMatcher: {
|
||||
selector: 'matchAll',
|
||||
|
|
@ -35,7 +36,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'Tangent',
|
||||
shortName: 'Tangent Constraint',
|
||||
shortName: 'Tangent',
|
||||
kind: 'Constraint',
|
||||
description: 'Tangent Between Line And Circle',
|
||||
selectionMatcher: {
|
||||
selector: 'matchSequence',
|
||||
|
|
@ -66,7 +68,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'EqualRadius',
|
||||
shortName: 'Equal Radius Constraint',
|
||||
shortName: 'Equal Radius',
|
||||
kind: 'Constraint',
|
||||
description: 'Equal Radius Between Two Circle',
|
||||
selectionMatcher: {
|
||||
selector: 'matchAll',
|
||||
|
|
@ -89,7 +92,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'EqualLength',
|
||||
shortName: 'Equal Length Constraint',
|
||||
shortName: 'Equal Length',
|
||||
kind: 'Constraint',
|
||||
description: 'Equal Length Between Two Segments',
|
||||
selectionMatcher: {
|
||||
selector: 'matchAll',
|
||||
|
|
@ -109,7 +113,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'PointOnLine',
|
||||
shortName: 'Point On Line Constraint',
|
||||
shortName: 'Point On Line',
|
||||
kind: 'Constraint',
|
||||
description: 'Point On Line',
|
||||
selectionMatcher: {
|
||||
selector: 'matchSequence',
|
||||
|
|
@ -135,7 +140,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'Angle',
|
||||
shortName: 'Angle Constraint',
|
||||
shortName: 'Angle',
|
||||
kind: 'Constraint',
|
||||
description: 'Angle',
|
||||
selectionMatcher: {
|
||||
selector: 'matchAll',
|
||||
|
|
@ -163,7 +169,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'Vertical',
|
||||
shortName: 'Vertical Constraint',
|
||||
shortName: 'Vertical',
|
||||
kind: 'Constraint',
|
||||
description: 'Vertical',
|
||||
|
||||
selectionMatcher: {
|
||||
|
|
@ -187,7 +194,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'Horizontal',
|
||||
shortName: 'Horizontal Constraint',
|
||||
shortName: 'Horizontal',
|
||||
kind: 'Constraint',
|
||||
description: 'Horizontal',
|
||||
|
||||
selectionMatcher: {
|
||||
|
|
@ -211,7 +219,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'AngleBetween',
|
||||
shortName: 'Angle Between Constraint',
|
||||
shortName: 'Angle Between',
|
||||
kind: 'Constraint',
|
||||
description: 'Angle Between Lines',
|
||||
|
||||
selectionMatcher: {
|
||||
|
|
@ -242,7 +251,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'Perpendicular',
|
||||
shortName: 'Perpendicular Constraint',
|
||||
shortName: 'Perpendicular',
|
||||
kind: 'Constraint',
|
||||
description: 'Perpendicularity between two or more lines',
|
||||
|
||||
selectionMatcher: {
|
||||
|
|
@ -267,7 +277,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'Parallel',
|
||||
shortName: 'Parallel Constraint',
|
||||
shortName: 'Parallel',
|
||||
kind: 'Constraint',
|
||||
description: 'Parallelism between two or more lines',
|
||||
|
||||
selectionMatcher: {
|
||||
|
|
@ -292,7 +303,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'Length',
|
||||
shortName: 'Length Constraint',
|
||||
shortName: 'Length',
|
||||
kind: 'Constraint',
|
||||
description: 'Segment Length',
|
||||
|
||||
selectionMatcher: {
|
||||
|
|
@ -322,7 +334,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'RadiusLength',
|
||||
shortName: 'Radius Length Constraint',
|
||||
shortName: 'Radius Length',
|
||||
kind: 'Constraint',
|
||||
description: 'Radius Length',
|
||||
|
||||
selectionMatcher: {
|
||||
|
|
@ -352,7 +365,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'DistancePL',
|
||||
shortName: 'Point to Line Distance Constraint',
|
||||
shortName: 'Point to Line Distance',
|
||||
kind: 'Constraint',
|
||||
description: 'Distance between Point and Line',
|
||||
|
||||
selectionMatcher: {
|
||||
|
|
@ -387,7 +401,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'DistancePP',
|
||||
shortName: 'Two Point Distance Constraint',
|
||||
shortName: 'Two Point Distance',
|
||||
kind: 'Constraint',
|
||||
description: 'Distance between two Points',
|
||||
|
||||
selectionMatcher: {
|
||||
|
|
@ -417,7 +432,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'Lock',
|
||||
shortName: 'Lock Point Constraint',
|
||||
shortName: 'Lock Point',
|
||||
kind: 'Constraint',
|
||||
description: 'Lock Point',
|
||||
selectionMatcher: {
|
||||
selector: 'matchSequence',
|
||||
|
|
@ -442,7 +458,8 @@ export default [
|
|||
|
||||
{
|
||||
id: 'Fillet',
|
||||
shortName: 'Fillet Tool',
|
||||
shortName: 'Fillet',
|
||||
kind: 'Tool',
|
||||
description: 'Add a Fillet',
|
||||
selectionMatcher: {
|
||||
selector: 'function',
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export function runActionOrToastWhyNot(actionId, selection, ctx) {
|
|||
if (matched) {
|
||||
action.invoke(ctx, matched)
|
||||
} else {
|
||||
toast('The action "' + action.shortName + '" requires selection of ' + getDescription(action.selectionMatcher));
|
||||
toast('The action "' + action.shortName + ' ' + action.kind + '" requires selection of ' + getDescription(action.selectionMatcher));
|
||||
}
|
||||
}
|
||||
matchAvailableActions(selection).forEach(a => {
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ export class Polynomial {
|
|||
}
|
||||
|
||||
out += m.terms.map(t => {
|
||||
let out = 'X' + t.param.id;
|
||||
let out = t.param.debugSymbol + t.param.id;
|
||||
if (t.fn.degree === 1) {
|
||||
|
||||
} else if (t.fn.degree !== Infinity) {
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@ export class Arc extends SketchObject {
|
|||
c.parent = this;
|
||||
this.children.push(a, b, c);
|
||||
|
||||
this.r = new Param(MIN_RADIUS + 0.001);
|
||||
this.r = new Param(MIN_RADIUS + 0.001, 'R');
|
||||
this.r.constraints = [greaterThanConstraint(MIN_RADIUS)];
|
||||
this.r.min = MIN_RADIUS;
|
||||
|
||||
this.ang1 = new Param(0);
|
||||
this.ang2 = new Param(0);
|
||||
this.ang1 = new Param(0, 'A');
|
||||
this.ang2 = new Param(0, 'A');
|
||||
|
||||
this.syncGeometry();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export class Circle extends SketchObject {
|
|||
this.c = c;
|
||||
c.parent = this;
|
||||
this.children.push(c);
|
||||
this.r = new Param(MIN_RADIUS + 0.001);
|
||||
this.r = new Param(MIN_RADIUS + 0.001, 'R');
|
||||
this.r.constraints = [greaterThanConstraint(MIN_RADIUS)];
|
||||
this.r.min = MIN_RADIUS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@ import {Param as SolverParam} from '../constr/solver';
|
|||
|
||||
export class Param {
|
||||
|
||||
constructor(value) {
|
||||
constructor(value, debugSymbol) {
|
||||
this.id = Generator.genID();
|
||||
this.value = value;
|
||||
this.solverParam = new SolverParam(value, this);
|
||||
this.debugSymbol = debugSymbol || 'X';
|
||||
}
|
||||
|
||||
set(value) {
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ export class EndPoint extends SketchObject {
|
|||
super();
|
||||
this.parent = null;
|
||||
this.params = {
|
||||
x: new Param(x),
|
||||
y: new Param(y)
|
||||
x: new Param(x, 'X'),
|
||||
y: new Param(y, 'Y')
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ export class Segment extends SketchObject {
|
|||
b.parent = this;
|
||||
this.children.push(a, b);
|
||||
this.params = {
|
||||
ang: new Param(undefined),
|
||||
t: new Param(undefined)
|
||||
ang: new Param(undefined, 'A'),
|
||||
t: new Param(undefined, 'T')
|
||||
};
|
||||
this.params.ang.normalizer = makeAngle0_360;
|
||||
this.params.t.min = 100;
|
||||
|
|
|
|||
Loading…
Reference in a new issue