Hello Team,
Looks like in latest release this parameter doesnt matter for reading data.
I see there is new method SetSystemLengthUnit for this purposes ?
Thanks.
With respects, Eugene.
Kirill Gavrilov Wed, 12/22/2021 - 19:52
OCCT 7.6.0 now storeslength unit information in XCAF document, which required redesigning logic working with units in XDE translations. So that while reading STEP or other model into XCAF document it is now preferred to setup desired system units at document creation time.
But at the same time, an attempt to preserve compatibility with old API "xstep.cascade.unit" has been done - so that the old code is expected to keep working, with some minor exceptions.
Therefore, a reproducible code sample demonstrating the problem would be helpful. An issue on Bugtracker could be also registered to either fix the bug or to put missing information into Upgrade Guide.
Hello Kirill,
Thank you for your answer.
I believe the problem is in function:
Standard_Integer STEPConstruct_UnitContext::ComputeFactors(const Handle(StepBasic_NamedUnit)& aUnit);
In version 7.5 it was calculation:
lengthFactor = parameter * 1000. / UnitsMethods::GetCasCadeLengthUnit();
But in version 7.6 there is:
const Standard_Real aCascadeUnit = StepData_GlobalFactors::Intance().CascadeUnit();
...
lengthFactor = parameter * 1000. / aCascadeUnit;
I think it is forgotten to add:
if (!model->IsInitializedUnit())
{
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
model->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
}
also for STEPControl_ActorRead::Transfer as it was done for TEPControl_ActorWrite::Transfer ?
Wed, 12/22/2021 - 19:52
OCCT 7.6.0 now stores length unit information in XCAF document, which required redesigning logic working with units in XDE translations. So that while reading STEP or other model into XCAF document it is now preferred to setup desired system units at document creation time.
But at the same time, an attempt to preserve compatibility with old API "xstep.cascade.unit" has been done - so that the old code is expected to keep working, with some minor exceptions.
Therefore, a reproducible code sample demonstrating the problem would be helpful. An issue on Bugtracker could be also registered to either fix the bug or to put missing information into Upgrade Guide.
Thu, 12/23/2021 - 09:41
Hello Kirill,
Thank you for your answer.
I believe the problem is in function:
Standard_Integer STEPConstruct_UnitContext::ComputeFactors(const Handle(StepBasic_NamedUnit)& aUnit);
In version 7.5 it was calculation:
lengthFactor = parameter * 1000. / UnitsMethods::GetCasCadeLengthUnit();
But in version 7.6 there is:
const Standard_Real aCascadeUnit = StepData_GlobalFactors::Intance().CascadeUnit();
...
lengthFactor = parameter * 1000. / aCascadeUnit;
Thu, 12/23/2021 - 09:59
I think it is forgotten to add:
if (!model->IsInitializedUnit())
{
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
model->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
}
also for STEPControl_ActorRead::Transfer as it was done for TEPControl_ActorWrite::Transfer ?
If I am not wrong.
Thu, 12/23/2021 - 11:32
Hello Eugene,
STEPControl_ActorRead or STEPControl_ActorWrite :: Transfer () is a recursive function and will be called many times.
As for a STEPControl_ActorWrite, unit initialization is not the best solution, but it protects against an uninitializable Writers.
As for a STEPControl_ActorRead, thanks for your research. Yes, I agree with you, adding initialization to the current solution is necessary.
I recommend to directly initialize Reader and Writer. This will remove the dependency on internal initialization:
Thu, 12/23/2021 - 12:42
Thank you, Dmitry, we will do it in this way.
With respects, Eugene.