Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-01 10:16:30

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