Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:21

0001 // Created on: 1995-04-26
0002 // Created by: Modelistation
0003 // Copyright (c) 1995-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _ChFi3d_ChBuilder_HeaderFile
0018 #define _ChFi3d_ChBuilder_HeaderFile
0019 
0020 #include <BRepAdaptor_Surface.hxx>
0021 #include <ChFi3d_Builder.hxx>
0022 #include <ChFiDS_ChamfMethod.hxx>
0023 #include <ChFiDS_ChamfMode.hxx>
0024 #include <ChFiDS_SecHArray1.hxx>
0025 #include <ChFiDS_ListOfStripe.hxx>
0026 #include <ChFiDS_SequenceOfSurfData.hxx>
0027 #include <ChFiDS_ElSpine.hxx>
0028 #include <math_Vector.hxx>
0029 #include <TopAbs_Orientation.hxx>
0030 #include <TopAbs_State.hxx>
0031 
0032 class TopoDS_Shape;
0033 class TopoDS_Edge;
0034 class TopoDS_Face;
0035 class ChFiDS_SurfData;
0036 class ChFiDS_Spine;
0037 class Adaptor3d_TopolTool;
0038 class TopoDS_Vertex;
0039 class ChFiDS_Stripe;
0040 
0041 
0042 //! construction tool for 3D chamfers on edges (on a solid).
0043 class ChFi3d_ChBuilder  : public ChFi3d_Builder
0044 {
0045 public:
0046 
0047   DEFINE_STANDARD_ALLOC
0048 
0049   
0050   //! initializes the Builder with the Shape <S> for the
0051   //! computation of chamfers
0052   Standard_EXPORT ChFi3d_ChBuilder(const TopoDS_Shape& S, const Standard_Real Ta = 1.0e-2);
0053   
0054   //! initializes a contour with the edge <E> as first
0055   //! (the next are found by propagation ).
0056   //! The two distances (parameters of the chamfer) must
0057   //! be set after.
0058   //! if the edge <E> has more than 2 adjacent faces
0059   Standard_EXPORT void Add (const TopoDS_Edge& E);
0060   
0061   //! initializes a new contour with the edge <E> as first
0062   //! (the next are found by propagation ), and  the
0063   //! distance <Dis>
0064   //! if the edge <E> has more than 2 adjacent faces
0065   Standard_EXPORT void Add (const Standard_Real Dis, const TopoDS_Edge& E);
0066   
0067   //! set the distance <Dis> of the fillet
0068   //! contour of index <IC> in the DS with <Dis> on <F>.
0069   //! if the face <F> is not one of common faces
0070   //! of an edge of the contour <IC>
0071   Standard_EXPORT void SetDist (const Standard_Real Dis,
0072                                 const Standard_Integer IC,
0073                                 const TopoDS_Face& F);
0074   
0075   //! gives the distances <Dis> of the fillet
0076   //! contour of index <IC> in the DS
0077   Standard_EXPORT void GetDist (const Standard_Integer IC, Standard_Real& Dis) const;
0078   
0079   //! initializes a new contour with the edge <E> as first
0080   //! (the next are found by propagation ), and  the
0081   //! distance <Dis1> and <Dis2>
0082   //! if the edge <E> has more than 2 adjacent faces
0083   Standard_EXPORT void Add (const Standard_Real Dis1,
0084                             const Standard_Real Dis2,
0085                             const TopoDS_Edge& E,
0086                             const TopoDS_Face& F);
0087   
0088   //! set the distances <Dis1> and <Dis2> of the fillet
0089   //! contour of index <IC> in the DS with <Dis1> on <F>.
0090   //! if the face <F> is not one of common faces
0091   //! of an edge of the contour <IC>
0092   Standard_EXPORT void SetDists (const Standard_Real Dis1,
0093                                  const Standard_Real Dis2,
0094                                  const Standard_Integer IC,
0095                                  const TopoDS_Face& F);
0096   
0097   //! gives the distances <Dis1> and <Dis2> of the fillet
0098   //! contour of index <IC> in the DS
0099   Standard_EXPORT void Dists (const Standard_Integer IC,
0100                               Standard_Real& Dis1,
0101                               Standard_Real& Dis2) const;
0102   
0103   //! initializes a new contour with the edge <E> as first
0104   //! (the next are found by propagation ), and  the
0105   //! distance <Dis1> and <Angle>
0106   //! if the edge <E> has more than 2 adjacent faces
0107   Standard_EXPORT void AddDA (const Standard_Real Dis,
0108                               const Standard_Real Angle,
0109                               const TopoDS_Edge& E,
0110                               const TopoDS_Face& F);
0111   
0112   //! set the distance <Dis> and <Angle> of the fillet
0113   //! contour of index <IC> in the DS with <Dis> on <F>.
0114   //! if the face <F> is not one of common faces
0115   //! of an edge of the contour <IC>
0116   Standard_EXPORT void SetDistAngle (const Standard_Real Dis,
0117                                      const Standard_Real Angle,
0118                                      const Standard_Integer IC,
0119                                      const TopoDS_Face& F);
0120   
0121   //! gives the distances <Dis> and <Angle> of the fillet
0122   //! contour of index <IC> in the DS
0123   Standard_EXPORT void GetDistAngle (const Standard_Integer IC,
0124                                      Standard_Real& Dis,
0125                                      Standard_Real& Angle) const;
0126   
0127   //! set the mode of shamfer
0128   Standard_EXPORT void SetMode (const ChFiDS_ChamfMode theMode);
0129   
0130   //! renvoi la methode des chanfreins utilisee
0131   Standard_EXPORT ChFiDS_ChamfMethod IsChamfer (const Standard_Integer IC) const;
0132   
0133   //! returns the mode of chamfer used
0134   Standard_EXPORT ChFiDS_ChamfMode Mode () const;
0135   
0136   //! Reset tous rayons du contour IC.
0137   Standard_EXPORT void ResetContour (const Standard_Integer IC);
0138   
0139   Standard_EXPORT void Simulate (const Standard_Integer IC);
0140   
0141   Standard_EXPORT Standard_Integer NbSurf (const Standard_Integer IC) const;
0142   
0143   Standard_EXPORT Handle(ChFiDS_SecHArray1) Sect (const Standard_Integer IC,
0144                                                   const Standard_Integer IS) const;
0145   
0146   Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data,
0147                                           const Handle(ChFiDS_ElSpine)& Guide,
0148                                           const Handle(ChFiDS_Spine)& Spine,
0149                                           const Standard_Integer Choix,
0150                                           const Handle(BRepAdaptor_Surface)& S1,
0151                                           const Handle(Adaptor3d_TopolTool)& I1,
0152                                           const Handle(BRepAdaptor_Curve2d)& PC1,
0153                                           const Handle(BRepAdaptor_Surface)& Sref1,
0154                                           const Handle(BRepAdaptor_Curve2d)& PCref1,
0155                                           Standard_Boolean& Decroch1,
0156                                           const Handle(BRepAdaptor_Surface)& S2,
0157                                           const Handle(Adaptor3d_TopolTool)& I2,
0158                                           const TopAbs_Orientation Or2,
0159                                           const Standard_Real Fleche,
0160                                           const Standard_Real TolGuide,
0161                                           Standard_Real& First,
0162                                           Standard_Real& Last,
0163                                           const Standard_Boolean Inside,
0164                                           const Standard_Boolean Appro,
0165                                           const Standard_Boolean Forward,
0166                                           const Standard_Boolean RecP,
0167                                           const Standard_Boolean RecS,
0168                                           const Standard_Boolean RecRst,
0169                                           const math_Vector& Soldep) Standard_OVERRIDE;
0170   
0171   Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data,
0172                                           const Handle(ChFiDS_ElSpine)& Guide,
0173                                           const Handle(ChFiDS_Spine)& Spine,
0174                                           const Standard_Integer Choix,
0175                                           const Handle(BRepAdaptor_Surface)& S1,
0176                                           const Handle(Adaptor3d_TopolTool)& I1,
0177                                           const TopAbs_Orientation Or1,
0178                                           const Handle(BRepAdaptor_Surface)& S2,
0179                                           const Handle(Adaptor3d_TopolTool)& I2,
0180                                           const Handle(BRepAdaptor_Curve2d)& PC2,
0181                                           const Handle(BRepAdaptor_Surface)& Sref2,
0182                                           const Handle(BRepAdaptor_Curve2d)& PCref2,
0183                                           Standard_Boolean& Decroch2,
0184                                           const Standard_Real Fleche,
0185                                           const Standard_Real TolGuide,
0186                                           Standard_Real& First,
0187                                           Standard_Real& Last,
0188                                           const Standard_Boolean Inside,
0189                                           const Standard_Boolean Appro,
0190                                           const Standard_Boolean Forward,
0191                                           const Standard_Boolean RecP,
0192                                           const Standard_Boolean RecS,
0193                                           const Standard_Boolean RecRst,
0194                                           const math_Vector& Soldep) Standard_OVERRIDE;
0195   
0196   Standard_EXPORT virtual void SimulSurf (Handle(ChFiDS_SurfData)& Data,
0197                                           const Handle(ChFiDS_ElSpine)& Guide,
0198                                           const Handle(ChFiDS_Spine)& Spine,
0199                                           const Standard_Integer Choix,
0200                                           const Handle(BRepAdaptor_Surface)& S1,
0201                                           const Handle(Adaptor3d_TopolTool)& I1,
0202                                           const Handle(BRepAdaptor_Curve2d)& PC1,
0203                                           const Handle(BRepAdaptor_Surface)& Sref1,
0204                                           const Handle(BRepAdaptor_Curve2d)& PCref1,
0205                                           Standard_Boolean& Decroch1,
0206                                           const TopAbs_Orientation Or1,
0207                                           const Handle(BRepAdaptor_Surface)& S2,
0208                                           const Handle(Adaptor3d_TopolTool)& I2,
0209                                           const Handle(BRepAdaptor_Curve2d)& PC2,
0210                                           const Handle(BRepAdaptor_Surface)& Sref2,
0211                                           const Handle(BRepAdaptor_Curve2d)& PCref2,
0212                                           Standard_Boolean& Decroch2,
0213                                           const TopAbs_Orientation Or2,
0214                                           const Standard_Real Fleche,
0215                                           const Standard_Real TolGuide,
0216                                           Standard_Real& First,
0217                                           Standard_Real& Last,
0218                                           const Standard_Boolean Inside,
0219                                           const Standard_Boolean Appro,
0220                                           const Standard_Boolean Forward,
0221                                           const Standard_Boolean RecP1,
0222                                           const Standard_Boolean RecRst1,
0223                                           const Standard_Boolean RecP2,
0224                                           const Standard_Boolean RecRst2,
0225                                           const math_Vector& Soldep) Standard_OVERRIDE;
0226   
0227   //! Methode, implemented in inheritants, calculates
0228   //! the elements of construction of  the surface (fillet
0229   //! or chamfer).
0230   Standard_EXPORT virtual Standard_Boolean PerformSurf (ChFiDS_SequenceOfSurfData& Data,
0231                                                         const Handle(ChFiDS_ElSpine)& Guide,
0232                                                         const Handle(ChFiDS_Spine)& Spine,
0233                                                         const Standard_Integer Choix,
0234                                                         const Handle(BRepAdaptor_Surface)& S1,
0235                                                         const Handle(Adaptor3d_TopolTool)& I1,
0236                                                         const Handle(BRepAdaptor_Surface)& S2,
0237                                                         const Handle(Adaptor3d_TopolTool)& I2,
0238                                                         const Standard_Real MaxStep,
0239                                                         const Standard_Real Fleche,
0240                                                         const Standard_Real TolGuide,
0241                                                         Standard_Real& First,
0242                                                         Standard_Real& Last,
0243                                                         const Standard_Boolean Inside,
0244                                                         const Standard_Boolean Appro,
0245                                                         const Standard_Boolean Forward,
0246                                                         const Standard_Boolean RecOnS1,
0247                                                         const Standard_Boolean RecOnS2,
0248                                                         const math_Vector& Soldep,
0249                                                         Standard_Integer& Intf,
0250                                                         Standard_Integer& Intl) Standard_OVERRIDE;
0251   
0252   //! Method, implemented in  the inheritants, calculates
0253   //! the elements of construction of  the surface (fillet
0254   //! or chamfer) contact edge/face.
0255   Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data,
0256                                             const Handle(ChFiDS_ElSpine)& Guide,
0257                                             const Handle(ChFiDS_Spine)& Spine,
0258                                             const Standard_Integer Choix,
0259                                             const Handle(BRepAdaptor_Surface)& S1,
0260                                             const Handle(Adaptor3d_TopolTool)& I1,
0261                                             const Handle(BRepAdaptor_Curve2d)& PC1,
0262                                             const Handle(BRepAdaptor_Surface)& Sref1,
0263                                             const Handle(BRepAdaptor_Curve2d)& PCref1,
0264                                             Standard_Boolean& Decroch1,
0265                                             const Handle(BRepAdaptor_Surface)& S2,
0266                                             const Handle(Adaptor3d_TopolTool)& I2,
0267                                             const TopAbs_Orientation Or2,
0268                                             const Standard_Real MaxStep,
0269                                             const Standard_Real Fleche,
0270                                             const Standard_Real TolGuide,
0271                                             Standard_Real& First,
0272                                             Standard_Real& Last,
0273                                             const Standard_Boolean Inside,
0274                                             const Standard_Boolean Appro,
0275                                             const Standard_Boolean Forward,
0276                                             const Standard_Boolean RecP,
0277                                             const Standard_Boolean RecS,
0278                                             const Standard_Boolean RecRst,
0279                                             const math_Vector& Soldep) Standard_OVERRIDE;
0280   
0281   //! Method, implemented in inheritants, calculates
0282   //! the elements of construction of  the surface (fillet
0283   //! or chamfer) contact edge/face.
0284   Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data,
0285                                             const Handle(ChFiDS_ElSpine)& Guide,
0286                                             const Handle(ChFiDS_Spine)& Spine,
0287                                             const Standard_Integer Choix,
0288                                             const Handle(BRepAdaptor_Surface)& S1,
0289                                             const Handle(Adaptor3d_TopolTool)& I1,
0290                                             const TopAbs_Orientation Or1,
0291                                             const Handle(BRepAdaptor_Surface)& S2,
0292                                             const Handle(Adaptor3d_TopolTool)& I2,
0293                                             const Handle(BRepAdaptor_Curve2d)& PC2,
0294                                             const Handle(BRepAdaptor_Surface)& Sref2,
0295                                             const Handle(BRepAdaptor_Curve2d)& PCref2,
0296                                             Standard_Boolean& Decroch2,
0297                                             const Standard_Real MaxStep,
0298                                             const Standard_Real Fleche,
0299                                             const Standard_Real TolGuide,
0300                                             Standard_Real& First,
0301                                             Standard_Real& Last,
0302                                             const Standard_Boolean Inside,
0303                                             const Standard_Boolean Appro,
0304                                             const Standard_Boolean Forward,
0305                                             const Standard_Boolean RecP,
0306                                             const Standard_Boolean RecS,
0307                                             const Standard_Boolean RecRst,
0308                                             const math_Vector& Soldep) Standard_OVERRIDE;
0309   
0310   //! Method, implemented in  inheritants, calculates
0311   //! the elements of construction of  the surface (fillet
0312   //! or chamfer) contact edge/edge.
0313   Standard_EXPORT virtual void PerformSurf (ChFiDS_SequenceOfSurfData& Data,
0314                                             const Handle(ChFiDS_ElSpine)& Guide,
0315                                             const Handle(ChFiDS_Spine)& Spine,
0316                                             const Standard_Integer Choix,
0317                                             const Handle(BRepAdaptor_Surface)& S1,
0318                                             const Handle(Adaptor3d_TopolTool)& I1,
0319                                             const Handle(BRepAdaptor_Curve2d)& PC1,
0320                                             const Handle(BRepAdaptor_Surface)& Sref1,
0321                                             const Handle(BRepAdaptor_Curve2d)& PCref1,
0322                                             Standard_Boolean& Decroch1,
0323                                             const TopAbs_Orientation Or1,
0324                                             const Handle(BRepAdaptor_Surface)& S2,
0325                                             const Handle(Adaptor3d_TopolTool)& I2,
0326                                             const Handle(BRepAdaptor_Curve2d)& PC2,
0327                                             const Handle(BRepAdaptor_Surface)& Sref2,
0328                                             const Handle(BRepAdaptor_Curve2d)& PCref2,
0329                                             Standard_Boolean& Decroch2,
0330                                             const TopAbs_Orientation Or2,
0331                                             const Standard_Real MaxStep,
0332                                             const Standard_Real Fleche,
0333                                             const Standard_Real TolGuide,
0334                                             Standard_Real& First,
0335                                             Standard_Real& Last,
0336                                             const Standard_Boolean Inside,
0337                                             const Standard_Boolean Appro,
0338                                             const Standard_Boolean Forward,
0339                                             const Standard_Boolean RecP1,
0340                                             const Standard_Boolean RecRst1,
0341                                             const Standard_Boolean RecP2,
0342                                             const Standard_Boolean RecRst2,
0343                                             const math_Vector& Soldep) Standard_OVERRIDE;
0344   
0345 
0346 
0347 
0348 protected:
0349 
0350   
0351   Standard_EXPORT void SimulKPart (const Handle(ChFiDS_SurfData)& SD) const Standard_OVERRIDE;
0352   
0353   Standard_EXPORT Standard_Boolean SimulSurf (Handle(ChFiDS_SurfData)& Data,
0354                                               const Handle(ChFiDS_ElSpine)& Guide,
0355                                               const Handle(ChFiDS_Spine)& Spine,
0356                                               const Standard_Integer Choix,
0357                                               const Handle(BRepAdaptor_Surface)& S1,
0358                                               const Handle(Adaptor3d_TopolTool)& I1,
0359                                               const Handle(BRepAdaptor_Surface)& S2,
0360                                               const Handle(Adaptor3d_TopolTool)& I2,
0361                                               const Standard_Real TolGuide,
0362                                               Standard_Real& First,
0363                                               Standard_Real& Last,
0364                                               const Standard_Boolean Inside,
0365                                               const Standard_Boolean Appro,
0366                                               const Standard_Boolean Forward,
0367                                               const Standard_Boolean RecOnS1,
0368                                               const Standard_Boolean RecOnS2,
0369                                               const math_Vector& Soldep,
0370                                               Standard_Integer& Intf,
0371                                               Standard_Integer& Intl) Standard_OVERRIDE;
0372   
0373   Standard_EXPORT Standard_Boolean PerformFirstSection (const Handle(ChFiDS_Spine)& S,
0374                                                         const Handle(ChFiDS_ElSpine)& HGuide,
0375                                                         const Standard_Integer Choix,
0376                                                         Handle(BRepAdaptor_Surface)& S1,
0377                                                         Handle(BRepAdaptor_Surface)& S2,
0378                                                         const Handle(Adaptor3d_TopolTool)& I1,
0379                                                         const Handle(Adaptor3d_TopolTool)& I2,
0380                                                         const Standard_Real Par,
0381                                                         math_Vector& SolDep,
0382                                                         TopAbs_State& Pos1,
0383                                                         TopAbs_State& Pos2) const Standard_OVERRIDE;
0384   
0385   //! computes  the  intersection of two chamfers on
0386   //! the vertex of index <Index> in myVDataMap.
0387   Standard_EXPORT void PerformTwoCorner (const Standard_Integer Index) Standard_OVERRIDE;
0388   
0389   //! computes the intersection of three chamfers on
0390   //! the vertex of index <Index> in myVDataMap.
0391   Standard_EXPORT void PerformThreeCorner (const Standard_Integer Index) Standard_OVERRIDE;
0392   
0393   //! extends  the spine  of  the Stripe  <S> at  the
0394   //! extremity of the vertex <V>.
0395   Standard_EXPORT void ExtentOneCorner (const TopoDS_Vertex& V,
0396                                         const Handle(ChFiDS_Stripe)& S) Standard_OVERRIDE;
0397   
0398   //! extends the spine of the 2 stripes of <LS> at the
0399   //! extremity of the vertex <V>
0400   Standard_EXPORT void ExtentTwoCorner (const TopoDS_Vertex& V,
0401                                         const ChFiDS_ListOfStripe& LS) Standard_OVERRIDE;
0402   
0403   //! extends the spine of the 2 stripes of <LS> at the
0404   //! extremity of the vertex <V>
0405   Standard_EXPORT void ExtentThreeCorner (const TopoDS_Vertex& V,
0406                                           const ChFiDS_ListOfStripe& LS) Standard_OVERRIDE;
0407   
0408   //! set the regularities
0409   Standard_EXPORT void SetRegul() Standard_OVERRIDE;
0410 
0411 
0412 
0413 
0414 private:
0415 
0416   
0417   Standard_EXPORT void ConexFaces (const Handle(ChFiDS_Spine)& Sp,
0418                                    const Standard_Integer IEdge,
0419                                    TopoDS_Face& F1,
0420                                    TopoDS_Face& F2) const;
0421 
0422   ChFiDS_ChamfMode   myMode;
0423 
0424 
0425 };
0426 
0427 
0428 
0429 
0430 
0431 
0432 
0433 #endif // _ChFi3d_ChBuilder_HeaderFile