From 91b57c972703c6f5cc55fbb63b37d4a30900fc95 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Mon, 3 Sep 2018 14:43:58 +0800 Subject: [PATCH] constraint: fix addMidPoint() --- constraint.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/constraint.py b/constraint.py index 02e25d2..fd091aa 100644 --- a/constraint.py +++ b/constraint.py @@ -1519,6 +1519,20 @@ class MidPoint(BaseSketch): _iconName = 'Assembly_ConstraintMidPoint.svg' _tooltip='Add a "{}" to constrain a point to the middle point of a line.' + @classmethod + def prepare(cls,obj,solver): + func = cls.constraintFunc(obj,solver) + if not func: + return + params = cls.getPropertyValues(obj) + cls.getEntities(obj,solver) + # temparary fix of slvs.addMidPoint(), which should have made wrkpln + # argument optional and defaults to 0 + if len(params)==2: + params.append(0) + ret = func(*params,group=solver.group) + solver.system.log('{}: {}'.format(cstrName(obj),ret)) + return ret + class Diameter(BaseSketch): _id = 25