+ elif CritType == FT_ConnectedElements:
+ # Checks the Threshold
+ if isinstance(aThreshold, geomBuilder.GEOM._objref_GEOM_Object): # shape
+ aCriterion.ThresholdID = aThreshold.GetStudyEntry()
+ if not aCriterion.ThresholdID:
+ name = aThreshold.GetName()
+ if not name:
+ name = "%s_%s"%(aThreshold.GetShapeType(), id(aThreshold)%10000)
+ aCriterion.ThresholdID = self.geompyD.addToStudy( aThreshold, name )
+ elif isinstance(aThreshold, int): # node id
+ aCriterion.Threshold = aThreshold
+ elif isinstance(aThreshold, list): # 3 point coordinates
+ if len( aThreshold ) < 3:
+ raise ValueError, "too few point coordinates, must be 3"
+ aCriterion.ThresholdStr = " ".join( [str(c) for c in aThreshold[:3]] )
+ elif isinstance(aThreshold, str):
+ if aThreshold.isdigit():
+ aCriterion.Threshold = aThreshold # node id
+ else:
+ aCriterion.ThresholdStr = aThreshold # hope that it's point coordinates
+ else:
+ raise ValueError,\
+ "The Threshold should either a VERTEX, or a node ID, "\
+ "or a list of point coordinates and not '%s'"%aThreshold