Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1998-04-08
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 _BRepOffsetAPI_MakePipeShell_HeaderFile
0018 #define _BRepOffsetAPI_MakePipeShell_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRepPrimAPI_MakeSweep.hxx>
0025 #include <BRepFill_PipeShell.hxx>
0026 #include <BRepFill_TypeOfContact.hxx>
0027 #include <BRepBuilderAPI_PipeError.hxx>
0028 #include <Standard_Integer.hxx>
0029 #include <BRepBuilderAPI_TransitionMode.hxx>
0030 #include <TopTools_ListOfShape.hxx>
0031 class TopoDS_Wire;
0032 class gp_Ax2;
0033 class gp_Dir;
0034 class TopoDS_Shape;
0035 class TopoDS_Vertex;
0036 class Law_Function;
0037 
0038 
0039 //! This class provides for a framework to construct a shell
0040 //! or a solid along a spine consisting in a wire.
0041 //! To produce a solid, the initial wire must be closed.
0042 //! Two approaches are used:
0043 //! - definition by section
0044 //! - by a section and a scaling law
0045 //! - by addition of successive intermediary sections
0046 //! - definition by sweep mode.
0047 //! - pseudo-Frenet
0048 //! - constant
0049 //! - binormal constant
0050 //! - normal defined by a surface support
0051 //! - normal defined by a guiding contour.
0052 //! The two global approaches can also be combined.
0053 //! You can also close the surface later in order to form a solid.
0054 //! Warning: some limitations exist
0055 //! -- Mode with auxiliary spine is incompatible with hometetic laws
0056 //! -- Mode with auxiliary spine and keep contact produce only CO surface.
0057 class BRepOffsetAPI_MakePipeShell  : public BRepPrimAPI_MakeSweep
0058 {
0059 public:
0060 
0061   DEFINE_STANDARD_ALLOC
0062 
0063   
0064   //! Constructs the shell-generating framework defined by the wire Spine.
0065   //! Sets an sweep's mode
0066   //! If no mode are set, the mode use in MakePipe is used
0067   Standard_EXPORT BRepOffsetAPI_MakePipeShell(const TopoDS_Wire& Spine);
0068   
0069   //! Sets a Frenet or a CorrectedFrenet trihedron
0070   //! to  perform  the  sweeping
0071   //! If IsFrenet is false, a corrected Frenet trihedron is used.
0072   Standard_EXPORT void SetMode (const Standard_Boolean IsFrenet = Standard_False);
0073   
0074   //! Sets a Discrete trihedron
0075   //! to  perform  the  sweeping
0076   Standard_EXPORT void SetDiscreteMode();
0077   
0078   //! Sets  a  fixed  trihedron  to  perform  the  sweeping
0079   //! all sections will be parallel.
0080   Standard_EXPORT void SetMode (const gp_Ax2& Axe);
0081   
0082   //! Sets a fixed BiNormal  direction to perform the --
0083   //! sweeping.   Angular   relations   between  the
0084   //! section(s) and <BiNormal> will be constant
0085   Standard_EXPORT void SetMode (const gp_Dir& BiNormal);
0086   
0087   //! Sets support to the spine to define the BiNormal of
0088   //! the trihedron, like the normal  to the surfaces.
0089   //! Warning:  To be effective, Each  edge of the <spine> must
0090   //! have a representation on one face of<SpineSupport>
0091   Standard_EXPORT Standard_Boolean SetMode (const TopoDS_Shape& SpineSupport);
0092   
0093   //! Sets  an  auxiliary  spine  to  define  the Normal
0094   //! For  each  Point  of  the  Spine  P,  an  Point  Q  is  evalued
0095   //! on  <AuxiliarySpine>
0096   //! If <CurvilinearEquivalence>
0097   //! Q split <AuxiliarySpine> with  the  same  length ratio
0098   //! than P split  <Spline>.
0099   //! Else  the  plan  define  by  P  and  the  tangent  to  the  <Spine>
0100   //! intersect <AuxiliarySpine> in Q.
0101   //! If <KeepContact> equals BRepFill_NoContact: The Normal is defined
0102   //! by the vector PQ.
0103   //! If <KeepContact> equals BRepFill_Contact: The Normal is defined to
0104   //! achieve that the sweeped section is in contact to the
0105   //! auxiliarySpine. The width of section is constant all along the path.
0106   //! In other words, the auxiliary spine lies on the swept surface,
0107   //! but not necessarily is a boundary of this surface. However,
0108   //! the auxiliary spine has to be close enough to the main spine
0109   //! to provide intersection with any section all along the path.
0110   //! If <KeepContact> equals BRepFill_ContactOnBorder: The auxiliary spine
0111   //! becomes a boundary of the swept surface and the width of section varies
0112   //! along the path.
0113   //! Give section to sweep.
0114   //! Possibilities are :
0115   //! - Give one or sevral section
0116   //! - Give one profile and an homotetic law.
0117   //! - Automatic compute of correspondence between spine, and section
0118   //! on the sweeped shape
0119   //! - correspondence between spine, and section on the sweeped shape
0120   //! defined by a vertex of the spine
0121   Standard_EXPORT void SetMode (const TopoDS_Wire& AuxiliarySpine, const Standard_Boolean CurvilinearEquivalence, const BRepFill_TypeOfContact KeepContact = BRepFill_NoContact);
0122   
0123   //! Adds the section Profile to this framework. First and last
0124   //! sections may be punctual, so the shape Profile may be
0125   //! both wire and vertex. Correspondent point on spine is
0126   //! computed automatically.
0127   //! If WithContact is true, the section is translated to be in
0128   //! contact with the spine.
0129   //! If WithCorrection is true, the section is rotated to be
0130   //! orthogonal to the spine?s tangent in the correspondent
0131   //! point. This option has no sense if the section is punctual
0132   //! (Profile is of type TopoDS_Vertex).
0133   Standard_EXPORT void Add (const TopoDS_Shape& Profile, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
0134   
0135   //! Adds the section Profile to this framework.
0136   //! Correspondent point on the spine is given by Location.
0137   //! Warning:
0138   //! To be effective, it is not recommended to combine methods Add and SetLaw.
0139   Standard_EXPORT void Add (const TopoDS_Shape& Profile, const TopoDS_Vertex& Location, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
0140   
0141   //! Sets the evolution law defined by the wire Profile with
0142   //! its position (Location, WithContact, WithCorrection
0143   //! are the same options as in methods Add) and a
0144   //! homotetic law defined by the function L.
0145   //! Warning:
0146   //! To be effective, it is not recommended to combine methods Add and SetLaw.
0147   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);
0148   
0149   //! Sets the evolution law defined by the wire Profile with
0150   //! its position (Location, WithContact, WithCorrection
0151   //! are the same options as in methods Add) and a
0152   //! homotetic law defined by the function L.
0153   //! Warning:
0154   //! To be effective, it is not recommended to combine methods Add and SetLaw.
0155   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);
0156   
0157   //! Removes the section Profile from this framework.
0158   Standard_EXPORT void Delete (const TopoDS_Shape& Profile);
0159   
0160   //! Returns true if this tool object is ready to build the
0161   //! shape, i.e. has a definition for the wire section Profile.
0162   Standard_EXPORT Standard_Boolean IsReady() const;
0163   
0164   //! Get a status, when Simulate or Build failed.       It can be
0165   //! BRepBuilderAPI_PipeDone,
0166   //! BRepBuilderAPI_PipeNotDone,
0167   //! BRepBuilderAPI_PlaneNotIntersectGuide,
0168   //! BRepBuilderAPI_ImpossibleContact.
0169   Standard_EXPORT BRepBuilderAPI_PipeError GetStatus() const;
0170   
0171   //! Sets the following tolerance values
0172   //! - 3D tolerance Tol3d
0173   //! - boundary tolerance BoundTol
0174   //! - angular tolerance TolAngular.
0175   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);
0176   
0177   //! Define the maximum V degree of resulting surface
0178   Standard_EXPORT void SetMaxDegree (const Standard_Integer NewMaxDegree);
0179   
0180   //! Define the maximum number of spans in V-direction
0181   //! on resulting surface
0182   Standard_EXPORT void SetMaxSegments (const Standard_Integer NewMaxSegments);
0183   
0184   //! Set the flag that indicates attempt to approximate
0185   //! a C1-continuous surface if a swept surface proved
0186   //! to be C0.
0187   Standard_EXPORT void SetForceApproxC1 (const Standard_Boolean ForceApproxC1);
0188   
0189   //! Sets the transition mode to manage discontinuities on
0190   //! the swept shape caused by fractures on the spine. The
0191   //! transition mode can be BRepBuilderAPI_Transformed
0192   //! (default value), BRepBuilderAPI_RightCorner,
0193   //! BRepBuilderAPI_RoundCorner:
0194   //! -              RepBuilderAPI_Transformed:
0195   //! discontinuities are treated by
0196   //! modification of the sweeping mode. The
0197   //! pipe is "transformed" at the fractures of
0198   //! the spine. This mode assumes building a
0199   //! self-intersected shell.
0200   //! -              BRepBuilderAPI_RightCorner:
0201   //! discontinuities are treated like right
0202   //! corner. Two pieces of the pipe
0203   //! corresponding to two adjacent
0204   //! segments of the spine are extended
0205   //! and intersected at a fracture of the spine.
0206   //! -              BRepBuilderAPI_RoundCorner:
0207   //! discontinuities are treated like round
0208   //! corner. The corner is treated as rotation
0209   //! of the profile around an axis which
0210   //! passes through the point of the spine's
0211   //! fracture. This axis is based on cross
0212   //! product of directions tangent to the
0213   //! adjacent segments of the spine at their common point.
0214   //! Warnings
0215   //! The mode BRepBuilderAPI_RightCorner provides a
0216   //! valid result if intersection of two pieces of the pipe
0217   //! (corresponding to two adjacent segments of the spine)
0218   //! in the neighborhood of the spine?s fracture is
0219   //! connected and planar. This condition can be violated if
0220   //! the spine is non-linear in some neighborhood of the
0221   //! fracture or if the profile was set with a scaling law.
0222   //! The last mode, BRepBuilderAPI_RoundCorner, will
0223   //! assuredly provide a good result only if a profile was set
0224   //! with option WithCorrection = True, i.e. it is strictly
0225   //! orthogonal to the spine.
0226   Standard_EXPORT void SetTransitionMode (const BRepBuilderAPI_TransitionMode Mode = BRepBuilderAPI_Transformed);
0227   
0228   //! Simulates the resulting shape by calculating its
0229   //! cross-sections. The spine is divided by this
0230   //! cross-sections into (NumberOfSection - 1) equal
0231   //! parts, the number of cross-sections is
0232   //! NumberOfSection. The cross-sections are wires and
0233   //! they are returned in the list Result.
0234   //! This gives a rapid preview of the resulting shape,
0235   //! which will be obtained using the settings you have provided.
0236   //! Raises  NotDone if  <me> it is not Ready
0237   Standard_EXPORT void Simulate (const Standard_Integer NumberOfSection, TopTools_ListOfShape& Result);
0238   
0239   //! Builds the resulting shape (redefined from MakeShape).
0240   Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0241   
0242   //! Transforms the sweeping Shell in Solid.
0243   //! If a propfile is not closed returns False
0244   Standard_EXPORT Standard_Boolean MakeSolid();
0245   
0246   //! Returns the  TopoDS  Shape of the bottom of the sweep.
0247   Standard_EXPORT virtual TopoDS_Shape FirstShape() Standard_OVERRIDE;
0248   
0249   //! Returns the TopoDS Shape of the top of the sweep.
0250   Standard_EXPORT virtual TopoDS_Shape LastShape() Standard_OVERRIDE;
0251   
0252   //! Returns a list of new shapes generated from the shape
0253   //! S by the shell-generating algorithm.
0254   //! This function is redefined from BRepOffsetAPI_MakeShape::Generated.
0255   //! S can be an edge or a vertex of a given Profile (see methods Add).
0256   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
0257   
0258   Standard_EXPORT Standard_Real ErrorOnSurface() const;
0259 
0260   //! Returns the list of original profiles
0261   void Profiles(TopTools_ListOfShape& theProfiles)
0262   {
0263     myPipe->Profiles(theProfiles);
0264   }
0265 
0266   //! Returns the spine
0267   const TopoDS_Wire& Spine()
0268   {
0269     return myPipe->Spine();
0270   }
0271 
0272 protected:
0273 
0274 
0275 
0276 
0277 
0278 private:
0279 
0280 
0281 
0282   Handle(BRepFill_PipeShell) myPipe;
0283 
0284 };
0285 
0286 
0287 
0288 
0289 
0290 
0291 
0292 #endif // _BRepOffsetAPI_MakePipeShell_HeaderFile