Improvement of translating assemblies from STEP.
// :j4 16.03.99 gka S4134
// abv 18.11.99 renamed from StepPDR_MakeItem
+#include <Interface_EntityIterator.hxx>
+#include <Interface_Graph.hxx>
#include <Interface_InterfaceModel.hxx>
#include <Standard_Transient.hxx>
#include <StepBasic_ApplicationContext.hxx>
//purpose :
//=======================================================================
-Standard_Boolean STEPConstruct_Assembly::CheckSRRReversesNAUO(const Handle(Interface_InterfaceModel) &Model,
+Standard_Boolean STEPConstruct_Assembly::CheckSRRReversesNAUO(const Interface_Graph& theGraph,
const Handle(StepShape_ContextDependentShapeRepresentation) &CDSR)
{
Handle(StepRepr_NextAssemblyUsageOccurrence) nauo =
#endif
return Standard_False;
}
-
+
Handle(StepBasic_ProductDefinition) pd1, pd2;
Handle(StepRepr_Representation) rep1 = CDSR->RepresentationRelation()->Rep1();
Handle(StepRepr_Representation) rep2 = CDSR->RepresentationRelation()->Rep2();
// find SDRs corresponding to Rep1 and Rep2 and remember their PDs
Handle(Standard_Type) tSDR = STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation);
- Standard_Integer nb = Model->NbEntities();
- for (Standard_Integer i = 1; i <= nb; i ++) {
- Handle(Standard_Transient) enti = Model->Value(i);
+ Interface_EntityIterator anIter = theGraph.Sharings(rep1);
+ for (; anIter.More() && pd1.IsNull(); anIter.Next()) {
+ Handle(Standard_Transient) enti = anIter.Value();
if (enti->DynamicType() == tSDR) {
Handle(StepShape_ShapeDefinitionRepresentation) SDR =
- Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(enti);
+ Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(enti);
if ( SDR->UsedRepresentation() == rep1 )
- pd1 = SDR->Definition().PropertyDefinition()->Definition().ProductDefinition();
- if ( SDR->UsedRepresentation() == rep2 )
- pd2 = SDR->Definition().PropertyDefinition()->Definition().ProductDefinition();
+ pd1 = SDR->Definition().PropertyDefinition()->Definition().ProductDefinition();
}
}
+ anIter = theGraph.Sharings(rep2);
+ for (; anIter.More() && pd2.IsNull(); anIter.Next()) {
+ Handle(Standard_Transient) enti = anIter.Value();
+ if (enti->DynamicType() == tSDR) {
+ Handle(StepShape_ShapeDefinitionRepresentation) SDR =
+ Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(enti);
+ if ( SDR->UsedRepresentation() == rep2 )
+ pd2 = SDR->Definition().PropertyDefinition()->Definition().ProductDefinition();
+ }
+ }
+
// checks..
if ( pd1 == nauo->RelatedProductDefinition() && // OK
class StepRepr_NextAssemblyUsageOccurrence;
class Interface_InterfaceModel;
class StepShape_ContextDependentShapeRepresentation;
+class Interface_Graph;
//! This operator creates and checks an item of an assembly, from its
//! Checks whether SRR's definition of assembly and component contradicts
//! with NAUO definition or not, according to model schema (AP214 or AP203)
- Standard_EXPORT static Standard_Boolean CheckSRRReversesNAUO (const Handle(Interface_InterfaceModel)& Model, const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR);
+ Standard_EXPORT static Standard_Boolean CheckSRRReversesNAUO (const Interface_Graph& theGraph, const Handle(StepShape_ContextDependentShapeRepresentation)& CDSR);
IsDepend=Standard_True;
Handle(StepRepr_RepresentationRelationship) RR = CDSR->RepresentationRelation();
if (RR.IsNull()) continue;
- SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( TP->Model(), CDSR );
+ SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph, CDSR );
Handle(StepRepr_Representation) rep = ( SRRReversed ? RR->Rep2() : RR->Rep1() );
iatrsf = ComputeSRRWT ( RR, TP, Trsf );
// find real ProductDefinition used rep
//DeclareAndCast(StepRepr_RepresentationRelationship,SRR,CDSR->RepresentationRelation());
if ( SRR.IsNull() ) return shbinder;
- Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( TP->Model(), CDSR );
+ Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( TP->Graph(), CDSR );
Handle(StepRepr_Representation) rep1 = ( SRRReversed ? SRR->Rep2() : SRR->Rep1() );
Handle(StepShape_ShapeRepresentation) rep = Handle(StepShape_ShapeRepresentation)::DownCast(rep1);
if ( SRR.IsNull() ) return ;
Handle(StepRepr_Representation) rep;
- Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph.Model(), CDSR );
+ Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph, CDSR );
if(SRRReversed)
rep = SRR->Rep2();
else
if ( SRR.IsNull() ) return ;
Handle(StepRepr_Representation) rep;
- Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph.Model(), CDSR );
+ Standard_Boolean SRRReversed = STEPConstruct_Assembly::CheckSRRReversesNAUO ( graph, CDSR );
if(SRRReversed)
rep = SRR->Rep2();
else
--- /dev/null
+puts "========"
+puts "OCC27570"
+puts "========"
+puts ""
+###########################################################
+# Unacceptable performance during reading large STEP files
+###########################################################
+
+set max_time 8
+
+dchrono cr reset
+dchrono cr start
+ReadStep D [locate_data_file bug27570.stp]
+dchrono cr stop
+
+# check time
+set chrono_info [dchrono cr show]
+regexp {CPU user time: ([-0-9.+eE]+) seconds} $chrono_info full CPU_time
+if { $CPU_time > ${max_time} } {
+ puts "CPU user time of STEP translation is more than ${max_time} seconds - Error"
+} else {
+ puts "CPU user time of STEP translation is less than ${max_time} seconds - OK"
+}
+
+# check number of shapes
+XGetOneShape result D
+checknbshapes result -solid 1000 -compound 1111