Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1998-07-22
0002 // Created by: Philippe MANGIN
0003 // Copyright (c) 1998-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 _BRepFill_PipeShell_HeaderFile
0018 #define _BRepFill_PipeShell_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022 
0023 #include <TopoDS_Wire.hxx>
0024 #include <TopoDS_Shape.hxx>
0025 #include <BRepFill_SequenceOfSection.hxx>
0026 #include <TopTools_DataMapOfShapeListOfShape.hxx>
0027 #include <Standard_Integer.hxx>
0028 #include <TopTools_HArray2OfShape.hxx>
0029 #include <GeomFill_Trihedron.hxx>
0030 #include <BRepFill_TransitionStyle.hxx>
0031 #include <GeomFill_PipeError.hxx>
0032 #include <Standard_Transient.hxx>
0033 #include <BRepFill_TypeOfContact.hxx>
0034 #include <TopTools_ListOfShape.hxx>
0035 #include <TopTools_SequenceOfShape.hxx>
0036 #include <TColStd_SequenceOfInteger.hxx>
0037 class Law_Function;
0038 class BRepFill_LocationLaw;
0039 class BRepFill_SectionLaw;
0040 class gp_Ax2;
0041 class gp_Dir;
0042 class TopoDS_Vertex;
0043 class gp_Trsf;
0044 class BRepFill_Sweep;
0045 
0046 
0047 class BRepFill_PipeShell;
0048 DEFINE_STANDARD_HANDLE(BRepFill_PipeShell, Standard_Transient)
0049 
0050 //! Computes a topological shell using some wires
0051 //! (spines and profiles) and diplacement option
0052 //! Perform general sweeping construction
0053 class BRepFill_PipeShell : public Standard_Transient
0054 {
0055 
0056 public:
0057 
0058   
0059   //! Set an sweep's mode
0060   //! If no mode are set, the mode used in MakePipe is used
0061   Standard_EXPORT BRepFill_PipeShell(const TopoDS_Wire& Spine);
0062   
0063   //! Set an Frenet or an CorrectedFrenet trihedron
0064   //! to  perform  the  sweeping
0065   Standard_EXPORT void Set (const Standard_Boolean Frenet = Standard_False);
0066   
0067   //! Set a Discrete trihedron
0068   //! to  perform  the  sweeping
0069   Standard_EXPORT void SetDiscrete();
0070   
0071   //! Set  an  fixed  trihedron  to  perform  the  sweeping
0072   //! all sections will be parallel.
0073   Standard_EXPORT void Set (const gp_Ax2& Axe);
0074   
0075   //! Set an fixed  BiNormal  direction to  perform
0076   //! the sweeping
0077   Standard_EXPORT void Set (const gp_Dir& BiNormal);
0078   
0079   //! Set support to the spine to define the BiNormal
0080   //! at   the spine, like    the  normal the surfaces.
0081   //! Warning: To  be  effective,  Each  edge  of  the  <spine>  must
0082   //! have an  representation  on   one   face  of<SpineSupport>
0083   Standard_EXPORT Standard_Boolean Set (const TopoDS_Shape& SpineSupport);
0084   
0085   //! Set  an  auxiliary  spine  to  define  the Normal
0086   //! For  each  Point  of  the  Spine  P,  an  Point  Q  is  evalued
0087   //! on  <AuxiliarySpine>
0088   //! If <CurvilinearEquivalence>
0089   //! Q split <AuxiliarySpine> with  the  same  length ratio
0090   //! than P split  <Spline>.
0091   //! Else  the  plan  define  by  P  and  the  tangent  to  the  <Spine>
0092   //! intersect <AuxiliarySpine> in Q.
0093   //! If <KeepContact> equals BRepFill_NoContact: The Normal is defined
0094   //! by the vector PQ.
0095   //! If <KeepContact> equals BRepFill_Contact: The Normal is defined to
0096   //! achieve that the sweeped section is in contact to the
0097   //! auxiliarySpine. The width of section is constant all along the path.
0098   //! In other words, the auxiliary spine lies on the swept surface,
0099   //! but not necessarily is a boundary of this surface. However,
0100   //! the auxiliary spine has to be close enough to the main spine
0101   //! to provide intersection with any section all along the path.
0102   //! If <KeepContact> equals BRepFill_ContactOnBorder: The auxiliary spine
0103   //! becomes a boundary of the swept surface and the width of section varies
0104   //! along the path.
0105   Standard_EXPORT void Set (const TopoDS_Wire& AuxiliarySpine, const Standard_Boolean CurvilinearEquivalence = Standard_True, const BRepFill_TypeOfContact KeepContact = BRepFill_NoContact);
0106   
0107   //! Define the maximum V degree of resulting surface
0108   Standard_EXPORT void SetMaxDegree (const Standard_Integer NewMaxDegree);
0109   
0110   //! Define the maximum number of spans in V-direction
0111   //! on resulting surface
0112   Standard_EXPORT void SetMaxSegments (const Standard_Integer NewMaxSegments);
0113   
0114   //! Set the flag that indicates attempt to approximate
0115   //! a C1-continuous surface if a swept surface proved
0116   //! to be C0.
0117   //! Give section to sweep.
0118   //! Possibilities are :
0119   //! - Give one or sevral profile
0120   //! - Give one profile and an homotetic law.
0121   //! - Automatic compute of correspondence between profile, and section on the sweeped shape
0122   //! - correspondence between profile, and section on the sweeped shape defined by a vertex of the spine
0123   Standard_EXPORT void SetForceApproxC1 (const Standard_Boolean ForceApproxC1);
0124 
0125   //! Set an section. The correspondence with the spine, will be automatically performed.
0126   Standard_EXPORT void Add (const TopoDS_Shape& Profile, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
0127 
0128   //! Set an section. The correspondence with the spine, is given by Location.
0129   Standard_EXPORT void Add (const TopoDS_Shape& Profile, const TopoDS_Vertex& Location, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
0130   
0131   //! Set  an    section  and  an   homotetic    law.
0132   //! The  homotetie's  centers  is  given  by  point  on  the  <Spine>.
0133   Standard_EXPORT void SetLaw (const TopoDS_Shape& Profile, const Handle(Law_Function)& L, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
0134   
0135   //! Set  an    section  and  an   homotetic    law.
0136   //! The  homotetie  center  is  given  by  point  on  the  <Spine>
0137   Standard_EXPORT void SetLaw (const TopoDS_Shape& Profile, const Handle(Law_Function)& L, const TopoDS_Vertex& Location, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
0138   
0139   //! Delete an section.
0140   Standard_EXPORT void DeleteProfile (const TopoDS_Shape& Profile);
0141   
0142   //! Say if <me> is ready to build the shape
0143   //! return False if <me> do not have section definition
0144   Standard_EXPORT Standard_Boolean IsReady() const;
0145   
0146   //! Get a status, when Simulate or Build failed.
0147   Standard_EXPORT GeomFill_PipeError GetStatus() const;
0148   
0149   Standard_EXPORT void SetTolerance (const Standard_Real Tol3d = 1.0e-4, const Standard_Real BoundTol = 1.0e-4, const Standard_Real TolAngular = 1.0e-2);
0150   
0151   //! Set the  Transition Mode to manage discontinuities
0152   //! on the sweep.
0153   Standard_EXPORT void SetTransition (const BRepFill_TransitionStyle Mode = BRepFill_Modified, const Standard_Real Angmin = 1.0e-2, const Standard_Real Angmax = 6.0);
0154   
0155   //! Perform simulation of the sweep :
0156   //! Somes Section are returned.
0157   Standard_EXPORT void Simulate (const Standard_Integer NumberOfSection, TopTools_ListOfShape& Sections);
0158   
0159   //! Builds the resulting shape (redefined from MakeShape).
0160   Standard_EXPORT Standard_Boolean Build();
0161   
0162   //! Transform the sweeping Shell in Solid.
0163   //! If the section are not closed returns False
0164   Standard_EXPORT Standard_Boolean MakeSolid();
0165   
0166   //! Returns the result Shape.
0167   Standard_EXPORT const TopoDS_Shape& Shape() const;
0168   
0169   Standard_EXPORT Standard_Real ErrorOnSurface() const;
0170   
0171   //! Returns the  TopoDS  Shape of the bottom of the sweep.
0172   Standard_EXPORT const TopoDS_Shape& FirstShape() const;
0173   
0174   //! Returns the TopoDS Shape of the top of the sweep.
0175   Standard_EXPORT const TopoDS_Shape& LastShape() const;
0176   
0177   //! Returns the list of original profiles
0178   void Profiles(TopTools_ListOfShape& theProfiles)
0179   {
0180     for (Standard_Integer i = 1; i <= mySeq.Length(); ++i)
0181       theProfiles.Append(mySeq(i).OriginalShape());
0182   }
0183 
0184   //! Returns the spine
0185   const TopoDS_Wire& Spine()
0186   {
0187     return mySpine;
0188   }
0189 
0190   //! Returns the  list   of shapes generated   from the
0191   //! shape <S>.
0192   Standard_EXPORT void Generated (const TopoDS_Shape& S, TopTools_ListOfShape& L);
0193 
0194 
0195 
0196 
0197   DEFINE_STANDARD_RTTIEXT(BRepFill_PipeShell,Standard_Transient)
0198 
0199 protected:
0200 
0201 
0202 
0203 
0204 private:
0205 
0206   
0207   Standard_EXPORT void Prepare();
0208   
0209   Standard_EXPORT void Place (const BRepFill_Section& Sec, TopoDS_Wire& W, gp_Trsf& Trsf, Standard_Real& param);
0210   
0211   Standard_EXPORT void ResetLoc();
0212   
0213   Standard_EXPORT void BuildHistory (const BRepFill_Sweep& theSweep);
0214 
0215   TopoDS_Wire mySpine;
0216   TopoDS_Shape myFirst;
0217   TopoDS_Shape myLast;
0218   TopoDS_Shape myShape;
0219   BRepFill_SequenceOfSection mySeq;
0220   TopTools_SequenceOfShape WSeq;
0221   TColStd_SequenceOfInteger  myIndOfSec;
0222   TopTools_DataMapOfShapeListOfShape myEdgeNewEdges;
0223   TopTools_DataMapOfShapeListOfShape myGenMap;
0224   Standard_Real myTol3d;
0225   Standard_Real myBoundTol;
0226   Standard_Real myTolAngular;
0227   Standard_Real angmin;
0228   Standard_Real angmax;
0229   Standard_Integer myMaxDegree;
0230   Standard_Integer myMaxSegments;
0231   Standard_Boolean myForceApproxC1;
0232   Handle(Law_Function) myLaw;
0233   Standard_Boolean myIsAutomaticLaw;
0234   Handle(BRepFill_LocationLaw) myLocation;
0235   Handle(BRepFill_SectionLaw) mySection;
0236   Handle(TopTools_HArray2OfShape) myFaces;
0237   GeomFill_Trihedron myTrihedron;
0238   BRepFill_TransitionStyle myTransition;
0239   GeomFill_PipeError myStatus;
0240   Standard_Real myErrorOnSurf;
0241 
0242 
0243 };
0244 
0245 
0246 
0247 
0248 
0249 
0250 
0251 #endif // _BRepFill_PipeShell_HeaderFile