mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0033351: Data Exchange, Step - Improvement for thread safety of the STEP translator
Local StepData_Factors object usage for each session Static variables isolated
This commit is contained in:
@@ -39,9 +39,13 @@ STEPCAFControl_Controller::STEPCAFControl_Controller ()
|
||||
|
||||
Standard_Boolean STEPCAFControl_Controller::Init ()
|
||||
{
|
||||
static Standard_Boolean inic = Standard_False;
|
||||
if (inic) return Standard_True;
|
||||
inic = Standard_True;
|
||||
static Standard_Mutex theMutex;
|
||||
{
|
||||
Standard_Mutex::Sentry aSentry(theMutex);
|
||||
static Standard_Boolean inic = Standard_False;
|
||||
if (inic) return Standard_True;
|
||||
inic = Standard_True;
|
||||
}
|
||||
// self-registering
|
||||
Handle(STEPCAFControl_Controller) STEPCTL = new STEPCAFControl_Controller;
|
||||
// do XSAlgo::Init, cause it does not called before.
|
||||
|
@@ -40,7 +40,6 @@
|
||||
#include <StepBasic_ProductDefinitionFormation.hxx>
|
||||
#include <StepBasic_ProductDefinitionWithAssociatedDocuments.hxx>
|
||||
#include <StepBasic_SiUnitAndLengthUnit.hxx>
|
||||
#include <StepData_GlobalFactors.hxx>
|
||||
#include <STEPCAFControl_Controller.hxx>
|
||||
#include <STEPCAFControl_DataMapOfPDExternFile.hxx>
|
||||
#include <STEPCAFControl_DataMapOfShapePD.hxx>
|
||||
@@ -55,6 +54,7 @@
|
||||
#include <STEPControl_Reader.hxx>
|
||||
#include <StepGeom_Axis2Placement3d.hxx>
|
||||
#include <StepGeom_Direction.hxx>
|
||||
#include <StepData_Factors.hxx>
|
||||
#include <StepDimTol_AngularityTolerance.hxx>
|
||||
#include <StepDimTol_CircularRunoutTolerance.hxx>
|
||||
#include <StepDimTol_CoaxialityTolerance.hxx>
|
||||
@@ -499,7 +499,8 @@ static void FillShapesMap(const TopoDS_Shape &S, TopTools_MapOfShape &map)
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void STEPCAFControl_Reader::prepareUnits(const Handle(StepData_StepModel)& theModel,
|
||||
const Handle(TDocStd_Document)& theDoc) const
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
StepData_Factors& theLocalFactors) const
|
||||
{
|
||||
Standard_Real aScaleFactorMM = 1.;
|
||||
if (!XCAFDoc_DocumentTool::GetLengthUnit(theDoc, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter))
|
||||
@@ -509,6 +510,7 @@ void STEPCAFControl_Reader::prepareUnits(const Handle(StepData_StepModel)& theMo
|
||||
// Sets length unit to the document
|
||||
XCAFDoc_DocumentTool::SetLengthUnit(theDoc, aScaleFactorMM, UnitsMethods_LengthUnit_Millimeter);
|
||||
}
|
||||
theLocalFactors.SetCascadeUnit(aScaleFactorMM);
|
||||
theModel->SetLocalLengthUnit(aScaleFactorMM);
|
||||
}
|
||||
|
||||
@@ -526,7 +528,8 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
|
||||
{
|
||||
reader.ClearShapes();
|
||||
Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(reader.Model());
|
||||
prepareUnits(aModel, doc);
|
||||
StepData_Factors aLocalFactors;
|
||||
prepareUnits(aModel, doc, aLocalFactors);
|
||||
Standard_Integer i;
|
||||
|
||||
// Read all shapes
|
||||
@@ -692,7 +695,7 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
|
||||
|
||||
// read colors
|
||||
if (GetColorMode())
|
||||
ReadColors(reader.WS(), doc);
|
||||
ReadColors(reader.WS(), doc, aLocalFactors);
|
||||
|
||||
// read names
|
||||
if (GetNameMode())
|
||||
@@ -700,7 +703,7 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
|
||||
|
||||
// read validation props
|
||||
if (GetPropsMode())
|
||||
ReadValProps(reader.WS(), doc, PDFileMap);
|
||||
ReadValProps(reader.WS(), doc, PDFileMap, aLocalFactors);
|
||||
|
||||
// read layers
|
||||
if (GetLayerMode())
|
||||
@@ -712,15 +715,15 @@ Standard_Boolean STEPCAFControl_Reader::Transfer (STEPControl_Reader &reader,
|
||||
|
||||
// read GDT entities from STEP model
|
||||
if (GetGDTMode())
|
||||
ReadGDTs(reader.WS(), doc);
|
||||
ReadGDTs(reader.WS(), doc, aLocalFactors);
|
||||
|
||||
// read Material entities from STEP model
|
||||
if (GetMatMode())
|
||||
ReadMaterials(reader.WS(), doc, SeqPDS);
|
||||
ReadMaterials(reader.WS(), doc, SeqPDS, aLocalFactors);
|
||||
|
||||
// read View entities from STEP model
|
||||
if (GetViewMode())
|
||||
ReadViews(reader.WS(), doc);
|
||||
ReadViews(reader.WS(), doc, aLocalFactors);
|
||||
|
||||
// Expand resulting CAF structure for sub-shapes (optionally with their
|
||||
// names) if requested
|
||||
@@ -950,7 +953,8 @@ static void propagateColorToParts(const Handle(XCAFDoc_ShapeTool)& theSTool,
|
||||
static void SetAssemblyComponentStyle(const Handle(Transfer_TransientProcess) &theTP,
|
||||
const Handle(XCAFDoc_ColorTool)& theCTool,
|
||||
const STEPConstruct_Styles& theStyles,
|
||||
const Handle(StepVisual_ContextDependentOverRidingStyledItem)& theStyle)
|
||||
const Handle(StepVisual_ContextDependentOverRidingStyledItem)& theStyle,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
if (theStyle.IsNull()) return;
|
||||
|
||||
@@ -1004,8 +1008,8 @@ static void SetAssemblyComponentStyle(const Handle(Transfer_TransientProcess) &t
|
||||
|
||||
if(!anAxp1.IsNull() && !anAxp2.IsNull())
|
||||
{
|
||||
Handle(Geom_Axis2Placement) anOrig = StepToGeom::MakeAxis2Placement (anAxp1);
|
||||
Handle(Geom_Axis2Placement) aTarg = StepToGeom::MakeAxis2Placement (anAxp2);
|
||||
Handle(Geom_Axis2Placement) anOrig = StepToGeom::MakeAxis2Placement (anAxp1, theLocalFactors);
|
||||
Handle(Geom_Axis2Placement) aTarg = StepToGeom::MakeAxis2Placement (anAxp2, theLocalFactors);
|
||||
gp_Ax3 anAx3Orig(anOrig->Ax2());
|
||||
gp_Ax3 anAx3Targ(aTarg->Ax2());
|
||||
|
||||
@@ -1056,17 +1060,18 @@ static void SetStyle(const Handle(XSControl_WorkSession) &theWS,
|
||||
const Handle(XCAFDoc_ShapeTool)& theSTool,
|
||||
const STEPConstruct_Styles& theStyles,
|
||||
const Handle(TColStd_HSequenceOfTransient)& theHSeqOfInvisStyle,
|
||||
const Handle(StepVisual_StyledItem)& theStyle)
|
||||
const Handle(StepVisual_StyledItem)& theStyle,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
if (theStyle.IsNull()) return;
|
||||
|
||||
const Handle(Transfer_TransientProcess) &aTP = theWS->TransferReader()->TransientProcess();
|
||||
if (Handle(StepVisual_OverRidingStyledItem) anOverridingStyle = Handle(StepVisual_OverRidingStyledItem)::DownCast (theStyle))
|
||||
{
|
||||
SetStyle (theWS, theMap, theCTool, theSTool, theStyles, theHSeqOfInvisStyle, anOverridingStyle->OverRiddenStyle ());
|
||||
SetStyle (theWS, theMap, theCTool, theSTool, theStyles, theHSeqOfInvisStyle, anOverridingStyle->OverRiddenStyle (), theLocalFactors);
|
||||
if (Handle(StepVisual_ContextDependentOverRidingStyledItem) anAssemblyComponentStyle = Handle(StepVisual_ContextDependentOverRidingStyledItem)::DownCast (theStyle))
|
||||
{
|
||||
SetAssemblyComponentStyle (aTP, theCTool, theStyles,anAssemblyComponentStyle);
|
||||
SetAssemblyComponentStyle (aTP, theCTool, theStyles,anAssemblyComponentStyle, theLocalFactors);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1247,7 +1252,8 @@ static Standard_Boolean IsOverriden(const Interface_Graph& theGraph,
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSession) &WS,
|
||||
const Handle(TDocStd_Document)& Doc) const
|
||||
const Handle(TDocStd_Document)& Doc,
|
||||
const StepData_Factors& theLocalFactors) const
|
||||
{
|
||||
STEPConstruct_Styles Styles(WS);
|
||||
if (!Styles.LoadStyles()) {
|
||||
@@ -1278,7 +1284,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSe
|
||||
// check that style is overridden by other root style
|
||||
if (!IsOverriden (aGraph, Style, anIsRootStyle))
|
||||
{
|
||||
SetStyle (WS, myMap, CTool, STool, Styles, aHSeqOfInvisStyle, Style);
|
||||
SetStyle (WS, myMap, CTool, STool, Styles, aHSeqOfInvisStyle, Style, theLocalFactors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1291,7 +1297,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadColors(const Handle(XSControl_WorkSe
|
||||
// check that style is overridden
|
||||
if (!IsOverriden (aGraph, Style, anIsRootStyle))
|
||||
{
|
||||
SetStyle (WS, myMap, CTool, STool, Styles, aHSeqOfInvisStyle, Style);
|
||||
SetStyle (WS, myMap, CTool, STool, Styles, aHSeqOfInvisStyle, Style, theLocalFactors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1490,7 +1496,8 @@ static TDF_Label GetLabelFromPD(const Handle(StepBasic_ProductDefinition) &PD,
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::ReadValProps(const Handle(XSControl_WorkSession) &WS,
|
||||
const Handle(TDocStd_Document)& Doc,
|
||||
const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const
|
||||
const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,
|
||||
const StepData_Factors& theLocalFactors) const
|
||||
{
|
||||
// get starting data
|
||||
const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
|
||||
@@ -1603,11 +1610,11 @@ Standard_Boolean STEPCAFControl_Reader::ReadValProps(const Handle(XSControl_Work
|
||||
Standard_Boolean isArea;
|
||||
Standard_Real val;
|
||||
gp_Pnt pos;
|
||||
if (Props.GetPropReal(ent, val, isArea)) {
|
||||
if (Props.GetPropReal(ent, val, isArea, theLocalFactors)) {
|
||||
if (isArea) XCAFDoc_Area::Set(L, val);
|
||||
else XCAFDoc_Volume::Set(L, val);
|
||||
}
|
||||
else if (Props.GetPropPnt(ent, rep->ContextOfItems(), pos)) {
|
||||
else if (Props.GetPropPnt(ent, rep->ContextOfItems(), pos, theLocalFactors)) {
|
||||
XCAFDoc_Centroid::Set(L, pos);
|
||||
}
|
||||
}
|
||||
@@ -1938,7 +1945,8 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
||||
const Standard_Real theFact,
|
||||
TopoDS_Shape& thePresentation,
|
||||
Handle(TCollection_HAsciiString)& thePresentName,
|
||||
Bnd_Box& theBox)
|
||||
Bnd_Box& theBox,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
if (thePresentEntity.IsNull())
|
||||
return Standard_False;
|
||||
@@ -2014,7 +2022,7 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
||||
{
|
||||
Handle(StepVisual_RepositionedTessellatedGeometricSet) aRTGS =
|
||||
Handle(StepVisual_RepositionedTessellatedGeometricSet)::DownCast(aTessSet);
|
||||
Handle(Geom_Axis2Placement) aLocation = StepToGeom::MakeAxis2Placement(aRTGS->Location());
|
||||
Handle(Geom_Axis2Placement) aLocation = StepToGeom::MakeAxis2Placement(aRTGS->Location(), theLocalFactors);
|
||||
if (!aLocation.IsNull())
|
||||
{
|
||||
const gp_Ax3 anAx3Orig = gp::XOY();
|
||||
@@ -2094,7 +2102,8 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
||||
//purpose : read annotation plane
|
||||
//=======================================================================
|
||||
Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane)& theAnnotationPlane,
|
||||
gp_Ax2& thePlane)
|
||||
gp_Ax2& thePlane,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
if (theAnnotationPlane.IsNull())
|
||||
return Standard_False;
|
||||
@@ -2114,7 +2123,7 @@ Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane)& t
|
||||
if (aA2P3D.IsNull())
|
||||
return Standard_False;
|
||||
|
||||
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aA2P3D);
|
||||
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aA2P3D, theLocalFactors);
|
||||
thePlane = anAxis->Ax2();
|
||||
return Standard_True;
|
||||
}
|
||||
@@ -2126,7 +2135,8 @@ Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane)& t
|
||||
//=======================================================================
|
||||
void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
||||
const Handle(Standard_Transient)& theGDT,
|
||||
const Handle(Standard_Transient)& theDimObject)
|
||||
const Handle(Standard_Transient)& theDimObject,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
if (theGDT.IsNull() || theDimObject.IsNull())
|
||||
return;
|
||||
@@ -2155,8 +2165,9 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
||||
Handle(StepVisual_DraughtingModel)::DownCast(aDMIA->UsedRepresentation());
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor;
|
||||
anActor.PrepareUnits(aDModel, aTP);
|
||||
Standard_Real aFact = StepData_GlobalFactors::Intance().LengthFactor();
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
anActor.PrepareUnits(aDModel, aTP, aLocalFactors);
|
||||
Standard_Real aFact = aLocalFactors.LengthFactor();
|
||||
|
||||
// retrieve AnnotationPlane
|
||||
Handle(StepRepr_RepresentationItem) aDMIAE = aDMIA->IdentifiedItemValue(1);
|
||||
@@ -2168,7 +2179,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
||||
for (subs.Start(); subs.More() && anAnPlane.IsNull(); subs.Next()) {
|
||||
anAnPlane = Handle(StepVisual_AnnotationPlane)::DownCast(subs.Value());
|
||||
}
|
||||
Standard_Boolean isHasPlane = readAnnotationPlane(anAnPlane, aPlaneAxes);
|
||||
Standard_Boolean isHasPlane = readAnnotationPlane(anAnPlane, aPlaneAxes, aLocalFactors);
|
||||
|
||||
// set plane axes to XCAF
|
||||
if (isHasPlane) {
|
||||
@@ -2192,7 +2203,7 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
||||
|
||||
// Retrieve presentation
|
||||
Bnd_Box aBox;
|
||||
if (!readPMIPresentation(aDMIAE, theTR, aFact, aResAnnotation, aPresentName, aBox))
|
||||
if (!readPMIPresentation(aDMIAE, theTR, aFact, aResAnnotation, aPresentName, aBox, aLocalFactors))
|
||||
return;
|
||||
gp_Pnt aPtext(0., 0., 0.);
|
||||
// if Annotation plane location inside bounding box set it to text position
|
||||
@@ -2240,7 +2251,8 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
||||
//=======================================================================
|
||||
void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
|
||||
const Handle(Standard_Transient)& theGDT,
|
||||
const Handle(XCAFDimTolObjects_DimensionObject)& theDimObject)
|
||||
const Handle(XCAFDimTolObjects_DimensionObject)& theDimObject,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
if (theGDT.IsNull() || theDimObject.IsNull())
|
||||
return;
|
||||
@@ -2262,8 +2274,9 @@ void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor;
|
||||
anActor.PrepareUnits(aSDR, aTP);
|
||||
aFact = StepData_GlobalFactors::Intance().LengthFactor();
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
anActor.PrepareUnits(aSDR, aTP, aLocalFactors);
|
||||
aFact = aLocalFactors.LengthFactor();
|
||||
}
|
||||
|
||||
if (theGDT->IsKind(STANDARD_TYPE(StepShape_DimensionalSize))) {
|
||||
@@ -2518,7 +2531,8 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
|
||||
const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal,
|
||||
const Standard_Real theModifValue,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS)
|
||||
const Handle(XSControl_WorkSession)& theWS,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
|
||||
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main());
|
||||
@@ -2539,7 +2553,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
|
||||
collectShapeAspect(aSAR->RelatingShapeAspect(), theWS, aSAs);
|
||||
Handle(StepDimTol_DatumFeature) aDF = Handle(StepDimTol_DatumFeature)::DownCast(aSAR->RelatingShapeAspect());
|
||||
if (!aSAR->RelatingShapeAspect()->IsKind(STANDARD_TYPE(StepDimTol_DatumTarget)))
|
||||
readAnnotation(aTR, aSAR->RelatingShapeAspect(), aDatObj);
|
||||
readAnnotation(aTR, aSAR->RelatingShapeAspect(), aDatObj, theLocalFactors);
|
||||
}
|
||||
|
||||
// Collect shape labels
|
||||
@@ -2673,8 +2687,9 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
|
||||
= Handle(StepGeom_Axis2Placement3d)::DownCast(aSRWP->ItemsValue(j));
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor;
|
||||
anActor.PrepareUnits(aSRWP, aTP);
|
||||
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(anAx);
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
anActor.PrepareUnits(aSRWP, aTP, aLocalFactors);
|
||||
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(anAx, aLocalFactors);
|
||||
aDatTargetObj->SetDatumTargetAxis(anAxis->Ax2());
|
||||
}
|
||||
else if (aSRWP->ItemsValue(j)->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit)))
|
||||
@@ -2689,7 +2704,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
|
||||
if (aNU.IsNull())
|
||||
continue;
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(aNU);
|
||||
anUnitCtx.ComputeFactors(aNU, theLocalFactors);
|
||||
aVal = aVal * anUnitCtx.LengthFactor();
|
||||
if (aM->Name()->String().IsEqual("target length") ||
|
||||
aM->Name()->String().IsEqual("target diameter"))
|
||||
@@ -2719,7 +2734,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
|
||||
aDGTTool->SetDatumToGeomTol(aDatL, theGDTL);
|
||||
aDatTargetObj->IsDatumTarget(Standard_True);
|
||||
aDatTargetObj->SetDatumTargetNumber(aDT->TargetId()->IntegerValue());
|
||||
readAnnotation(aTR, aDT, aDatTargetObj);
|
||||
readAnnotation(aTR, aDT, aDatTargetObj, theLocalFactors);
|
||||
aDat->SetObject(aDatTargetObj);
|
||||
isExistDatumTarget = Standard_True;
|
||||
}
|
||||
@@ -2748,7 +2763,7 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
|
||||
aDGTTool->SetDatumToGeomTol(aDatL, theGDTL);
|
||||
if (aDatObj->GetPresentation().IsNull()) {
|
||||
// Try find annotation connected to datum entity (not right case, according recommended practices)
|
||||
readAnnotation(aTR, theDat, aDatObj);
|
||||
readAnnotation(aTR, theDat, aDatObj, theLocalFactors);
|
||||
}
|
||||
aDat->SetObject(aDatObj);
|
||||
}
|
||||
@@ -2764,7 +2779,8 @@ Standard_Boolean STEPCAFControl_Reader::setDatumToXCAF(const Handle(StepDimTol_D
|
||||
Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Transient)& theEnt,
|
||||
const TDF_Label theGDTL,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS)
|
||||
const Handle(XSControl_WorkSession)& theWS,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader();
|
||||
const Handle(Transfer_TransientProcess) &aTP = aTR->TransientProcess();
|
||||
@@ -2845,7 +2861,7 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
aModifValue = aVal * anUnitCtx.LengthFactor();
|
||||
}
|
||||
}
|
||||
@@ -2857,7 +2873,7 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
|
||||
if (anIterDRC.Value()->IsKind(STANDARD_TYPE(StepDimTol_Datum)))
|
||||
{
|
||||
Handle(StepDimTol_Datum) aD = Handle(StepDimTol_Datum)::DownCast(anIterDRC.Value());
|
||||
setDatumToXCAF(aD, theGDTL, aPositionCounter, aXCAFModifiers, aXCAFModifWithVal, aModifValue, theDoc, theWS);
|
||||
setDatumToXCAF(aD, theGDTL, aPositionCounter, aXCAFModifiers, aXCAFModifWithVal, aModifValue, theDoc, theWS, theLocalFactors);
|
||||
}
|
||||
else if (anIterDRC.Value()->IsKind(STANDARD_TYPE(StepDimTol_DatumReferenceElement)))
|
||||
{
|
||||
@@ -2882,7 +2898,7 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
aModifValue = aVal * anUnitCtx.LengthFactor();
|
||||
}
|
||||
}
|
||||
@@ -2892,7 +2908,7 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
|
||||
if (anIterDRE.Value()->IsKind(STANDARD_TYPE(StepDimTol_Datum)))
|
||||
{
|
||||
Handle(StepDimTol_Datum) aD = Handle(StepDimTol_Datum)::DownCast(anIterDRE.Value());
|
||||
setDatumToXCAF(aD, theGDTL, aPositionCounter, aXCAFModifiers, aXCAFModifWithVal, aModifValue, theDoc, theWS);
|
||||
setDatumToXCAF(aD, theGDTL, aPositionCounter, aXCAFModifiers, aXCAFModifWithVal, aModifValue, theDoc, theWS, theLocalFactors);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2911,7 +2927,8 @@ Standard_Boolean STEPCAFControl_Reader::readDatumsAP242(const Handle(Standard_Tr
|
||||
//=======================================================================
|
||||
TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS)
|
||||
const Handle(XSControl_WorkSession)& theWS,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
TDF_Label aGDTL;
|
||||
if (!theEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)) &&
|
||||
@@ -3082,7 +3099,7 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
dim1 = dim1 * anUnitCtx.LengthFactor();
|
||||
}
|
||||
}
|
||||
@@ -3098,7 +3115,7 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
dim2 = dim2 * anUnitCtx.LengthFactor();
|
||||
}
|
||||
}
|
||||
@@ -3139,7 +3156,7 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
dim = dim * anUnitCtx.LengthFactor();
|
||||
//std::cout<<"GeometricTolerance: Magnitude = "<<dim<<std::endl;
|
||||
Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(1, 1);
|
||||
@@ -3359,7 +3376,7 @@ TDF_Label STEPCAFControl_Reader::createGDTObjectInXCAF(const Handle(Standard_Tra
|
||||
TDataStd_Name::Set(aGDTL, str);
|
||||
}
|
||||
|
||||
readDatumsAP242(theEnt, aGDTL, theDoc, theWS);
|
||||
readDatumsAP242(theEnt, aGDTL, theDoc, theWS, theLocalFactors);
|
||||
}
|
||||
return aGDTL;
|
||||
}
|
||||
@@ -3390,7 +3407,8 @@ void convertAngleValue(
|
||||
static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
const TDF_Label& aDimL,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS)
|
||||
const Handle(XSControl_WorkSession)& theWS,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
|
||||
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main());
|
||||
@@ -3455,7 +3473,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
continue;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit))) {
|
||||
aVal = aVal * anUnitCtx.LengthFactor();
|
||||
|
||||
@@ -3482,7 +3500,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
continue;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnitAndQRI))) {
|
||||
aVal = aVal * anUnitCtx.LengthFactor();
|
||||
}
|
||||
@@ -3562,7 +3580,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtxUpperBound;
|
||||
anUnitCtxUpperBound.ComputeFactors(NU);
|
||||
anUnitCtxUpperBound.ComputeFactors(NU, theLocalFactors);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
|
||||
{
|
||||
@@ -3598,7 +3616,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||
NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtxLowerBound;
|
||||
anUnitCtxLowerBound.ComputeFactors(NU);
|
||||
anUnitCtxLowerBound.ComputeFactors(NU, theLocalFactors);
|
||||
if (aMWU->IsKind(STANDARD_TYPE(StepBasic_PlaneAngleMeasureWithUnit)) ||
|
||||
aMWU->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI)))
|
||||
{
|
||||
@@ -3808,8 +3826,8 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
|
||||
if (aDimL.FindAttribute(XCAFDoc_Dimension::GetID(), aDim))
|
||||
{
|
||||
readAnnotation(aTR, theEnt, aDimObj);
|
||||
readConnectionPoints(aTR, theEnt, aDimObj);
|
||||
readAnnotation(aTR, theEnt, aDimObj, theLocalFactors);
|
||||
readConnectionPoints(aTR, theEnt, aDimObj, theLocalFactors);
|
||||
aDim->SetObject(aDimObj);
|
||||
}
|
||||
}
|
||||
@@ -3930,7 +3948,8 @@ static Standard_Boolean getTolType(const Handle(Standard_Transient)& theEnt,
|
||||
static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
const TDF_Label& theTolL,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS)
|
||||
const Handle(XSControl_WorkSession)& theWS,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
|
||||
Handle(XCAFDoc_DimTolTool) aDGTTool = XCAFDoc_DocumentTool::DimTolTool(theDoc->Main());
|
||||
@@ -3956,7 +3975,7 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) return;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
aVal = aVal * anUnitCtx.LengthFactor();
|
||||
aTolObj->SetValue(aVal);
|
||||
}
|
||||
@@ -3981,7 +4000,7 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) return;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
aVal = aVal * anUnitCtx.LengthFactor();
|
||||
aTolObj->SetValueOfZoneModifier(aVal);
|
||||
aTolObj->SetZoneModifier(XCAFDimTolObjects_GeomToleranceZoneModif_Projected);
|
||||
@@ -3999,7 +4018,7 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
if (!(anUnit.CaseNum(anUnit.Value()) == 1)) continue;
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
convertAngleValue(anUnitCtx, aVal);
|
||||
aTolObj->SetValueOfZoneModifier(aVal);
|
||||
aTolObj->SetZoneModifier(XCAFDimTolObjects_GeomToleranceZoneModif_Runout);
|
||||
@@ -4072,12 +4091,12 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
{
|
||||
Handle(StepBasic_NamedUnit) NU = anUnit.NamedUnit();
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
convertAngleValue(anUnitCtx, aVal);
|
||||
aTolObj->SetMaxValueModifier(aVal);
|
||||
}
|
||||
|
||||
readAnnotation(aTR, theEnt, aTolObj);
|
||||
readAnnotation(aTR, theEnt, aTolObj, theLocalFactors);
|
||||
aGTol->SetObject(aTolObj);
|
||||
}
|
||||
|
||||
@@ -4087,7 +4106,8 @@ static void setGeomTolObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSession)& theWS,
|
||||
const Handle(TDocStd_Document)& theDoc)
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
const Handle(Interface_InterfaceModel) &aModel = theWS->Model();
|
||||
const Interface_Graph& aGraph = theWS->Graph();
|
||||
@@ -4107,13 +4127,13 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
|
||||
if (anEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)) ||
|
||||
anEnt->IsKind(STANDARD_TYPE(StepShape_DimensionalLocation)) ||
|
||||
anEnt->IsKind(STANDARD_TYPE(StepDimTol_GeometricTolerance))) {
|
||||
TDF_Label aGDTL = createGDTObjectInXCAF(anEnt, theDoc, theWS);
|
||||
TDF_Label aGDTL = createGDTObjectInXCAF(anEnt, theDoc, theWS, theLocalFactors);
|
||||
if (!aGDTL.IsNull()) {
|
||||
if (anEnt->IsKind(STANDARD_TYPE(StepDimTol_GeometricTolerance))) {
|
||||
setGeomTolObjectToXCAF(anEnt, aGDTL, theDoc, theWS);
|
||||
setGeomTolObjectToXCAF(anEnt, aGDTL, theDoc, theWS, theLocalFactors);
|
||||
}
|
||||
else {
|
||||
setDimObjectToXCAF(anEnt, aGDTL, theDoc, theWS);
|
||||
setDimObjectToXCAF(anEnt, aGDTL, theDoc, theWS, theLocalFactors);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4200,20 +4220,21 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
|
||||
|
||||
// Calculate unit
|
||||
Standard_Real aFact = 1.0;
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
if (!aDMIA.IsNull())
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor;
|
||||
Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
|
||||
anActor.PrepareUnits(aDMIA->UsedRepresentation(), aTP);
|
||||
aFact = StepData_GlobalFactors::Intance().LengthFactor();
|
||||
anActor.PrepareUnits(aDMIA->UsedRepresentation(), aTP, aLocalFactors);
|
||||
aFact = aLocalFactors.LengthFactor();
|
||||
}
|
||||
|
||||
// Presentation
|
||||
TopoDS_Shape aPresentation;
|
||||
Handle(TCollection_HAsciiString) aPresentName;
|
||||
Bnd_Box aBox;
|
||||
if (!readPMIPresentation(anEnt, aTR, aFact, aPresentation, aPresentName, aBox))
|
||||
if (!readPMIPresentation(anEnt, aTR, aFact, aPresentation, aPresentName, aBox, aLocalFactors))
|
||||
continue;
|
||||
// Annotation plane
|
||||
Handle(StepVisual_AnnotationPlane) anAnPlane;
|
||||
@@ -4240,7 +4261,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
|
||||
aDGTTool->SetDimension(aShapesL, anEmptySeq2, aGDTL);
|
||||
gp_Ax2 aPlaneAxes;
|
||||
if (!anAnPlane.IsNull()) {
|
||||
if (readAnnotationPlane(anAnPlane, aPlaneAxes))
|
||||
if (readAnnotationPlane(anAnPlane, aPlaneAxes, aLocalFactors))
|
||||
aDimObj->SetPlane(aPlaneAxes);
|
||||
}
|
||||
aDimObj->SetPresentation(aPresentation, aPresentName);
|
||||
@@ -4298,7 +4319,8 @@ static Handle(StepShape_SolidModel) FindSolidForPDS(const Handle(StepRepr_Produc
|
||||
|
||||
Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_WorkSession) &WS,
|
||||
const Handle(TDocStd_Document)& Doc,
|
||||
const Handle(TColStd_HSequenceOfTransient)& SeqPDS) const
|
||||
const Handle(TColStd_HSequenceOfTransient)& SeqPDS,
|
||||
const StepData_Factors& theLocalFactors) const
|
||||
{
|
||||
const Handle(XSControl_TransferReader) &TR = WS->TransferReader();
|
||||
const Handle(Transfer_TransientProcess) &TP = TR->TransientProcess();
|
||||
@@ -4366,11 +4388,11 @@ Standard_Boolean STEPCAFControl_Reader::ReadMaterials(const Handle(XSControl_Wor
|
||||
NU->IsKind(STANDARD_TYPE(StepBasic_SiUnitAndLengthUnit)))
|
||||
{
|
||||
STEPConstruct_UnitContext anUnitCtx;
|
||||
anUnitCtx.ComputeFactors(NU);
|
||||
anUnitCtx.ComputeFactors(NU, theLocalFactors);
|
||||
aDensity = aDensity / (anUnitCtx.LengthFactor()*anUnitCtx.LengthFactor()*anUnitCtx.LengthFactor());
|
||||
// transfer length value for Density from millimeter to santimeter
|
||||
// in order to result density has dimension gram/(sm*sm*sm)
|
||||
const Standard_Real aCascadeUnit = StepData_GlobalFactors::Intance().CascadeUnit();
|
||||
const Standard_Real aCascadeUnit = theLocalFactors.CascadeUnit();
|
||||
aDensity = aDensity*1000. / (aCascadeUnit * aCascadeUnit * aCascadeUnit);
|
||||
}
|
||||
if (NU->IsKind(STANDARD_TYPE(StepBasic_ConversionBasedUnitAndMassUnit))) {
|
||||
@@ -4451,7 +4473,8 @@ void collectViewShapes(const Handle(XSControl_WorkSession)& theWS,
|
||||
//=======================================================================
|
||||
Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_GeometricRepresentationItem)& theClippingCameraModel,
|
||||
TDF_LabelSequence& theClippingPlanes,
|
||||
const Handle(XCAFDoc_ClippingPlaneTool)& theTool)
|
||||
const Handle(XCAFDoc_ClippingPlaneTool)& theTool,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
Handle(TCollection_HAsciiString) anExpression = new TCollection_HAsciiString();
|
||||
NCollection_Sequence<Handle(StepGeom_GeometricRepresentationItem)> aPlanes;
|
||||
@@ -4470,7 +4493,7 @@ Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_Geome
|
||||
Handle(StepVisual_CameraModelD3MultiClippingUnion) aCameraModelUnion =
|
||||
aCameraModel->ShapeClipping()->Value(1).CameraModelD3MultiClippingUnion();
|
||||
if (!aCameraModelUnion.IsNull())
|
||||
return buildClippingPlanes(aCameraModelUnion, theClippingPlanes, theTool);
|
||||
return buildClippingPlanes(aCameraModelUnion, theClippingPlanes, theTool, theLocalFactors);
|
||||
}
|
||||
for (Standard_Integer i = 1; i <= aCameraModel->ShapeClipping()->Length(); i++) {
|
||||
aPlanes.Append(Handle(StepGeom_GeometricRepresentationItem)::DownCast(aCameraModel->ShapeClipping()->Value(i).Value()));
|
||||
@@ -4496,7 +4519,7 @@ Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_Geome
|
||||
for (Standard_Integer i = 1; i <= aPlanes.Length(); i++) {
|
||||
Handle(StepGeom_Plane) aPlaneEnt = Handle(StepGeom_Plane)::DownCast(aPlanes.Value(i));
|
||||
if (!aPlaneEnt.IsNull()) {
|
||||
Handle(Geom_Plane) aPlane = StepToGeom::MakePlane(aPlaneEnt);
|
||||
Handle(Geom_Plane) aPlane = StepToGeom::MakePlane(aPlaneEnt, theLocalFactors);
|
||||
if (!aPlane.IsNull()) {
|
||||
TDF_Label aPlaneL = theTool->AddClippingPlane(aPlane->Pln(), aPlaneEnt->Name());
|
||||
theClippingPlanes.Append(aPlaneL);
|
||||
@@ -4506,7 +4529,7 @@ Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_Geome
|
||||
}
|
||||
}
|
||||
else {
|
||||
anExpression->AssignCat(buildClippingPlanes(aPlanes.Value(i), theClippingPlanes, theTool));
|
||||
anExpression->AssignCat(buildClippingPlanes(aPlanes.Value(i), theClippingPlanes, theTool, theLocalFactors));
|
||||
}
|
||||
anExpression->AssignCat(anOperation);
|
||||
}
|
||||
@@ -4520,7 +4543,9 @@ Handle(TCollection_HAsciiString) buildClippingPlanes(const Handle(StepGeom_Geome
|
||||
//function : ReadViews
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSession)& theWS, const Handle(TDocStd_Document)& theDoc) const
|
||||
Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSession)& theWS,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const StepData_Factors& theLocalFactors) const
|
||||
{
|
||||
const Handle(Interface_InterfaceModel) &aModel = theWS->Model();
|
||||
Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
|
||||
@@ -4551,15 +4576,16 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
|
||||
}
|
||||
aDModel = Handle(StepVisual_DraughtingModel)::DownCast(subs.Value());
|
||||
}
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
if (!aDModel.IsNull())
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer();
|
||||
STEPControl_ActorRead anActor;
|
||||
anActor.PrepareUnits(aDModel, aTP);
|
||||
anActor.PrepareUnits(aDModel, aTP, aLocalFactors);
|
||||
}
|
||||
|
||||
anObj->SetName(aCameraModel->Name());
|
||||
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aCameraModel->ViewReferenceSystem());
|
||||
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(aCameraModel->ViewReferenceSystem(), aLocalFactors);
|
||||
anObj->SetViewDirection(anAxis->Direction());
|
||||
anObj->SetUpDirection(anAxis->Direction() ^ anAxis->XDirection());
|
||||
Handle(StepVisual_ViewVolume) aViewVolume = aCameraModel->PerspectiveOfVolume();
|
||||
@@ -4569,7 +4595,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
|
||||
else if (aViewVolume->ProjectionType() == StepVisual_copParallel)
|
||||
aType = XCAFView_ProjectionType_Parallel;
|
||||
anObj->SetType(aType);
|
||||
Handle(Geom_CartesianPoint) aPoint = StepToGeom::MakeCartesianPoint(aViewVolume->ProjectionPoint());
|
||||
Handle(Geom_CartesianPoint) aPoint = StepToGeom::MakeCartesianPoint(aViewVolume->ProjectionPoint(), aLocalFactors);
|
||||
anObj->SetProjectionPoint(aPoint->Pnt());
|
||||
anObj->SetZoomFactor(aViewVolume->ViewPlaneDistance());
|
||||
anObj->SetWindowHorizontalSize(aViewVolume->ViewWindow()->SizeInX());
|
||||
@@ -4586,7 +4612,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadViews(const Handle(XSControl_WorkSes
|
||||
if (!aClippingCameraModel.IsNull()) {
|
||||
Handle(TCollection_HAsciiString) aClippingExpression;
|
||||
Handle(XCAFDoc_ClippingPlaneTool) aClippingPlaneTool = XCAFDoc_DocumentTool::ClippingPlaneTool(theDoc->Main());
|
||||
aClippingExpression = buildClippingPlanes(aClippingCameraModel, aClippingPlanes, aClippingPlaneTool);
|
||||
aClippingExpression = buildClippingPlanes(aClippingCameraModel, aClippingPlanes, aClippingPlaneTool, aLocalFactors);
|
||||
anObj->SetClippingExpression(aClippingExpression);
|
||||
}
|
||||
|
||||
|
@@ -38,6 +38,7 @@ class StepShape_ConnectedFaceSet;
|
||||
class StepRepr_NextAssemblyUsageOccurrence;
|
||||
class STEPConstruct_Tool;
|
||||
class StepDimTol_Datum;
|
||||
class StepData_Factors;
|
||||
|
||||
|
||||
//! Provides a tool to read STEP file and put it into
|
||||
@@ -212,7 +213,8 @@ protected:
|
||||
//! corresponding color assignments in the DECAF document
|
||||
Standard_EXPORT Standard_Boolean ReadColors
|
||||
(const Handle(XSControl_WorkSession)& WS,
|
||||
const Handle(TDocStd_Document)& doc) const;
|
||||
const Handle(TDocStd_Document)& doc,
|
||||
const StepData_Factors& theLocalFactors) const;
|
||||
|
||||
//! Reads names of parts defined in the STEP model and
|
||||
//! assigns them to corresponding labels in the DECAF document
|
||||
@@ -221,7 +223,10 @@ protected:
|
||||
//! Reads validation properties assigned to shapes in the STEP
|
||||
//! model and assigns them to corresponding labels in the DECAF
|
||||
//! document
|
||||
Standard_EXPORT Standard_Boolean ReadValProps (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc, const STEPCAFControl_DataMapOfPDExternFile& PDFileMap) const;
|
||||
Standard_EXPORT Standard_Boolean ReadValProps (const Handle(XSControl_WorkSession)& WS,
|
||||
const Handle(TDocStd_Document)& doc,
|
||||
const STEPCAFControl_DataMapOfPDExternFile& PDFileMap,
|
||||
const StepData_Factors& theLocalFactors) const;
|
||||
|
||||
//! Reads layers of parts defined in the STEP model and
|
||||
//! set reference between shape and layers in the DECAF document
|
||||
@@ -233,14 +238,21 @@ protected:
|
||||
|
||||
//! Reads D> for instances defined in the STEP model and
|
||||
//! set reference between shape instances from different assemblyes
|
||||
Standard_EXPORT Standard_Boolean ReadGDTs (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc);
|
||||
Standard_EXPORT Standard_Boolean ReadGDTs (const Handle(XSControl_WorkSession)& WS,
|
||||
const Handle(TDocStd_Document)& doc,
|
||||
const StepData_Factors& theLocalFactors);
|
||||
|
||||
//! Reads materials for instances defined in the STEP model and
|
||||
//! set reference between shape instances from different assemblyes
|
||||
Standard_EXPORT Standard_Boolean ReadMaterials (const Handle(XSControl_WorkSession)& WS, const Handle(TDocStd_Document)& doc, const Handle(TColStd_HSequenceOfTransient)& SeqPDS) const;
|
||||
Standard_EXPORT Standard_Boolean ReadMaterials (const Handle(XSControl_WorkSession)& WS,
|
||||
const Handle(TDocStd_Document)& doc,
|
||||
const Handle(TColStd_HSequenceOfTransient)& SeqPDS,
|
||||
const StepData_Factors& theLocalFactors) const;
|
||||
|
||||
//! Reads Views for instances defined in the STEP model
|
||||
Standard_EXPORT Standard_Boolean ReadViews(const Handle(XSControl_WorkSession)& theWS, const Handle(TDocStd_Document)& theDoc) const;
|
||||
Standard_EXPORT Standard_Boolean ReadViews(const Handle(XSControl_WorkSession)& theWS,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const StepData_Factors& theLocalFactors) const;
|
||||
|
||||
//! Populates the sub-Label of the passed TDF Label with shape
|
||||
//! data associated with the given STEP Representation Item,
|
||||
@@ -281,22 +293,26 @@ private:
|
||||
const XCAFDimTolObjects_DatumModifWithValue theXCAFModifWithVal,
|
||||
const Standard_Real theModifValue,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS);
|
||||
const Handle(XSControl_WorkSession)& theWS,
|
||||
const StepData_Factors& theLocalFactors);
|
||||
|
||||
//! Internal method. Read Datums, connected to GeomTolerance theGDTL.
|
||||
Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt,
|
||||
const TDF_Label theGDTL,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS);
|
||||
const Handle(XSControl_WorkSession)& theWS,
|
||||
const StepData_Factors& theLocalFactors);
|
||||
|
||||
//! Internal method. Read Dimension or GeomTolerance.
|
||||
TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
const Handle(XSControl_WorkSession)& theWS);
|
||||
const Handle(XSControl_WorkSession)& theWS,
|
||||
const StepData_Factors& theLocalFactors);
|
||||
|
||||
//! Prepares units for transfer
|
||||
void prepareUnits(const Handle(StepData_StepModel)& theModel,
|
||||
const Handle(TDocStd_Document)& theDoc) const;
|
||||
const Handle(TDocStd_Document)& theDoc,
|
||||
StepData_Factors& theLocalFactors) const;
|
||||
|
||||
private:
|
||||
|
||||
|
@@ -56,6 +56,7 @@
|
||||
#include <STEPConstruct_Styles.hxx>
|
||||
#include <STEPConstruct_ValidationProps.hxx>
|
||||
#include <STEPControl_StepModelType.hxx>
|
||||
#include <StepData_Factors.hxx>
|
||||
#include <StepData_Logical.hxx>
|
||||
#include <StepData_StepModel.hxx>
|
||||
#include <StepDimTol_AngularityTolerance.hxx>
|
||||
@@ -348,18 +349,21 @@ IFSelect_ReturnStatus STEPCAFControl_Writer::Write(const Standard_CString theFil
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void STEPCAFControl_Writer::prepareUnit(const TDF_Label& theLabel,
|
||||
const Handle(StepData_StepModel)& theModel)
|
||||
const Handle(StepData_StepModel)& theModel,
|
||||
StepData_Factors& theLocalFactors)
|
||||
{
|
||||
Handle(XCAFDoc_LengthUnit) aLengthAttr;
|
||||
if (!theLabel.IsNull() &&
|
||||
theLabel.Root().FindAttribute(XCAFDoc_LengthUnit::GetID(), aLengthAttr))
|
||||
{
|
||||
theModel->SetLocalLengthUnit(aLengthAttr->GetUnitValue() * 1000); // convert to mm
|
||||
theLocalFactors.SetCascadeUnit(aLengthAttr->GetUnitValue() * 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
theModel->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
theLocalFactors.SetCascadeUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -511,8 +515,9 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
|
||||
Handle(STEPCAFControl_ActorWrite) anActor =
|
||||
Handle(STEPCAFControl_ActorWrite)::DownCast(theWriter.WS()->NormAdaptor()->ActorWrite());
|
||||
|
||||
StepData_Factors aLocalFactors;
|
||||
const Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(theWriter.WS()->Model());
|
||||
prepareUnit(theLabels.First(), aModel); // set local length unit to the model
|
||||
prepareUnit(theLabels.First(), aModel, aLocalFactors); // set local length unit to the model
|
||||
// translate free top-level shapes of the DECAF document
|
||||
const Standard_Integer aStepSchema = Interface_Static::IVal("write.step.schema");
|
||||
TDF_LabelSequence aSubLabels;
|
||||
@@ -614,7 +619,7 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
|
||||
{
|
||||
// translate final solids
|
||||
Message_ProgressScope aPS1(aRange, NULL, 2);
|
||||
TopoDS_Shape aSass = transferExternFiles(aCurL, theMode, aSubLabels, theIsMulti, aPS1.Next());
|
||||
TopoDS_Shape aSass = transferExternFiles(aCurL, theMode, aSubLabels, aLocalFactors, theIsMulti, aPS1.Next());
|
||||
if (aPS1.UserBreak())
|
||||
return Standard_False;
|
||||
|
||||
@@ -653,7 +658,7 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
|
||||
{
|
||||
if (aStepSchema == 5)
|
||||
{
|
||||
writeDGTsAP242(theWriter.WS(), aSubLabels);
|
||||
writeDGTsAP242(theWriter.WS(), aSubLabels, aLocalFactors);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -733,6 +738,7 @@ Standard_Boolean STEPCAFControl_Writer::transfer(STEPControl_Writer& theWriter,
|
||||
TopoDS_Shape STEPCAFControl_Writer::transferExternFiles(const TDF_Label& theLabel,
|
||||
const STEPControl_StepModelType theMode,
|
||||
TDF_LabelSequence& theLabels,
|
||||
const StepData_Factors& theLocalFactors,
|
||||
const Standard_CString thePrefix,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
@@ -815,7 +821,7 @@ TopoDS_Shape STEPCAFControl_Writer::transferExternFiles(const TDF_Label& theLabe
|
||||
TDF_Label aRefL;
|
||||
if (!XCAFDoc_ShapeTool::GetReferredShape(aCurL, aRefL))
|
||||
continue;
|
||||
TopoDS_Shape aShComp = transferExternFiles(aRefL, theMode, theLabels, thePrefix, aPS.Next());
|
||||
TopoDS_Shape aShComp = transferExternFiles(aRefL, theMode, theLabels, theLocalFactors, thePrefix, aPS.Next());
|
||||
aShComp.Location(XCAFDoc_ShapeTool::GetLocation(aCurL));
|
||||
aBuilder.Add(aComp, aShComp);
|
||||
}
|
||||
@@ -2457,7 +2463,8 @@ void STEPCAFControl_Writer::writePresentation(const Handle(XSControl_WorkSession
|
||||
const Standard_Boolean theHasPlane,
|
||||
const gp_Ax2& theAnnotationPlane,
|
||||
const gp_Pnt& theTextPosition,
|
||||
const Handle(Standard_Transient)& theDimension)
|
||||
const Handle(Standard_Transient)& theDimension,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
if (thePresentation.IsNull())
|
||||
return;
|
||||
@@ -2508,7 +2515,7 @@ void STEPCAFControl_Writer::writePresentation(const Handle(XSControl_WorkSession
|
||||
aPrsStyles->SetValue(1, aPrsStyle);
|
||||
// Plane
|
||||
Handle(StepGeom_Plane) aPlane = new StepGeom_Plane();
|
||||
GeomToStep_MakeAxis2Placement3d anAxisMaker(theAnnotationPlane);
|
||||
GeomToStep_MakeAxis2Placement3d anAxisMaker(theAnnotationPlane, theLocalFactors);
|
||||
const Handle(StepGeom_Axis2Placement3d)& anAxis = anAxisMaker.Value();
|
||||
// Set text position to plane origin
|
||||
Handle(StepGeom_CartesianPoint) aTextPos = new StepGeom_CartesianPoint();
|
||||
@@ -2540,7 +2547,8 @@ Handle(StepDimTol_Datum) STEPCAFControl_Writer::writeDatumAP242(const Handle(XSC
|
||||
const TDF_LabelSequence& theShapeL,
|
||||
const TDF_Label& theDatumL,
|
||||
const Standard_Boolean theIsFirstDTarget,
|
||||
const Handle(StepDimTol_Datum)& theWrittenDatum)
|
||||
const Handle(StepDimTol_Datum)& theWrittenDatum,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
// Get working data
|
||||
const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
|
||||
@@ -2694,7 +2702,7 @@ Handle(StepDimTol_Datum) STEPCAFControl_Writer::writeDatumAP242(const Handle(XSC
|
||||
// Common for all datum targets
|
||||
StepBasic_Unit aUnit = GetUnit(aRC);
|
||||
gp_Ax2 aDTAxis = anObject->GetDatumTargetAxis();
|
||||
GeomToStep_MakeAxis2Placement3d anAxisMaker(aDTAxis);
|
||||
GeomToStep_MakeAxis2Placement3d anAxisMaker(aDTAxis, theLocalFactors);
|
||||
Handle(StepGeom_Axis2Placement3d) anA2P3D = anAxisMaker.Value();
|
||||
anA2P3D->SetName(new TCollection_HAsciiString("orientation"));
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) anItems;
|
||||
@@ -2788,7 +2796,7 @@ Handle(StepDimTol_Datum) STEPCAFControl_Writer::writeDatumAP242(const Handle(XSC
|
||||
|
||||
//Annotation plane and Presentation
|
||||
writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), Standard_True, anObject->HasPlane(),
|
||||
anObject->GetPlane(), anObject->GetPointTextAttach(), aSA);
|
||||
anObject->GetPlane(), anObject->GetPointTextAttach(), aSA, theLocalFactors);
|
||||
|
||||
return aDatum;
|
||||
}
|
||||
@@ -2801,7 +2809,8 @@ Handle(StepDimTol_Datum) STEPCAFControl_Writer::writeDatumAP242(const Handle(XSC
|
||||
static void WriteDimValues(const Handle(XSControl_WorkSession)& theWS,
|
||||
const Handle(XCAFDimTolObjects_DimensionObject)& theObject,
|
||||
const Handle(StepRepr_RepresentationContext)& theRC,
|
||||
const StepShape_DimensionalCharacteristic& theDimension)
|
||||
const StepShape_DimensionalCharacteristic& theDimension,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
// Get working data
|
||||
const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
|
||||
@@ -2928,7 +2937,7 @@ static void WriteDimValues(const Handle(XSControl_WorkSession)& theWS,
|
||||
Handle(StepGeom_Axis2Placement3d) anOrientation = new StepGeom_Axis2Placement3d();
|
||||
gp_Dir aDir;
|
||||
theObject->GetDirection(aDir);
|
||||
GeomToStep_MakeCartesianPoint MkPoint(gp_Pnt(0, 0, 0));
|
||||
GeomToStep_MakeCartesianPoint MkPoint(gp_Pnt(0, 0, 0), theLocalFactors.LengthFactor());
|
||||
const Handle(StepGeom_CartesianPoint)& aLoc = MkPoint.Value();
|
||||
Handle(StepGeom_Direction) anAxis = new StepGeom_Direction();
|
||||
Handle(TColStd_HArray1OfReal) aCoords = new TColStd_HArray1OfReal(1, 3);
|
||||
@@ -3025,13 +3034,14 @@ static void WriteDerivedGeometry(const Handle(XSControl_WorkSession)& theWS,
|
||||
const Handle(StepRepr_ConstructiveGeometryRepresentation)& theRepr,
|
||||
Handle(StepRepr_ShapeAspect)& theFirstSA,
|
||||
Handle(StepRepr_ShapeAspect)& theSecondSA,
|
||||
NCollection_Vector<Handle(StepGeom_CartesianPoint)>& thePnts)
|
||||
NCollection_Vector<Handle(StepGeom_CartesianPoint)>& thePnts,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
|
||||
// First point
|
||||
if (theObject->HasPoint())
|
||||
{
|
||||
GeomToStep_MakeCartesianPoint aPointMaker(theObject->GetPoint());
|
||||
GeomToStep_MakeCartesianPoint aPointMaker(theObject->GetPoint(), theLocalFactors.LengthFactor());
|
||||
Handle(StepGeom_CartesianPoint) aPoint = aPointMaker.Value();
|
||||
thePnts.Append(aPoint);
|
||||
Handle(StepRepr_DerivedShapeAspect) aDSA = new StepRepr_DerivedShapeAspect();
|
||||
@@ -3052,7 +3062,7 @@ static void WriteDerivedGeometry(const Handle(XSControl_WorkSession)& theWS,
|
||||
// Second point (for locations)
|
||||
if (theObject->HasPoint2())
|
||||
{
|
||||
GeomToStep_MakeCartesianPoint aPointMaker(theObject->GetPoint2());
|
||||
GeomToStep_MakeCartesianPoint aPointMaker(theObject->GetPoint2(), theLocalFactors.LengthFactor());
|
||||
Handle(StepGeom_CartesianPoint) aPoint = aPointMaker.Value();
|
||||
thePnts.Append(aPoint);
|
||||
Handle(StepRepr_DerivedShapeAspect) aDSA = new StepRepr_DerivedShapeAspect();
|
||||
@@ -3080,7 +3090,8 @@ static Handle(StepDimTol_HArray1OfDatumSystemOrReference) WriteDatumSystem(const
|
||||
const TDF_Label theGeomTolL,
|
||||
const TDF_LabelSequence& theDatumSeq,
|
||||
const STEPConstruct_DataMapOfAsciiStringTransient& theDatumMap,
|
||||
const Handle(StepRepr_RepresentationContext)& theRC)
|
||||
const Handle(StepRepr_RepresentationContext)& theRC,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
// Get working data
|
||||
const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
|
||||
@@ -3249,7 +3260,7 @@ static Handle(StepDimTol_HArray1OfDatumSystemOrReference) WriteDatumSystem(const
|
||||
// Axis
|
||||
if (anObject->HasAxis())
|
||||
{
|
||||
GeomToStep_MakeAxis2Placement3d anAxisMaker(anObject->GetAxis());
|
||||
GeomToStep_MakeAxis2Placement3d anAxisMaker(anObject->GetAxis(), theLocalFactors);
|
||||
Handle(StepGeom_Axis2Placement3d) anAxis = anAxisMaker.Value();
|
||||
anAxis->SetName(new TCollection_HAsciiString("orientation"));
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = new StepAP242_GeometricItemSpecificUsage();
|
||||
@@ -3335,7 +3346,8 @@ void STEPCAFControl_Writer::writeGeomTolerance(const Handle(XSControl_WorkSessio
|
||||
const TDF_LabelSequence& theShapeSeqL,
|
||||
const TDF_Label& theGeomTolL,
|
||||
const Handle(StepDimTol_HArray1OfDatumSystemOrReference)& theDatumSystem,
|
||||
const Handle(StepRepr_RepresentationContext)& theRC)
|
||||
const Handle(StepRepr_RepresentationContext)& theRC,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
// Get working data
|
||||
const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
|
||||
@@ -3532,7 +3544,7 @@ void STEPCAFControl_Writer::writeGeomTolerance(const Handle(XSControl_WorkSessio
|
||||
writeToleranceZone(theWS, anObject, aGeomTol, theRC);
|
||||
//Annotation plane and Presentation
|
||||
writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), Standard_True, anObject->HasPlane(),
|
||||
anObject->GetPlane(), anObject->GetPointTextAttach(), aGeomTol);
|
||||
anObject->GetPlane(), anObject->GetPointTextAttach(), aGeomTol, theLocalFactors);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -3914,7 +3926,8 @@ Standard_Boolean STEPCAFControl_Writer::writeDGTs(const Handle(XSControl_WorkSes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_WorkSession)& theWS,
|
||||
const TDF_LabelSequence& theLabels)
|
||||
const TDF_LabelSequence& theLabels,
|
||||
const StepData_Factors& theLocalFactors)
|
||||
{
|
||||
(void)theLabels;
|
||||
// Get working data
|
||||
@@ -3970,7 +3983,8 @@ Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_Wo
|
||||
Handle(Standard_Transient) aWrittenDatum;
|
||||
Standard_Boolean isFirstDT = !aDatumMap.Find(aDatumName, aWrittenDatum);
|
||||
Handle(StepDimTol_Datum) aDatum = writeDatumAP242(theWS, aShapeL, aDatumL, isFirstDT,
|
||||
Handle(StepDimTol_Datum)::DownCast(aWrittenDatum));
|
||||
Handle(StepDimTol_Datum)::DownCast(aWrittenDatum),
|
||||
theLocalFactors);
|
||||
// Add created Datum into Map
|
||||
aDatumMap.Bind(aDatumName, aDatum);
|
||||
}
|
||||
@@ -4012,7 +4026,7 @@ Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_Wo
|
||||
aSA->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), myGDTCommonPDS, StepData_LTrue);
|
||||
aModel->AddWithRefs(aSA);
|
||||
writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->HasPlane(),
|
||||
Standard_False, anObject->GetPlane(), anObject->GetPointTextAttach(), aSA);
|
||||
Standard_False, anObject->GetPlane(), anObject->GetPointTextAttach(), aSA, theLocalFactors);
|
||||
}
|
||||
|
||||
if (!XCAFDoc_DimTolTool::GetRefShapeLabel(aDimensionL, aFirstShapeL, aSecondShapeL))
|
||||
@@ -4084,14 +4098,14 @@ Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_Wo
|
||||
if (anObject->GetType() == XCAFDimTolObjects_DimensionType_DimensionPresentation)
|
||||
{
|
||||
writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->HasPlane(),
|
||||
Standard_False, anObject->GetPlane(), anObject->GetPointTextAttach(), aFirstSA);
|
||||
Standard_False, anObject->GetPlane(), anObject->GetPointTextAttach(), aFirstSA, theLocalFactors);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Write dimensions
|
||||
StepShape_DimensionalCharacteristic aDimension;
|
||||
if (anObject->HasPoint() || anObject->HasPoint2())
|
||||
WriteDerivedGeometry(theWS, anObject, aCGRepr, aFirstSA, aSecondSA, aConnectionPnts);
|
||||
WriteDerivedGeometry(theWS, anObject, aCGRepr, aFirstSA, aSecondSA, aConnectionPnts, theLocalFactors);
|
||||
XCAFDimTolObjects_DimensionType aDimType = anObject->GetType();
|
||||
if (STEPCAFControl_GDTProperty::IsDimensionalLocation(aDimType))
|
||||
{
|
||||
@@ -4165,10 +4179,10 @@ Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_Wo
|
||||
}
|
||||
|
||||
// Write values
|
||||
WriteDimValues(theWS, anObject, aRC, aDimension);
|
||||
WriteDimValues(theWS, anObject, aRC, aDimension, theLocalFactors);
|
||||
//Annotation plane and Presentation
|
||||
writePresentation(theWS, anObject->GetPresentation(), anObject->GetPresentationName(), Standard_True, anObject->HasPlane(),
|
||||
anObject->GetPlane(), anObject->GetPointTextAttach(), aDimension.Value());
|
||||
anObject->GetPlane(), anObject->GetPointTextAttach(), aDimension.Value(), theLocalFactors);
|
||||
}
|
||||
// Write Derived geometry
|
||||
if (aConnectionPnts.Length() > 0)
|
||||
@@ -4203,8 +4217,8 @@ Standard_Boolean STEPCAFControl_Writer::writeDGTsAP242(const Handle(XSControl_Wo
|
||||
XCAFDoc_DimTolTool::GetDatumWithObjectOfTolerLabels(aGeomTolL, aDatumSeq);
|
||||
Handle(StepDimTol_HArray1OfDatumSystemOrReference) aDatumSystem;
|
||||
if (aDatumSeq.Length() > 0)
|
||||
aDatumSystem = WriteDatumSystem(theWS, aGeomTolL, aDatumSeq, aDatumMap, aRC);
|
||||
writeGeomTolerance(theWS, aFirstShapeL, aGeomTolL, aDatumSystem, aRC);
|
||||
aDatumSystem = WriteDatumSystem(theWS, aGeomTolL, aDatumSeq, aDatumMap, aRC, theLocalFactors);
|
||||
writeGeomTolerance(theWS, aFirstShapeL, aGeomTolL, aDatumSystem, aRC, theLocalFactors);
|
||||
}
|
||||
|
||||
// Write Draughting model for Annotation Planes
|
||||
|
@@ -38,6 +38,7 @@ class XSControl_WorkSession;
|
||||
class TDocStd_Document;
|
||||
class STEPCAFControl_ExternFile;
|
||||
class TopoDS_Shape;
|
||||
class StepData_Factors;
|
||||
|
||||
//! Provides a tool to write DECAF document to the
|
||||
//! STEP file. Besides transfer of shapes (including
|
||||
@@ -188,6 +189,7 @@ protected:
|
||||
TopoDS_Shape transferExternFiles(const TDF_Label& theLabel,
|
||||
const STEPControl_StepModelType theMode,
|
||||
TDF_LabelSequence& theLabelSeq,
|
||||
const StepData_Factors& theLocalFactors,
|
||||
const Standard_CString thePrefix = "",
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
@@ -209,7 +211,8 @@ protected:
|
||||
|
||||
//! Write D>s assigned to specified labels, to STEP model, according AP242
|
||||
Standard_Boolean writeDGTsAP242(const Handle(XSControl_WorkSession)& theWS,
|
||||
const TDF_LabelSequence& theLabels);
|
||||
const TDF_LabelSequence& theLabels,
|
||||
const StepData_Factors& theLocalFactors);
|
||||
|
||||
//! Write materials assigned to specified labels, to STEP model
|
||||
Standard_Boolean writeMaterials(const Handle(XSControl_WorkSession)& theWS,
|
||||
@@ -233,7 +236,8 @@ protected:
|
||||
//! If it exists, initializes local length unit from it
|
||||
//! Else initializes according to Cascade length unit
|
||||
void prepareUnit(const TDF_Label& theLabel,
|
||||
const Handle(StepData_StepModel)& theModel);
|
||||
const Handle(StepData_StepModel)& theModel,
|
||||
StepData_Factors& theLocalFactors);
|
||||
|
||||
Handle(StepRepr_ShapeAspect) writeShapeAspect(const Handle(XSControl_WorkSession)& theWS,
|
||||
const TDF_Label theLabel,
|
||||
@@ -248,13 +252,15 @@ protected:
|
||||
const Standard_Boolean theHasPlane,
|
||||
const gp_Ax2& theAnnotationPlane,
|
||||
const gp_Pnt& theTextPosition,
|
||||
const Handle(Standard_Transient)& theDimension);
|
||||
const Handle(Standard_Transient)& theDimension,
|
||||
const StepData_Factors& theLocalFactors);
|
||||
|
||||
Handle(StepDimTol_Datum) writeDatumAP242(const Handle(XSControl_WorkSession)& theWS,
|
||||
const TDF_LabelSequence& theShapeL,
|
||||
const TDF_Label& theDatumL,
|
||||
const Standard_Boolean isFirstDTarget,
|
||||
const Handle(StepDimTol_Datum)& theWrittenDatum);
|
||||
const Handle(StepDimTol_Datum)& theWrittenDatum,
|
||||
const StepData_Factors& theLocalFactors);
|
||||
|
||||
void writeToleranceZone(const Handle(XSControl_WorkSession)& theWS,
|
||||
const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject,
|
||||
@@ -265,7 +271,8 @@ protected:
|
||||
const TDF_LabelSequence& theShapeSeqL,
|
||||
const TDF_Label& theGeomTolL,
|
||||
const Handle(StepDimTol_HArray1OfDatumSystemOrReference)& theDatumSystem,
|
||||
const Handle(StepRepr_RepresentationContext)& theRC);
|
||||
const Handle(StepRepr_RepresentationContext)& theRC,
|
||||
const StepData_Factors& theLocalFactors);
|
||||
|
||||
private:
|
||||
|
||||
|
Reference in New Issue
Block a user