However it's always MM even when the step file has different units.
How should I be doing this?
Thanks ...
Discussion
3 archived replies
Posts are displayed in their archived order.
01Commenter-1
As I understand it the paramter "xstep.cascade.unit" is the target unit in OpenCASCADE which should be converted to. So you will always get the default value "MM" here if you don´t change the parameter yourself.
The forum post you linked to uses the method po_model->GlobalSection().UnitValue() already, perhaps you should try using
po_model->GlobalSection().UnitValue() instead to receive the unit name you are looking for.
See IGESData_GlobalSection Class Reference in doxygen for details.
I hope this works. Didn´t try it though.
02Commenter-1
Sorry, I just realized you asked for STEP and not IGES.
In this case I think you could try something like this:
STEPControl_Reader reader;
reader.ReadFile (s_file_name);
DeclareAndCast (StepData_StepModel, model, reader.Model());
for (int i = 1; i < model->NbEntities(); ++i)
{
if (model->Entity(i)->IsKind (STANDARD_TYPE(StepBasic_ConversionBasedUnitAndLengthUnit)))
{
DeclareAndCast (StepBasic_ConversionBasedUnitAndLengthUnit, convUnit, model->Entity(i));
TCollection_HAsciiString unitName = convUnit->Name ();
unitName.Print (cout);
break;
}
}
03Commenter-2
Dear Wayne,
OCCT 6.5.3 provides a dedicated tool allowing to consult units found in the STEP file.
See Release Notes, issue 23009 on page 28.
Regards