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, Author.
Discussion
5 archived replies
Posts are displayed in their archived order.
01Commenter-1
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.
02Author
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;
03Author
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.
04Commenter-2
Hello Author,
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:
STEPControl_Reader aReader();
aReader.ReadFile (aPath);
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
aReader.SetSystemLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
05Author
Thank you, Dmitry, we will do it in this way.
With respects, Author.