-def checkFillet(theObjects, theRadius):
- # Verify the arc and lines are connected smoothly
- print "Check Fillet"
- aLine = []
- anArc = []
- aSize = len(theObjects)
- for feat in theObjects:
- assert(feat is not None)
- if (feat.getKind() == "SketchLine"):
- aLine.append(feat)
- elif (feat.getKind() == "SketchArc"):
- anArc.append(feat)
- aFilletArc = anArc[-1]
- assert(aFilletArc is not None)
- anArc.pop()
-
- anArcPoints = []
- aPoint = geomDataAPI_Point2D(aFilletArc.attribute("ArcStartPoint"))
- #print "ArcStartPoint " + repr(aPoint.x()) + " " + repr(aPoint.y())
- anArcPoints.append((aPoint.x(), aPoint.y()))
- aPoint = geomDataAPI_Point2D(aFilletArc.attribute("ArcEndPoint"))
- #print "ArcEndPoint " + repr(aPoint.x()) + " " + repr(aPoint.y())
- anArcPoints.append((aPoint.x(), aPoint.y()))
- aPoint = geomDataAPI_Point2D(aFilletArc.attribute("ArcCenter"))
- #print "ArcCenter " + repr(aPoint.x()) + " " + repr(aPoint.y())
- aCenterX = aPoint.x()
- aCenterY = aPoint.y()
- aFilletRadius = math.hypot(anArcPoints[0][0]-aCenterX, anArcPoints[0][1]-aCenterY)
-
- for line in aLine:
- aStartPoint = geomDataAPI_Point2D(line.attribute("StartPoint"))
- aEndPoint = geomDataAPI_Point2D(line.attribute("EndPoint"))
-
- aLinePoints = []
- aLinePoints.append((aStartPoint.x(), aStartPoint.y()))
- #print "aLineStartPoint " + repr(aStartPoint.x()) + " " + repr(aStartPoint.y())
- aLinePoints.append((aEndPoint.x(), aEndPoint.y()))
- #print "aLineEndPoint " + repr(aEndPoint.x()) + " " + repr(aEndPoint.y())
+def checkSmoothness(theSketch):
+ aPtPtCoincidences = getCoincidences(theSketch)
+ for coinc in aPtPtCoincidences:
+ aConnectedFeatures = connectedFeatures(coinc)
+ assert(len(aConnectedFeatures) == 2)
+ if aConnectedFeatures[0].getKind() == "SketchArc":
+ if aConnectedFeatures[1].getKind() == "SketchArc":
+ checkArcArcSmoothness(aConnectedFeatures[0], aConnectedFeatures[1])
+ elif aConnectedFeatures[1].getKind() == "SketchLine":
+ checkArcLineSmoothness(aConnectedFeatures[0], aConnectedFeatures[1])
+ elif aConnectedFeatures[0].getKind() == "SketchLine" and aConnectedFeatures[1].getKind() == "SketchArc":
+ checkArcLineSmoothness(aConnectedFeatures[1], aConnectedFeatures[0])