| 1 | -- Created on: 1994-11-16 |
| 2 | -- Created by: Christian CAILLET |
| 3 | -- Copyright (c) 1994-1999 Matra Datavision |
| 4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
| 5 | -- |
| 6 | -- This file is part of Open CASCADE Technology software library. |
| 7 | -- |
| 8 | -- This library is free software; you can redistribute it and / or modify it |
| 9 | -- under the terms of the GNU Lesser General Public version 2.1 as published |
| 10 | -- by the Free Software Foundation, with special exception defined in the file |
| 11 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
| 12 | -- distribution for complete text of the license and disclaimer of any warranty. |
| 13 | -- |
| 14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
| 15 | -- commercial license or contractual agreement. |
| 16 | |
| 17 | class GeomBuilder from IGESConvGeom |
| 18 | |
| 19 | ---Purpose : This class provides some useful basic tools to build IGESGeom |
| 20 | -- curves, especially : |
| 21 | -- define a curve in a plane in 3D space (ex. Circular or Conic |
| 22 | -- arc, or Copious Data defined in 2D) |
| 23 | -- make a CopiousData from a list of points/vectors |
| 24 | |
| 25 | uses XY from gp, XYZ from gp, Trsf, Ax1, Ax2, Ax3, |
| 26 | HSequenceOfXYZ, HArray1OfXY, HArray1OfXYZ, |
| 27 | TransformationMatrix, CopiousData |
| 28 | |
| 29 | raises DomainError |
| 30 | |
| 31 | is |
| 32 | |
| 33 | Create returns GeomBuilder; |
| 34 | ---Purpose : Creates a GeomBuilder at initial state. |
| 35 | |
| 36 | Clear (me : in out) is static; |
| 37 | ---Purpose : Clears list of Points/Vectors and data about Transformation |
| 38 | |
| 39 | AddXY (me : in out; val : XY from gp) is static; |
| 40 | ---Purpose : Adds a XY (Z=0) to the list of points |
| 41 | |
| 42 | AddXYZ (me : in out; val : XYZ from gp) is static; |
| 43 | ---Purpose : Adds a XYZ to the list of points |
| 44 | |
| 45 | AddVec (me : in out; val : XYZ from gp) is static; |
| 46 | ---Purpose : Adds a Vector part to the list of points. It will be used |
| 47 | -- for CopiousData, datatype=3, only. |
| 48 | -- AddXY and AddXYZ consider a null vector part (0,0,0) |
| 49 | -- AddVec adds to the last added XY or XYZ |
| 50 | |
| 51 | NbPoints (me) returns Integer is static; |
| 52 | ---Purpose : Returns the count of already recorded points |
| 53 | |
| 54 | Point (me; num : Integer) returns XYZ is static; |
| 55 | ---Purpose : Returns a point given its rank (if added as XY, Z will be 0) |
| 56 | |
| 57 | MakeCopiousData (me; datatype : Integer; polyline : Boolean = Standard_False) |
| 58 | returns mutable CopiousData |
| 59 | ---Purpose : Makes a CopiousData with the list of recorded Points/Vectors |
| 60 | -- according to <datatype>, which must be 1,2 or 3 |
| 61 | -- If <polyline> is given True, the CopiousData is coded as a |
| 62 | -- Polyline, but <datatype> must not be 3 |
| 63 | -- <datatype> = 1 : Common Z is computed as average of all Z |
| 64 | -- <datatype> = 1 or 2 : Vectors are ignored |
| 65 | raises DomainError; |
| 66 | -- Error if : <datatype> is not 1,2 or 3; or NbPoints is 0 |
| 67 | |
| 68 | MakeXY (me) returns mutable HArray1OfXY is static; |
| 69 | ---Purpose : Returns the list of points as a HArray1OfXY. Z are ignored. |
| 70 | |
| 71 | MakeXYZ (me) returns mutable HArray1OfXYZ is static; |
| 72 | ---Purpose : Returns the list of points as a HArray1OfXYZ |
| 73 | |
| 74 | |
| 75 | Position (me) returns Trsf from gp is static; |
| 76 | ---Purpose : Returns the Position in which the method EvalXYZ will |
| 77 | -- evaluate a XYZ. It can be regarded as defining a local system. |
| 78 | -- It is initially set to Identity |
| 79 | |
| 80 | SetPosition (me : in out; pos : Trsf from gp) is static; |
| 81 | ---Purpose : Sets final position from an already defined Trsf |
| 82 | |
| 83 | SetPosition (me : in out; pos : Ax3 from gp) is static; |
| 84 | ---Purpose : Sets final position from an Ax3 |
| 85 | |
| 86 | SetPosition (me : in out; pos : Ax2 from gp) is static; |
| 87 | ---Purpose : Sets final position from an Ax2 |
| 88 | |
| 89 | SetPosition (me : in out; pos : Ax1 from gp) is static; |
| 90 | ---Purpose : Sets final position from an Ax1 |
| 91 | -- (this means that origin point and Z-axis are defined, the |
| 92 | -- other axes are defined arbitrarily) |
| 93 | |
| 94 | IsIdentity (me) returns Boolean is static; |
| 95 | ---Purpose : Returns True if the Position is Identity |
| 96 | |
| 97 | IsTranslation (me) returns Boolean is static; |
| 98 | ---Purpose : Returns True if the Position is a Translation only |
| 99 | -- Remark : Identity and ZOnly will answer True |
| 100 | |
| 101 | IsZOnly (me) returns Boolean is static; |
| 102 | ---Purpose : Returns True if the Position corresponds to a Z-Displacement, |
| 103 | -- i.e. is a Translation only, and only on Z |
| 104 | -- Remark : Identity will answer True |
| 105 | |
| 106 | EvalXYZ (me; val : XYZ from gp; X,Y,Z : out Real) is static; |
| 107 | ---Purpose : Evaluates a XYZ value in the Position already defined. |
| 108 | -- Returns the transformed coordinates. |
| 109 | -- For a 2D definition, X,Y will then be used to define a XY and |
| 110 | -- Z will be regarded as a Z Displacement (can be ignored) |
| 111 | |
| 112 | MakeTransformation (me; unit : Real = 1) |
| 113 | returns mutable TransformationMatrix is static; |
| 114 | ---Purpose : Returns the IGES Transformation which corresponds to the |
| 115 | -- Position. Even if it is an Identity : IsIdentity should be |
| 116 | -- tested first. |
| 117 | -- <unit> is the unit value in which the model is created : |
| 118 | -- it is used to convert translation part |
| 119 | |
| 120 | fields |
| 121 | |
| 122 | theXYZ : HSequenceOfXYZ; |
| 123 | theVec : HSequenceOfXYZ; |
| 124 | thepos : Trsf from gp; |
| 125 | |
| 126 | end GeomBuilder; |