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

0022962: Invalid realization of reading and writing material in STEP.

This commit is contained in:
GKA 2012-02-03 12:35:42 +00:00 committed by bugmaster
parent d11ab6c3fe
commit 1d2b1ccb45
2 changed files with 14 additions and 5 deletions

View File

@ -145,6 +145,7 @@
#include <StepShape_SolidModel.hxx>
#include <StepShape_ShellBasedSurfaceModel.hxx>
#include <StepShape_GeometricSet.hxx>
#include <StepBasic_ProductDefinition.hxx>
//#include <BRepTools.hxx>
@ -1888,13 +1889,17 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor
for(Standard_Integer i=1; i<=SeqPDS->Length(); i++) {
Handle(StepRepr_ProductDefinitionShape) PDS =
Handle(StepRepr_ProductDefinitionShape)::DownCast(SeqPDS->Value(i));
if(PDS.IsNull()) continue;
if(PDS.IsNull())
continue;
Handle(StepBasic_ProductDefinition) aProdDef = PDS->Definition().ProductDefinition();
if(aProdDef.IsNull())
continue;
Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString("");
Handle(TCollection_HAsciiString) aDescription = new TCollection_HAsciiString("");
Handle(TCollection_HAsciiString) aDensName = new TCollection_HAsciiString("");
Handle(TCollection_HAsciiString) aDensValType = new TCollection_HAsciiString("");
Standard_Real aDensity=0;
Interface_EntityIterator subs = graph.Sharings(PDS);
Interface_EntityIterator subs = graph.Sharings( aProdDef);
for(subs.Start(); subs.More(); subs.Next()) {
Handle(StepRepr_PropertyDefinition) PropD =
Handle(StepRepr_PropertyDefinition)::DownCast(subs.Value());

View File

@ -157,7 +157,7 @@
#include <StepBasic_HArray1OfDerivedUnitElement.hxx>
#include <StepBasic_DerivedUnit.hxx>
#include <StepRepr_MeasureRepresentationItem.hxx>
#include <StepBasic_ProductDefinition.hxx>
//=======================================================================
//function : GetLabelName
@ -2365,6 +2365,10 @@ Standard_Boolean STEPCAFControl_Writer::WriteMaterials (const Handle(XSControl_W
Handle(Standard_Transient) ent = seqRI.Value(1);
FindPDSforRI(aGraph,ent,PDS,RC);
if(PDS.IsNull()) continue;
Handle(StepBasic_ProductDefinition) aProdDef =
PDS->Definition().ProductDefinition();
if(aProdDef.IsNull())
continue;
// write material entities
TDF_Label MatL = Node->Father()->Label();
Handle(TCollection_HAsciiString) aName;
@ -2429,7 +2433,7 @@ Standard_Boolean STEPCAFControl_Writer::WriteMaterials (const Handle(XSControl_W
}
// write chain PDS---(DRI,MRI)
StepRepr_CharacterizedDefinition CD1;
CD1.SetValue(PDS);
CD1.SetValue(aProdDef);
Handle(StepRepr_PropertyDefinition) PropD1 = new StepRepr_PropertyDefinition;
PropD1->Init(new TCollection_HAsciiString("material property"),Standard_True,
new TCollection_HAsciiString("material name"),CD1);
@ -2441,7 +2445,7 @@ Standard_Boolean STEPCAFControl_Writer::WriteMaterials (const Handle(XSControl_W
PDR1->Init(RD1,RepDRI);
Model->AddWithRefs(PDR1);
StepRepr_CharacterizedDefinition CD2;
CD2.SetValue(PDS);
CD2.SetValue(aProdDef);
Handle(StepRepr_PropertyDefinition) PropD2 = new StepRepr_PropertyDefinition;
PropD2->Init(new TCollection_HAsciiString("material property"),Standard_True,
new TCollection_HAsciiString("density"),CD2);