Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/BRepOffsetAPI_MakePipeShell.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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