Functions | |
| def | smeshDC::smeshDC.EnumToLong |
| Returns a long value from enumeration Should be used for SMESH.FunctorType enumeration. | |
| def | smeshDC::smeshDC.ColorToString |
| Returns a string representation of the color. | |
| def | smeshDC::smeshDC.GetEmptyCriterion |
| Creates an empty criterion. | |
| def | smeshDC::smeshDC.GetCriterion |
| Creates a criterion by the given parameters Criterion structures allow to define complex filters by combining them with logical operations (AND / OR) (see example below) | |
| def | smeshDC::smeshDC.GetFilter |
| Creates a filter with the given parameters. | |
| def | smeshDC::smeshDC.GetFunctor |
| Creates a numerical functor by its type. | |
| def | smeshDC::Mesh.GetIdsFromFilter |
| Passes mesh elements through the given filter and return IDs of fitting elements. | |
| def | smeshDC::Mesh.GetFreeBorders |
| Verifies whether a 2D mesh element has free edges (edges connected to one face only) Returns a list of special structures (borders). | |
| def smeshDC.smeshDC.ColorToString | ( | self, | |
| c | |||
| ) | [inherited] |
Returns a string representation of the color.
To be used with filters.
| c | color value (SALOMEDS.Color) |
Definition at line 549 of file smeshDC.py.
| def smeshDC.smeshDC.EnumToLong | ( | self, | |
| theItem | |||
| ) | [inherited] |
Returns a long value from enumeration Should be used for SMESH.FunctorType enumeration.
Definition at line 542 of file smeshDC.py.
| def smeshDC.smeshDC.GetCriterion | ( | self, | |
| elementType, | |||
| CritType, | |||
Compare = FT_EqualTo, |
|||
Treshold = "", |
|||
UnaryOp = FT_Undefined, |
|||
BinaryOp = FT_Undefined, |
|||
Tolerance = 1e-07 |
|||
| ) | [inherited] |
Creates a criterion by the given parameters
Criterion structures allow to define complex filters by combining them with logical operations (AND / OR) (see example below)
| elementType | the type of elements(NODE, EDGE, FACE, VOLUME) |
| CritType | the type of criterion (FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc.) |
| Compare | belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo} |
| Treshold | the threshold value (range of ids as string, shape, numeric) |
| UnaryOp | FT_LogicalNOT or FT_Undefined |
| BinaryOp | a binary logical operation FT_LogicalAND, FT_LogicalOR or FT_Undefined (must be for the last criterion of all criteria) |
| Tolerance | the tolerance used by FT_BelongToGeom, FT_BelongToSurface, FT_LyingOnGeom, FT_CoplanarFaces criteria |
Definition at line 781 of file smeshDC.py.
00788 : 00789 aCriterion = self.GetEmptyCriterion() 00790 aCriterion.TypeOfElement = elementType 00791 aCriterion.Type = self.EnumToLong(CritType) 00792 aCriterion.Tolerance = Tolerance 00793 00794 aTreshold = Treshold 00795 00796 if Compare in [FT_LessThan, FT_MoreThan, FT_EqualTo]: 00797 aCriterion.Compare = self.EnumToLong(Compare) 00798 elif Compare == "=" or Compare == "==": 00799 aCriterion.Compare = self.EnumToLong(FT_EqualTo) 00800 elif Compare == "<": 00801 aCriterion.Compare = self.EnumToLong(FT_LessThan) 00802 elif Compare == ">": 00803 aCriterion.Compare = self.EnumToLong(FT_MoreThan) 00804 else: 00805 aCriterion.Compare = self.EnumToLong(FT_EqualTo) 00806 aTreshold = Compare 00807 00808 if CritType in [FT_BelongToGeom, FT_BelongToPlane, FT_BelongToGenSurface, 00809 FT_BelongToCylinder, FT_LyingOnGeom]: 00810 # Checks the treshold 00811 if isinstance(aTreshold, geompyDC.GEOM._objref_GEOM_Object): 00812 aCriterion.ThresholdStr = GetName(aTreshold) 00813 aCriterion.ThresholdID = salome.ObjectToID(aTreshold) 00814 else: 00815 print "Error: The treshold should be a shape." 00816 return None 00817 if isinstance(UnaryOp,float): 00818 aCriterion.Tolerance = UnaryOp 00819 UnaryOp = FT_Undefined 00820 pass 00821 elif CritType == FT_RangeOfIds: 00822 # Checks the treshold 00823 if isinstance(aTreshold, str): 00824 aCriterion.ThresholdStr = aTreshold 00825 else: 00826 print "Error: The treshold should be a string." 00827 return None 00828 elif CritType == FT_CoplanarFaces: 00829 # Checks the treshold 00830 if isinstance(aTreshold, int): 00831 aCriterion.ThresholdID = "%s"%aTreshold 00832 elif isinstance(aTreshold, str): 00833 ID = int(aTreshold) 00834 if ID < 1: 00835 raise ValueError, "Invalid ID of mesh face: '%s'"%aTreshold 00836 aCriterion.ThresholdID = aTreshold 00837 else: 00838 raise ValueError,\ 00839 "The treshold should be an ID of mesh face and not '%s'"%aTreshold 00840 elif CritType == FT_ElemGeomType: 00841 # Checks the treshold 00842 try: 00843 aCriterion.Threshold = self.EnumToLong(aTreshold) 00844 except: 00845 if isinstance(aTreshold, int): 00846 aCriterion.Threshold = aTreshold 00847 else: 00848 print "Error: The treshold should be an integer or SMESH.GeometryType." 00849 return None 00850 pass 00851 pass 00852 elif CritType == FT_GroupColor: 00853 # Checks the treshold 00854 try: 00855 aCriterion.ThresholdStr = self.ColorToString(aTreshold) 00856 except: 00857 print "Error: The threshold value should be of SALOMEDS.Color type" 00858 return None 00859 pass 00860 elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume, FT_FreeNodes, 00861 FT_FreeFaces, FT_LinearOrQuadratic, 00862 FT_BareBorderFace, FT_BareBorderVolume, 00863 FT_OverConstrainedFace, FT_OverConstrainedVolume]: 00864 # At this point the treshold is unnecessary 00865 if aTreshold == FT_LogicalNOT: 00866 aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT) 00867 elif aTreshold in [FT_LogicalAND, FT_LogicalOR]: 00868 aCriterion.BinaryOp = aTreshold 00869 else: 00870 # Check treshold 00871 try: 00872 aTreshold = float(aTreshold) 00873 aCriterion.Threshold = aTreshold 00874 except: 00875 print "Error: The treshold should be a number." 00876 return None 00877 00878 if Treshold == FT_LogicalNOT or UnaryOp == FT_LogicalNOT: 00879 aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT) 00880 00881 if Treshold in [FT_LogicalAND, FT_LogicalOR]: 00882 aCriterion.BinaryOp = self.EnumToLong(Treshold) 00883 00884 if UnaryOp in [FT_LogicalAND, FT_LogicalOR]: 00885 aCriterion.BinaryOp = self.EnumToLong(UnaryOp) 00886 00887 if BinaryOp in [FT_LogicalAND, FT_LogicalOR]: 00888 aCriterion.BinaryOp = self.EnumToLong(BinaryOp) 00889 00890 return aCriterion
| def smeshDC.smeshDC.GetEmptyCriterion | ( | self | ) | [inherited] |
Creates an empty criterion.
Definition at line 752 of file smeshDC.py.
00753 : 00754 Type = self.EnumToLong(FT_Undefined) 00755 Compare = self.EnumToLong(FT_Undefined) 00756 Threshold = 0 00757 ThresholdStr = "" 00758 ThresholdID = "" 00759 UnaryOp = self.EnumToLong(FT_Undefined) 00760 BinaryOp = self.EnumToLong(FT_Undefined) 00761 Tolerance = 1e-07 00762 TypeOfElement = ALL 00763 Precision = -1 ##@1e-07 00764 return Filter.Criterion(Type, Compare, Threshold, ThresholdStr, ThresholdID, 00765 UnaryOp, BinaryOp, Tolerance, TypeOfElement, Precision)
| def smeshDC.smeshDC.GetFilter | ( | self, | |
| elementType, | |||
CritType = FT_Undefined, |
|||
Compare = FT_EqualTo, |
|||
Treshold = "", |
|||
UnaryOp = FT_Undefined, |
|||
Tolerance = 1e-07 |
|||
| ) | [inherited] |
Creates a filter with the given parameters.
| elementType | the type of elements in the group |
| CritType | the type of criterion ( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. ) |
| Compare | belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo} |
| Treshold | the threshold value (range of id ids as string, shape, numeric) |
| UnaryOp | FT_LogicalNOT or FT_Undefined |
| Tolerance | the tolerance used by FT_BelongToGeom, FT_BelongToSurface, FT_LyingOnGeom, FT_CoplanarFaces criteria |
Definition at line 903 of file smeshDC.py.
00909 : 00910 aCriterion = self.GetCriterion(elementType, CritType, Compare, Treshold, UnaryOp, FT_Undefined,Tolerance) 00911 aFilterMgr = self.CreateFilterManager() 00912 aFilter = aFilterMgr.CreateFilter() 00913 aCriteria = [] 00914 aCriteria.append(aCriterion) 00915 aFilter.SetCriteria(aCriteria) 00916 aFilterMgr.UnRegister() 00917 return aFilter
| def smeshDC.Mesh.GetFreeBorders | ( | self | ) | [inherited] |
Verifies whether a 2D mesh element has free edges (edges connected to one face only)
Returns a list of special structures (borders).
Definition at line 1853 of file smeshDC.py.
| def smeshDC.smeshDC.GetFunctor | ( | self, | |
| theCriterion | |||
| ) | [inherited] |
Creates a numerical functor by its type.
| theCriterion | FT_...; functor type |
Definition at line 922 of file smeshDC.py.
00923 : 00924 aFilterMgr = self.CreateFilterManager() 00925 if theCriterion == FT_AspectRatio: 00926 return aFilterMgr.CreateAspectRatio() 00927 elif theCriterion == FT_AspectRatio3D: 00928 return aFilterMgr.CreateAspectRatio3D() 00929 elif theCriterion == FT_Warping: 00930 return aFilterMgr.CreateWarping() 00931 elif theCriterion == FT_MinimumAngle: 00932 return aFilterMgr.CreateMinimumAngle() 00933 elif theCriterion == FT_Taper: 00934 return aFilterMgr.CreateTaper() 00935 elif theCriterion == FT_Skew: 00936 return aFilterMgr.CreateSkew() 00937 elif theCriterion == FT_Area: 00938 return aFilterMgr.CreateArea() 00939 elif theCriterion == FT_Volume3D: 00940 return aFilterMgr.CreateVolume3D() 00941 elif theCriterion == FT_MaxElementLength2D: 00942 return aFilterMgr.CreateMaxElementLength2D() 00943 elif theCriterion == FT_MaxElementLength3D: 00944 return aFilterMgr.CreateMaxElementLength3D() 00945 elif theCriterion == FT_MultiConnection: 00946 return aFilterMgr.CreateMultiConnection() 00947 elif theCriterion == FT_MultiConnection2D: 00948 return aFilterMgr.CreateMultiConnection2D() 00949 elif theCriterion == FT_Length: 00950 return aFilterMgr.CreateLength() 00951 elif theCriterion == FT_Length2D: 00952 return aFilterMgr.CreateLength2D() 00953 else: 00954 print "Error: given parameter is not numerucal functor type."
| def smeshDC.Mesh.GetIdsFromFilter | ( | self, | |
| theFilter | |||
| ) | [inherited] |
Passes mesh elements through the given filter and return IDs of fitting elements.
| theFilter | SMESH_Filter |
Definition at line 1845 of file smeshDC.py.