mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0027721: Add possibility to read STEP file with invalid shape_representation entity.
Add special parameter, which allow reading of all top level (not shared by any other entities) solids (manifold_solid_brep) and shells (shell_based_surface_model). The examples how to use a new parameter: DRAW: switch on a parameter: param read.step.all.shapes On update model to apply new parameter value: newmodel read as usual: stepread test.stp res * // each top level solid or shell will be read as res_i shape. or ReadStep Doc test.stp CXX Code: switch on a parameter: Interface_Static::SetIVal("read.step.all.shapes", 1); read as usual
This commit is contained in:
parent
30c1ef75af
commit
c6f530b8d9
@ -191,6 +191,14 @@ STEPControl_Controller::STEPControl_Controller ()
|
|||||||
Interface_Static::Init ("XSTEP","write.step.sequence",'t',"ToSTEP");
|
Interface_Static::Init ("XSTEP","write.step.sequence",'t',"ToSTEP");
|
||||||
Interface_Static::Init ("XSTEP","read.step.sequence",'t',"FromSTEP");
|
Interface_Static::Init ("XSTEP","read.step.sequence",'t',"FromSTEP");
|
||||||
|
|
||||||
|
// ika 28.07.16: Paremeter to read all top level solids and shells,
|
||||||
|
// should be used only in case of invalid shape_representation without links to shapes.
|
||||||
|
Interface_Static::Init("step", "read.step.all.shapes", 'e', "");
|
||||||
|
Interface_Static::Init("step", "read.step.all.shapes", '&', "enum 0");
|
||||||
|
Interface_Static::Init("step", "read.step.all.shapes", '&', "eval Off");
|
||||||
|
Interface_Static::Init("step", "read.step.all.shapes", '&', "eval On");
|
||||||
|
Interface_Static::SetIVal("read.step.all.shapes", 0);
|
||||||
|
|
||||||
init = Standard_True;
|
init = Standard_True;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,8 +53,10 @@
|
|||||||
#include <StepRepr_RepresentationMap.hxx>
|
#include <StepRepr_RepresentationMap.hxx>
|
||||||
#include <StepRepr_RepresentationRelationship.hxx>
|
#include <StepRepr_RepresentationRelationship.hxx>
|
||||||
#include <StepRepr_ShapeAspect.hxx>
|
#include <StepRepr_ShapeAspect.hxx>
|
||||||
|
#include <StepShape_ManifoldSolidBrep.hxx>
|
||||||
#include <StepShape_ShapeDefinitionRepresentation.hxx>
|
#include <StepShape_ShapeDefinitionRepresentation.hxx>
|
||||||
#include <StepShape_ShapeRepresentation.hxx>
|
#include <StepShape_ShapeRepresentation.hxx>
|
||||||
|
#include <StepShape_ShellBasedSurfaceModel.hxx>
|
||||||
#include <TCollection_AsciiString.hxx>
|
#include <TCollection_AsciiString.hxx>
|
||||||
#include <TColStd_Array1OfAsciiString.hxx>
|
#include <TColStd_Array1OfAsciiString.hxx>
|
||||||
#include <TColStd_Array1OfReal.hxx>
|
#include <TColStd_Array1OfReal.hxx>
|
||||||
@ -123,6 +125,23 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
|
|||||||
Standard_Integer nb = Model()->NbEntities();
|
Standard_Integer nb = Model()->NbEntities();
|
||||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||||
Handle(Standard_Transient) ent = Model()->Value(i);
|
Handle(Standard_Transient) ent = Model()->Value(i);
|
||||||
|
if (Interface_Static::IVal("read.step.all.shapes") == 1) {
|
||||||
|
// Special case to read invalid shape_representation without links to shapes.
|
||||||
|
if (ent->IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep))) {
|
||||||
|
Interface_EntityIterator aShareds = WS()->Graph().Sharings(ent);
|
||||||
|
if (!aShareds.More()) {
|
||||||
|
theroots.Append(ent);
|
||||||
|
WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ent->IsKind(STANDARD_TYPE(StepShape_ShellBasedSurfaceModel))) {
|
||||||
|
Interface_EntityIterator aShareds = WS()->Graph().Sharings(ent);
|
||||||
|
if (!aShareds.More()) {
|
||||||
|
theroots.Append(ent);
|
||||||
|
WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if(ent->IsKind(STANDARD_TYPE(StepBasic_ProductDefinition))) {
|
if(ent->IsKind(STANDARD_TYPE(StepBasic_ProductDefinition))) {
|
||||||
// PTV 31.01.2003 TRJ11 exclude Product Definition With Associated Document from roots
|
// PTV 31.01.2003 TRJ11 exclude Product Definition With Associated Document from roots
|
||||||
if (ent->IsKind(STANDARD_TYPE(StepBasic_ProductDefinitionWithAssociatedDocuments))) {
|
if (ent->IsKind(STANDARD_TYPE(StepBasic_ProductDefinitionWithAssociatedDocuments))) {
|
||||||
|
19
tests/bugs/step/bug27721
Normal file
19
tests/bugs/step/bug27721
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "OCC27721"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
##############################################################################
|
||||||
|
# Add possibility to read STEP file with invalid shape_representation entity.
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
param read.step.all.shapes 1
|
||||||
|
newmodel
|
||||||
|
|
||||||
|
ReadStep D [locate_data_file bug27721.stp]
|
||||||
|
|
||||||
|
XGetOneShape result D
|
||||||
|
|
||||||
|
checknbshapes result -solid 1 -shell 2 -shape 43
|
||||||
|
|
||||||
|
param read.step.all.shapes 0
|
||||||
|
newmodel
|
Loading…
x
Reference in New Issue
Block a user