0031382: Data Exchange - BinXCAF should preserve length unit information

Possibility for adding LengthUnit info to XCAF document using special class XCAFDoc_LenghtUnit and XCAFDoc_LenghtUnitTool is implemented.
Package UnitsMethods is split: geom methods were placed to new file GeomConvert_Units which is in the toolkit TKXSBase, internal step scale factors was placed to StepData.
Updated UnitMethods to convert scale factor to different unit types.
Now, XSAlgo::XSAlgo_AlgoContainer is used to update unit info from static interface values.
New Draw command "XSetLengthUnit" and "XGetLengthUnit" for set or get XDE attribute.
Upgraded tests for STEP, IGES, OBJ, glTF, VRML formats to check area regressing with used unit.
Upgraded tests\de test cases to use any units in the "loop back" algorithms.
This commit is contained in:
dpasukhi
2020-11-10 07:52:30 +03:00
committed by bugmaster
parent 9592ae247b
commit da80ff68f1
106 changed files with 2258 additions and 662 deletions

View File

@@ -45,6 +45,7 @@
#include <STEPConstruct_UnitContext.hxx>
#include <STEPControl_ActorWrite.hxx>
#include <STEPControl_StepModelType.hxx>
#include <StepData_GlobalFactors.hxx>
#include <StepData_StepModel.hxx>
#include <StepGeom_Axis2Placement3d.hxx>
#include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx>
@@ -231,7 +232,7 @@ static Standard_Boolean IsManifoldShape(const TopoDS_Shape& theShape) {
STEPControl_ActorWrite::STEPControl_ActorWrite ()
: mygroup (0) , mytoler (-1.)
{
SetMode(STEPControl_ShellBasedSurfaceModel);
SetMode(STEPControl_ShellBasedSurfaceModel);
}
//=======================================================================
@@ -450,8 +451,6 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_
const Handle(Transfer_FinderProcess)& FP,
const Message_ProgressRange& theProgress)
{
XSAlgo::AlgoContainer()->PrepareForTransfer();
Handle(TransferBRep_ShapeMapper) mapper = Handle(TransferBRep_ShapeMapper)::DownCast(start);
if (mapper.IsNull()) return NullResult();
@@ -462,12 +461,15 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_
if ( ! model.IsNull() ) myContext.SetModel ( model ); //: abv 04.11.00: take APD from model
myContext.AddAPD ( Standard_False ); // update APD
myContext.SetLevel ( 1 ); // set assembly level to 1 (to ensure)
//:S4136: init UnitsMethods to reset angle unit factors (see TopoDSToStep)
Standard_Real lFactor = UnitsMethods::GetLengthFactorValue ( Interface_Static::IVal ( "write.step.unit" ) );
lFactor /= UnitsMethods::GetCasCadeLengthUnit();
if (!model->IsInitializedUnit())
{
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
model->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
}
Standard_Real aLFactor = model->WriteLengthUnit();
aLFactor /= model->LocalLengthUnit();
Standard_Integer anglemode = Interface_Static::IVal("step.angleunit.mode");
UnitsMethods::InitializeFactors ( lFactor, ( anglemode <= 1 ? 1. : M_PI/180. ), 1. );
StepData_GlobalFactors::Intance().InitializeFactors (aLFactor, ( anglemode <= 1 ? 1. : M_PI/180. ), 1. );
// create SDR
STEPConstruct_Part SDRTool;