1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
-- File: ShapeBuild_ReShape.cdl
-- Created: Wed Jun 3 12:43:06 1998
-- Author: data exchange team
-- <det@loufox.nnov.matra-dtv.fr>
---Copyright: Matra Datavision 1998
class ReShape from ShapeBuild inherits ReShape from BRepTools
---Purpose: Rebuilds a Shape by making pre-defined substitutions on some
-- of its components
--
-- In a first phase, it records requests to replace or remove
-- some individual shapes
-- For each shape, the last given request is recorded
-- Requests may be applied "Oriented" (i.e. only to an item with
-- the SAME orientation) or not (the orientation of replacing
-- shape is respectful of that of the original one)
--
-- Then, these requests may be applied to any shape which may
-- contain one or more of these individual shapes
uses
ShapeEnum from TopAbs,
Shape from TopoDS,
Status from ShapeExtend
is
Create returns mutable ReShape from ShapeBuild;
---Purpose: Returns an empty Reshape
Apply (me: mutable; shape: Shape from TopoDS; until: ShapeEnum from TopAbs; buildmode: Integer)
returns Shape from TopoDS is redefined;
---Purpose: Applies the substitutions requests to a shape
--
-- <until> gives the level of type until which requests are taken
-- into account. For subshapes of the type <until> no rebuild
-- and futher exploring are done.
-- ACTUALLY, NOT IMPLEMENTED BELOW TopAbs_FACE
--
-- <buildmode> says how to do on a SOLID,SHELL ... if one of its
-- sub-shapes has been changed:
-- 0: at least one Replace or Remove -> COMPOUND, else as such
-- 1: at least one Remove (Replace are ignored) -> COMPOUND
-- 2: Replace and Remove are both ignored
-- If Replace/Remove are ignored or absent, the result as same
-- type as the starting shape
Apply (me: mutable; shape: Shape from TopoDS; until: ShapeEnum from TopAbs = TopAbs_SHAPE)
returns Shape from TopoDS is redefined;
---Purpose: Applies the substitutions requests to a shape.
--
-- <until> gives the level of type until which requests are taken
-- into account. For subshapes of the type <until> no rebuild
-- and futher exploring are done.
--
-- NOTE: each subshape can be replaced by shape of the same type
-- or by shape containing only shapes of that type (for
-- example, TopoDS_Edge can be replaced by TopoDS_Edge,
-- TopoDS_Wire or TopoDS_Compound containing TopoDS_Edges).
-- If incompatible shape type is encountered, it is ignored
-- and flag FAIL1 is set in Status.
Status (me: mutable; shape: Shape from TopoDS; newsh: out Shape from TopoDS; last : Boolean = Standard_False)
returns Integer is redefined;
---Purpose: Returns a complete substitution status for a shape
-- 0 : not recorded, <newsh> = original <shape>
-- < 0: to be removed, <newsh> is NULL
-- > 0: to be replaced, <newsh> is a new item
-- If <last> is False, returns status and new shape recorded in
-- the map directly for the shape, if True and status > 0 then
-- recursively searches for the last status and new shape.
Status (me; status: Status from ShapeExtend) returns Boolean;
---Purpose: Queries the status of last call to Apply(shape,enum)
-- OK : no (sub)shapes replaced or removed
-- DONE1: source (starting) shape replaced
-- DONE2: source (starting) shape removed
-- DONE3: some subshapes replaced
-- DONE4: some subshapes removed
-- FAIL1: some replacements not done because of bad type of subshape
end ReShape;
|