1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0028427: Data Exchange - Update Reference Manual for STEP format

- Update STEP manual
- Fix code style in several files
This commit is contained in:
ika 2017-01-17 12:18:42 +03:00 committed by bugmaster
parent 20aa0d3fdd
commit 63c71e2f68
13 changed files with 806 additions and 831 deletions

View File

@ -48,7 +48,7 @@ This provides a natural way to deal with non-supported protocols when they share
@subsection occt_step_1_2 STEP Interface @subsection occt_step_1_2 STEP Interface
The STEP interface reads STEP files produced in accordance with STEP Application Protocol 214 (Conformance Class 2 both CD and DIS versions of schema) and translates them to Open CASCADE Technology models. STEP Application Protocol 203 is also supported. The STEP interface reads STEP files produced in accordance with STEP Application Protocol 214 (Conformance Class 2 both CD and DIS versions of schema) and translates them to Open CASCADE Technology models. STEP Application Protocol 203 and some parts of AP242 are also supported.
The STEP interface also translates OCCT models to STEP files. STEP files that are produced by this interface conform to STEP AP 203 or AP 214 (Conformance Class 2, either CD or DIS version of the schema) depending on the user's option. The STEP interface also translates OCCT models to STEP files. STEP files that are produced by this interface conform to STEP AP 203 or AP 214 (Conformance Class 2, either CD or DIS version of the schema) depending on the user's option.
@ -56,7 +56,7 @@ Basic interface reads and writes geometrical, topological STEP data and assembly
The interface is able to translate one entity, a group of entities or a whole file. The interface is able to translate one entity, a group of entities or a whole file.
Other kinds of data such as colors, validation properties, layers, names and the structure of assemblies can be read or written with the help of XDE tools: <i> STEPCAFControl_Reader</i> and <i> STEPCAFControl_Writer</i>. Other kinds of data such as colors, validation properties, layers, GD&T, names and the structure of assemblies can be read or written with the help of XDE tools: <i> STEPCAFControl_Reader</i> and <i> STEPCAFControl_Writer</i>.
To choose a translation mode when exporting to a STEP format, use <i> STEPControl_STEPModelType</i>. To choose a translation mode when exporting to a STEP format, use <i> STEPControl_STEPModelType</i>.
@ -309,12 +309,12 @@ Note that the following parameters have effect only if *read.step.product.mode*
<h4>read.step.product.context:</h4> <h4>read.step.product.context:</h4>
When reading AP 209 STEP files, allows selecting either only design or analysis, or both types of products for translation When reading AP 209 STEP files, allows selecting either only `design' or `analysis', or both types of products for translation
* 1 (all) -- translates all products; * 1 (all) -- translates all products;
* 2 (design) -- translates only products that have *PRODUCT_DEFINITION_CONTEXT* with field *life_cycle_stage* set to design; * 2 (design) -- translates only products that have *PRODUCT_DEFINITION_CONTEXT* with field *life_cycle_stage* set to `design';
* 3 (analysis) -- translates only products associated with *PRODUCT_DEFINITION_CONTEXT* entity whose field *life_cycle_stage* set to analysis. * 3 (analysis) -- translates only products associated with *PRODUCT_DEFINITION_CONTEXT* entity whose field *life_cycle_stage* set to `analysis'.
Note that in AP 203 and AP214 files all products should be marked as design, so if this mode is set to analysis, nothing will be read. Note that in AP 203 and AP214 files all products should be marked as `design', so if this mode is set to `analysis', nothing will be read.
Read this parameter with: Read this parameter with:
~~~~~ ~~~~~
@ -522,12 +522,12 @@ There is a number of predefined operators that can be used. They are:
Cumulative lists can be used as well. Cumulative lists can be used as well.
<h5>Single entities</h5> <h5>Single entities</h5>
You can select an entity either by its rank or by its handle (an entitys handle can be obtained by invoking the *StepData_StepModel::Entity* function). You can select an entity either by its rank or by its handle (an entity's handle can be obtained by invoking the *StepData_StepModel::Entity* function).
<h5>Selection by rank</h5> <h5>Selection by rank</h5>
Use method *StepData_StepModel::NextNumberForLabel* to find its rank with the following: Use method *StepData_StepModel::NextNumberForLabel* to find its rank with the following:
~~~~~ ~~~~~
Standard_CString label = #...; Standard_CString label = `#...';
StepData_StepModel model = reader.StepModel(); StepData_StepModel model = reader.StepModel();
rank = model->NextNumberForLabe(label, 0, Standard_False); rank = model->NextNumberForLabe(label, 0, Standard_False);
~~~~~ ~~~~~
@ -546,7 +546,7 @@ Standard_Boolean ok = reader.TransferEntity (ent);
Tables given in this paragraph show the mapping of STEP entities to OCCT objects. Only topological and geometrical STEP entities and entities defining assembly structures are described in this paragraph. For a full list of STEP entities please refer to Appendix A. Tables given in this paragraph show the mapping of STEP entities to OCCT objects. Only topological and geometrical STEP entities and entities defining assembly structures are described in this paragraph. For a full list of STEP entities please refer to Appendix A.
@subsubsection occt_step_2_4_1 Assembly structure representation entities @subsubsection occt_step_2_4_1 Assembly structure representation entities
Not all entities defining the assembly structure in the STEP file are translated to OCCT shapes, but they are used to identify the relationships between assemblies and their components. Since the graph of natural dependencies of entities based on direct references between them does not include the references from assemblies to their components, these dependencies are introduced in addition to the former ones. This is made basing on the analysis of the following entities describing the structure of the assembly. Not all entities defining the assembly structure in the STEP file are translated to OCCT shapes, but they are used to identify the relationships between assemblies and their components. Since the graph of `natural' dependencies of entities based on direct references between them does not include the references from assemblies to their components, these dependencies are introduced in addition to the former ones. This is made basing on the analysis of the following entities describing the structure of the assembly.
| STEP entity type | CASCADE shape | Comments | | STEP entity type | CASCADE shape | Comments |
| :--------------- | :-------------- | :------ | | :--------------- | :-------------- | :------ |
@ -861,10 +861,11 @@ Default value is 0.
<h4>write.step.schema</h4> <h4>write.step.schema</h4>
defines the version of schema used for the output STEP file: defines the version of schema used for the output STEP file:
* 1 or ;AP214CD; (default): AP214, CD version (dated 26 November 1996), * 1 or *AP214CD* (default): AP214, CD version (dated 26 November 1996),
* 2 or ;AP214DIS;: AP214, DIS version (dated 15 September 1998). * 2 or *AP214DIS*: AP214, DIS version (dated 15 September 1998).
* 3 or ;AP203;: AP203, possibly with modular extensions (depending on data written to a file). * 3 or *AP203*: AP203, possibly with modular extensions (depending on data written to a file).
* 4 or *AP214IS*: AP214, IS version (dated 2002) * 4 or *AP214IS*: AP214, IS version (dated 2002)
* 5 or *AP242DIS*: AP242, DIS version.
Read this parameter with: Read this parameter with:
~~~~~ ~~~~~
@ -879,7 +880,7 @@ Default value is 1 (;CD;).
For the parameter *write.step.schema* to take effect, method *STEPControl_Writer::Model(Standard_True)* should be called after changing this parameter (corresponding command in DRAW is *newmodel*). For the parameter *write.step.schema* to take effect, method *STEPControl_Writer::Model(Standard_True)* should be called after changing this parameter (corresponding command in DRAW is *newmodel*).
<h4>write.step.product.name</h4> <h4>write.step.product.name</h4>
Defines the text string that will be used for field name of PRODUCT entities written to the STEP file. Defines the text string that will be used for field `name' of PRODUCT entities written to the STEP file.
Default value: OCCT STEP translator (current OCCT version number). Default value: OCCT STEP translator (current OCCT version number).
@ -1148,6 +1149,8 @@ The following steps should be taken:
* Repr * Repr
* AP214 * AP214
* AP203 * AP203
* AP242
Each field of a STEP entity should be represented by a corresponding field of this class. The class should have methods for initializing, setting and obtaining fields and it should also have the default constructor. Each field of a STEP entity should be represented by a corresponding field of this class. The class should have methods for initializing, setting and obtaining fields and it should also have the default constructor.
* Create the *RWStepxxx_RWNewEntity* class with a default constructor and methods *ReadStep()*, *WriteStep()* and if the entity references other entities, then method *Share()*. * Create the *RWStepxxx_RWNewEntity* class with a default constructor and methods *ReadStep()*, *WriteStep()* and if the entity references other entities, then method *Share()*.
* Update file *StepAP214_Protocol.cxx*. In the constructor *StepAP214_Protocol::StepAP214_Protocol()* add the new type to the map of registered types and associate the unique integer identifier with this type. * Update file *StepAP214_Protocol.cxx*. In the constructor *StepAP214_Protocol::StepAP214_Protocol()* add the new type to the map of registered types and associate the unique integer identifier with this type.
@ -1387,14 +1390,15 @@ It is necessary to call command *newmodel* to perform a new translation of the n
@section occt_step_7 Reading from and writing to STEP @section occt_step_7 Reading from and writing to STEP
The *STEPCAFControl* package (TKXDESTEP toolkit) provides tools to read and write STEP files (see XDE Users Guide). The *STEPCAFControl* package (TKXDESTEP toolkit) provides tools to read and write STEP files (see XDE User's Guide).
In addition to the translation of shapes implemented in basic translator, it provides the following: In addition to the translation of shapes implemented in basic translator, it provides the following:
* STEP assemblies, read as OCCT compounds by basic translator, are translated to XDE assemblies; * STEP assemblies, read as OCCT compounds by basic translator, are translated to XDE assemblies;
* Names of products are translated and assigned to assembly components and instances in XDE; * Names of products are translated and assigned to assembly components and instances in XDE;
* STEP external references are recognized and translated (if external documents are STEP files); * STEP external references are recognized and translated (if external documents are STEP files);
* Colors, layers, materials and validation properties assigned to parts or subparts are translated; * Colors, layers, materials and validation properties assigned to parts or subparts are translated;
* STEP dimensional tolerances are translated. * STEP Geometric Dimensions and Tolerances are translated;
* STEP Saved Views are translated.
@subsection occt_step_7_1 Reading from STEP @subsection occt_step_7_1 Reading from STEP
@ -1433,7 +1437,115 @@ Standard_Boolean ok = reader.Transfer(doc);
~~~~~ ~~~~~
where *doc* is a variable which contains a handle to the output document and should have a type *Handle(TDocStd_Document)*. where *doc* is a variable which contains a handle to the output document and should have a type *Handle(TDocStd_Document)*.
@subsection occt_step_7_2 Writing to STEP
@subsection occt_step_7_2 Attributes read from STEP
### Colors
Colors are implemented in accordance with <a href="http://www.cax-if.org/documents/rec_prac_styling_org_v15.pdf">Recommended practices for model styling and organization</a> sections 4 and 5.
The following attributes are imported from STEP file:
* colors linked to assemblies, solids, shells, faces/surfaces, wireframes, edges/curves and vertices/points;
* information about invisibility.
The following attributes are mentioned in the Recommended Practices, but not handled by OCCT:
* styling different sides of surfaces with different colors;
* transparency and reflectance for surfaces;
* curve styles;
* point markers.
### Layers
Layers are implemented in accordance with <a href="http://www.cax-if.org/documents/rec_prac_styling_org_v15.pdf">Recommended practices for model styling and organization</a> section 6.
All layers are imported, but invisibility styles are skipped.
### Materials
Materials are implemented in accordance with <a href="http://www.cax-if.org/documents/RecPrac_MaterialDensity_v21.pdf">Recommended practices for material identification and density</a> section 4.
OCCT translator processes materials attached to solids in shape representations. The name, description and density (name and value) are imported for each material.
### Validation properties
Validation properties are implemented in accordance with <a href="http://www.cax-if.org/documents/rec_prac_gvp_v44.pdf">Recommended practices for geometric and assembly validation properties</a> section 4 for AP214.
OCCT processes several types of geometric validation properties for solids, shells and geometric sets:
* area;
* volume;
* centroid.
### Geometric dimensions and tolerances
General types of STEP entities imported by OCCT are listed in the table below:
|STEP entity|OCCT attribute|
| :------------ | :----- |
|Dimensional_Size|XCAFDoc_Dimension|
|Dimensional_Location|XCAFDoc_Dimension|
|Dimensional_Size_With_Path|XCAFDoc_Dimension|
|Dimensional_Location_With_Path|XCAFDoc_Dimension|
|Angular_Size|XCAFDoc_Dimension|
|Angular_Location|XCAFDoc_Dimension|
|Geometric_Tolerance and subtypes|XCAFDoc_GeometricTolerance|
|Datum|XCAFDoc_Datum|
|Datum_Feature|XCAFDoc_Datum|
|Datum_Target|XCAFDoc_Datum|
Processing of GD&T is realized in accordance with <a href="http://www.cax-if.org/documents/rec_pracs_pmi_v40.pdf">Recommended practices for the Representation and Presentation of Product Manufacturing</a> for AP242.
The general restriction is that OCCT STEP Reader imports GD&T assigned only to shapes (faces, edges, vertices, etc) or to shape groups from general shape model i.e. any constructive geometries are not translated as referenced shapes.
#### Dimensions
Dimensions are implemented according to section 5 of the latter document.
Additionally to the reference shapes, the Reader imports from STEP file some auxiliary geometry for dimensional line building: connection points and line orientation, if exist.
The following values and modifiers described in sections 5.2 and 5.3 can be imported from STEP file:
- qualifiers (minimum, maximum and average);
- plus/minus bounds;
- value range;
- class of tolerance;
- text notes, attached to dimension value;
- dimension modifiers type 2 (Table 8);
- number of decimal places.
#### Datums
Datums are implemented in accordance with sections 6.5 and 6.6.1-6.6.2.
Each datum can have one or several datum features (shapes from the model, to which the datum is linked) and datum targets (auxiliary geometry: point, line, rectangle, circle or area).
#### Tolerances
Tolerances are implemented in accordance with sections 6.7-6.9 with several restrictions.
Types of imported tolerances:
- simple tolerances (see Table 10);
- tolerance with modifiers (section 6.9.3);
- tolerance with maximum value (section 6.9.5);
- tolerance with datums (section 6.9.7 (simple datums and datum with modifiers) and 6.9.8 (common datums));
- superposition of the mentioned types.
Not all tolerance zones can be imported by OCCT STEP Reader, only the Tolerance Zones with associated symbols from *Table 11, Projected tolerance zone* (section 6.9.2.2) and *Runout zone* definition.
#### Presentations
Each semantic representation of GD&T (Dimension, Tolerance, Datum Feature or Datum Target) can have a presentation; its processing by OCCT is implemented in accordance with sections 7.3, 8 and 9.1-9.2.
Presentations have several types:
- *Graphic Presentation* (polylines or tessellated wireframes) - partially implemented in OCCT;
- *Minimal Presentation* (position and orientation) - implemented in OCCT as a part of Graphic presentation;
- *Character-based Presentation* (3D Text with information about fonts, curve styles etc.) - not handled by OCCT.
Note, that separate Minimal presentation and Character-based Presentation are not described in any Recommended Practices, so there is no agreement about how such information should be saved in STEP file.
OCCT STEP Reader imports only Annotation Planes, outline/stroked Polylines and Tessellated wireframes, i.e. all styling information (color, curve style, etc.) and filled characters are missed.
OCCT STEP Reader also handles Annotations, linked directly to shapes (section 9.3.1), processing of these presentations is subject to the same restrictions as the processing of presentations, linked to GD&T semantic.
#### Geometric dimensions and tolerances AP214
Simple types of GD&T (Dimensions, Tolerances and Datums without presentations or any types of modifiers) are also handled in AP214. However, according to the Recommended Practices for the Representation and Presentation of Product Manufacturing, this implementation is obsolete.
### Saved views
Saved views are implemented in accordance with <a href="http://www.cax-if.org/documents/rec_pracs_pmi_v40.pdf">Recommended practices for the Representation and Presentation of Product Manufacturing</a> section 9.4.1-9.4.4.
For each Saved View OCCT STEP Reader will retrieve the following attributes:
- set of displayed shape representations;
- set of displayed PMI presentations;
- projection point;
- view direction;
- up direction of view window;
- horizontal size of view window;
- vertical size of view window;
- zoom factor;
- clipping planes (single plane of combination of planes);
- front and back plane clipping.
@subsection occt_step_7_3 Writing to STEP
The translation from XDE to STEP can be initialized as follows: The translation from XDE to STEP can be initialized as follows:
~~~~~ ~~~~~
@ -1474,5 +1586,40 @@ IFSelect_ReturnStatus statw = writer.WriteFile (S);
~~~~~ ~~~~~
where *S* is *OStream*. where *S* is *OStream*.
@subsection occt_step_7_4 Attributes written to STEP
### Colors
The following attributes are exported to STEP file:
* colors linked to assemblies, solids, shells, faces/surfaces, wireframes, edges/curves;
* information about visibility.
Restrictions:
* colors and visibility information for points is not exported by default, it is necessary to use *write.step.vertex.mode* parameter;
* all colors are always applied to both sides of surfaces;
* all curves are exported with 'continuous' curve style.
### Layers
All layers are exported, but invisibility styles can be connected only to shapes.
### Materials
For solids with materials, the material is exported to STEP file (name, description and density (name and value)).
### Validation properties
Geometric validation properties, such as volume, area and centroid, which are attached to shape, are exported to STEP file.
### Geometric dimensions and tolerances
All entities, which can be imported from STEP, can be exported too.
Please see the same item in section @ref occt_step_7_1 "Reading from STEP" to find more information.
Note: OCCT use AP214 by default, so for GD&T exporting AP242 should be set manually:
~~~~~
Interface_Static::SetCVal("write.step.schema", "AP242DIS"));
~~~~~
or
~~~~~
Interface_Static::SetIVal("write.step.schema", 5));
~~~~~
### Saved views
Saved Views are not exported by OCCT.

View File

@ -253,8 +253,6 @@ Standard_Boolean STEPControl_ActorRead::Recognize
} }
if (start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) { if (start->IsKind(STANDARD_TYPE(StepShape_ContextDependentShapeRepresentation))) {
// DeclareAndCast(StepShape_ContextDependentShapeRepresentation,CDSR,start);
// return Recognize (CDSR->RepresentationRelation());
return Standard_True; return Standard_True;
// on fait le pari que, si ce n est pas transferable tel quel, // on fait le pari que, si ce n est pas transferable tel quel,
// des CDSR implicitement references le sont ... // des CDSR implicitement references le sont ...
@ -670,7 +668,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
Handle(StepRepr_ProductDefinitionShape) PDS = Handle(StepRepr_ProductDefinitionShape) PDS =
Handle(StepRepr_ProductDefinitionShape)::DownCast(subs1.Value()); Handle(StepRepr_ProductDefinitionShape)::DownCast(subs1.Value());
if(PDS.IsNull()) continue; if(PDS.IsNull()) continue;
//IsPDS=Standard_True;
Interface_EntityIterator subs2 = graph.Sharings(PDS); Interface_EntityIterator subs2 = graph.Sharings(PDS);
for (subs2.Start(); subs2.More(); subs2.Next()) { for (subs2.Start(); subs2.More(); subs2.Next()) {
Handle(StepShape_ContextDependentShapeRepresentation) CDSR = Handle(StepShape_ContextDependentShapeRepresentation) CDSR =
@ -689,7 +686,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
DeclareAndCast(StepShape_ShapeDefinitionRepresentation,SDR,subs3.Value()); DeclareAndCast(StepShape_ShapeDefinitionRepresentation,SDR,subs3.Value());
Handle(StepRepr_ProductDefinitionShape) PDS1 = Handle(StepRepr_ProductDefinitionShape) PDS1 =
Handle(StepRepr_ProductDefinitionShape)::DownCast(SDR->Definition().PropertyDefinition()); Handle(StepRepr_ProductDefinitionShape)::DownCast(SDR->Definition().PropertyDefinition());
//Handle(StepRepr_PropertyDefinition) PD = SDR->Definition().PropertyDefinition();
if(PDS1.IsNull()) continue; if(PDS1.IsNull()) continue;
Interface_EntityIterator subs4 = graph.Shareds(PDS1); Interface_EntityIterator subs4 = graph.Shareds(PDS1);
for (subs4.Start(); subs4.More(); subs4.Next()) { for (subs4.Start(); subs4.More(); subs4.Next()) {
@ -871,10 +867,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
if ( !myNMTool.IsPureNMShell(aCurrentShell) && !shellClosingsMap.Contains(aCurrentShell) ) if ( !myNMTool.IsPureNMShell(aCurrentShell) && !shellClosingsMap.Contains(aCurrentShell) )
brepBuilder.Add(compWithClosings, aCurrentShell); brepBuilder.Add(compWithClosings, aCurrentShell);
} }
comp = compWithClosings;
comp = compWithClosings;
} }
// [END] Try to close OPEN Shells in I-DEAS case (ssv; 17.11.2010) // [END] Try to close OPEN Shells in I-DEAS case (ssv; 17.11.2010)
@ -925,7 +918,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
Handle(TransferBRep_ShapeBinder) shbinder; Handle(TransferBRep_ShapeBinder) shbinder;
//:j2: treat SRRs here in order to compare them with NAUO //:j2: treat SRRs here in order to compare them with NAUO
Handle(StepRepr_ShapeRepresentationRelationship) SRR = CDSR->RepresentationRelation(); Handle(StepRepr_ShapeRepresentationRelationship) SRR = CDSR->RepresentationRelation();
//DeclareAndCast(StepRepr_RepresentationRelationship,SRR,CDSR->RepresentationRelation());
if ( SRR.IsNull() ) return shbinder; if ( SRR.IsNull() ) return shbinder;
Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( TP->Graph(), CDSR ); Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( TP->Graph(), CDSR );
@ -939,34 +931,12 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
gp_Trsf Trsf; gp_Trsf Trsf;
Standard_Boolean iatrsf = ComputeSRRWT ( SRR, TP, Trsf ); Standard_Boolean iatrsf = ComputeSRRWT ( SRR, TP, Trsf );
/* Delete this part does not work gka
// use SDR for reading rep in order to handle subassemblies
Interface_EntityIterator subs = TP->Graph().Sharings(rep);
Standard_Integer nbitem=0;
for (subs.Start(); subs.More(); subs.Next()) nbitem++;
Message_ProgressSentry PS ( TP->GetProgress(), "Shape", 0, nbitem, 1 );
for (subs.Start(); subs.More() && PS.More() ; subs.Next(),PS.Next()) {
if ( subs.Value()->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) {
DeclareAndCast(StepShape_ShapeDefinitionRepresentation,SDR,subs.Value());
#ifdef TRANSLOG
if (TP->TraceLevel() > 1)
sout<<" -- Actor : Ent.n0 "<<TP->Model()->Number(CDSR)<<" -> Sharing Ent.no"<<TP->Model()->Number(SDR)<<endl;
#endif
binder = TP->Find ( SDR );
if ( binder.IsNull() ) binder = TransferEntity(SDR,TP);
theResult = TransferBRep::ShapeResult (binder);
break;
}
}*/
//if ( theResult.IsNull() && ! subs.More() ) {
Handle(Transfer_Binder) binder; Handle(Transfer_Binder) binder;
Standard_Boolean isBound = Standard_False; Standard_Boolean isBound = Standard_False;
if (!TP->IsBound(rep)) binder = TransferEntity(rep,TP,isBound); if (!TP->IsBound(rep)) binder = TransferEntity(rep,TP,isBound);
else binder = TP->Find(rep); else binder = TP->Find(rep);
theResult = TransferBRep::ShapeResult (binder); theResult = TransferBRep::ShapeResult (binder);
//}
if ( ! theResult.IsNull() ) { if ( ! theResult.IsNull() ) {
if ( iatrsf ) { if ( iatrsf ) {
@ -1017,7 +987,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
Handle(StepShape_ShapeRepresentation) anitem = Handle(StepShape_ShapeRepresentation)::DownCast(anitemt); Handle(StepShape_ShapeRepresentation) anitem = Handle(StepShape_ShapeRepresentation)::DownCast(anitemt);
Handle(Transfer_Binder) binder; Handle(Transfer_Binder) binder;
Standard_Boolean isBound = Standard_False; Standard_Boolean isBound = Standard_False;
if (!TP->IsBound(anitem)) binder = TransferEntity(anitem,TP,isBound);//TP->Transferring(anitem); if (!TP->IsBound(anitem)) binder = TransferEntity(anitem,TP,isBound);
else binder = TP->Find(anitem); else binder = TP->Find(anitem);
TopoDS_Shape theResult = TransferBRep::ShapeResult (binder); TopoDS_Shape theResult = TransferBRep::ShapeResult (binder);
if (!theResult.IsNull()) { if (!theResult.IsNull()) {
@ -1043,10 +1013,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
} }
//=======================================================================
//function : OldWay
//purpose :
//=======================================================================
//======================================================================= //=======================================================================
//function : IsNeedRepresentation //function : IsNeedRepresentation
//purpose : //purpose :
@ -1308,7 +1274,6 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
// La Shape, et la mise en position // La Shape, et la mise en position
Handle(StepShape_ShapeRepresentation) maprep = Handle(StepShape_ShapeRepresentation):: Handle(StepShape_ShapeRepresentation) maprep = Handle(StepShape_ShapeRepresentation)::
DownCast(mapit->MappingSource()->MappedRepresentation()); DownCast(mapit->MappingSource()->MappedRepresentation());
//Handle(StepRepr_Representation) maprep = mapit->MappingSource()->MappedRepresentation();
Standard_Boolean isBound = Standard_False; Standard_Boolean isBound = Standard_False;
Handle(Transfer_Binder) binder = TP->Find(maprep); Handle(Transfer_Binder) binder = TP->Find(maprep);
if (binder.IsNull()) binder = TransferEntity(maprep,TP,isBound); if (binder.IsNull()) binder = TransferEntity(maprep,TP,isBound);
@ -1367,51 +1332,51 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
try { try {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
StepToTopoDS_Tool myTool; StepToTopoDS_Tool myTool;
StepToTopoDS_DataMapOfTRI aMap; StepToTopoDS_DataMapOfTRI aMap;
myTool.Init(aMap, TP);
StepToTopoDS_TranslateFace myTF;
myTF.SetPrecision(myPrecision);
myTF.SetMaxTol(myMaxTol);
// Non-manifold topology is not processed here (ssv; 15.11.2010)
StepToTopoDS_NMTool dummyNMTool;
myTF.Init (fs, myTool, dummyNMTool);
Handle(StepRepr_Representation) oldSRContext = mySRContext;
if ( mySRContext.IsNull() ) { // if no context, try to find it (ex: r0701_ug.stp #4790)
Handle(StepRepr_Representation) context = FindContext ( fs, TP );
if ( context.IsNull() ) {
TP->AddWarning ( fs, "Entity with no unit context; default units taken" );
ResetUnits();
}
else PrepareUnits ( context, TP );
}
// Apply ShapeFix
Handle(Transfer_Binder) binder = TP->Find (fs);
sb = Handle(TransferBRep_ShapeBinder)::DownCast ( binder );
if ( ! sb.IsNull() && ! sb->Result().IsNull() ) {
TopoDS_Shape S = sb->Result();
Handle(Standard_Transient) info;
TopoDS_Shape shape = XSAlgo::AlgoContainer()->ProcessShape( S, myPrecision, myMaxTol,
"read.step.resource.name",
"read.step.sequence", info,
TP->GetProgress() );
// TopoDS_Shape shape = XSAlgo::AlgoContainer()->PerformFixShape( S, TP, myPrecision, myMaxTol );
if ( shape != S )
sb->SetResult ( shape );
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
}
myTool.Init(aMap, TP);
if ( oldSRContext.IsNull() && ! mySRContext.IsNull() ) //:S4136 StepToTopoDS_TranslateFace myTF;
PrepareUnits ( oldSRContext, TP ); myTF.SetPrecision(myPrecision);
TP->Bind(fs, sb); myTF.SetMaxTol(myMaxTol);
return sb; // TP->Find (start);
} // Non-manifold topology is not processed here (ssv; 15.11.2010)
StepToTopoDS_NMTool dummyNMTool;
myTF.Init(fs, myTool, dummyNMTool);
Handle(StepRepr_Representation) oldSRContext = mySRContext;
if (mySRContext.IsNull()) { // if no context, try to find it (ex: r0701_ug.stp #4790)
Handle(StepRepr_Representation) context = FindContext(fs, TP);
if (context.IsNull()) {
TP->AddWarning(fs, "Entity with no unit context; default units taken");
ResetUnits();
}
else PrepareUnits(context, TP);
}
// Apply ShapeFix
Handle(Transfer_Binder) binder = TP->Find(fs);
sb = Handle(TransferBRep_ShapeBinder)::DownCast(binder);
if (!sb.IsNull() && !sb->Result().IsNull()) {
TopoDS_Shape S = sb->Result();
Handle(Standard_Transient) info;
TopoDS_Shape shape = XSAlgo::AlgoContainer()->ProcessShape(S, myPrecision, myMaxTol,
"read.step.resource.name",
"read.step.sequence", info,
TP->GetProgress());
// TopoDS_Shape shape = XSAlgo::AlgoContainer()->PerformFixShape( S, TP, myPrecision, myMaxTol );
if (shape != S)
sb->SetResult(shape);
XSAlgo::AlgoContainer()->MergeTransferInfo(TP, info, nbTPitems);
}
if (oldSRContext.IsNull() && !mySRContext.IsNull()) //:S4136
PrepareUnits(oldSRContext, TP);
TP->Bind(fs, sb);
return sb; // TP->Find (start);
}
catch(Standard_Failure) catch(Standard_Failure)
{ {
TP->AddFail(fs,"Exeption is raised. Entity was not translated."); TP->AddFail(fs,"Exeption is raised. Entity was not translated.");
@ -1432,12 +1397,9 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(const Handle(Standa
if (start.IsNull()) return NullResult(); if (start.IsNull()) return NullResult();
XSAlgo::AlgoContainer()->PrepareForTransfer(); XSAlgo::AlgoContainer()->PrepareForTransfer();
// myContext.SetModel ( Handle(StepData_StepModel)::DownCast ( TP->Model() ) ); // for asking IsAP203?
Handle(Message_Messenger) sout = TP->Messenger(); Handle(Message_Messenger) sout = TP->Messenger();
#ifdef TRANSLOG #ifdef TRANSLOG
// POUR MISE AU POINT, a supprimer ensuite // POUR MISE AU POINT, a supprimer ensuite
// sout<<"STEP->Shape, ent n0 "<<TP->Model()->Number(start)<<" Level="<<TP->NestingLevel()<<endl;
if (TP->TraceLevel() > 1) if (TP->TraceLevel() > 1)
sout<<" -- Actor : Transfer Ent.n0 "<<TP->Model()->Number(start)<<" Type "<<start->DynamicType()->Name()<<endl; sout<<" -- Actor : Transfer Ent.n0 "<<TP->Model()->Number(start)<<" Type "<<start->DynamicType()->Name()<<endl;
#endif #endif
@ -1454,17 +1416,17 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(const Handle(Standa
shbinder = OldWay(start,TP); shbinder = OldWay(start,TP);
//skl //skl
else if(start->IsKind(STANDARD_TYPE(StepBasic_ProductDefinition))) { else if (start->IsKind(STANDARD_TYPE(StepBasic_ProductDefinition))) {
Handle(StepBasic_ProductDefinition) PD = Handle(StepBasic_ProductDefinition) PD =
Handle(StepBasic_ProductDefinition)::DownCast(start); Handle(StepBasic_ProductDefinition)::DownCast(start);
shbinder = TransferEntity(PD,TP); shbinder = TransferEntity(PD, TP);
} }
// NextAssemblyUsageOccurrence // NextAssemblyUsageOccurrence
else if (start->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))) { else if (start->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))) {
Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO = Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO =
Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(start); Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(start);
shbinder = TransferEntity(NAUO,TP); shbinder = TransferEntity(NAUO, TP);
} }
//end skl //end skl
@ -1522,9 +1484,7 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
mySRContext = rep; mySRContext = rep;
Standard_Integer stat1, stat2 = 0; // sera alimente par STEPControl_Unit Standard_Integer stat1, stat2 = 0; // sera alimente par STEPControl_Unit
// DeclareAndCast(StepShape_ShapeRepresentation,sr,start);
if (rep.IsNull()) { if (rep.IsNull()) {
// TP->AddWarning(sr,"Not a ShapeRepresentation, default unit taken");
ResetUnits(); ResetUnits();
return; return;
} }
@ -1549,7 +1509,6 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
if (theRepCont->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext))) { if (theRepCont->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext))) {
DeclareAndCast(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext, theGRCAGAUC,theRepCont); DeclareAndCast(StepGeom_GeometricRepresentationContextAndGlobalUnitAssignedContext, theGRCAGAUC,theRepCont);
theGUAC = theGRCAGAUC->GlobalUnitAssignedContext(); theGUAC = theGRCAGAUC->GlobalUnitAssignedContext();
// TP->AddWarning(theRepCont,"No Length Uncertainty, last defined one is taken");
} }
// ---------------------------------------------------- // ----------------------------------------------------
@ -1597,7 +1556,6 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
} }
myMaxTol = Max ( myPrecision, Interface_Static::RVal("read.maxprecision.val") ); myMaxTol = Max ( myPrecision, Interface_Static::RVal("read.maxprecision.val") );
// Assign uncertainty // Assign uncertainty
// Interface_Static::SetRVal("lastpreci",UpdatedValue);
#ifdef TRANSLOG #ifdef TRANSLOG
if (TP->TraceLevel() > 1) if (TP->TraceLevel() > 1)
TP->Messenger() <<" Cc1ToTopoDS : Length Unit = "<<myUnit.LengthFactor()<<" Tolerance CASCADE = "<<myPrecision<<endl; TP->Messenger() <<" Cc1ToTopoDS : Length Unit = "<<myUnit.LengthFactor()<<" Tolerance CASCADE = "<<myPrecision<<endl;
@ -1809,5 +1767,4 @@ void STEPControl_ActorRead::computeIDEASClosings(const TopoDS_Compound& comp,
if ( !closingShells.IsEmpty() ) if ( !closingShells.IsEmpty() )
shellClosingsMap.Add(shellA, closingShells); shellClosingsMap.Add(shellA, closingShells);
} }
} }

View File

@ -21,133 +21,133 @@
Handle(TCollection_HAsciiString) StepToTopoDS::DecodeBuilderError(const StepToTopoDS_BuilderError Error) Handle(TCollection_HAsciiString) StepToTopoDS::DecodeBuilderError(const StepToTopoDS_BuilderError Error)
{ {
Handle(TCollection_HAsciiString) mess; Handle(TCollection_HAsciiString) mess;
switch(Error) switch (Error)
{ {
case StepToTopoDS_BuilderDone: case StepToTopoDS_BuilderDone:
{ {
mess = new TCollection_HAsciiString("Builder Done"); mess = new TCollection_HAsciiString("Builder Done");
break; break;
}
case StepToTopoDS_BuilderOther:
{
mess = new TCollection_HAsciiString("Builder Other");
break;
}
} }
case StepToTopoDS_BuilderOther:
{
mess = new TCollection_HAsciiString("Builder Other");
break;
}
}
return mess; return mess;
} }
Handle(TCollection_HAsciiString) StepToTopoDS::DecodeShellError(const StepToTopoDS_TranslateShellError Error) Handle(TCollection_HAsciiString) StepToTopoDS::DecodeShellError(const StepToTopoDS_TranslateShellError Error)
{ {
Handle(TCollection_HAsciiString) mess; Handle(TCollection_HAsciiString) mess;
switch(Error) switch (Error)
{ {
case StepToTopoDS_TranslateShellDone: case StepToTopoDS_TranslateShellDone:
{ {
mess = new TCollection_HAsciiString("Translate Shell Done"); mess = new TCollection_HAsciiString("Translate Shell Done");
break; break;
}
case StepToTopoDS_TranslateShellOther:
{
mess = new TCollection_HAsciiString("Translate Shell Other");
break;
}
} }
case StepToTopoDS_TranslateShellOther:
{
mess = new TCollection_HAsciiString("Translate Shell Other");
break;
}
}
return mess; return mess;
} }
Handle(TCollection_HAsciiString) StepToTopoDS::DecodeFaceError(const StepToTopoDS_TranslateFaceError Error) Handle(TCollection_HAsciiString) StepToTopoDS::DecodeFaceError(const StepToTopoDS_TranslateFaceError Error)
{ {
Handle(TCollection_HAsciiString) mess; Handle(TCollection_HAsciiString) mess;
switch(Error) switch (Error)
{ {
case StepToTopoDS_TranslateFaceDone: case StepToTopoDS_TranslateFaceDone:
{ {
mess = new TCollection_HAsciiString("Translate Face Done"); mess = new TCollection_HAsciiString("Translate Face Done");
break; break;
}
case StepToTopoDS_TranslateFaceOther:
{
mess = new TCollection_HAsciiString("Translate Face Other");
break;
}
} }
case StepToTopoDS_TranslateFaceOther:
{
mess = new TCollection_HAsciiString("Translate Face Other");
break;
}
}
return mess; return mess;
} }
Handle(TCollection_HAsciiString) StepToTopoDS::DecodeEdgeError(const StepToTopoDS_TranslateEdgeError Error) Handle(TCollection_HAsciiString) StepToTopoDS::DecodeEdgeError(const StepToTopoDS_TranslateEdgeError Error)
{ {
Handle(TCollection_HAsciiString) mess; Handle(TCollection_HAsciiString) mess;
switch(Error) switch (Error)
{ {
case StepToTopoDS_TranslateEdgeDone: case StepToTopoDS_TranslateEdgeDone:
{ {
mess = new TCollection_HAsciiString("Translate Edge Done"); mess = new TCollection_HAsciiString("Translate Edge Done");
break; break;
}
case StepToTopoDS_TranslateEdgeOther:
{
mess = new TCollection_HAsciiString("Translate Edge Other");
break;
}
} }
case StepToTopoDS_TranslateEdgeOther:
{
mess = new TCollection_HAsciiString("Translate Edge Other");
break;
}
}
return mess; return mess;
} }
Handle(TCollection_HAsciiString) StepToTopoDS::DecodeVertexError(const StepToTopoDS_TranslateVertexError Error) Handle(TCollection_HAsciiString) StepToTopoDS::DecodeVertexError(const StepToTopoDS_TranslateVertexError Error)
{ {
Handle(TCollection_HAsciiString) mess; Handle(TCollection_HAsciiString) mess;
switch(Error) switch (Error)
{ {
case StepToTopoDS_TranslateVertexDone: case StepToTopoDS_TranslateVertexDone:
{ {
mess = new TCollection_HAsciiString("Translate Vertex Done"); mess = new TCollection_HAsciiString("Translate Vertex Done");
break; break;
}
case StepToTopoDS_TranslateVertexOther:
{
mess = new TCollection_HAsciiString("Translate Vertex Other");
break;
}
} }
case StepToTopoDS_TranslateVertexOther:
{
mess = new TCollection_HAsciiString("Translate Vertex Other");
break;
}
}
return mess; return mess;
} }
Handle(TCollection_HAsciiString) StepToTopoDS::DecodeVertexLoopError(const StepToTopoDS_TranslateVertexLoopError Error) Handle(TCollection_HAsciiString) StepToTopoDS::DecodeVertexLoopError(const StepToTopoDS_TranslateVertexLoopError Error)
{ {
Handle(TCollection_HAsciiString) mess; Handle(TCollection_HAsciiString) mess;
switch(Error) switch (Error)
{ {
case StepToTopoDS_TranslateVertexLoopDone: case StepToTopoDS_TranslateVertexLoopDone:
{ {
mess = new TCollection_HAsciiString("Translate VertexLoop Done"); mess = new TCollection_HAsciiString("Translate VertexLoop Done");
break; break;
}
case StepToTopoDS_TranslateVertexLoopOther:
{
mess = new TCollection_HAsciiString("Translate VertexLoop Other");
break;
}
} }
case StepToTopoDS_TranslateVertexLoopOther:
{
mess = new TCollection_HAsciiString("Translate VertexLoop Other");
break;
}
}
return mess; return mess;
} }
Handle(TCollection_HAsciiString) StepToTopoDS::DecodePolyLoopError(const StepToTopoDS_TranslatePolyLoopError Error) Handle(TCollection_HAsciiString) StepToTopoDS::DecodePolyLoopError(const StepToTopoDS_TranslatePolyLoopError Error)
{ {
Handle(TCollection_HAsciiString) mess; Handle(TCollection_HAsciiString) mess;
switch(Error) switch (Error)
{ {
case StepToTopoDS_TranslatePolyLoopDone: case StepToTopoDS_TranslatePolyLoopDone:
{ {
mess = new TCollection_HAsciiString("Translate PolyLoop Done"); mess = new TCollection_HAsciiString("Translate PolyLoop Done");
break; break;
}
case StepToTopoDS_TranslatePolyLoopOther:
{
mess = new TCollection_HAsciiString("Translate PolyLoop Other");
break;
}
} }
case StepToTopoDS_TranslatePolyLoopOther:
{
mess = new TCollection_HAsciiString("Translate PolyLoop Other");
break;
}
}
return mess; return mess;
} }
@ -155,39 +155,39 @@ Handle(TCollection_HAsciiString) StepToTopoDS::DecodePolyLoopError(const StepToT
Standard_CString StepToTopoDS::DecodeGeometricToolError(const StepToTopoDS_GeometricToolError Error) Standard_CString StepToTopoDS::DecodeGeometricToolError(const StepToTopoDS_GeometricToolError Error)
{ {
Standard_CString mess=""; Standard_CString mess="";
switch(Error) switch (Error)
{ {
case StepToTopoDS_GeometricToolDone: case StepToTopoDS_GeometricToolDone:
{ {
mess = Standard_CString(" Geometric Tool is done"); mess = Standard_CString(" Geometric Tool is done");
break; break;
}
case StepToTopoDS_GeometricToolIsDegenerated:
{
mess = Standard_CString(" an Edge is degenerated");
break;
}
case StepToTopoDS_GeometricToolHasNoPCurve:
{
mess = Standard_CString(" SurfaceCurve does not contain a PCurve lying on the BasisSurface");
break;
}
case StepToTopoDS_GeometricToolWrong3dParameters:
{
mess = Standard_CString(" the update of 3D-Parameters failed");
break;
}
case StepToTopoDS_GeometricToolNoProjectiOnCurve:
{
mess = Standard_CString(" the projection of a VertexPoint on the curve3d failed");
break;
}
case StepToTopoDS_GeometricToolOther:
{
mess = Standard_CString(" GeometricTool failed");
break;
}
} }
case StepToTopoDS_GeometricToolIsDegenerated:
{
mess = Standard_CString(" an Edge is degenerated");
break;
}
case StepToTopoDS_GeometricToolHasNoPCurve:
{
mess = Standard_CString(" SurfaceCurve does not contain a PCurve lying on the BasisSurface");
break;
}
case StepToTopoDS_GeometricToolWrong3dParameters:
{
mess = Standard_CString(" the update of 3D-Parameters failed");
break;
}
case StepToTopoDS_GeometricToolNoProjectiOnCurve:
{
mess = Standard_CString(" the projection of a VertexPoint on the curve3d failed");
break;
}
case StepToTopoDS_GeometricToolOther:
{
mess = Standard_CString(" GeometricTool failed");
break;
}
}
return mess; return mess;
} }

View File

@ -89,8 +89,6 @@
#include <TransferBRep.hxx> #include <TransferBRep.hxx>
#include <stdio.h> #include <stdio.h>
//#include <StepShape_VertexShell.hxx>
//:e0
static void ResetPreci (const TopoDS_Shape& S, Standard_Real maxtol) static void ResetPreci (const TopoDS_Shape& S, Standard_Real maxtol)
{ {
//:S4136 //:S4136
@ -99,12 +97,6 @@ static void ResetPreci (const TopoDS_Shape& S, Standard_Real maxtol)
ShapeFix_ShapeTolerance STU; ShapeFix_ShapeTolerance STU;
STU.LimitTolerance (S,Precision::Confusion(),maxtol); STU.LimitTolerance (S,Precision::Confusion(),maxtol);
} }
// Standard_Real ratio = Interface_Static::RVal("XSTEP.readprecision.ratio");
// if (ratio >= 1) {
// Standard_Real lastpre = Interface_Static::RVal("lastpreci");
// ShapeFix_ShapeTolerance STU;
// STU.LimitTolerance (S,lastpre/ratio,lastpre*ratio);
// }
} }
// ============================================================================ // ============================================================================
@ -440,10 +432,10 @@ void StepToTopoDS_Builder::Init
aCShell = aFBABWV->VoidsValue(i); aCShell = aFBABWV->VoidsValue(i);
myTranShell.Init(aCShell, myTool, dummyNMTool); myTranShell.Init(aCShell, myTool, dummyNMTool);
if (myTranShell.IsDone()) { if (myTranShell.IsDone()) {
Sh = myTranShell.Value(); Sh = myTranShell.Value();
Sh.Closed(Standard_True); Sh.Closed(Standard_True);
//BRepLib::SameParameter(Sh); //BRepLib::SameParameter(Sh);
B.Add(S,Sh); B.Add(S, Sh);
} }
else { else {
TP->AddWarning TP->AddWarning
@ -498,48 +490,32 @@ void StepToTopoDS_Builder::Init
myTranShell.SetMaxTol(MaxTol()); myTranShell.SetMaxTol(MaxTol());
Message_ProgressSentry PS ( TP->GetProgress(), "Shell", 0, Nb, 1 ); Message_ProgressSentry PS ( TP->GetProgress(), "Shell", 0, Nb, 1 );
for (Standard_Integer i=1; i<=Nb && PS.More(); i++, PS.Next()) { for (Standard_Integer i = 1; i <= Nb && PS.More(); i++, PS.Next()) {
//for (Standard_Integer i=1; i<=Nb; i++) {
aShell = aSBSM->SbsmBoundaryValue(i); aShell = aSBSM->SbsmBoundaryValue(i);
//aVertexShell = aShell.VertexShell(); aOpenShell = aShell.OpenShell();
aOpenShell = aShell.OpenShell();
aClosedShell = aShell.ClosedShell(); aClosedShell = aShell.ClosedShell();
//if (!aVertexShell.IsNull()) {
//TP->AddWarning
//(aVertexShell,
//" VertexShell from ShellBasedSurfaceModel not mapped to TopoDS");
//}
//else
if (!aOpenShell.IsNull()) { if (!aOpenShell.IsNull()) {
myTranShell.Init(aOpenShell, myTool, NMTool); myTranShell.Init(aOpenShell, myTool, NMTool);
if (myTranShell.IsDone()) { if (myTranShell.IsDone()) {
//Sh = myTranShell.Value(); Shl = TopoDS::Shell(myTranShell.Value());
//Sh.Closed(Standard_False); Shl.Closed(Standard_False);
//BRepLib::SameParameter(Sh); B.Add(S, Shl);
//B.Add(S,Sh);
Shl = TopoDS::Shell(myTranShell.Value());
Shl.Closed(Standard_False);
B.Add(S,Shl);
} }
else { else {
TP->AddWarning TP->AddWarning
(aOpenShell," OpenShell from ShellBasedSurfaceModel not mapped to TopoDS"); (aOpenShell, " OpenShell from ShellBasedSurfaceModel not mapped to TopoDS");
} }
} }
else if (!aClosedShell.IsNull()) { else if (!aClosedShell.IsNull()) {
myTranShell.Init(aClosedShell, myTool, NMTool); myTranShell.Init(aClosedShell, myTool, NMTool);
if (myTranShell.IsDone()) { if (myTranShell.IsDone()) {
//Sh = myTranShell.Value(); Shl = TopoDS::Shell(myTranShell.Value());
//Sh.Closed(Standard_True); Shl.Closed(Standard_True);
//BRepLib::SameParameter(Sh); B.Add(S, Shl);
//B.Add(S,Sh);
Shl = TopoDS::Shell(myTranShell.Value());
Shl.Closed(Standard_True);
B.Add(S,Shl);
} }
else { else {
TP->AddWarning TP->AddWarning
(aClosedShell," ClosedShell from ShellBasedSurfaceModel not mapped to TopoDS"); (aClosedShell, " ClosedShell from ShellBasedSurfaceModel not mapped to TopoDS");
} }
} }
} }
@ -735,13 +711,6 @@ void StepToTopoDS_Builder::Init
const Handle(Transfer_ActorOfTransientProcess)& RA, const Handle(Transfer_ActorOfTransientProcess)& RA,
const Standard_Boolean isManifold) const Standard_Boolean isManifold)
{ {
// Initialisation of the Tool
// StepToTopoDS_Tool myTool;
// StepToTopoDS_DataMapOfTRI aMap;
// myTool.Init(aMap, TP);
// Start Mapping // Start Mapping
TopoDS_Compound S; TopoDS_Compound S;
BRep_Builder B; BRep_Builder B;
@ -773,42 +742,42 @@ void StepToTopoDS_Builder::Init
// try composite_curve // try composite_curve
Handle(StepGeom_CompositeCurve) CC = Handle(StepGeom_CompositeCurve)::DownCast(aCrv); Handle(StepGeom_CompositeCurve) CC = Handle(StepGeom_CompositeCurve)::DownCast(aCrv);
if ( ! CC.IsNull() ) { if (!CC.IsNull()) {
StepToTopoDS_TranslateCompositeCurve TrCC; StepToTopoDS_TranslateCompositeCurve TrCC;
TrCC.SetPrecision(preci); TrCC.SetPrecision(preci);
TrCC.SetMaxTol(maxtol); TrCC.SetMaxTol(maxtol);
TrCC.Init( CC, TP ); TrCC.Init(CC, TP);
if ( TrCC.IsDone() ) if (TrCC.IsDone())
{ {
if (TrCC.IsInfiniteSegment()) if (TrCC.IsInfiniteSegment())
{ {
BRep_Builder aB; BRep_Builder aB;
TopoDS_Compound aComp; TopoDS_Compound aComp;
aB.MakeCompound(aComp); aB.MakeCompound(aComp);
TopExp_Explorer anExp; TopExp_Explorer anExp;
for (anExp.Init (TrCC.Value(), TopAbs_EDGE); anExp.More(); anExp.Next()) for (anExp.Init(TrCC.Value(), TopAbs_EDGE); anExp.More(); anExp.Next())
aB.Add (aComp, anExp.Current()); aB.Add(aComp, anExp.Current());
res = aComp; res = aComp;
} }
else else
res = TrCC.Value(); res = TrCC.Value();
} }
} }
else { // try other curves else { // try other curves
Handle(Geom_Curve) aGeomCrv; Handle(Geom_Curve) aGeomCrv;
try { try {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
aGeomCrv = StepToGeom::MakeCurve (aCrv); aGeomCrv = StepToGeom::MakeCurve(aCrv);
} }
catch(Standard_Failure const& anException) { catch (Standard_Failure const& anException) {
Handle(Message_Messenger) sout = TP->Messenger(); Handle(Message_Messenger) sout = TP->Messenger();
sout<<"StepToTopoDS, GeometricSet, elem "<<i<<" of "<<nbElem<<": exception "; sout << "StepToTopoDS, GeometricSet, elem " << i << " of " << nbElem << ": exception ";
sout<<anException.GetMessageString() << endl; sout << anException.GetMessageString() << endl;
} }
if ( ! aGeomCrv.IsNull() ) { if (!aGeomCrv.IsNull()) {
BRepBuilderAPI_MakeEdge anEdge(aGeomCrv, aGeomCrv->FirstParameter(), aGeomCrv->LastParameter()); BRepBuilderAPI_MakeEdge anEdge(aGeomCrv, aGeomCrv->FirstParameter(), aGeomCrv->LastParameter());
if ( anEdge.IsDone() ) res = anEdge.Edge(); if (anEdge.IsDone()) res = anEdge.Edge();
} }
} }
} }
// try point // try point
@ -821,39 +790,39 @@ void StepToTopoDS_Builder::Init
} }
} }
// Element should finally be a Surface // Element should finally be a Surface
else if ( ent->IsKind(STANDARD_TYPE(StepGeom_Surface)) ) { else if (ent->IsKind(STANDARD_TYPE(StepGeom_Surface))) {
Handle(StepGeom_Surface) aSurf = Handle(StepGeom_Surface) aSurf =
Handle(StepGeom_Surface)::DownCast(ent); Handle(StepGeom_Surface)::DownCast(ent);
// try curve_bounded_surf // try curve_bounded_surf
if ( ent->IsKind(STANDARD_TYPE(StepGeom_CurveBoundedSurface)) ) { if (ent->IsKind(STANDARD_TYPE(StepGeom_CurveBoundedSurface))) {
Handle(StepGeom_CurveBoundedSurface) CBS = Handle(StepGeom_CurveBoundedSurface) CBS =
Handle(StepGeom_CurveBoundedSurface)::DownCast(aSurf); Handle(StepGeom_CurveBoundedSurface)::DownCast(aSurf);
StepToTopoDS_TranslateCurveBoundedSurface TrCBS; StepToTopoDS_TranslateCurveBoundedSurface TrCBS;
TrCBS.SetPrecision(preci); TrCBS.SetPrecision(preci);
TrCBS.SetMaxTol(maxtol); TrCBS.SetMaxTol(maxtol);
TrCBS.Init( CBS, TP ); TrCBS.Init(CBS, TP);
if ( TrCBS.IsDone() ) res = TrCBS.Value(); if (TrCBS.IsDone()) res = TrCBS.Value();
} }
// try RectangularCompositeSurface // try RectangularCompositeSurface
else if ( ent->IsKind(STANDARD_TYPE(StepGeom_RectangularCompositeSurface)) ) { else if (ent->IsKind(STANDARD_TYPE(StepGeom_RectangularCompositeSurface))) {
Handle(StepGeom_RectangularCompositeSurface) RCS = Handle(StepGeom_RectangularCompositeSurface) RCS =
Handle(StepGeom_RectangularCompositeSurface)::DownCast(aSurf); Handle(StepGeom_RectangularCompositeSurface)::DownCast(aSurf);
Standard_Integer nbi = RCS->NbSegmentsI(); Standard_Integer nbi = RCS->NbSegmentsI();
Standard_Integer nbj = RCS->NbSegmentsJ(); Standard_Integer nbj = RCS->NbSegmentsJ();
TopoDS_Compound C; TopoDS_Compound C;
B.MakeCompound ( C ); B.MakeCompound(C);
for ( Standard_Integer ii=1; ii <= nbi; ii++ ) for (Standard_Integer ii = 1; ii <= nbi; ii++)
for ( Standard_Integer j=1; j <= nbj; j++ ) { for (Standard_Integer j = 1; j <= nbj; j++) {
Handle(StepGeom_SurfacePatch) patch = RCS->SegmentsValue ( ii, j ); Handle(StepGeom_SurfacePatch) patch = RCS->SegmentsValue(ii, j);
TopoDS_Face f = TranslateBoundedSurf (patch->ParentSurface(), preci); TopoDS_Face f = TranslateBoundedSurf(patch->ParentSurface(), preci);
if ( ! f.IsNull() ) B.Add ( C, f ); if (!f.IsNull()) B.Add(C, f);
} }
res = C; res = C;
} }
// try other surfs // try other surfs
else res = TranslateBoundedSurf (aSurf, preci); else res = TranslateBoundedSurf(aSurf, preci);
} }
else if ( ent->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationItem)) ) else if ( ent->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationItem)) )
{ {

View File

@ -67,8 +67,6 @@
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <Transfer_TransientProcess.hxx> #include <Transfer_TransientProcess.hxx>
//#include <StepToTopoDS_ExtPCOnS.hxx>
//#include <BRepAPI.hxx>
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Method : HasPCurve // Method : HasPCurve
// Purpose : returns true if the surface curve has at least one pcurve lying // Purpose : returns true if the surface curve has at least one pcurve lying
@ -171,45 +169,45 @@ Standard_Boolean StepToTopoDS_GeometricTool::IsLikeSeam
if (StepEdge == OrEdge->EdgeElement()) nbOE ++; if (StepEdge == OrEdge->EdgeElement()) nbOE ++;
} }
// the two oriented edges are not in the same wire // the two oriented edges are not in the same wire
if (nbOE == 1) { if (nbOE == 1) {
// check is the two pcurve are not indentical ? // check is the two pcurve are not indentical ?
Handle(StepGeom_Line) line1 = Handle(StepGeom_Line)::DownCast Handle(StepGeom_Line) line1 = Handle(StepGeom_Line)::DownCast
(StepPCurve1->ReferenceToCurve()->ItemsValue(1)); (StepPCurve1->ReferenceToCurve()->ItemsValue(1));
Handle(StepGeom_Line) line2 = Handle(StepGeom_Line)::DownCast Handle(StepGeom_Line) line2 = Handle(StepGeom_Line)::DownCast
(StepPCurve2->ReferenceToCurve()->ItemsValue(1)); (StepPCurve2->ReferenceToCurve()->ItemsValue(1));
if (!line1.IsNull() && !line2.IsNull()) { if (!line1.IsNull() && !line2.IsNull()) {
// Same Origin in X OR Y && Same Vector ?? // Same Origin in X OR Y && Same Vector ??
// WITHIN A given tolerance !!! // WITHIN A given tolerance !!!
Standard_Real DeltaX = Abs(line1->Pnt()->CoordinatesValue(1) - Standard_Real DeltaX = Abs(line1->Pnt()->CoordinatesValue(1) -
line2->Pnt()->CoordinatesValue(1)); line2->Pnt()->CoordinatesValue(1));
Standard_Real DeltaY = Abs(line1->Pnt()->CoordinatesValue(2) - Standard_Real DeltaY = Abs(line1->Pnt()->CoordinatesValue(2) -
line2->Pnt()->CoordinatesValue(2)); line2->Pnt()->CoordinatesValue(2));
Standard_Real DeltaDirX = Standard_Real DeltaDirX =
Abs(line1->Dir()->Orientation()->DirectionRatiosValue(1) - Abs(line1->Dir()->Orientation()->DirectionRatiosValue(1) -
line2->Dir()->Orientation()->DirectionRatiosValue(1)); line2->Dir()->Orientation()->DirectionRatiosValue(1));
Standard_Real DeltaDirY = Standard_Real DeltaDirY =
Abs(line1->Dir()->Orientation()->DirectionRatiosValue(2) - Abs(line1->Dir()->Orientation()->DirectionRatiosValue(2) -
line2->Dir()->Orientation()->DirectionRatiosValue(2)); line2->Dir()->Orientation()->DirectionRatiosValue(2));
Standard_Real preci2d = Precision::PConfusion(); //:S4136: Parametric(BRepAPI::Precision(),10); Standard_Real preci2d = Precision::PConfusion(); //:S4136: Parametric(BRepAPI::Precision(),10);
if ((DeltaX < preci2d) || (DeltaY < preci2d))
return ((DeltaDirX < preci2d) && (DeltaDirY < preci2d));
else return Standard_False;
// Warning : la manipulation de tolerances dans ce contexte est un if ((DeltaX < preci2d) || (DeltaY < preci2d))
// peu trop dangeureux. return ((DeltaDirX < preci2d) && (DeltaDirY < preci2d));
// il serait preferable de plus de ne pas restreindre au else return Standard_False;
// cas de deux lignes.
// un mode plus convenable de detection serait de se servir // Warning : la manipulation de tolerances dans ce contexte est un
// des isos (ou bords naturels) de la surface de base // peu trop dangeureux.
// et de detecter que les deux courbes se trouvent sur le // il serait preferable de plus de ne pas restreindre au
// bord de fermeture. // cas de deux lignes.
// il faut toutefois prevoir le cas ou les deux courbes // un mode plus convenable de detection serait de se servir
// sont confondues (ex : CATIA, "couture" de separation // des isos (ou bords naturels) de la surface de base
// en deux faces d un support periodique. // et de detecter que les deux courbes se trouvent sur le
// Ce travail reste evidement A FAIRE !!! ... // bord de fermeture.
// il faut toutefois prevoir le cas ou les deux courbes
// sont confondues (ex : CATIA, "couture" de separation
// en deux faces d un support periodique.
// Ce travail reste evidement A FAIRE !!! ...
} }
else return Standard_False; else return Standard_False;
} }
@ -233,7 +231,6 @@ Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
Standard_Real cf = theCurve->FirstParameter(); Standard_Real cf = theCurve->FirstParameter();
Standard_Real cl = theCurve->LastParameter(); Standard_Real cl = theCurve->LastParameter();
// Standard_Real preci = BRepAPI::Precision();
if (theCurve->IsKind(STANDARD_TYPE(Geom_BoundedCurve)) && !theCurve->IsClosed()) { if (theCurve->IsKind(STANDARD_TYPE(Geom_BoundedCurve)) && !theCurve->IsClosed()) {
if (w1 < cf) { if (w1 < cf) {
@ -270,9 +267,9 @@ Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
// l'un des points projecte se trouve sur l'origine du parametrage // l'un des points projecte se trouve sur l'origine du parametrage
// de la courbe 3D. L algo a donne cl +- preci au lieu de cf ou vice-versa // de la courbe 3D. L algo a donne cl +- preci au lieu de cf ou vice-versa
// DANGER precision 3d applique a une espace 1d // DANGER precision 3d applique a une espace 1d
// w2 = cf au lieu de w2 = cl // w2 = cf au lieu de w2 = cl
if (Abs(w2 - cf) < Precision::PConfusion() /*preci*/) w2 = cl ; if (Abs(w2 - cf) < Precision::PConfusion() /*preci*/) w2 = cl;
// w1 = cl au lieu de w1 = cf // w1 = cl au lieu de w1 = cf
else if (Abs(w1 - cl) < Precision::PConfusion() /*preci*/) w1 = cf; else if (Abs(w1 - cl) < Precision::PConfusion() /*preci*/) w1 = cf;
@ -281,15 +278,15 @@ Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
// on inverse quand meme les parametres !!!!!! // on inverse quand meme les parametres !!!!!!
else { else {
//:S4136 abv 20 Apr 99: r0701_ug.stp #6230: add check in 3d //:S4136 abv 20 Apr 99: r0701_ug.stp #6230: add check in 3d
if ( theCurve->Value(w1).Distance(theCurve->Value(cf)) < preci ) w1 = cf; if (theCurve->Value(w1).Distance(theCurve->Value(cf)) < preci) w1 = cf;
if ( theCurve->Value(w2).Distance(theCurve->Value(cl)) < preci ) w2 = cl; if (theCurve->Value(w2).Distance(theCurve->Value(cl)) < preci) w2 = cl;
if ( w1 > w2 ) { if (w1 > w2) {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
cout << "Warning : parameter range of edge crossing non periodic curve origin" << endl; cout << "Warning : parameter range of edge crossing non periodic curve origin" << endl;
#endif #endif
Standard_Real tmp = w1; Standard_Real tmp = w1;
w1 = w2; w1 = w2;
w2 = tmp; w2 = tmp;
} }
} }
} }
@ -304,9 +301,9 @@ Standard_Boolean StepToTopoDS_GeometricTool::UpdateParam3d
// DANGER precision 3d applique a une espace 1d // DANGER precision 3d applique a une espace 1d
// w2 = cf au lieu de w2 = cl // w2 = cf au lieu de w2 = cl
if (Abs(w2 - cf) < Precision::PConfusion() /*preci*/) w2 = cl ; if (Abs(w2 - cf) < Precision::PConfusion()) w2 = cl ;
// w1 = cl au lieu de w1 = cf // w1 = cl au lieu de w1 = cf
else if (Abs(w1 - cl) < Precision::PConfusion() /*preci*/) w1 = cf; else if (Abs(w1 - cl) < Precision::PConfusion()) w1 = cf;
// on se trouve dans un cas ou l origine est traversee // on se trouve dans un cas ou l origine est traversee
// illegal sur une courbe fermee non periodique // illegal sur une courbe fermee non periodique

View File

@ -37,10 +37,20 @@
#include <TransferBRep_ShapeBinder.hxx> #include <TransferBRep_ShapeBinder.hxx>
// + pour CartesianOperator3d // + pour CartesianOperator3d
//=======================================================================
//function : StepToTopoDS_MakeTransformed
//purpose :
//=======================================================================
StepToTopoDS_MakeTransformed::StepToTopoDS_MakeTransformed () StepToTopoDS_MakeTransformed::StepToTopoDS_MakeTransformed ()
{ {
} }
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
Standard_Boolean StepToTopoDS_MakeTransformed::Compute Standard_Boolean StepToTopoDS_MakeTransformed::Compute
(const Handle(StepGeom_Axis2Placement3d)& Origin, (const Handle(StepGeom_Axis2Placement3d)& Origin,
const Handle(StepGeom_Axis2Placement3d)& Target) const Handle(StepGeom_Axis2Placement3d)& Target)
@ -64,27 +74,46 @@ Standard_Boolean StepToTopoDS_MakeTransformed::Compute
return Standard_True; return Standard_True;
} }
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
Standard_Boolean StepToTopoDS_MakeTransformed::Compute Standard_Boolean StepToTopoDS_MakeTransformed::Compute
(const Handle(StepGeom_CartesianTransformationOperator3d)& Operator) (const Handle(StepGeom_CartesianTransformationOperator3d)& Operator)
{ {
return StepToGeom::MakeTransformation3d (Operator, theTrsf); return StepToGeom::MakeTransformation3d (Operator, theTrsf);
} }
//=======================================================================
//function : Transformation
//purpose :
//=======================================================================
const gp_Trsf& StepToTopoDS_MakeTransformed::Transformation () const const gp_Trsf& StepToTopoDS_MakeTransformed::Transformation () const
{ {
return theTrsf; return theTrsf;
} }
//=======================================================================
//function : Transform
//purpose :
//=======================================================================
Standard_Boolean StepToTopoDS_MakeTransformed::Transform Standard_Boolean StepToTopoDS_MakeTransformed::Transform
(TopoDS_Shape& shape) const (TopoDS_Shape& shape) const
{ {
if (theTrsf.Form() == gp_Identity) return Standard_False; if (theTrsf.Form() == gp_Identity) return Standard_False;
TopLoc_Location theLoc(theTrsf); TopLoc_Location theLoc(theTrsf);
shape.Move (theLoc); shape.Move (theLoc);
// shape.Location(theLoc);
return Standard_True; return Standard_True;
} }
//=======================================================================
//function : TranslateMappedItem
//purpose :
//=======================================================================
TopoDS_Shape StepToTopoDS_MakeTransformed::TranslateMappedItem TopoDS_Shape StepToTopoDS_MakeTransformed::TranslateMappedItem
(const Handle(StepRepr_MappedItem)& mapit, (const Handle(StepRepr_MappedItem)& mapit,
const Handle(Transfer_TransientProcess)& TP) const Handle(Transfer_TransientProcess)& TP)
@ -103,8 +132,6 @@ TopoDS_Shape StepToTopoDS_MakeTransformed::TranslateMappedItem
Handle(StepGeom_CartesianTransformationOperator3d) CartOp = Handle(StepGeom_CartesianTransformationOperator3d) CartOp =
Handle(StepGeom_CartesianTransformationOperator3d)::DownCast(mapit->MappingTarget()); Handle(StepGeom_CartesianTransformationOperator3d)::DownCast(mapit->MappingTarget());
// Handle(StepRepr_ItemDefinedTransformation) ItemDef =
// Handle(StepRepr_ItemDefinedTransformation)::DownCast(mapit->MappingTarget());
Standard_Boolean ok = Standard_False; Standard_Boolean ok = Standard_False;
if (!Origin.IsNull() && !Target.IsNull()) ok = Compute (Origin,Target); if (!Origin.IsNull() && !Target.IsNull()) ok = Compute (Origin,Target);

View File

@ -127,20 +127,21 @@ Standard_Boolean StepToTopoDS_TranslateCompositeCurve::Init (const Handle(StepGe
// if segment is itself a composite_curve, translate recursively // if segment is itself a composite_curve, translate recursively
if ( crv->IsKind(STANDARD_TYPE(StepGeom_CompositeCurve)) ) { if ( crv->IsKind(STANDARD_TYPE(StepGeom_CompositeCurve)) ) {
if ( crv == CC ) { // cyclic reference protection if (crv == CC) { // cyclic reference protection
TP->AddFail (ccs, "Cyclic reference; segment dropped" ); TP->AddFail(ccs, "Cyclic reference; segment dropped");
continue; continue;
} }
Handle(StepGeom_CompositeCurve) cc = Handle(StepGeom_CompositeCurve)::DownCast ( crv ); Handle(StepGeom_CompositeCurve) cc = Handle(StepGeom_CompositeCurve)::DownCast ( crv );
if ( ! Init ( cc, TP, S, Surf ) || myWire.IsNull() ) continue; if ( ! Init ( cc, TP, S, Surf ) || myWire.IsNull() )
continue;
Standard_Integer nb = sbwd->NbEdges() + 1; Standard_Integer nb = sbwd->NbEdges() + 1;
for ( TopoDS_Iterator it ( myWire ); it.More(); it.Next() ) { for (TopoDS_Iterator it(myWire); it.More(); it.Next()) {
TopoDS_Edge edge = TopoDS::Edge ( it.Value() ); TopoDS_Edge edge = TopoDS::Edge(it.Value());
if ( ccs->SameSense() ) sbwd->Add ( edge ); if (ccs->SameSense()) sbwd->Add(edge);
else { else {
edge.Reverse(); edge.Reverse();
sbwd->Add ( edge, nb > sbwd->NbEdges() ? 0 : nb ); sbwd->Add(edge, nb > sbwd->NbEdges() ? 0 : nb);
} }
} }
myWire.Nullify(); myWire.Nullify();
continue; continue;
@ -150,19 +151,21 @@ Standard_Boolean StepToTopoDS_TranslateCompositeCurve::Init (const Handle(StepGe
// detect pcurve and 3d curve // detect pcurve and 3d curve
Handle(StepGeom_Pcurve) pcurve = Handle(StepGeom_Pcurve)::DownCast ( crv ); Handle(StepGeom_Pcurve) pcurve = Handle(StepGeom_Pcurve)::DownCast ( crv );
if ( pcurve.IsNull() ) { if (pcurve.IsNull()) {
Handle(StepGeom_SurfaceCurve) sc = Handle(StepGeom_SurfaceCurve)::DownCast ( crv ); Handle(StepGeom_SurfaceCurve) sc = Handle(StepGeom_SurfaceCurve)::DownCast(crv);
if ( ! sc.IsNull() ) { if (!sc.IsNull()) {
crv = sc->Curve3d(); crv = sc->Curve3d();
if ( SurfMode ) { // find proper pcurve if (SurfMode) { // find proper pcurve
for ( Standard_Integer j=1; j <= sc->NbAssociatedGeometry(); j++ ) { for (Standard_Integer j = 1; j <= sc->NbAssociatedGeometry(); j++) {
StepGeom_PcurveOrSurface PCorS = sc->AssociatedGeometryValue ( j ); StepGeom_PcurveOrSurface PCorS = sc->AssociatedGeometryValue(j);
Handle(StepGeom_Pcurve) pc = PCorS.Pcurve(); Handle(StepGeom_Pcurve) pc = PCorS.Pcurve();
if ( pc.IsNull() || pc->BasisSurface() != S ) continue; if (pc.IsNull() || pc->BasisSurface() != S)
pcurve = pc; continue;
if ( ccs->SameSense() ) break; pcurve = pc;
} if (ccs->SameSense())
} break;
}
}
} }
} }
else { else {
@ -204,30 +207,30 @@ Standard_Boolean StepToTopoDS_TranslateCompositeCurve::Init (const Handle(StepGe
if ( ! pcurve.IsNull() ) { if ( ! pcurve.IsNull() ) {
try { try {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
StepToTopoDS_TranslateEdge TrE; StepToTopoDS_TranslateEdge TrE;
Handle(Geom2d_Curve) c2d = TrE.MakePCurve ( pcurve, Surf ); Handle(Geom2d_Curve) c2d = TrE.MakePCurve(pcurve, Surf);
if ( ! c2d.IsNull() ) { if (!c2d.IsNull()) {
if ( edge.IsNull() ) { if (edge.IsNull()) {
BRepBuilderAPI_MakeEdge MkEdge ( c2d, Surf, c2d->FirstParameter(), c2d->LastParameter() ); BRepBuilderAPI_MakeEdge MkEdge(c2d, Surf, c2d->FirstParameter(), c2d->LastParameter());
if (MkEdge.IsDone()) if (MkEdge.IsDone())
{ {
if (Precision::IsNegativeInfinite (c2d->FirstParameter()) || Precision::IsPositiveInfinite (c2d->LastParameter())) if (Precision::IsNegativeInfinite(c2d->FirstParameter()) || Precision::IsPositiveInfinite(c2d->LastParameter()))
{ {
myInfiniteSegment = Standard_True; myInfiniteSegment = Standard_True;
TP->AddWarning (CC, "Segment with infinite parameters"); TP->AddWarning(CC, "Segment with infinite parameters");
} }
edge = MkEdge.Edge(); edge = MkEdge.Edge();
} }
} }
else { else {
BRep_Builder B; BRep_Builder B;
TopLoc_Location L; TopLoc_Location L;
B.UpdateEdge ( edge, c2d, Surf, L, 0. ); B.UpdateEdge(edge, c2d, Surf, L, 0.);
B.Range ( edge, Surf, L, c2d->FirstParameter(), c2d->LastParameter() ); B.Range(edge, Surf, L, c2d->FirstParameter(), c2d->LastParameter());
B.SameRange ( edge, Standard_False ); B.SameRange(edge, Standard_False);
B.SameParameter ( edge, Standard_False ); B.SameParameter(edge, Standard_False);
} }
} }
} }
catch(Standard_Failure const& anException) { catch(Standard_Failure const& anException) {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG

View File

@ -56,6 +56,11 @@ StepToTopoDS_TranslateCurveBoundedSurface::StepToTopoDS_TranslateCurveBoundedSur
Init ( CBS, TP ); Init ( CBS, TP );
} }
//=======================================================================
//function : Init
//purpose :
//=======================================================================
Standard_Boolean StepToTopoDS_TranslateCurveBoundedSurface::Init ( Standard_Boolean StepToTopoDS_TranslateCurveBoundedSurface::Init (
const Handle(StepGeom_CurveBoundedSurface) &CBS, const Handle(StepGeom_CurveBoundedSurface) &CBS,
const Handle(Transfer_TransientProcess) &TP) const Handle(Transfer_TransientProcess) &TP)
@ -76,22 +81,10 @@ Standard_Boolean StepToTopoDS_TranslateCurveBoundedSurface::Init (
// pdn to force bsplsurf to be periodic // pdn to force bsplsurf to be periodic
Handle(StepGeom_BSplineSurface) sgbss = Handle(StepGeom_BSplineSurface)::DownCast(S); Handle(StepGeom_BSplineSurface) sgbss = Handle(StepGeom_BSplineSurface)::DownCast(S);
if (!sgbss.IsNull()) { if (!sgbss.IsNull()) {
/* Handle(Geom_Surface) periodicSurf = ShapeAlgo::AlgoContainer()->ConvertToPeriodic(Surf);
StepGeom_BSplineSurfaceForm form = sgbss->SurfaceForm(); if (!periodicSurf.IsNull()) {
if ((form == StepGeom_bssfCylindricalSurf)|| TP->AddWarning(S, "Surface forced to be periodic");
(form == StepGeom_bssfConicalSurf)|| Surf = periodicSurf;
(form == StepGeom_bssfSphericalSurf)||
(form == StepGeom_bssfToroidalSurf)||
(form == StepGeom_bssfSurfOfRevolution)||
(form == StepGeom_bssfGeneralisedCone)||
(form == StepGeom_bssfUnspecified))
*/
{
Handle(Geom_Surface) periodicSurf = ShapeAlgo::AlgoContainer()->ConvertToPeriodic (Surf);
if(!periodicSurf.IsNull()) {
TP->AddWarning(S,"Surface forced to be periodic");
Surf = periodicSurf;
}
} }
} }

View File

@ -85,11 +85,7 @@ static void DecodeMakeEdgeError(const BRepLib_MakeEdge& ME,
(void)U1, (void)U2; // avoid compiler warning (void)U1, (void)U2; // avoid compiler warning
Handle(Transfer_TransientProcess) TP = aTool.TransientProcess(); Handle(Transfer_TransientProcess) TP = aTool.TransientProcess();
// if (!myCurve.IsNull() && !tobind.IsNull()) {
// TransferBRep::SetShapeResult
// (TP,tobind, MakeEdge(myCurve,V1,V2,U1,U2,BRepAPI::Precision()) );
// aTool.Bind (tobind,E); SURTOUT PAS : noter pour debug/erreur
// }
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
cout << "------------------------------------" << endl; cout << "------------------------------------" << endl;
cout << "MakeEdge Error : " << ME.Error()<<" - "; cout << "MakeEdge Error : " << ME.Error()<<" - ";
@ -158,18 +154,22 @@ static Handle(Geom_Curve) MakeCurve
static TopoDS_Edge MakeEdge static TopoDS_Edge MakeEdge
(const Handle(Geom_Curve)& C3D, (const Handle(Geom_Curve)& C3D,
const TopoDS_Vertex& V1, const TopoDS_Vertex& V2, const TopoDS_Vertex& V1, const TopoDS_Vertex& V2,
const Standard_Real U1, const Standard_Real U2) //, const Standard_Real preci) const Standard_Real U1, const Standard_Real U2)
{ {
// fait son edge quoi qu il arrive
BRep_Builder B; BRep_Builder B;
TopoDS_Edge E; TopoDS_Edge E;
B.MakeEdge (E,C3D,Precision::Confusion());//preci); B.MakeEdge (E,C3D,Precision::Confusion());
B.Add (E,V1); B.Add (E,V2); B.Add (E,V1); B.Add (E,V2);
B.UpdateVertex(V1, U1, E, 0.);//preci); B.UpdateVertex(V1, U1, E, 0.);
B.UpdateVertex(V2, U2, E, 0.);//preci); B.UpdateVertex(V2, U2, E, 0.);
return E; return E;
} }
// ============================================================================
// Method : StepToTopoDS_TranslateEdge::StepToTopoDS_TranslateEdge()
// Purpose :
// ============================================================================
StepToTopoDS_TranslateEdge::StepToTopoDS_TranslateEdge() StepToTopoDS_TranslateEdge::StepToTopoDS_TranslateEdge()
{ {
done = Standard_False; done = Standard_False;
@ -214,7 +214,6 @@ void StepToTopoDS_TranslateEdge::Init(const Handle(StepShape_Edge)& aEdge,
else { else {
myError = StepToTopoDS_TranslateEdgeDone; myError = StepToTopoDS_TranslateEdgeDone;
done = Standard_True; done = Standard_True;
// BRep_Builder B;
//:S4136 B.SameRange(TopoDS::Edge(myResult), Standard_False); //:a5 abv 11 Feb 98 //:S4136 B.SameRange(TopoDS::Edge(myResult), Standard_False); //:a5 abv 11 Feb 98
//:S4136 B.SameParameter(TopoDS::Edge(myResult), Standard_False);//:a5 //:S4136 B.SameParameter(TopoDS::Edge(myResult), Standard_False);//:a5
return; return;
@ -253,10 +252,6 @@ void StepToTopoDS_TranslateEdge::Init(const Handle(StepShape_Edge)& aEdge,
BRep_Builder B; BRep_Builder B;
// Standard_Real preci = BRepAPI::Precision();
// Standard_Real precision = BRepAPI::Precision();
Handle(StepGeom_Curve) C = EC->EdgeGeometry(); Handle(StepGeom_Curve) C = EC->EdgeGeometry();
if( C.IsNull()) if( C.IsNull())
{ {
@ -273,8 +268,7 @@ void StepToTopoDS_TranslateEdge::Init(const Handle(StepShape_Edge)& aEdge,
// (following the geometrical sense) // (following the geometrical sense)
// ----------------------------------------------------------- // -----------------------------------------------------------
// Standard_Boolean OrientedEdgeOrientation = OE->Orientation(); Standard_Boolean EdgeCurveSameSense = EC->SameSense();
Standard_Boolean EdgeCurveSameSense = EC->SameSense();
if (EdgeCurveSameSense) { if (EdgeCurveSameSense) {
Vstart = EC->EdgeStart(); Vstart = EC->EdgeStart();
@ -315,37 +309,23 @@ void StepToTopoDS_TranslateEdge::Init(const Handle(StepShape_Edge)& aEdge,
if ( C->IsKind(STANDARD_TYPE(StepGeom_Pcurve))) { if ( C->IsKind(STANDARD_TYPE(StepGeom_Pcurve))) {
B.MakeEdge(E); B.MakeEdge(E);
//:S4136 B.UpdateEdge (E,preci); //:S4136 B.UpdateEdge (E,preci);
B.Add(E, V1); // ?? en fin de TranslateEdgeLoop B.Add(E, V1);
B.Add(E, V2); B.Add(E, V2);
} }
else if (C->IsKind(STANDARD_TYPE(StepGeom_SurfaceCurve)) ) { else if (C->IsKind(STANDARD_TYPE(StepGeom_SurfaceCurve)) ) {
// qui reprend les types SeamCurve et IntersectionCurve // For SeamCurve and IntersectionCurve types
// --- The Edge Geometry is a Surface Curve --- // --- The Edge Geometry is a Surface Curve ---
// --- (3d + 2 Pcurve Or Surface) --- // --- (3d + 2 Pcurve Or Surface) ---
Handle(StepGeom_SurfaceCurve) Sc = Handle(StepGeom_SurfaceCurve) Sc =
Handle(StepGeom_SurfaceCurve)::DownCast(C); Handle(StepGeom_SurfaceCurve)::DownCast(C);
Handle(StepGeom_Curve) C1 = Sc->Curve3d(); Handle(StepGeom_Curve) C1 = Sc->Curve3d();
// if (C1->IsKind(STANDARD_TYPE(StepGeom_Polyline))) {
// B.MakeEdge(E);
// B.UpdateEdge (E,preci);
// B.Add(E, V1); // ?? en fin de TranslateEdgeLoop
// B.Add(E, V2);
// }
// else {
MakeFromCurve3D (C1,EC,Vend,Precision(), E,V1,V2 , aTool); MakeFromCurve3D (C1,EC,Vend,Precision(), E,V1,V2 , aTool);
// }
} }
// else if (C->IsKind(STANDARD_TYPE(StepGeom_Polyline))) {
// B.MakeEdge(E);
// B.UpdateEdge (E,preci);
// B.Add(E, V1); // ?? en fin de TranslateEdgeLoop
// B.Add(E, V2);
// }
else { else {
// --- The Edge Geometry is a Single 3d Curve --- // --- The Edge Geometry is a Single 3d Curve ---
MakeFromCurve3D (C,EC,Vend,Precision(), E,V1,V2 , aTool); MakeFromCurve3D (C,EC,Vend,Precision(), E,V1,V2 , aTool);
} }
// On force les flags SameRange et SameParameter a Standard_False // Force set flags SameRange and SameParameter to Standard_False
if (done) { if (done) {
//:S4136 B.SameRange(E, Standard_False); //:S4136 B.SameRange(E, Standard_False);
//:S4136 B.SameParameter(E, Standard_False); //:S4136 B.SameParameter(E, Standard_False);
@ -384,6 +364,11 @@ static void GetCartesianPoints ( const Handle(StepShape_EdgeCurve)& EC,
} }
} }
// ============================================================================
// Method : StepToTopoDS_TranslateEdge::MakeFromCurve3D()
// Purpose :
// ============================================================================
void StepToTopoDS_TranslateEdge::MakeFromCurve3D void StepToTopoDS_TranslateEdge::MakeFromCurve3D
(const Handle(StepGeom_Curve)& C3D, const Handle(StepShape_EdgeCurve)& EC, (const Handle(StepGeom_Curve)& C3D, const Handle(StepShape_EdgeCurve)& EC,
const Handle(StepShape_Vertex)& Vend, const Handle(StepShape_Vertex)& Vend,
@ -435,11 +420,9 @@ void StepToTopoDS_TranslateEdge::MakeFromCurve3D
} }
else { else {
if (ME.Error() == BRepLib_DifferentPointsOnClosedCurve) { if (ME.Error() == BRepLib_DifferentPointsOnClosedCurve) {
// The Edge could be closed and trimmed by 2 Differents // The Edge could be closed and trimmed by 2 Different vertices
// Vertices
if (C1->IsClosed()) { if (C1->IsClosed()) {
// Attention : il faudra mettre a jour la topologie des // Attention : topology updating
// vertex pour avoir des edges cul a cul ...... Good Luck!
aTool.Bind (Vend,V1); aTool.Bind (Vend,V1);
TopoDS_Shape aLocalShape = V1.Reversed(); TopoDS_Shape aLocalShape = V1.Reversed();
V2 = TopoDS::Vertex(aLocalShape); V2 = TopoDS::Vertex(aLocalShape);
@ -450,8 +433,8 @@ void StepToTopoDS_TranslateEdge::MakeFromCurve3D
} }
else { else {
DecodeMakeEdgeError(ME, C3D, C1, V1, V2, U1, U2, aTool, EC); DecodeMakeEdgeError(ME, C3D, C1, V1, V2, U1, U2, aTool, EC);
E = MakeEdge (C1,V1,V2,U1,U2);//preci E = MakeEdge (C1,V1,V2,U1,U2);
myError = StepToTopoDS_TranslateEdgeDone; // ???? myError = StepToTopoDS_TranslateEdgeDone;
done = Standard_True; done = Standard_True;
// return; // return;
} }
@ -459,8 +442,7 @@ void StepToTopoDS_TranslateEdge::MakeFromCurve3D
else { else {
// Then, this is should be coded as degenerated // Then, this is should be coded as degenerated
// To be performed later !!! // To be performed later !!!
// DecodeMakeEdgeError(ME, C3D, C1, V1, V2, U1, U2, aTool, EC); myError = StepToTopoDS_TranslateEdgeDone;
myError = StepToTopoDS_TranslateEdgeDone; // ????
// Bon, on la fait cette petite edge, mais faudra repasser // Bon, on la fait cette petite edge, mais faudra repasser
// pour l enlever ET FUSIONNER LES VERTEX, pour tout le shell ! // pour l enlever ET FUSIONNER LES VERTEX, pour tout le shell !
// courbe trop petite pour etre mise -> fait planter // courbe trop petite pour etre mise -> fait planter
@ -483,8 +465,8 @@ void StepToTopoDS_TranslateEdge::MakeFromCurve3D
} }
else { else {
DecodeMakeEdgeError(ME, C3D, C1, V1, V2, U1, U2, aTool, EC); DecodeMakeEdgeError(ME, C3D, C1, V1, V2, U1, U2, aTool, EC);
E = MakeEdge (C1,V1,V2,U1,U2);//,preci E = MakeEdge (C1,V1,V2,U1,U2);
myError = StepToTopoDS_TranslateEdgeDone; // ???? myError = StepToTopoDS_TranslateEdgeDone;
done = Standard_True; done = Standard_True;
} }
} }

View File

@ -127,8 +127,6 @@ static void CheckPCurves (TopoDS_Wire& aWire, const TopoDS_Face& aFace,
Handle(ShapeExtend_WireData) sbwd = new ShapeExtend_WireData ( aWire ); Handle(ShapeExtend_WireData) sbwd = new ShapeExtend_WireData ( aWire );
for (Standard_Integer i = 1; i <= sbwd->NbEdges(); i++) { for (Standard_Integer i = 1; i <= sbwd->NbEdges(); i++) {
const TopoDS_Edge& myEdge = sbwd->Edge(i); const TopoDS_Edge& myEdge = sbwd->Edge(i);
// B.SameRange( myEdge, Standard_True );
// B.SameParameter ( myEdge, Standard_True );
// First Check : 2D Parameters on Edge : // First Check : 2D Parameters on Edge :
// Case 1 : w1 == w2 illegal => Drop the PCurve // Case 1 : w1 == w2 illegal => Drop the PCurve
@ -234,19 +232,14 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
TopoDS_Edge E; TopoDS_Edge E;
TopoDS_Vertex V; TopoDS_Vertex V;
// Standard_Real U1,U2, U1a, U1b, U2a, U2b;
Standard_Boolean isSeam, isLikeSeam; Standard_Boolean isSeam, isLikeSeam;
Handle(StepShape_Edge) StepEdge, StepEdge1; Handle(StepShape_Edge) StepEdge, StepEdge1;
Handle(StepShape_OrientedEdge) OrEdge1, OrEdge2; Handle(StepShape_OrientedEdge) OrEdge1, OrEdge2;
Handle(StepGeom_Curve) StepCurve, StepCurve1, StepCurve2; Handle(StepGeom_Curve) StepCurve, StepCurve1, StepCurve2;
// Handle(StepGeom_Pcurve) StepPCurve, StepPCurve1, StepPCurve2;
Handle(StepRepr_DefinitionalRepresentation) DRI, Dri1, Dri2; Handle(StepRepr_DefinitionalRepresentation) DRI, Dri1, Dri2;
Handle(Geom2d_Curve) C2d, C2d1, C2d2, WhichC2d1, WhichC2d2; Handle(Geom2d_Curve) C2d, C2d1, C2d2, WhichC2d1, WhichC2d2;
// unused gp_Pnt Pdeb, Pmil, Pfin, pV1, pV2;
TopoDS_Edge suspectE; //:f1, degEdge; TopoDS_Edge suspectE; //:f1, degEdge;
Standard_Integer j, NbEdge = EL->NbEdgeList(); Standard_Integer j, NbEdge = EL->NbEdgeList();
@ -275,8 +268,6 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
B.MakeWire(W); B.MakeWire(W);
// Standard_Integer lastpcurve = 0;
// ----------------------------------------------- // -----------------------------------------------
// Preparation : Make Vertices + Curves3d // Preparation : Make Vertices + Curves3d
// Hence, a closed curve limited by distinct vertices // Hence, a closed curve limited by distinct vertices
@ -298,20 +289,8 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
if (C->IsKind(STANDARD_TYPE(StepGeom_SurfaceCurve))) { if (C->IsKind(STANDARD_TYPE(StepGeom_SurfaceCurve))) {
Handle(StepGeom_SurfaceCurve) Sc = Handle(StepGeom_SurfaceCurve)::DownCast(C); Handle(StepGeom_SurfaceCurve) Sc = Handle(StepGeom_SurfaceCurve)::DownCast(C);
C = Sc->Curve3d(); C = Sc->Curve3d();
// if (modepcurve != 3) {
// lastpcurve = StepToTopoDS_GeometricTool::PCurve (Sc,StepSurf,StepPCurve1);
// if (StepPCurve1 == StepPCurve) modepcurve = -1;
// StepPCurve = StepPCurve1;
// }
} }
} }
//// else if (C->IsKind(STANDARD_TYPE(StepGeom_Polyline))) { }
// else if (C->IsKind(STANDARD_TYPE(StepGeom_Pcurve))) {
// if (modepcurve != 3) {
// if (C == StepPCurve) modepcurve = -1;
// StepPCurve = Handle(StepGeom_Pcurve)::DownCast(C);
// }
// }
Handle(Geom_Curve) C1; Handle(Geom_Curve) C1;
if (!C.IsNull()) { if (!C.IsNull()) {
try try
@ -355,10 +334,6 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
if (myTranVertex1.IsDone()) { if (myTranVertex1.IsDone()) {
V1 = TopoDS::Vertex(myTranVertex1.Value()); V1 = TopoDS::Vertex(myTranVertex1.Value());
} }
// if (Vend == Vstart) { cas normal deja assure par aTool
// aTool.Bind (Vend,V1);
// }
// else
if (myTranVertex2.IsDone()) { if (myTranVertex2.IsDone()) {
V2 = TopoDS::Vertex(myTranVertex2.Value()); V2 = TopoDS::Vertex(myTranVertex2.Value());
gp_Pnt p1 = BRep_Tool::Pnt(V1); gp_Pnt p1 = BRep_Tool::Pnt(V1);
@ -368,24 +343,12 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
if(!iseV) aTool.Bind(Vend,V1); //gka 21.08.1998 bug PRO7656 if(!iseV) aTool.Bind(Vend,V1); //gka 21.08.1998 bug PRO7656
else if(!istV) aTool.Bind (Vstart,V2); else if(!istV) aTool.Bind (Vstart,V2);
else aTool.Bind (Vend,V1); else aTool.Bind (Vend,V1);
//Fixed = Standard_False;
//aTool.Bind (Vend,V1);
if (!C1.IsNull() && !C1->IsClosed() && Fixed) if (!C1.IsNull() && !C1->IsClosed() && Fixed)
TP->AddWarning(EL->EdgeListValue(j), TP->AddWarning(EL->EdgeListValue(j),
"Vertex of same coordinates, set confused"); "Vertex of same coordinates, set confused");
} }
} }
} }
// if (NbEdge!=1 && theSame == NbEdge) {
// TP->AddWarning(EL,"Wire was ignored. All edges are the same.");
// done = Standard_False;
// return;
// }
// Fixed=Standard_True;
// if (modepcurve == -1) {
// modepcurve = 3;
// TP->AddWarning(EL,"Shared Pcurve not allowed, Pcurves are recomputed");
// }
//:f6 abv 29 Apr 98: BUC50070 #3815: make sure that each two edges are //:f6 abv 29 Apr 98: BUC50070 #3815: make sure that each two edges are
// connected by the same vertex; else check that vertices confuse // connected by the same vertex; else check that vertices confuse
@ -408,7 +371,6 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
Vs22 = ( OrEdge2->Orientation() ? EC2->EdgeEnd() : EC2->EdgeStart() ); Vs22 = ( OrEdge2->Orientation() ? EC2->EdgeEnd() : EC2->EdgeStart() );
if((Vs1 == Vs2) || (Vs1 == Vs22) || (Vs2 == Vs11) || (Vs22 == Vs11)) continue; if((Vs1 == Vs2) || (Vs1 == Vs22) || (Vs2 == Vs11) || (Vs22 == Vs11)) continue;
//?? if ( Vs1.IsSame(Vs2) ) continue; // OK
StepToTopoDS_TranslateVertex myTranVertex1 (Vs1, aTool, NMTool); StepToTopoDS_TranslateVertex myTranVertex1 (Vs1, aTool, NMTool);
StepToTopoDS_TranslateVertex myTranVertex2 (Vs2, aTool, NMTool); StepToTopoDS_TranslateVertex myTranVertex2 (Vs2, aTool, NMTool);
@ -484,14 +446,14 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
// -------------------------------------------- // --------------------------------------------
if (C.IsNull()) if (C.IsNull())
{ {
aTool.ComputePCurve(Standard_True); aTool.ComputePCurve(Standard_True);
hasPcurve = Standard_False; hasPcurve = Standard_False;
} }
else if (C->IsKind(STANDARD_TYPE(StepGeom_Pcurve))) { else if (C->IsKind(STANDARD_TYPE(StepGeom_Pcurve))) {
Handle(StepGeom_Pcurve) StepPCurve = Handle(StepGeom_Pcurve)::DownCast(C); Handle(StepGeom_Pcurve) StepPCurve = Handle(StepGeom_Pcurve)::DownCast(C);
C2d = myTranEdge.MakePCurve (StepPCurve,ConvSurf); C2d = myTranEdge.MakePCurve(StepPCurve, ConvSurf);
// -- Statistics -- // -- Statistics --
aTool.AddContinuity (C2d); aTool.AddContinuity(C2d);
} }
// ----------------------------------------- // -----------------------------------------
@ -502,69 +464,69 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
// ----------------------------------------- // -----------------------------------------
else if (modepcurve == 3) { else if (modepcurve == 3) {
aTool.ComputePCurve(Standard_True); aTool.ComputePCurve(Standard_True);
hasPcurve = Standard_False; hasPcurve = Standard_False;
} }
else if (C->IsKind(STANDARD_TYPE(StepGeom_SurfaceCurve)) ) { else if (C->IsKind(STANDARD_TYPE(StepGeom_SurfaceCurve))) {
// recouvre les cas SeamCurve et IntersectionCurve // recouvre les cas SeamCurve et IntersectionCurve
Handle(StepGeom_SurfaceCurve) SurfCurve =
Handle(StepGeom_SurfaceCurve)::DownCast(C);
Handle(StepGeom_Pcurve) StepPCurve, StepPCurve1, StepPCurve2; Handle(StepGeom_SurfaceCurve) SurfCurve =
Standard_Integer lastpcurve = StepToTopoDS_GeometricTool::PCurve(SurfCurve,StepSurf,StepPCurve,0); Handle(StepGeom_SurfaceCurve)::DownCast(C);
hasPcurve = !StepPCurve.IsNull();
// De toute facon, on recalcule Handle(StepGeom_Pcurve) StepPCurve, StepPCurve1, StepPCurve2;
Standard_Integer lastpcurve = StepToTopoDS_GeometricTool::PCurve(SurfCurve, StepSurf, StepPCurve, 0);
hasPcurve = !StepPCurve.IsNull();
if (isPlane) hasPcurve = Standard_False; // De toute facon, on recalcule
// ------------------------------------------- if (isPlane) hasPcurve = Standard_False;
// --- Special Mapping Cases : ---
// --- the SurfaceCurve is a SeamCurve ---
// --- or is like a seam curve ---
// --- (see CATIA cylinder) ---
// -------------------------------------------
isLikeSeam = StepToTopoDS_GeometricTool::IsLikeSeam(SurfCurve,StepSurf,StepEdge,EL);
isSeam = StepToTopoDS_GeometricTool::IsSeamCurve(SurfCurve, StepSurf,StepEdge, EL); // -------------------------------------------
// --- Special Mapping Cases : ---
if (isSeam || isLikeSeam) { // --- the SurfaceCurve is a SeamCurve ---
// isLikeSeam = Two faces on the same Surface // --- or is like a seam curve ---
StepPCurve1 = SurfCurve->AssociatedGeometryValue(1).Pcurve(); // --- (see CATIA cylinder) ---
StepPCurve2 = SurfCurve->AssociatedGeometryValue(2).Pcurve(); // -------------------------------------------
if (StepPCurve1.IsNull() || StepPCurve2.IsNull()) hasPcurve = Standard_False; //smh : BUC60810 isLikeSeam = StepToTopoDS_GeometricTool::IsLikeSeam(SurfCurve, StepSurf, StepEdge, EL);
else {
C2d1 = myTranEdge.MakePCurve (StepPCurve1,ConvSurf);
C2d2 = myTranEdge.MakePCurve (StepPCurve2,ConvSurf);
hasPcurve = (!C2d1.IsNull() && !C2d2.IsNull());
}
if (isLikeSeam) { isSeam = StepToTopoDS_GeometricTool::IsSeamCurve(SurfCurve, StepSurf, StepEdge, EL);
suspectE = E;
ThereIsLikeSeam = Standard_True; if (isSeam || isLikeSeam) {
hasPcurve = Standard_True; // isLikeSeam = Two faces on the same Surface
} StepPCurve1 = SurfCurve->AssociatedGeometryValue(1).Pcurve();
} StepPCurve2 = SurfCurve->AssociatedGeometryValue(2).Pcurve();
else if (hasPcurve) { if (StepPCurve1.IsNull() || StepPCurve2.IsNull()) hasPcurve = Standard_False; //smh : BUC60810
// GeometricTool : Pcurve a retourne StepPCurve else {
while (lastpcurve > 0) { C2d1 = myTranEdge.MakePCurve(StepPCurve1, ConvSurf);
C2d1 = myTranEdge.MakePCurve (StepPCurve,ConvSurf); C2d2 = myTranEdge.MakePCurve(StepPCurve2, ConvSurf);
if (C2d1.IsNull()) { hasPcurve = (!C2d1.IsNull() && !C2d2.IsNull());
TP->AddWarning(EC,"Incorrect pcurve is not translated. Pcurve definition is not correct"); }
hasPcurve = Standard_False;
break; if (isLikeSeam) {
} suspectE = E;
else C2d = C2d1; ThereIsLikeSeam = Standard_True;
lastpcurve = StepToTopoDS_GeometricTool::PCurve(SurfCurve,StepSurf,StepPCurve,lastpcurve); hasPcurve = Standard_True;
// -- Statistics -- }
aTool.AddContinuity (C2d); }
} else if (hasPcurve) {
} // GeometricTool : Pcurve a retourne StepPCurve
if (!hasPcurve) { while (lastpcurve > 0) {
// The edge geometry has no 2D representation C2d1 = myTranEdge.MakePCurve(StepPCurve, ConvSurf);
aTool.ComputePCurve(Standard_True); if (C2d1.IsNull()) {
} TP->AddWarning(EC, "Incorrect pcurve is not translated. Pcurve definition is not correct");
hasPcurve = Standard_False;
break;
}
else C2d = C2d1;
lastpcurve = StepToTopoDS_GeometricTool::PCurve(SurfCurve, StepSurf, StepPCurve, lastpcurve);
// -- Statistics --
aTool.AddContinuity(C2d);
}
}
if (!hasPcurve) {
// The edge geometry has no 2D representation
aTool.ComputePCurve(Standard_True);
}
} }
// ---------------------------------------------------------- // ----------------------------------------------------------
@ -573,8 +535,8 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
// ---------------------------------------------------------- // ----------------------------------------------------------
else { else {
aTool.ComputePCurve(Standard_True); aTool.ComputePCurve(Standard_True);
hasPcurve = Standard_False; hasPcurve = Standard_False;
} }
// ---------------------------------- // ----------------------------------
@ -583,101 +545,94 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
if (hasPcurve && (isSeam || ThereIsLikeSeam)) { if (hasPcurve && (isSeam || ThereIsLikeSeam)) {
// ----------------------------------------------------------- // -----------------------------------------------------------
// The Edge is a Seam Edge : The pcurve wich is FORWARD has to // The Edge is a Seam Edge : The pcurve wich is FORWARD has to
// be identified // be identified
// ----------------------------------------------------------- // -----------------------------------------------------------
if ((!C2d1.IsNull()) && (!C2d2.IsNull())) {
TopAbs_Orientation CumulO, EdgeO, WireO, FaceO;
EdgeO = E.Orientation();
if (ForwardWire) WireO = TopAbs_FORWARD;
else WireO = TopAbs_REVERSED;
if (sameSense) FaceO = TopAbs_FORWARD;
else FaceO = TopAbs_REVERSED;
CumulO = TopAbs::Compose(EdgeO, WireO); if ((!C2d1.IsNull()) && (!C2d2.IsNull())) {
CumulO = TopAbs::Compose(CumulO, FaceO); TopAbs_Orientation CumulO, EdgeO, WireO, FaceO;
EdgeO = E.Orientation();
if (ForwardWire) WireO = TopAbs_FORWARD;
else WireO = TopAbs_REVERSED;
if (sameSense) FaceO = TopAbs_FORWARD;
else FaceO = TopAbs_REVERSED;
Standard_Boolean ForwardEdge = (CumulO == TopAbs_FORWARD); CumulO = TopAbs::Compose(EdgeO, WireO);
CumulO = TopAbs::Compose(CumulO, FaceO);
// if(!ThereIsLikeSeam) ForwardEdge = Standard_True; Standard_Boolean ForwardEdge = (CumulO == TopAbs_FORWARD);
Standard_Integer forwardPC =
ShapeAnalysis_Curve().SelectForwardSeam (C2d1,C2d2);
if (forwardPC == 0) {
TP->AddFail(StepEdge," Seam curve not mapped");
done = Standard_False;
myError = StepToTopoDS_TranslateEdgeLoopOther;
continue;
}
else if (!ForwardEdge) forwardPC = 3 - forwardPC; // inverser 1-2
if (forwardPC == 1) { Standard_Integer forwardPC =
if(isSeam) { ShapeAnalysis_Curve().SelectForwardSeam(C2d1, C2d2);
// When the edge is a Seam, it is better to find the topological if (forwardPC == 0) {
// trimming right now. TP->AddFail(StepEdge, " Seam curve not mapped");
// Remarque : pour bien faire, il faudrait, si necessaire, recalculer done = Standard_False;
// les trois courbes de maniere a ce qu`elles soient myError = StepToTopoDS_TranslateEdgeLoopOther;
// immediatement Same Range et Same Parameter. continue;
B.UpdateEdge(E, C2d1, C2d2, Face, 0.); }
//:S4136 FindParameter(C2d1, C2d2, E, Face, preci); else if (!ForwardEdge) forwardPC = 3 - forwardPC; // inverser 1-2
}
else if (forwardPC == 1) {
B.UpdateEdge(E, C2d1, Face, 0.); //preci if (isSeam) {
} // When the edge is a Seam, it is better to find the topological
else { // trimming right now.
if(isSeam) { // Remarque : pour bien faire, il faudrait, si necessaire, recalculer
// When the edge is a Seam, it is better to find the topological // les trois courbes de maniere a ce qu`elles soient
// trimming right now. // immediatement Same Range et Same Parameter.
B.UpdateEdge(E, C2d2, C2d1, Face, 0.); B.UpdateEdge(E, C2d1, C2d2, Face, 0.);
//:S4136 FindParameter(C2d1, C2d2, E, Face, preci); //:S4136 FindParameter(C2d1, C2d2, E, Face, preci);
} }
else else
B.UpdateEdge(E, C2d2, Face, 0.); B.UpdateEdge(E, C2d1, Face, 0.); //preci
} }
} else {
else { if (isSeam) {
TP->AddFail(StepEdge," Seam curve not mapped"); // When the edge is a Seam, it is better to find the topological
done = Standard_False; // trimming right now.
myError = StepToTopoDS_TranslateEdgeLoopOther; B.UpdateEdge(E, C2d2, C2d1, Face, 0.);
continue; //:S4136 FindParameter(C2d1, C2d2, E, Face, preci);
} }
else
B.UpdateEdge(E, C2d2, Face, 0.);
}
}
else {
TP->AddFail(StepEdge, " Seam curve not mapped");
done = Standard_False;
myError = StepToTopoDS_TranslateEdgeLoopOther;
continue;
}
} }
else { else {
// --------------------------- // ---------------------------
// The Edge is a "normal" edge // The Edge is a "normal" edge
// --------------------------- // ---------------------------
if (hasPcurve) { if (hasPcurve) {
if ( !C2d.IsNull() && !isLikeSeam ) { if (!C2d.IsNull() && !isLikeSeam) {
B.UpdateEdge(E, C2d, Face, 0.); B.UpdateEdge(E, C2d, Face, 0.);
} }
else { else {
TP->AddFail(StepEdge," Edge: Trimming of 2D curve failed"); TP->AddFail(StepEdge, " Edge: Trimming of 2D curve failed");
// cout << "2D curve type : " << C2d->DynamicType() << endl; done = Standard_False;
done = Standard_False; myError = StepToTopoDS_TranslateEdgeLoopOther;
myError = StepToTopoDS_TranslateEdgeLoopOther; continue;
continue; }
} }
}
} }
if (!E.IsNull()) { if (E.IsNull()) {
// B.Add(W,E); -- DABORD regarder degeneree manquante !!! TP->AddFail(StepEdge, " an Edge not mapped");
} done = Standard_False;
else { myError = StepToTopoDS_TranslateEdgeLoopOther;
TP->AddFail(StepEdge," an Edge not mapped");
done = Standard_False;
myError = StepToTopoDS_TranslateEdgeLoopOther;
// continue;
} }
} }
else { // The Edge is Not mapped => switch to next wire ? else { // The Edge is Not mapped => switch to next wire ?
TP->AddFail(StepEdge," an Edge not mapped"); TP->AddFail(StepEdge," an Edge not mapped");
done = Standard_False; done = Standard_False;
myError = StepToTopoDS_TranslateEdgeLoopOther; myError = StepToTopoDS_TranslateEdgeLoopOther;
// continue;
} }
if (done) B.Add (W,E); // on le fait ici. Sauf si erreur rencontree ... ! if (done) B.Add (W,E); // on le fait ici. Sauf si erreur rencontree ... !
@ -704,7 +659,7 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
// ---------------------------------------------- // ----------------------------------------------
// Computes the 2D parameter of Vertices on Edges // Computes the 2D parameter of Vertices on Edges
// ---------------------------------------------- // ----------------------------------------------
//pdn compute parameter of Vertices using progecting //pdn compute parameter of Vertices using projecting
if (!aTool.ComputePCurve()) if (!aTool.ComputePCurve())
for (TopoDS_Iterator EdgeIt(W);EdgeIt.More();EdgeIt.Next()){ for (TopoDS_Iterator EdgeIt(W);EdgeIt.More();EdgeIt.Next()){
TopoDS_Edge edge = TopoDS::Edge(EdgeIt.Value()); TopoDS_Edge edge = TopoDS::Edge(EdgeIt.Value());
@ -728,19 +683,8 @@ void StepToTopoDS_TranslateEdgeLoop::Init(const Handle(StepShape_FaceBound)& Fac
myError = StepToTopoDS_TranslateEdgeLoopDone; myError = StepToTopoDS_TranslateEdgeLoopDone;
done = Standard_True; done = Standard_True;
// Check des PCurves SYSTEMATIQUE, s il n y en a que quelques unes // Check des PCurves SYSTEMATIQUE, s il n y en a que quelques unes
// if (isPlane) RemovePCurves (W, Face);
// else CheckPCurves (W, Face);
CheckPCurves (W, Face,isPlane,preci); CheckPCurves (W, Face,isPlane,preci);
// --------------------------------------------
// Control the UVLoop (Closed and Head To Tail)
// --------------------------------------------
// StepToTopoDS_GeometricToolError tError =
// StepToTopoDS_GeometricTool::CloseUV(W, Face, aTool);
// if(tError != StepToTopoDS_GeometricToolDone) {
// TP->AddWarning(StepEdge,StepToTopoDS::DecodeGeometricToolError(tError));
// }
return; return;
} }

View File

@ -127,6 +127,11 @@ static inline Standard_Boolean isReversed(const Handle(StepGeom_Surface)& theSte
return (!aStepTorSur.IsNull() && aStepTorSur->MajorRadius() < 0 ? Standard_True : Standard_False); return (!aStepTorSur.IsNull() && aStepTorSur->MajorRadius() < 0 ? Standard_True : Standard_False);
} }
// ============================================================================
// Method : Init
// Purpose : Init with a FaceSurface and a Tool
// ============================================================================
void StepToTopoDS_TranslateFace::Init void StepToTopoDS_TranslateFace::Init
(const Handle(StepShape_FaceSurface)& FS, StepToTopoDS_Tool& aTool, StepToTopoDS_NMTool& NMTool) (const Handle(StepShape_FaceSurface)& FS, StepToTopoDS_Tool& aTool, StepToTopoDS_NMTool& NMTool)
{ {
@ -179,22 +184,10 @@ void StepToTopoDS_TranslateFace::Init
// pdn to force bsplsurf to be periodic // pdn to force bsplsurf to be periodic
Handle(StepGeom_BSplineSurface) sgbss = Handle(StepGeom_BSplineSurface)::DownCast(StepSurf); Handle(StepGeom_BSplineSurface) sgbss = Handle(StepGeom_BSplineSurface)::DownCast(StepSurf);
if (!sgbss.IsNull()) { if (!sgbss.IsNull()) {
/* Handle(Geom_Surface) periodicSurf = ShapeAlgo::AlgoContainer()->ConvertToPeriodic(GeomSurf);
StepGeom_BSplineSurfaceForm form = sgbss->SurfaceForm(); if (!periodicSurf.IsNull()) {
if ((form == StepGeom_bssfCylindricalSurf)|| TP->AddWarning(StepSurf, "Surface forced to be periodic");
(form == StepGeom_bssfConicalSurf)|| GeomSurf = periodicSurf;
(form == StepGeom_bssfSphericalSurf)||
(form == StepGeom_bssfToroidalSurf)||
(form == StepGeom_bssfSurfOfRevolution)||
(form == StepGeom_bssfGeneralisedCone)||
(form == StepGeom_bssfUnspecified))
*/
{
Handle(Geom_Surface) periodicSurf = ShapeAlgo::AlgoContainer()->ConvertToPeriodic (GeomSurf);
if(!periodicSurf.IsNull()) {
TP->AddWarning(StepSurf,"Surface forced to be periodic");
GeomSurf = periodicSurf;
}
} }
} }
@ -232,11 +225,6 @@ void StepToTopoDS_TranslateFace::Init
// Alors on peut dire : face a deux bords dont la couture manque // Alors on peut dire : face a deux bords dont la couture manque
// La couture est entre les deux vertex // La couture est entre les deux vertex
// TopoDS_Wire W1,W2;
// Standard_Boolean fautcoudre =
// ( (NbBnd == 2) && (GeomSurf->IsUClosed() || GeomSurf->IsVClosed()) );
for (Standard_Integer i = 1; i <= NbBnd; i ++) { for (Standard_Integer i = 1; i <= NbBnd; i ++) {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
@ -264,29 +252,25 @@ void StepToTopoDS_TranslateFace::Init
BRepBuilderAPI_MakeFace mf (GeomSurf, Precision()); BRepBuilderAPI_MakeFace mf (GeomSurf, Precision());
for (TopoDS_Iterator it(mf); it.More(); it.Next()) for (TopoDS_Iterator it(mf); it.More(); it.Next())
B.Add (F, it.Value()); B.Add (F, it.Value());
continue;
continue;
} }
} }
if (//GeomSurf->IsKind(STANDARD_TYPE(Geom_SphericalSurface)) || if (GeomSurf->IsKind(STANDARD_TYPE(Geom_ToroidalSurface))) {
GeomSurf->IsKind(STANDARD_TYPE(Geom_ToroidalSurface)) ) { continue;
// TP->AddWarning(VL," VertexLoop on Cone or Torus NOT YET IMPLEMENTED");
continue;
} }
if (GeomSurf->IsKind(STANDARD_TYPE(Geom_Plane)) ) { if (GeomSurf->IsKind(STANDARD_TYPE(Geom_Plane))) {
TP->AddWarning(VL,"VertexLoop on plane is ignored"); TP->AddWarning(VL, "VertexLoop on plane is ignored");
continue; //smh : BUC60809 continue; //smh : BUC60809
} }
myTranVL.SetPrecision(Precision());//gka myTranVL.SetPrecision(Precision());//gka
myTranVL.SetMaxTol(MaxTol()); myTranVL.SetMaxTol(MaxTol());
myTranVL.Init(VL, aTool, NMTool); myTranVL.Init(VL, aTool, NMTool);
if (myTranVL.IsDone()) { if (myTranVL.IsDone()) {
B.Add ( F, myTranVL.Value() ); B.Add(F, myTranVL.Value());
} }
else { else {
TP->AddWarning(VL," a VertexLoop not mapped to TopoDS"); TP->AddWarning(VL, " a VertexLoop not mapped to TopoDS");
} }
} }
@ -302,12 +286,12 @@ void StepToTopoDS_TranslateFace::Init
myTranPL.SetMaxTol(MaxTol()); myTranPL.SetMaxTol(MaxTol());
myTranPL.Init(PL, aTool, GeomSurf, F); myTranPL.Init(PL, aTool, GeomSurf, F);
if (myTranPL.IsDone()) { if (myTranPL.IsDone()) {
TopoDS_Wire W = TopoDS::Wire(myTranPL.Value()); TopoDS_Wire W = TopoDS::Wire(myTranPL.Value());
W.Orientation ( FaceBound->Orientation() ? TopAbs_FORWARD : TopAbs_REVERSED); W.Orientation(FaceBound->Orientation() ? TopAbs_FORWARD : TopAbs_REVERSED);
B.Add ( F, W ); B.Add(F, W);
} }
else { else {
TP->AddWarning(PL," a PolyLoop not mapped to TopoDS"); TP->AddWarning(PL, " a PolyLoop not mapped to TopoDS");
} }
} }
@ -316,11 +300,11 @@ void StepToTopoDS_TranslateFace::Init
// ----------------------- // -----------------------
else if (Loop->IsKind(STANDARD_TYPE(StepShape_EdgeLoop))) { else if (Loop->IsKind(STANDARD_TYPE(StepShape_EdgeLoop))) {
//:S4136 if (STF.Closed()) { //:S4136 if (STF.Closed()) {
//:S4136 Handle(StepShape_EdgeLoop) EL = //:S4136 Handle(StepShape_EdgeLoop) EL =
//:S4136 Handle(StepShape_EdgeLoop)::DownCast(FaceBound->Bound()); //:S4136 Handle(StepShape_EdgeLoop)::DownCast(FaceBound->Bound());
//:S4136 if (EL->NbEdgeList() != 1) STF.Closed() = Standard_False; //:S4136 if (EL->NbEdgeList() != 1) STF.Closed() = Standard_False;
//:S4136 } //:S4136 }
TopoDS_Wire W; TopoDS_Wire W;
myTranEdgeLoop.SetPrecision(Precision()); //gka myTranEdgeLoop.SetPrecision(Precision()); //gka
@ -328,62 +312,42 @@ void StepToTopoDS_TranslateFace::Init
myTranEdgeLoop.Init(FaceBound, F, GeomSurf, StepSurf, sameSense, aTool, NMTool); myTranEdgeLoop.Init(FaceBound, F, GeomSurf, StepSurf, sameSense, aTool, NMTool);
if (myTranEdgeLoop.IsDone()) { if (myTranEdgeLoop.IsDone()) {
W = TopoDS::Wire(myTranEdgeLoop.Value());
W = TopoDS::Wire(myTranEdgeLoop.Value()); // STEP Face_Surface orientation :
// if the topological orientation is opposite to the geometric
// orientation of the surface => the underlying topological
// orientation are not implicitly reversed
// this is the case in CAS.CADE => If the face_surface is reversed,
// the wire orientation has to be explictly reversed
if (FaceBound->Orientation()) {
// *DTH* if (sameSense || GeomSurf->IsKind(STANDARD_TYPE(Geom_Plane)))
W.Orientation(sameSense ? TopAbs_FORWARD : TopAbs_REVERSED);
}
else {
// *DTH* if (sameSense || GeomSurf->IsKind(STANDARD_TYPE(Geom_Plane)))
W.Orientation(sameSense ? TopAbs_REVERSED : TopAbs_FORWARD);
}
// -----------------------------
// The Wire is added to the Face
// -----------------------------
// STEP Face_Surface orientation : B.Add(F, W);
// if the topological orientation is opposite to the geometric
// orientation of the surface => the underlying topological
// orientation are not implicitly reversed
// this is the case in CAS.CADE => If the face_surface is reversed,
// the wire orientation has to be explictly reversed
if (FaceBound->Orientation()) {
// *DTH* if (sameSense || GeomSurf->IsKind(STANDARD_TYPE(Geom_Plane)))
W.Orientation (sameSense ? TopAbs_FORWARD : TopAbs_REVERSED);
}
else {
// *DTH* if (sameSense || GeomSurf->IsKind(STANDARD_TYPE(Geom_Plane)))
W.Orientation (sameSense ? TopAbs_REVERSED : TopAbs_FORWARD);
}
// -----------------------------
// The Wire is added to the Face
// -----------------------------
B.Add ( F, W );
} }
else { else {
// Il y a eu un probleme dans le mapping : On perd la Face // Il y a eu un probleme dans le mapping : On perd la Face
// (facon de parler ...) Pas de moyen aujourd hui de recuperer // (facon de parler ...) Pas de moyen aujourd hui de recuperer
// au moins toutes les geometries (Points, Courbes 3D, Surface) // au moins toutes les geometries (Points, Courbes 3D, Surface)
TP->AddFail(Loop," EdgeLoop not mapped to TopoDS"); TP->AddFail(Loop, " EdgeLoop not mapped to TopoDS");
//if(GeomSurf->IsKind(STANDARD_TYPE(Geom_BoundedSurface))) {
//Standard_Real su1, sv1, su2, sv2;
//GeomSurf->Bounds(su1, su2, sv1, sv2);
//if(sv1 == -Precision::Infinite()) sv1 = 0.;
//if(sv2 == Precision::Infinite()) sv2 = 1.;
//BRepBuilderAPI_MakeFace mkf(GeomSurf,su1,su2,sv1,sv2);
//if (mkf.IsDone()) {
// done shall be standard false but no recipient to
// to store uncompletally mapped topology
// see Improvment Resquest DPA/126/95
//myResult = mkf.Face();
//done = Standard_True;
//}
//}
// CKY JAN-97 : un Wire manque, eh bien on continue quand meme !! // CKY JAN-97 : un Wire manque, eh bien on continue quand meme !!
// sauf si OuterBound : la c est quand meme pas bien normal ... // sauf si OuterBound : la c est quand meme pas bien normal ...
if (FaceBound->IsKind(STANDARD_TYPE(StepShape_FaceOuterBound))) { if (FaceBound->IsKind(STANDARD_TYPE(StepShape_FaceOuterBound))) {
TP->AddWarning(FS,"No Outer Bound : Face not done"); TP->AddWarning(FS, "No Outer Bound : Face not done");
// return; }
} continue;
continue;
// myError = StepToTopoDS_TranslateFaceOther;
// done = Standard_False;
// return;
} }
} }
else { else {
// Type not yet implemented or non sens // Type not yet implemented or non sens
TP->AddFail(Loop," Type of loop not yet implemented"); TP->AddFail(Loop," Type of loop not yet implemented");
@ -391,9 +355,6 @@ void StepToTopoDS_TranslateFace::Init
cout << Loop->DynamicType() << endl; cout << Loop->DynamicType() << endl;
#endif #endif
continue; continue;
// done = Standard_False;
// myError = StepToTopoDS_TranslateFaceOther;
// return;
} }
} }

View File

@ -113,55 +113,50 @@ void StepToTopoDS_TranslatePolyLoop::Init(const Handle(StepShape_PolyLoop)& PL,
GP2 = StepToGeom::MakeCartesianPoint (P2); GP2 = StepToGeom::MakeCartesianPoint (P2);
TopoDS_Shape aBoundEdge; TopoDS_Shape aBoundEdge;
Standard_Boolean isbound = aTool.IsEdgeBound(PP); Standard_Boolean isbound = aTool.IsEdgeBound(PP);
if ( !isbound) { if (!isbound) {
if (aTool.IsVertexBound(P2)) { if (aTool.IsVertexBound(P2)) {
V2 = aTool.FindVertex(P2); V2 = aTool.FindVertex(P2);
} }
else { else {
B.MakeVertex(V2, GP2->Pnt(), Precision::Confusion()); //:S4136: preci B.MakeVertex(V2, GP2->Pnt(), Precision::Confusion()); //:S4136: preci
aTool.BindVertex(P2,V2); aTool.BindVertex(P2, V2);
} }
V = gp_Vec( GP1->Pnt(), GP2->Pnt()); V = gp_Vec(GP1->Pnt(), GP2->Pnt());
L = new Geom_Line( GP1->Pnt() , gp_Dir(V) ); L = new Geom_Line(GP1->Pnt(), gp_Dir(V));
B.MakeEdge(E, L, Precision::Confusion()); //:S4136: preci B.MakeEdge(E, L, Precision::Confusion()); //:S4136: preci
V1.Orientation(TopAbs_FORWARD); V1.Orientation(TopAbs_FORWARD);
V2.Orientation(TopAbs_REVERSED); V2.Orientation(TopAbs_REVERSED);
B.Add(E, V1); B.Add(E, V1);
B.Add(E, V2); B.Add(E, V2);
Magn = V.Magnitude(); Magn = V.Magnitude();
B.UpdateVertex(V1, 0., E, 0. ); //:S4136: preci B.UpdateVertex(V1, 0., E, 0.); //:S4136: preci
B.UpdateVertex(V2, Magn, E, 0. ); //:S4136: preci B.UpdateVertex(V2, Magn, E, 0.); //:S4136: preci
} }
else { else {
aBoundEdge = aTool.FindEdge(PP); aBoundEdge = aTool.FindEdge(PP);
E = TopoDS::Edge(aBoundEdge); E = TopoDS::Edge(aBoundEdge);
// Il faut qu en finale l edge soit vue // Il faut qu en finale l edge soit vue
// - via sa premiere face, orientation combinee = celle de cette premiere face // - via sa premiere face, orientation combinee = celle de cette premiere face
// - via sa deuxieme face, orientation combinee INVERSE de la precedente // - via sa deuxieme face, orientation combinee INVERSE de la precedente
if (TopoFace.Orientation() == TopAbs_FORWARD) E.Reverse(); if (TopoFace.Orientation() == TopAbs_FORWARD) E.Reverse();
V2 = aTool.FindVertex(P2); V2 = aTool.FindVertex(P2);
// Standard_Real u1,v1,u2,v2;
// ElSLib::Parameters(SP->Pln(), GP1->Pnt(), u1, v1);
// ElSLib::Parameters(SP->Pln(), GP2->Pnt(), u2, v2);
// V2d = gp_Vec2d( gp_Pnt2d(u1,v1), gp_Pnt2d(u2,v2) );
// L2d = new Geom2d_Line( gp_Pnt2d(u1,v1), gp_Dir2d(V2d) );
} }
gp_Pnt2d V2p1 = STSU->ValueOfUV (GP1->Pnt(), Precision()); gp_Pnt2d V2p1 = STSU->ValueOfUV (GP1->Pnt(), Precision());
gp_Pnt2d V2p2 = STSU->ValueOfUV (GP2->Pnt(), Precision()); gp_Pnt2d V2p2 = STSU->ValueOfUV (GP2->Pnt(), Precision());
if (E.Orientation() == TopAbs_FORWARD) { if (E.Orientation() == TopAbs_FORWARD) {
V2d = gp_Vec2d( V2p1, V2p2 ); V2d = gp_Vec2d(V2p1, V2p2);
L2d = new Geom2d_Line( V2p1, gp_Dir2d(V2d) ); L2d = new Geom2d_Line(V2p1, gp_Dir2d(V2d));
} else { }
V2d = gp_Vec2d( V2p2, V2p1 ); else {
L2d = new Geom2d_Line( V2p2, gp_Dir2d(V2d) ); V2d = gp_Vec2d(V2p2, V2p1);
L2d = new Geom2d_Line(V2p2, gp_Dir2d(V2d));
} }
B.UpdateEdge(E, L2d, TopoFace, 0.); B.UpdateEdge(E, L2d, TopoFace, 0.);
// E.Orientation(TopAbs_FORWARD);
TopoDS_Edge EB = E; // pour le binding : cumul des orientations ! TopoDS_Edge EB = E; // pour le binding : cumul des orientations !
EB.Orientation (TopoFace.Orientation()); EB.Orientation (TopoFace.Orientation());
if (!isbound) aTool.BindEdge(PP, EB); if (!isbound) aTool.BindEdge(PP, EB);
if (!E.IsNull()) { if (!E.IsNull()) {
B.Add(W,E); B.Add(W, E);
} }
P1 = P2; P1 = P2;
GP1 = GP2; GP1 = GP2;

View File

@ -81,26 +81,26 @@ void StepToTopoDS_TranslateShell::Init
myTranFace.SetMaxTol(MaxTol()); myTranFace.SetMaxTol(MaxTol());
Message_ProgressSentry PS ( TP->GetProgress(), "Face", 0, NbFc, 1 ); Message_ProgressSentry PS ( TP->GetProgress(), "Face", 0, NbFc, 1 );
for (Standard_Integer i=1; i<=NbFc && PS.More(); i++, PS.Next()) { for (Standard_Integer i = 1; i <= NbFc && PS.More(); i++, PS.Next()) {
#ifdef OCCT_DEBUG #ifdef OCCT_DEBUG
cout << "Processing Face : " << i << endl; cout << "Processing Face : " << i << endl;
#endif #endif
StepFace = CFS->CfsFacesValue(i); StepFace = CFS->CfsFacesValue(i);
Handle(StepShape_FaceSurface) theFS = Handle(StepShape_FaceSurface) theFS =
Handle(StepShape_FaceSurface)::DownCast(StepFace); Handle(StepShape_FaceSurface)::DownCast(StepFace);
if (!theFS.IsNull()) { if (!theFS.IsNull()) {
myTranFace.Init(theFS, aTool, NMTool); myTranFace.Init(theFS, aTool, NMTool);
if (myTranFace.IsDone()) { if (myTranFace.IsDone()) {
S = myTranFace.Value(); S = myTranFace.Value();
F = TopoDS::Face(S); F = TopoDS::Face(S);
B.Add(Sh, F); B.Add(Sh, F);
} }
else { // Warning only + add FaceSurface file Identifier else { // Warning only + add FaceSurface file Identifier
TP->AddWarning(theFS," a Face from Shell not mapped to TopoDS"); TP->AddWarning(theFS, " a Face from Shell not mapped to TopoDS");
} }
} }
else { // Warning : ajouter identifier else { // Warning : add identifier
TP->AddWarning(StepFace," Face is not of FaceSurface Type; not mapped to TopoDS"); TP->AddWarning(StepFace, " Face is not of FaceSurface Type; not mapped to TopoDS");
} }
} }
Sh.Closed (BRep_Tool::IsClosed (Sh)); Sh.Closed (BRep_Tool::IsClosed (Sh));