From b005f9065ce04285699db15743ef87015dd1f1e7 Mon Sep 17 00:00:00 2001 From: gka Date: Wed, 2 Aug 2017 11:36:05 +0300 Subject: [PATCH] 0029270: Added possibility to load in the STEP model a few step files. if in the method XSControl_Reader::SetWS(const Handle(XSControl_WorkSession)& WS,const Standard_Boolean scratch) flag scratch is equal to false then entities from loaded step files were added in the existing STEP model. --- src/IFSelect/IFSelect_WorkSession.cxx | 7 ++++--- ...epVisual_RWPresentationLayerAssignment.cxx | 20 +++++++++++-------- src/StepData/StepData_StepModel.cxx | 13 +++++++++++- src/StepData/StepData_StepReaderData.cxx | 4 ++-- src/StepSelect/StepSelect_WorkLibrary.cxx | 12 +++++++++-- ...StepVisual_PresentationLayerAssignment.cxx | 2 +- 6 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/IFSelect/IFSelect_WorkSession.cxx b/src/IFSelect/IFSelect_WorkSession.cxx index 611bb30911..b9416b4954 100644 --- a/src/IFSelect/IFSelect_WorkSession.cxx +++ b/src/IFSelect/IFSelect_WorkSession.cxx @@ -212,7 +212,7 @@ IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile { if (thelibrary.IsNull()) return IFSelect_RetVoid; if (theprotocol.IsNull()) return IFSelect_RetVoid; - Handle(Interface_InterfaceModel) model; + Handle(Interface_InterfaceModel) model =myModel; IFSelect_ReturnStatus status = IFSelect_RetVoid; try { OCC_CATCH_SIGNALS @@ -1701,11 +1701,12 @@ Standard_Integer IFSelect_WorkSession::RunTransformer { Standard_Integer effect = 0; if (transf.IsNull() || !IsLoaded()) return effect; + Handle(Interface_InterfaceModel) newmod; // Null au depart Interface_CheckIterator checks; checks.SetName("X-STEP WorkSession : RunTransformer"); Standard_Boolean res = transf->Perform - (thegraph->Graph(),theprotocol,checks,newmod); + (thegraph->Graph(),theprotocol,checks,myModel); if (!checks.IsEmpty(Standard_False)) { Handle(Message_Messenger) sout = Message::DefaultMessenger(); @@ -3055,7 +3056,7 @@ Handle(IFSelect_Selection) IFSelect_WorkSession::GiveSelection } Handle(IFSelect_Selection) sel; - if (np >= 0) + if (np >= 0) { nomsel[np] = 0; } diff --git a/src/RWStepVisual/RWStepVisual_RWPresentationLayerAssignment.cxx b/src/RWStepVisual/RWStepVisual_RWPresentationLayerAssignment.cxx index 2cf4d65934..1a3b1db4d1 100644 --- a/src/RWStepVisual/RWStepVisual_RWPresentationLayerAssignment.cxx +++ b/src/RWStepVisual/RWStepVisual_RWPresentationLayerAssignment.cxx @@ -52,14 +52,18 @@ void RWStepVisual_RWPresentationLayerAssignment::ReadStep Handle(StepVisual_HArray1OfLayeredItem) aAssignedItems; StepVisual_LayeredItem aAssignedItemsItem; Standard_Integer nsub3; - if (data->ReadSubList (num,3,"assigned_items",ach,nsub3)) { - Standard_Integer nb3 = data->NbParams(nsub3); - aAssignedItems = new StepVisual_HArray1OfLayeredItem (1, nb3); - for (Standard_Integer i3 = 1; i3 <= nb3; i3 ++) { - //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed - if (data->ReadEntity (nsub3,i3,"assigned_items",ach,aAssignedItemsItem)) - aAssignedItems->SetValue(i3,aAssignedItemsItem); - } + if (data->ReadSubList(num, 3, "assigned_items", ach, nsub3)) { + Standard_Integer nb3 = data->NbParams(nsub3); + if (nb3) + { + + aAssignedItems = new StepVisual_HArray1OfLayeredItem(1, nb3); + for (Standard_Integer i3 = 1; i3 <= nb3; i3++) { + //szv#4:S4163:12Mar99 `Standard_Boolean stat3 =` not needed + if (data->ReadEntity(nsub3, i3, "assigned_items", ach, aAssignedItemsItem)) + aAssignedItems->SetValue(i3, aAssignedItemsItem); + } + } } //--- Initialisation of the read entity --- diff --git a/src/StepData/StepData_StepModel.cxx b/src/StepData/StepData_StepModel.cxx index 306609cea8..2f7b682fef 100644 --- a/src/StepData/StepData_StepModel.cxx +++ b/src/StepData/StepData_StepModel.cxx @@ -141,11 +141,22 @@ void StepData_StepModel::SetIdentLabel Standard_Integer num = Number(ent); if (!num) return; + Standard_Integer nbEnt = NbEntities(); if(theidnums.IsNull()) { - theidnums = new TColStd_HArray1OfInteger(1, NbEntities()); + theidnums = new TColStd_HArray1OfInteger(1,nbEnt); theidnums->Init(0); } + else if(nbEnt > theidnums->Length()) + { + Standard_Integer prevLength = theidnums->Length(); + Handle(TColStd_HArray1OfInteger) idnums1 = new TColStd_HArray1OfInteger(1,nbEnt); + idnums1->Init(0); + Standard_Integer k =1; + for( ; k <= prevLength; k++) + idnums1->SetValue(k , theidnums->Value(k)); + theidnums = idnums1; + } theidnums->SetValue(num,ident); } diff --git a/src/StepData/StepData_StepReaderData.cxx b/src/StepData/StepData_StepReaderData.cxx index 3634d55ef0..dc2d3b689f 100644 --- a/src/StepData/StepData_StepReaderData.cxx +++ b/src/StepData/StepData_StepReaderData.cxx @@ -996,8 +996,8 @@ Standard_Boolean StepData_StepReaderData::ReadReal(const Standard_Integer num, Handle(String) errmess; // Null si pas d erreur if (nump > 0 && nump <= NbParams(num)) { const Interface_FileParameter& FP = Param(num,nump); - if (FP.ParamType() == Interface_ParamReal) val = - Interface_FileReaderData::Fastof(FP.CValue()); + if (FP.ParamType() == Interface_ParamReal || FP.ParamType() == Interface_ParamInteger) + val = Interface_FileReaderData::Fastof(FP.CValue()); else errmess = new String("Parameter n0.%d (%s) not a Real"); } else errmess = new String("Parameter n0.%d (%s) absent"); diff --git a/src/StepSelect/StepSelect_WorkLibrary.cxx b/src/StepSelect/StepSelect_WorkLibrary.cxx index 623d88c225..98e6464147 100644 --- a/src/StepSelect/StepSelect_WorkLibrary.cxx +++ b/src/StepSelect/StepSelect_WorkLibrary.cxx @@ -70,8 +70,16 @@ Standard_Integer StepSelect_WorkLibrary::ReadFile long status = 1; DeclareAndCast(StepData_Protocol,stepro,protocol); if (stepro.IsNull()) return 1; - Handle(StepData_StepModel) stepmodel = new StepData_StepModel; - model = stepmodel; + + Handle(StepData_StepModel) stepmodel; + if(!model.IsNull()) + stepmodel = Handle(StepData_StepModel)::DownCast(model); + if(stepmodel.IsNull()) + { + stepmodel = new StepData_StepModel; + model = stepmodel; + } + StepFile_ReadTrace (0); char *pName=(char *)name; status = StepFile_Read (pName,stepmodel,stepro); diff --git a/src/StepVisual/StepVisual_PresentationLayerAssignment.cxx b/src/StepVisual/StepVisual_PresentationLayerAssignment.cxx index c48d676191..eed606e60f 100644 --- a/src/StepVisual/StepVisual_PresentationLayerAssignment.cxx +++ b/src/StepVisual/StepVisual_PresentationLayerAssignment.cxx @@ -70,5 +70,5 @@ StepVisual_LayeredItem StepVisual_PresentationLayerAssignment::AssignedItemsValu Standard_Integer StepVisual_PresentationLayerAssignment::NbAssignedItems () const { - return assignedItems->Length(); + return (assignedItems.IsNull() ? 0 : assignedItems->Length()); } -- 2.39.5