From cf117a2aea7d39d956ee747f6046a627d9e97a61 Mon Sep 17 00:00:00 2001 From: Val Erastov Date: Tue, 20 Dec 2016 22:52:18 -0800 Subject: [PATCH] bulk adding for the parallel constraint --- web/app/sketcher/fetchers.js | 4 ++++ web/app/sketcher/parametric.js | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/web/app/sketcher/fetchers.js b/web/app/sketcher/fetchers.js index 9525163e..1f534368 100644 --- a/web/app/sketcher/fetchers.js +++ b/web/app/sketcher/fetchers.js @@ -84,6 +84,10 @@ export function line(objs) { throw "Illegal Argument. Constraint requires a line." } +export function lines(objs) { + return objs.filter(o => o._class == 'TCAD.TWO.Segment') +} + export function arcCircAndLine(objs) { var arc = null; diff --git a/web/app/sketcher/parametric.js b/web/app/sketcher/parametric.js index 8e6c6b18..db7788c2 100644 --- a/web/app/sketcher/parametric.js +++ b/web/app/sketcher/parametric.js @@ -207,8 +207,12 @@ ParametricManager.prototype.horizontal = function(objs) { }; ParametricManager.prototype.parallel = function(objs) { - var lines = fetch.twoLines(objs); - this.add(new Constraints.Parallel(lines[0], lines[1])); + const lines = fetch.lines(objs); + const constraints = []; + for (let i = 1; i < lines.length; i++) { + constraints.push(new Constraints.Parallel(lines[i - 1], lines[i])); + } + this.addAll(constraints); }; ParametricManager.prototype.perpendicular = function(objs) {