1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

...

1 Commits

Author SHA1 Message Date
gka
b005f9065c 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.
2017-10-27 17:08:42 +03:00
6 changed files with 41 additions and 17 deletions

View File

@@ -212,7 +212,7 @@ IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile
{ {
if (thelibrary.IsNull()) return IFSelect_RetVoid; if (thelibrary.IsNull()) return IFSelect_RetVoid;
if (theprotocol.IsNull()) return IFSelect_RetVoid; if (theprotocol.IsNull()) return IFSelect_RetVoid;
Handle(Interface_InterfaceModel) model; Handle(Interface_InterfaceModel) model =myModel;
IFSelect_ReturnStatus status = IFSelect_RetVoid; IFSelect_ReturnStatus status = IFSelect_RetVoid;
try { try {
OCC_CATCH_SIGNALS OCC_CATCH_SIGNALS
@@ -1701,11 +1701,12 @@ Standard_Integer IFSelect_WorkSession::RunTransformer
{ {
Standard_Integer effect = 0; Standard_Integer effect = 0;
if (transf.IsNull() || !IsLoaded()) return effect; if (transf.IsNull() || !IsLoaded()) return effect;
Handle(Interface_InterfaceModel) newmod; // Null au depart Handle(Interface_InterfaceModel) newmod; // Null au depart
Interface_CheckIterator checks; Interface_CheckIterator checks;
checks.SetName("X-STEP WorkSession : RunTransformer"); checks.SetName("X-STEP WorkSession : RunTransformer");
Standard_Boolean res = transf->Perform Standard_Boolean res = transf->Perform
(thegraph->Graph(),theprotocol,checks,newmod); (thegraph->Graph(),theprotocol,checks,myModel);
if (!checks.IsEmpty(Standard_False)) { if (!checks.IsEmpty(Standard_False)) {
Handle(Message_Messenger) sout = Message::DefaultMessenger(); Handle(Message_Messenger) sout = Message::DefaultMessenger();
@@ -3055,7 +3056,7 @@ Handle(IFSelect_Selection) IFSelect_WorkSession::GiveSelection
} }
Handle(IFSelect_Selection) sel; Handle(IFSelect_Selection) sel;
if (np >= 0) if (np >= 0)
{ {
nomsel[np] = 0; nomsel[np] = 0;
} }

View File

@@ -52,14 +52,18 @@ void RWStepVisual_RWPresentationLayerAssignment::ReadStep
Handle(StepVisual_HArray1OfLayeredItem) aAssignedItems; Handle(StepVisual_HArray1OfLayeredItem) aAssignedItems;
StepVisual_LayeredItem aAssignedItemsItem; StepVisual_LayeredItem aAssignedItemsItem;
Standard_Integer nsub3; Standard_Integer nsub3;
if (data->ReadSubList (num,3,"assigned_items",ach,nsub3)) { if (data->ReadSubList(num, 3, "assigned_items", ach, nsub3)) {
Standard_Integer nb3 = data->NbParams(nsub3); Standard_Integer nb3 = data->NbParams(nsub3);
aAssignedItems = new StepVisual_HArray1OfLayeredItem (1, nb3); if (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 = new StepVisual_HArray1OfLayeredItem(1, nb3);
aAssignedItems->SetValue(i3,aAssignedItemsItem); 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 --- //--- Initialisation of the read entity ---

View File

@@ -141,11 +141,22 @@ void StepData_StepModel::SetIdentLabel
Standard_Integer num = Number(ent); Standard_Integer num = Number(ent);
if (!num) if (!num)
return; return;
Standard_Integer nbEnt = NbEntities();
if(theidnums.IsNull()) if(theidnums.IsNull())
{ {
theidnums = new TColStd_HArray1OfInteger(1, NbEntities()); theidnums = new TColStd_HArray1OfInteger(1,nbEnt);
theidnums->Init(0); 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); theidnums->SetValue(num,ident);
} }

View File

@@ -996,8 +996,8 @@ Standard_Boolean StepData_StepReaderData::ReadReal(const Standard_Integer num,
Handle(String) errmess; // Null si pas d erreur Handle(String) errmess; // Null si pas d erreur
if (nump > 0 && nump <= NbParams(num)) { if (nump > 0 && nump <= NbParams(num)) {
const Interface_FileParameter& FP = Param(num,nump); const Interface_FileParameter& FP = Param(num,nump);
if (FP.ParamType() == Interface_ParamReal) val = if (FP.ParamType() == Interface_ParamReal || FP.ParamType() == Interface_ParamInteger)
Interface_FileReaderData::Fastof(FP.CValue()); 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) not a Real");
} }
else errmess = new String("Parameter n0.%d (%s) absent"); else errmess = new String("Parameter n0.%d (%s) absent");

View File

@@ -70,8 +70,16 @@ Standard_Integer StepSelect_WorkLibrary::ReadFile
long status = 1; long status = 1;
DeclareAndCast(StepData_Protocol,stepro,protocol); DeclareAndCast(StepData_Protocol,stepro,protocol);
if (stepro.IsNull()) return 1; 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); StepFile_ReadTrace (0);
char *pName=(char *)name; char *pName=(char *)name;
status = StepFile_Read (pName,stepmodel,stepro); status = StepFile_Read (pName,stepmodel,stepro);

View File

@@ -70,5 +70,5 @@ StepVisual_LayeredItem StepVisual_PresentationLayerAssignment::AssignedItemsValu
Standard_Integer StepVisual_PresentationLayerAssignment::NbAssignedItems () const Standard_Integer StepVisual_PresentationLayerAssignment::NbAssignedItems () const
{ {
return assignedItems->Length(); return (assignedItems.IsNull() ? 0 : assignedItems->Length());
} }