mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0033483: Data Exchange - Static_Interface local instance for the model
StepData_StepParameters class created and used instead of Interface_Static
This commit is contained in:
@@ -211,9 +211,10 @@ namespace {
|
||||
// Purpose : Empty constructor
|
||||
// ============================================================================
|
||||
|
||||
STEPControl_ActorRead::STEPControl_ActorRead()
|
||||
STEPControl_ActorRead::STEPControl_ActorRead(const Handle(Interface_InterfaceModel)& theModel)
|
||||
: myPrecision(0.0),
|
||||
myMaxTol(0.0)
|
||||
myMaxTol(0.0),
|
||||
myModel(theModel)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -231,8 +232,13 @@ Standard_Boolean STEPControl_ActorRead::Recognize
|
||||
|
||||
if (start->IsKind(STANDARD_TYPE(StepRepr_NextAssemblyUsageOccurrence))) return Standard_True;
|
||||
|
||||
TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode");
|
||||
if(!aProdMode.IsEqual("ON"))
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(myModel);
|
||||
if (aStepModel.IsNull())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool aProdMode = aStepModel->InternalParameters.ReadProductMode;
|
||||
if(!aProdMode)
|
||||
if(start->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) return Standard_True;
|
||||
|
||||
DeclareAndCast(StepShape_ShapeRepresentation,sr,start);
|
||||
@@ -244,7 +250,7 @@ Standard_Boolean STEPControl_ActorRead::Recognize
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const Standard_Boolean aCanReadTessGeom = (Interface_Static::IVal("read.step.tessellated") != 0);
|
||||
const Standard_Boolean aCanReadTessGeom = aStepModel->InternalParameters.ReadTessellated != 0;
|
||||
|
||||
if (start->IsKind(STANDARD_TYPE(StepShape_FacetedBrep))) return Standard_True;
|
||||
if (start->IsKind(STANDARD_TYPE(StepShape_BrepWithVoids))) return Standard_True;
|
||||
@@ -327,7 +333,7 @@ Handle(Transfer_Binder) STEPControl_ActorRead::Transfer
|
||||
}
|
||||
}
|
||||
// [END] Get version of preprocessor (to detect I-Deas case) (ssv; 23.11.2010)
|
||||
Standard_Boolean aTrsfUse = (Interface_Static::IVal("read.step.root.transformation") == 1);
|
||||
Standard_Boolean aTrsfUse = (aStepModel->InternalParameters.ReadRootTransformation == 1);
|
||||
return TransferShape(start, TP, aLocalFactors, Standard_True, aTrsfUse, theProgress);
|
||||
}
|
||||
|
||||
@@ -431,10 +437,12 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
|
||||
Handle(TColStd_HSequenceOfTransient)& listSDRAspect,
|
||||
const Handle(Transfer_TransientProcess)& TP)
|
||||
{
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
|
||||
|
||||
// Flag indicating preferred shape representation type, to be chosen if
|
||||
// several different representations are attached to the same shape
|
||||
Standard_Integer delta = 100;
|
||||
Standard_Integer ICS = Interface_Static::IVal("read.step.shape.repr");
|
||||
Standard_Integer ICS = aStepModel->InternalParameters.ReadShapeRepr;
|
||||
Standard_Integer nbSDR0 = listSDR->Length();
|
||||
|
||||
// Iterate by entities referring PDS
|
||||
@@ -534,17 +542,19 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
|
||||
|
||||
// Flag indicating whether SDRs associated with the product`s main SDR
|
||||
// by SRRs (which correspond to hybrid model representation in AP203 since 1998)
|
||||
// should be taken into account
|
||||
Standard_Integer readSRR = Interface_Static::IVal("read.step.shape.relationship");
|
||||
Standard_Integer readSRR = aStepModel->InternalParameters.ReadRelationship;
|
||||
|
||||
Standard_Integer readConstructiveGeomRR = Interface_Static::IVal("read.step.constructivegeom.relationship");
|
||||
Standard_Integer readConstructiveGeomRR = aStepModel->InternalParameters.ReadConstrRelation;
|
||||
// Flag indicating whether SDRs associated with the product`s main SDR
|
||||
// by SAs (which correspond to hybrid model representation in AP203 before 1998)
|
||||
// should be taken into account
|
||||
Standard_Integer readSA = Interface_Static::IVal("read.step.shape.aspect");
|
||||
Standard_Integer readSA = aStepModel->InternalParameters.ReadShapeAspect;
|
||||
if ( ! readSA )
|
||||
listSDRAspect->Clear();
|
||||
|
||||
@@ -558,7 +568,7 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
|
||||
// possibly attached directly to intermediate assemblies (1)
|
||||
// Special mode (4) is used to translate shape attached to this product only,
|
||||
// ignoring sub-assemblies if any
|
||||
Standard_Integer readAssembly = Interface_Static::IVal("read.step.assembly.level");
|
||||
Standard_Integer readAssembly = aStepModel->InternalParameters.ReadAssemblyLevel;
|
||||
if ( readAssembly ==3 || ( readAssembly ==2 && listNAUO->Length() >0 ) )
|
||||
listSDR->Clear();
|
||||
else if ( readAssembly == 4 )
|
||||
@@ -824,6 +834,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
|
||||
{
|
||||
NM_DETECTED = Standard_False;
|
||||
Handle(TransferBRep_ShapeBinder) shbinder;
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
|
||||
if(!Recognize(sr))
|
||||
return shbinder;
|
||||
isBound = Standard_False;
|
||||
@@ -848,7 +859,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
|
||||
Standard_Integer nsh = 0;
|
||||
|
||||
// [BEGIN] Proceed with non-manifold topology (ssv; 12.11.2010)
|
||||
Standard_Boolean isNMMode = Interface_Static::IVal("read.step.nonmanifold") != 0;
|
||||
Standard_Boolean isNMMode = aStepModel->InternalParameters.ReadNonmanifold != 0;
|
||||
Standard_Boolean isManifold = Standard_True;
|
||||
if ( isNMMode && sr->IsKind(STANDARD_TYPE(StepShape_NonManifoldSurfaceShapeRepresentation)) ) {
|
||||
isManifold = Standard_False;
|
||||
@@ -860,7 +871,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
|
||||
}
|
||||
// Special processing for I-DEAS STP case (ssv; 15.11.2010)
|
||||
else {
|
||||
Standard_Integer isIDeasMode = Interface_Static::IVal("read.step.ideas");
|
||||
Standard_Integer isIDeasMode = aStepModel->InternalParameters.ReadIdeas;
|
||||
if (isNMMode && myNMTool.IsIDEASCase() && isIDeasMode) {
|
||||
isManifold = Standard_False;
|
||||
NM_DETECTED = Standard_True;
|
||||
@@ -1412,7 +1423,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
|
||||
<< start->DynamicType()->Name() << std::endl;
|
||||
chrono.Start();
|
||||
#endif
|
||||
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
|
||||
//:S4136
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
Handle(StepRepr_Representation) oldSRContext = mySRContext;
|
||||
@@ -1420,7 +1431,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
|
||||
Handle(StepRepr_Representation) context = FindContext ( start, TP );
|
||||
if ( context.IsNull() ) {
|
||||
TP->AddWarning ( start, "Entity with no unit context; default units taken" );
|
||||
ResetUnits(aLocalFactors);
|
||||
ResetUnits(aStepModel, aLocalFactors);
|
||||
}
|
||||
else PrepareUnits ( context, TP, aLocalFactors);
|
||||
}
|
||||
@@ -1429,8 +1440,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
|
||||
|
||||
// Start progress scope (no need to check if progress exists -- it is safe)
|
||||
Message_ProgressScope aPS(theProgress, "Transfer stage", isManifold ? 2 : 1);
|
||||
|
||||
const Standard_Boolean aReadTessellatedWhenNoBRepOnly = (Interface_Static::IVal("read.step.tessellated") == 2);
|
||||
const Standard_Boolean aReadTessellatedWhenNoBRepOnly = (aStepModel->InternalParameters.ReadTessellated == 2);
|
||||
Standard_Boolean aHasGeom = Standard_True;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
@@ -1631,11 +1641,12 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity
|
||||
myTF.Init(fs, myTool, dummyNMTool, theLocalFactors);
|
||||
Handle(StepRepr_Representation) oldSRContext = mySRContext;
|
||||
StepData_Factors aLocalFactors = theLocalFactors;
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
|
||||
if (mySRContext.IsNull()) { // if no context, try to find it (ex: r0701_ug.stp #4790)
|
||||
Handle(StepRepr_Representation) context = FindContext(fs, TP);
|
||||
if (context.IsNull()) {
|
||||
TP->AddWarning(fs, "Entity with no unit context; default units taken");
|
||||
ResetUnits(aLocalFactors);
|
||||
ResetUnits(aStepModel, aLocalFactors);
|
||||
}
|
||||
else PrepareUnits(context, TP, aLocalFactors);
|
||||
}
|
||||
@@ -1695,13 +1706,13 @@ Handle(Transfer_Binder) STEPControl_ActorRead::TransferShape(
|
||||
#endif
|
||||
|
||||
Handle(TransferBRep_ShapeBinder) shbinder;
|
||||
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
|
||||
|
||||
// Product Definition Entities
|
||||
// They should be treated with Design Manager
|
||||
// case ShapeDefinitionRepresentation if ProductMode != ON
|
||||
TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode");
|
||||
if(!aProdMode.IsEqual("ON") &&
|
||||
bool aProdMode = aStepModel->InternalParameters.ReadProductMode;
|
||||
if(!aProdMode &&
|
||||
start->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation)))
|
||||
shbinder = OldWay(start,TP, theProgress);
|
||||
//skl
|
||||
@@ -1773,10 +1784,10 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
|
||||
StepData_Factors& theLocalFactors)
|
||||
{
|
||||
mySRContext = rep;
|
||||
|
||||
Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(TP->Model());
|
||||
Standard_Integer stat1, stat2 = 0; // sera alimente par STEPControl_Unit
|
||||
if (rep.IsNull()) {
|
||||
ResetUnits(theLocalFactors);
|
||||
ResetUnits(aModel, theLocalFactors);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1784,7 +1795,7 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
|
||||
Handle(StepRepr_RepresentationContext) theRepCont = rep->ContextOfItems();
|
||||
if (theRepCont.IsNull()) {
|
||||
TP->AddWarning(rep,"Bad RepresentationContext, default unit taken");
|
||||
ResetUnits(theLocalFactors);
|
||||
ResetUnits(aModel, theLocalFactors);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1815,13 +1826,13 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
|
||||
aTol = theGRCAGAUC->GlobalUncertaintyAssignedContext();
|
||||
}
|
||||
|
||||
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(TP->Model());
|
||||
// ----------------------------------------------------
|
||||
// Decoding and Setting the Values
|
||||
// ----------------------------------------------------
|
||||
if (!theGUAC.IsNull()) {
|
||||
stat1 = myUnit.ComputeFactors(theGUAC, theLocalFactors);
|
||||
Standard_Integer anglemode = Interface_Static::IVal("step.angleunit.mode");
|
||||
Standard_Integer anglemode = aStepModel->InternalParameters.AngleUnit;
|
||||
Standard_Real angleFactor = ( anglemode == 0 ? myUnit.PlaneAngleFactor() :
|
||||
anglemode == 1 ? 1. : M_PI/180. );
|
||||
theLocalFactors.InitializeFactors(myUnit.LengthFactor(),
|
||||
@@ -1836,15 +1847,15 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
|
||||
}
|
||||
|
||||
// myPrecision = Precision::Confusion();
|
||||
if (Interface_Static::IVal("read.precision.mode") == 1) //:i1 gka S4136 05.04.99
|
||||
myPrecision = Interface_Static::RVal("read.precision.val");
|
||||
if (aStepModel->InternalParameters.ReadPrecisionMode == 1) //:i1 gka S4136 05.04.99
|
||||
myPrecision = aStepModel->InternalParameters.ReadPrecisionVal;
|
||||
else if (myUnit.HasUncertainty())
|
||||
myPrecision = myUnit.Uncertainty() * myUnit.LengthFactor();
|
||||
else {
|
||||
TP->AddWarning(theRepCont,"No Length Uncertainty, value of read.precision.val is taken");
|
||||
myPrecision = Interface_Static::RVal("read.precision.val");
|
||||
myPrecision = aStepModel->InternalParameters.ReadPrecisionVal;
|
||||
}
|
||||
myMaxTol = Max ( myPrecision, Interface_Static::RVal("read.maxprecision.val") );
|
||||
myMaxTol = Max ( myPrecision, aStepModel->InternalParameters.ReadMaxPrecisionVal );
|
||||
// Assign uncertainty
|
||||
#ifdef TRANSLOG
|
||||
if (TP->TraceLevel() > 1)
|
||||
@@ -1857,11 +1868,11 @@ void STEPControl_ActorRead::PrepareUnits(const Handle(StepRepr_Representation)&
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void STEPControl_ActorRead::ResetUnits (StepData_Factors& theLocalFactors)
|
||||
void STEPControl_ActorRead::ResetUnits (Handle(StepData_StepModel)& theModel, StepData_Factors& theLocalFactors)
|
||||
{
|
||||
theLocalFactors.InitializeFactors ( 1, 1, 1 );
|
||||
myPrecision = Interface_Static::RVal("read.precision.val");
|
||||
myMaxTol = Max ( myPrecision, Interface_Static::RVal("read.maxprecision.val") );
|
||||
myPrecision = theModel->InternalParameters.ReadPrecisionVal;
|
||||
myMaxTol = Max ( myPrecision, theModel->InternalParameters.ReadMaxPrecisionVal );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -2071,3 +2082,12 @@ void STEPControl_ActorRead::computeIDEASClosings(const TopoDS_Compound& comp,
|
||||
shellClosingsMap.Add(shellA, closingShells);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// Method : SetModel
|
||||
// Purpose :
|
||||
//=======================================================================
|
||||
void STEPControl_ActorRead::SetModel(const Handle(Interface_InterfaceModel)& theModel)
|
||||
{
|
||||
myModel = theModel;
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include <TopTools_ListOfShape.hxx>
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
#include <Interface_InterfaceModel.hxx>
|
||||
|
||||
class StepRepr_Representation;
|
||||
class Standard_Transient;
|
||||
@@ -47,6 +48,7 @@ class TopoDS_Shell;
|
||||
class TopoDS_Compound;
|
||||
class StepRepr_ConstructiveGeometryRepresentationRelationship;
|
||||
class StepData_Factors;
|
||||
class StepData_StepModel;
|
||||
|
||||
|
||||
class STEPControl_ActorRead;
|
||||
@@ -62,8 +64,7 @@ class STEPControl_ActorRead : public Transfer_ActorOfTransientProcess
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Standard_EXPORT STEPControl_ActorRead();
|
||||
Standard_EXPORT STEPControl_ActorRead(const Handle(Interface_InterfaceModel)& theModel);
|
||||
|
||||
Standard_EXPORT virtual Standard_Boolean Recognize (const Handle(Standard_Transient)& start) Standard_OVERRIDE;
|
||||
|
||||
@@ -88,7 +89,11 @@ public:
|
||||
|
||||
//! reset units and tolerances context to default
|
||||
//! (mm, radians, read.precision.val, etc.)
|
||||
Standard_EXPORT void ResetUnits(StepData_Factors& theLocalFactors);
|
||||
Standard_EXPORT void ResetUnits(Handle(StepData_StepModel)& theModel,
|
||||
StepData_Factors& theLocalFactors);
|
||||
|
||||
//! Set model
|
||||
Standard_EXPORT void SetModel(const Handle(Interface_InterfaceModel)& theModel);
|
||||
|
||||
//! Computes transformation defined by two axis placements (in MAPPED_ITEM
|
||||
//! or ITEM_DEFINED_TRANSFORMATION) taking into account their
|
||||
@@ -205,7 +210,7 @@ private:
|
||||
Standard_Real myPrecision;
|
||||
Standard_Real myMaxTol;
|
||||
Handle(StepRepr_Representation) mySRContext;
|
||||
|
||||
Handle(Interface_InterfaceModel) myModel;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -545,12 +545,12 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_
|
||||
}
|
||||
Standard_Real aLFactor = model->WriteLengthUnit();
|
||||
aLFactor /= model->LocalLengthUnit();
|
||||
Standard_Integer anglemode = Interface_Static::IVal("step.angleunit.mode");
|
||||
const Standard_Integer anglemode = model->InternalParameters.AngleUnit;
|
||||
StepData_Factors aLocalFactors;
|
||||
aLocalFactors.InitializeFactors(aLFactor, (anglemode <= 1 ? 1. : M_PI / 180.), 1.);
|
||||
// create SDR
|
||||
STEPConstruct_Part SDRTool;
|
||||
SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application() );
|
||||
SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application(), model);
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) sdr = SDRTool.SDRValue();
|
||||
// transfer shape
|
||||
|
||||
@@ -575,18 +575,18 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::Transfer (const Handle(Transfer_
|
||||
|
||||
//==========================================
|
||||
|
||||
static Standard_Real UsedTolerance (const Standard_Real mytoler,
|
||||
const TopoDS_Shape& theShape)
|
||||
static Standard_Real UsedTolerance (Handle(StepData_StepModel)& theStepModel,
|
||||
const Standard_Real mytoler,
|
||||
const TopoDS_Shape& theShape)
|
||||
{
|
||||
|
||||
// COMPUTING 3D TOLERANCE
|
||||
// Either from Session, or Computed (Least,Average, or Greatest)
|
||||
// Then given to TopoDSToStep_Tool
|
||||
|
||||
Standard_Real Tol = mytoler;
|
||||
Standard_Integer tolmod = Interface_Static::IVal("write.precision.mode");
|
||||
Standard_Integer tolmod = theStepModel->InternalParameters.WritePrecisionMode;
|
||||
if (Tol <= 0 && tolmod == 2) Tol =
|
||||
Interface_Static::RVal("write.precision.val");
|
||||
theStepModel->InternalParameters.WritePrecisionVal;
|
||||
if (Tol <= 0) {
|
||||
ShapeAnalysis_ShapeTolerance stu;
|
||||
Tol = stu.Tolerance (theShape,tolmod);
|
||||
@@ -605,11 +605,12 @@ static Standard_Real UsedTolerance (const Standard_Real mytoler,
|
||||
// if GroupMode is >1 downgrades all compounds having single subshape to that
|
||||
// subshape
|
||||
|
||||
Standard_Boolean STEPControl_ActorWrite::IsAssembly (TopoDS_Shape &S) const
|
||||
Standard_Boolean STEPControl_ActorWrite::IsAssembly (const Handle(StepData_StepModel)& theModel,
|
||||
TopoDS_Shape &S) const
|
||||
{
|
||||
if ( ! GroupMode() || S.ShapeType() != TopAbs_COMPOUND ) return Standard_False;
|
||||
// PTV 16.09.2002 OCC725 for storing compound of vertices
|
||||
if (Interface_Static::IVal("write.step.vertex.mode") == 0) {//bug 23950
|
||||
if (theModel->InternalParameters.WriteVertexMode == 0) {//bug 23950
|
||||
if (S.ShapeType() == TopAbs_COMPOUND ) {
|
||||
Standard_Boolean IsOnlyVertices = Standard_True;
|
||||
TopoDS_Iterator anItr( S );
|
||||
@@ -630,7 +631,7 @@ Standard_Boolean STEPControl_ActorWrite::IsAssembly (TopoDS_Shape &S) const
|
||||
it.Next();
|
||||
if ( it.More() ) return Standard_True;
|
||||
S = shape;
|
||||
return IsAssembly ( S );
|
||||
return IsAssembly ( theModel, S );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -669,7 +670,8 @@ static Standard_Boolean transferVertex (const Handle(Transfer_FinderProcess)& FP
|
||||
{
|
||||
Standard_Boolean IsDone = Standard_False;
|
||||
MoniTool_DataMapOfShapeTransient aMap;
|
||||
TopoDSToStep_Tool aTool(aMap, Standard_True);
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
|
||||
TopoDSToStep_Tool aTool(aMap, Standard_True, aStepModel->InternalParameters.WriteSurfaceCurMode);
|
||||
TopoDSToStep_MakeStepVertex aMkVrtx ( TopoDS::Vertex(aShVrtx), aTool, FP, theLocalFactors );
|
||||
|
||||
if (!aMkVrtx.IsDone())
|
||||
@@ -701,6 +703,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
STEPControl_StepModelType mymode = Mode();
|
||||
Handle(TransferBRep_ShapeMapper) mapper = Handle(TransferBRep_ShapeMapper)::DownCast(start);
|
||||
Handle(Transfer_Binder) binder;
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
|
||||
|
||||
// Indicates whether to use an existing NMSSR to write items to (ss; 13.11.2010)
|
||||
Standard_Boolean useExistingNMSSR = Standard_False;
|
||||
@@ -724,13 +727,13 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
}
|
||||
|
||||
// MODE ASSEMBLY : if Compound, (sub-)assembly
|
||||
if ( IsAssembly(theShape) )
|
||||
if ( IsAssembly(aStepModel, theShape) )
|
||||
return TransferCompound(start, SDR0, FP, theLocalFactors, theProgress);
|
||||
|
||||
Message_ProgressScope aPSRoot(theProgress, NULL, 2);
|
||||
|
||||
// [BEGIN] Separate manifold topology from non-manifold in group mode 0 (ssv; 18.11.2010)
|
||||
Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
|
||||
Standard_Boolean isNMMode = aStepModel->InternalParameters.WriteNonmanifold != 0;
|
||||
Handle(Transfer_Binder) aNMBinder;
|
||||
if (isNMMode && !GroupMode() && theShape.ShapeType() == TopAbs_COMPOUND) {
|
||||
TopoDS_Compound aNMCompound;
|
||||
@@ -823,7 +826,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
sdr = SDR0;
|
||||
else {
|
||||
STEPConstruct_Part SDRTool;
|
||||
SDRTool.MakeSDR( 0, myContext.GetProductName(), myContext.GetAPD()->Application() );
|
||||
SDRTool.MakeSDR( 0, myContext.GetProductName(), myContext.GetAPD()->Application(), aStepModel );
|
||||
sdr = SDRTool.SDRValue();
|
||||
}
|
||||
|
||||
@@ -854,7 +857,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
Handle(TopTools_HSequenceOfShape) RepItemSeq = new TopTools_HSequenceOfShape();
|
||||
|
||||
Standard_Boolean isSeparateVertices =
|
||||
Interface_Static::IVal("write.step.vertex.mode") == 0;//bug 23950
|
||||
aStepModel->InternalParameters.WriteVertexMode == 0;//bug 23950
|
||||
// PTV 16.09.2002 OCC725 separate shape from solo vertices.
|
||||
Standard_Boolean isOnlyVertices = Standard_False;
|
||||
if (theShape.ShapeType() == TopAbs_COMPOUND && isSeparateVertices)
|
||||
@@ -957,7 +960,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
// COMPUTING 3D TOLERANCE
|
||||
// Either from Session, or Computed (Least,Average, or Greatest)
|
||||
// Then given to TopoDSToStep_Tool
|
||||
Standard_Real Tol = UsedTolerance (mytoler,theShape);
|
||||
Standard_Real Tol = UsedTolerance (aStepModel, mytoler,theShape);
|
||||
|
||||
// Create a STEP-Entity for each TopoDS_Shape
|
||||
// according to the current StepModelMode
|
||||
@@ -999,7 +1002,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
|
||||
if (hasGeometry(aShape))
|
||||
{
|
||||
Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val");
|
||||
Standard_Real maxTol = aStepModel->InternalParameters.ReadMaxPrecisionVal;
|
||||
|
||||
aShape = XSAlgo::AlgoContainer()->ProcessShape(xShape, Tol, maxTol,
|
||||
"write.step.resource.name",
|
||||
@@ -1323,7 +1326,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
GetCasted(StepRepr_RepresentationItem, ItemSeq->Value(rep));
|
||||
items->SetValue(rep,repit);
|
||||
}
|
||||
Standard_Integer ap = Interface_Static::IVal("write.step.schema");
|
||||
Standard_Integer ap = aStepModel->InternalParameters.WriteSchema;
|
||||
Transfer_SequenceOfBinder aSeqBindRelation;
|
||||
if(ap == 3 && nbs > 1) {
|
||||
Standard_Integer j = 1;
|
||||
@@ -1353,7 +1356,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
repr1->SetValue(2,items->Value(j));
|
||||
ShapeRepr1->SetItems(repr1);
|
||||
STEPConstruct_UnitContext mk1;
|
||||
mk1.Init(Tol, theLocalFactors);
|
||||
mk1.Init(Tol, aStepModel, theLocalFactors);
|
||||
ShapeRepr1->SetContextOfItems(mk1.Value()); // la tolerance, voir au debut
|
||||
ShapeRepr1->SetName (new TCollection_HAsciiString(""));
|
||||
|
||||
@@ -1390,7 +1393,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
Handle(StepShape_ShapeRepresentation) shapeTessRepr = new StepVisual_TessellatedShapeRepresentation;
|
||||
shapeTessRepr->SetItems(itemsTess);
|
||||
STEPConstruct_UnitContext mk1;
|
||||
mk1.Init(Tol, theLocalFactors);
|
||||
mk1.Init(Tol, aStepModel, theLocalFactors);
|
||||
shapeTessRepr->SetContextOfItems(mk1.Value());
|
||||
shapeTessRepr->SetName(new TCollection_HAsciiString(""));
|
||||
|
||||
@@ -1413,7 +1416,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
|
||||
|
||||
// init representation
|
||||
STEPConstruct_UnitContext mk;
|
||||
mk.Init(Tol, theLocalFactors);
|
||||
mk.Init(Tol, aStepModel, theLocalFactors);
|
||||
shapeRep->SetContextOfItems(mk.Value()); // la tolerance, voir au debut
|
||||
shapeRep->SetName (new TCollection_HAsciiString(""));
|
||||
|
||||
@@ -1459,8 +1462,10 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound
|
||||
if (mapper.IsNull()) return binder;
|
||||
TopoDS_Shape theShape = mapper->Value();
|
||||
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
|
||||
|
||||
// Inspect non-manifold topology case (ssv; 10.11.2010)
|
||||
Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
|
||||
Standard_Boolean isNMMode = aStepModel->InternalParameters.WriteNonmanifold != 0;
|
||||
Standard_Boolean isManifold;
|
||||
if (isNMMode)
|
||||
isManifold = IsManifoldShape(theShape);
|
||||
@@ -1472,7 +1477,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound
|
||||
// Prepare a collection for non-manifold group of shapes
|
||||
Handle(TopTools_HSequenceOfShape) NonManifoldGroup = new TopTools_HSequenceOfShape();
|
||||
Standard_Boolean isSeparateVertices =
|
||||
(Interface_Static::IVal("write.step.vertex.mode") == 0);//bug 23950
|
||||
(aStepModel->InternalParameters.WriteVertexMode == 0);//bug 23950
|
||||
// PTV OCC725 17.09.2002 -- begin --
|
||||
Standard_Integer nbFreeVrtx = 0;
|
||||
TopoDS_Compound aCompOfVrtx;
|
||||
@@ -1560,9 +1565,9 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound
|
||||
for (Standard_Integer rep = 1; rep <= nsub; rep++)
|
||||
items->SetValue(rep,GetCasted(StepRepr_RepresentationItem, ItemSeq->Value(rep)));
|
||||
shapeRep->SetItems(items);
|
||||
Standard_Real Tol = UsedTolerance (mytoler,theShape);
|
||||
Standard_Real Tol = UsedTolerance (aStepModel, mytoler,theShape);
|
||||
STEPConstruct_UnitContext mk;
|
||||
mk.Init(Tol, theLocalFactors);
|
||||
mk.Init(Tol, aStepModel, theLocalFactors);
|
||||
shapeRep->SetContextOfItems(mk.Value()); // la tolerance, voir au debut
|
||||
shapeRep->SetName (new TCollection_HAsciiString(""));
|
||||
|
||||
@@ -1612,14 +1617,15 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferSubShape
|
||||
Handle(Transfer_Binder) resbind = FP->Find(mapper);
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) sdr;
|
||||
// Handle(StepShape_ShapeRepresentation) resultat;
|
||||
STEPConstruct_Part SDRTool;
|
||||
STEPConstruct_Part SDRTool;
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(FP->Model());
|
||||
|
||||
// Already SDR and SR available : take them as are
|
||||
Standard_Boolean iasdr = FP->GetTypedTransient
|
||||
(resbind,STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation),sdr);
|
||||
if ( iasdr ) SDRTool.ReadSDR ( sdr );
|
||||
else {
|
||||
SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application() );
|
||||
SDRTool.MakeSDR ( 0, myContext.GetProductName(), myContext.GetAPD()->Application(), aStepModel );
|
||||
sdr = SDRTool.SDRValue();
|
||||
}
|
||||
// resultat = GetCasted(StepShape_ShapeRepresentation,sdr->UsedRepresentation());
|
||||
|
@@ -96,7 +96,8 @@ public:
|
||||
//! Default implementation uses flag GroupMode and analyses
|
||||
//! the shape itself
|
||||
//! NOTE: this method can modify shape
|
||||
Standard_EXPORT virtual Standard_Boolean IsAssembly (TopoDS_Shape& S) const;
|
||||
Standard_EXPORT virtual Standard_Boolean IsAssembly (const Handle(StepData_StepModel)& theModel,
|
||||
TopoDS_Shape& S) const;
|
||||
|
||||
|
||||
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <IFSelect_SignCounter.hxx>
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <MoniTool_Macros.hxx>
|
||||
#include <RWHeaderSection.hxx>
|
||||
#include <RWStepAP214.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
@@ -35,6 +36,8 @@
|
||||
#include <STEPEdit.hxx>
|
||||
#include <STEPEdit_EditContext.hxx>
|
||||
#include <STEPEdit_EditSDR.hxx>
|
||||
#include <STEPControl_ActorRead.hxx>
|
||||
#include <StepData_StepModel.hxx>
|
||||
#include <StepSelect_WorkLibrary.hxx>
|
||||
#include <STEPSelections_SelectAssembly.hxx>
|
||||
#include <STEPSelections_SelectDerived.hxx>
|
||||
@@ -323,14 +326,12 @@ STEPControl_Controller::STEPControl_Controller ()
|
||||
aMutex.Unlock();
|
||||
|
||||
Handle(STEPControl_ActorWrite) ActWrite = new STEPControl_ActorWrite;
|
||||
ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
|
||||
myAdaptorWrite = ActWrite;
|
||||
|
||||
Handle(StepSelect_WorkLibrary) swl = new StepSelect_WorkLibrary;
|
||||
swl->SetDumpLabel(1);
|
||||
myAdaptorLibrary = swl;
|
||||
myAdaptorProtocol = STEPEdit::Protocol();
|
||||
myAdaptorRead = new STEPControl_ActorRead; // par ex pour Recognize
|
||||
|
||||
SetModeWrite (0,4);
|
||||
SetModeWriteHelp (0,"As Is");
|
||||
@@ -405,6 +406,20 @@ Handle(Interface_InterfaceModel) STEPControl_Controller::NewModel () const
|
||||
return STEPEdit::NewModel();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ActorRead
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Transfer_ActorOfTransientProcess) STEPControl_Controller::ActorRead(const Handle(Interface_InterfaceModel)& theModel) const
|
||||
{
|
||||
DeclareAndCast(STEPControl_ActorRead, anAdap, myAdaptorRead);
|
||||
if (anAdap.IsNull()) {
|
||||
anAdap = new STEPControl_ActorRead(theModel);
|
||||
anAdap->SetModel(theModel);
|
||||
}
|
||||
return anAdap;
|
||||
}
|
||||
|
||||
// #### PROVISOIRE ??? ####
|
||||
|
||||
IFSelect_ReturnStatus STEPControl_Controller::TransferWriteShape
|
||||
@@ -419,7 +434,7 @@ IFSelect_ReturnStatus STEPControl_Controller::TransferWriteShape
|
||||
Handle(STEPControl_ActorWrite)::DownCast(myAdaptorWrite);
|
||||
// A PRESENT ON PASSE PAR LE PROFILE
|
||||
if (!ActWrite.IsNull())
|
||||
ActWrite->SetGroupMode (Interface_Static::IVal("write.step.assembly"));
|
||||
ActWrite->SetGroupMode (Handle(StepData_StepModel)::DownCast(model)->InternalParameters.WriteAssembly);
|
||||
|
||||
return XSControl_Controller::TransferWriteShape(shape, FP, model, modeshape, theProgress);
|
||||
}
|
||||
|
@@ -46,7 +46,10 @@ public:
|
||||
//! Creates a new empty Model ready to receive data of the Norm.
|
||||
//! It is taken from STEP Template Model
|
||||
Standard_EXPORT Handle(Interface_InterfaceModel) NewModel() const Standard_OVERRIDE;
|
||||
|
||||
|
||||
//! Returns the Actor for Read attached to the pair (norm,appli)
|
||||
Standard_EXPORT Handle(Transfer_ActorOfTransientProcess) ActorRead(const Handle(Interface_InterfaceModel)& theModel) const Standard_OVERRIDE;
|
||||
|
||||
Standard_EXPORT virtual void Customise (Handle(XSControl_WorkSession)& WS) Standard_OVERRIDE;
|
||||
|
||||
//! Takes one Shape and transfers it to the InterfaceModel
|
||||
|
@@ -12,9 +12,12 @@
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <IFSelect_WorkLibrary.hxx>
|
||||
#include <Interface_EntityIterator.hxx>
|
||||
#include <Interface_Graph.hxx>
|
||||
#include <Interface_Static.hxx>
|
||||
#include <Message.hxx>
|
||||
#include <Message_Messenger.hxx>
|
||||
#include <StepBasic_ApplicationContext.hxx>
|
||||
#include <StepBasic_ConversionBasedUnit.hxx>
|
||||
#include <StepBasic_DocumentProductEquivalence.hxx>
|
||||
@@ -93,6 +96,150 @@ Handle(StepData_StepModel) STEPControl_Reader::StepModel () const
|
||||
return Handle(StepData_StepModel)::DownCast(Model());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadFile
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_ReturnStatus STEPControl_Reader::ReadFile(const Standard_CString filename)
|
||||
{
|
||||
Handle(IFSelect_WorkLibrary) aLibrary = WS()->WorkLibrary();
|
||||
Handle(Interface_Protocol) aProtocol = WS()->Protocol();
|
||||
if (aLibrary.IsNull()) return IFSelect_RetVoid;
|
||||
if (aProtocol.IsNull()) return IFSelect_RetVoid;
|
||||
Handle(StepData_StepModel) aStepModel = new StepData_StepModel;
|
||||
aStepModel->InternalParameters.InitFromStatic();
|
||||
aStepModel->SetSourceCodePage(aStepModel->InternalParameters.ReadCodePage);
|
||||
IFSelect_ReturnStatus status = IFSelect_RetVoid;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
Standard_Integer stat = aLibrary->ReadFile(filename, aStepModel, aProtocol);
|
||||
if (stat == 0) status = IFSelect_RetDone;
|
||||
else if (stat < 0) status = IFSelect_RetError;
|
||||
else status = IFSelect_RetFail;
|
||||
}
|
||||
catch (Standard_Failure const& anException) {
|
||||
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
||||
sout << " **** Interruption ReadFile par Exception : ****\n";
|
||||
sout << anException.GetMessageString();
|
||||
sout << "\n Abandon" << std::endl;
|
||||
status = IFSelect_RetFail;
|
||||
}
|
||||
if (status != IFSelect_RetDone) return status;
|
||||
WS()->SetModel(aStepModel);
|
||||
WS()->SetLoadedFile(filename);
|
||||
WS()->InitTransferReader(4);
|
||||
return status;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadFile
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_ReturnStatus STEPControl_Reader::ReadFile(const Standard_CString filename,
|
||||
const StepData_ConfParameters& theParams)
|
||||
{
|
||||
Handle(IFSelect_WorkLibrary) aLibrary = WS()->WorkLibrary();
|
||||
Handle(Interface_Protocol) aProtocol = WS()->Protocol();
|
||||
if (aLibrary.IsNull()) return IFSelect_RetVoid;
|
||||
if (aProtocol.IsNull()) return IFSelect_RetVoid;
|
||||
Handle(StepData_StepModel) aStepModel = new StepData_StepModel;
|
||||
aStepModel->InternalParameters = theParams;
|
||||
aStepModel->SetSourceCodePage(aStepModel->InternalParameters.ReadCodePage);
|
||||
IFSelect_ReturnStatus status = IFSelect_RetVoid;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
Standard_Integer stat = aLibrary->ReadFile(filename, aStepModel, aProtocol);
|
||||
if (stat == 0) status = IFSelect_RetDone;
|
||||
else if (stat < 0) status = IFSelect_RetError;
|
||||
else status = IFSelect_RetFail;
|
||||
}
|
||||
catch (Standard_Failure const& anException) {
|
||||
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
||||
sout << " **** Interruption ReadFile par Exception : ****\n";
|
||||
sout << anException.GetMessageString();
|
||||
sout << "\n Abandon" << std::endl;
|
||||
status = IFSelect_RetFail;
|
||||
}
|
||||
if (status != IFSelect_RetDone) return status;
|
||||
WS()->SetModel(aStepModel);
|
||||
WS()->SetLoadedFile(filename);
|
||||
WS()->InitTransferReader(4);
|
||||
return status;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStream
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_ReturnStatus STEPControl_Reader::ReadStream(const Standard_CString theName,
|
||||
std::istream& theIStream)
|
||||
{
|
||||
Handle(IFSelect_WorkLibrary) aLibrary = WS()->WorkLibrary();
|
||||
Handle(Interface_Protocol) aProtocol = WS()->Protocol();
|
||||
if (aLibrary.IsNull()) return IFSelect_RetVoid;
|
||||
if (aProtocol.IsNull()) return IFSelect_RetVoid;
|
||||
Handle(StepData_StepModel) aStepModel = new StepData_StepModel;
|
||||
aStepModel->InternalParameters.InitFromStatic();
|
||||
aStepModel->SetSourceCodePage(aStepModel->InternalParameters.ReadCodePage);
|
||||
IFSelect_ReturnStatus status = IFSelect_RetVoid;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
Standard_Integer stat = aLibrary->ReadStream(theName, theIStream, aStepModel, aProtocol);
|
||||
if (stat == 0) status = IFSelect_RetDone;
|
||||
else if (stat < 0) status = IFSelect_RetError;
|
||||
else status = IFSelect_RetFail;
|
||||
}
|
||||
catch (Standard_Failure const& anException) {
|
||||
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
||||
sout << " **** Interruption ReadFile par Exception : ****\n";
|
||||
sout << anException.GetMessageString();
|
||||
sout << "\n Abandon" << std::endl;
|
||||
status = IFSelect_RetFail;
|
||||
}
|
||||
if (status != IFSelect_RetDone) return status;
|
||||
WS()->SetModel(aStepModel);
|
||||
WS()->SetLoadedFile(theName);
|
||||
WS()->InitTransferReader(4);
|
||||
return status;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadStream
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
IFSelect_ReturnStatus STEPControl_Reader::ReadStream(const Standard_CString theName,
|
||||
const StepData_ConfParameters& theParams,
|
||||
std::istream& theIStream)
|
||||
{
|
||||
Handle(IFSelect_WorkLibrary) aLibrary = WS()->WorkLibrary();
|
||||
Handle(Interface_Protocol) aProtocol = WS()->Protocol();
|
||||
if (aLibrary.IsNull()) return IFSelect_RetVoid;
|
||||
if (aProtocol.IsNull()) return IFSelect_RetVoid;
|
||||
Handle(StepData_StepModel) aStepModel = new StepData_StepModel;
|
||||
aStepModel->InternalParameters = theParams;
|
||||
aStepModel->SetSourceCodePage(aStepModel->InternalParameters.ReadCodePage);
|
||||
IFSelect_ReturnStatus status = IFSelect_RetVoid;
|
||||
try {
|
||||
OCC_CATCH_SIGNALS
|
||||
Standard_Integer stat = aLibrary->ReadStream(theName, theIStream, aStepModel, aProtocol);
|
||||
if (stat == 0) status = IFSelect_RetDone;
|
||||
else if (stat < 0) status = IFSelect_RetError;
|
||||
else status = IFSelect_RetFail;
|
||||
}
|
||||
catch (Standard_Failure const& anException) {
|
||||
Message_Messenger::StreamBuffer sout = Message::SendInfo();
|
||||
sout << " **** Interruption ReadFile par Exception : ****\n";
|
||||
sout << anException.GetMessageString();
|
||||
sout << "\n Abandon" << std::endl;
|
||||
status = IFSelect_RetFail;
|
||||
}
|
||||
if (status != IFSelect_RetDone) return status;
|
||||
WS()->SetModel(aStepModel);
|
||||
WS()->SetLoadedFile(theName);
|
||||
WS()->InitTransferReader(4);
|
||||
return status;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : TransferRoot
|
||||
//purpose :
|
||||
@@ -114,11 +261,12 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
|
||||
if (therootsta) return theroots.Length();
|
||||
therootsta = Standard_True;
|
||||
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(WS()->Model());
|
||||
//theroots.Clear();
|
||||
Standard_Integer nb = Model()->NbEntities();
|
||||
for (Standard_Integer i = 1; i <= nb; i ++) {
|
||||
Handle(Standard_Transient) ent = Model()->Value(i);
|
||||
if (Interface_Static::IVal("read.step.all.shapes") == 1) {
|
||||
if (aStepModel->InternalParameters.ReadAllShapes == 1) {
|
||||
// Special case to read invalid shape_representation without links to shapes.
|
||||
if (ent->IsKind(STANDARD_TYPE(StepShape_ManifoldSolidBrep))) {
|
||||
Interface_EntityIterator aShareds = WS()->Graph().Sharings(ent);
|
||||
@@ -178,8 +326,9 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
|
||||
}
|
||||
// determinate roots used ProductDefinitionContext
|
||||
if(IsRoot) {
|
||||
const char *str1 = Interface_Static::CVal("read.step.product.context");
|
||||
Standard_Integer ICS = Interface_Static::IVal("read.step.product.context");
|
||||
StepData_ConfParameters::ReadMode_ProductContext aProdContMode = aStepModel->InternalParameters.ReadProductContext;
|
||||
TCollection_AsciiString str1 = aStepModel->InternalParameters.GetString(aProdContMode);
|
||||
Standard_Integer ICS = aStepModel->InternalParameters.ReadProductContext;
|
||||
if(ICS>1) {
|
||||
subs = graph.Shareds(PD);
|
||||
for(subs.Start(); subs.More(); subs.Next()) {
|
||||
@@ -188,7 +337,7 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
|
||||
if (PDC.IsNull()) continue;
|
||||
const char *str2 = PDC->LifeCycleStage()->String().ToCString();
|
||||
const char *str3 = PDC->Name()->String().ToCString();
|
||||
if( !( strcasecmp(str1,str2)==0 || strcasecmp(str1,str3)==0 ) )
|
||||
if( !( strcasecmp(str1.ToCString(),str2)==0 || strcasecmp(str1.ToCString(),str3) == 0))
|
||||
IsRoot=Standard_False;
|
||||
}
|
||||
}
|
||||
@@ -212,8 +361,8 @@ Standard_Integer STEPControl_Reader::NbRootsForTransfer()
|
||||
WS()->TransferReader()->TransientProcess()->RootsForTransfer()->Append(ent);
|
||||
}
|
||||
}
|
||||
TCollection_AsciiString aProdMode = Interface_Static::CVal("read.step.product.mode");
|
||||
if(!aProdMode.IsEqual("ON")) {
|
||||
bool aProdMode = aStepModel->InternalParameters.ReadProductMode;
|
||||
if(!aProdMode) {
|
||||
if(ent->IsKind(STANDARD_TYPE(StepShape_ShapeDefinitionRepresentation))) {
|
||||
Standard_Boolean IsRoot = Standard_True;
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) SDR =
|
||||
@@ -440,6 +589,10 @@ void STEPControl_Reader::FileUnits( TColStd_SequenceOfAsciiString& theUnitLength
|
||||
//=======================================================================
|
||||
void STEPControl_Reader::SetSystemLengthUnit(const Standard_Real theLengthUnit)
|
||||
{
|
||||
if (StepModel().IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
StepModel()->SetLocalLengthUnit(theLengthUnit);
|
||||
}
|
||||
|
||||
@@ -449,6 +602,10 @@ void STEPControl_Reader::SetSystemLengthUnit(const Standard_Real theLengthUnit)
|
||||
//=======================================================================
|
||||
Standard_Real STEPControl_Reader::SystemLengthUnit() const
|
||||
{
|
||||
if (StepModel().IsNull())
|
||||
{
|
||||
return 1.;
|
||||
}
|
||||
return StepModel()->LocalLengthUnit();
|
||||
}
|
||||
|
||||
|
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <XSControl_Reader.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <StepData_ConfParameters.hxx>
|
||||
#include <TColStd_SequenceOfAsciiString.hxx>
|
||||
#include <TColStd_Array1OfAsciiString.hxx>
|
||||
#include <TColStd_Array1OfReal.hxx>
|
||||
@@ -83,6 +84,24 @@ public:
|
||||
//! Returns the model as a StepModel.
|
||||
//! It can then be consulted (header, product)
|
||||
Standard_EXPORT Handle(StepData_StepModel) StepModel() const;
|
||||
|
||||
//! Loads a file and returns the read status
|
||||
//! Zero for a Model which compies with the Controller
|
||||
Standard_EXPORT virtual IFSelect_ReturnStatus ReadFile(const Standard_CString filename) Standard_OVERRIDE;
|
||||
|
||||
//! Loads a file from stream and returns the read status
|
||||
Standard_EXPORT virtual IFSelect_ReturnStatus ReadStream(const Standard_CString theName,
|
||||
std::istream& theIStream) Standard_OVERRIDE;
|
||||
|
||||
//! Loads a file and returns the read status
|
||||
//! Zero for a Model which compies with the Controller
|
||||
Standard_EXPORT IFSelect_ReturnStatus ReadFile(const Standard_CString filename,
|
||||
const StepData_ConfParameters& theParams);
|
||||
|
||||
//! Loads a file from stream and returns the read status
|
||||
Standard_EXPORT IFSelect_ReturnStatus ReadStream(const Standard_CString theName,
|
||||
const StepData_ConfParameters& theParams,
|
||||
std::istream& theIStream);
|
||||
|
||||
//! Transfers a root given its rank in the list of candidate roots
|
||||
//! Default is the first one
|
||||
@@ -99,10 +118,12 @@ public:
|
||||
//! found in file
|
||||
Standard_EXPORT void FileUnits (TColStd_SequenceOfAsciiString& theUnitLengthNames, TColStd_SequenceOfAsciiString& theUnitAngleNames, TColStd_SequenceOfAsciiString& theUnitSolidAngleNames);
|
||||
|
||||
//! Sets system length unit used by transfer process
|
||||
//! Sets system length unit used by transfer process.
|
||||
//! Performs only if a model is not NULL
|
||||
Standard_EXPORT void SetSystemLengthUnit(const Standard_Real theLengthUnit);
|
||||
|
||||
//! Returns system length unit used by transfer process
|
||||
//! Returns system length unit used by transfer process.
|
||||
//! Performs only if a model is not NULL
|
||||
Standard_EXPORT Standard_Real SystemLengthUnit() const;
|
||||
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include <Interface_Macros.hxx>
|
||||
#include <STEPControl_ActorWrite.hxx>
|
||||
#include <STEPControl_Controller.hxx>
|
||||
#include <StepData_ConfParameters.hxx>
|
||||
#include <StepData_StepModel.hxx>
|
||||
#include <StepData_Protocol.hxx>
|
||||
#include <StepData_StepWriter.hxx>
|
||||
@@ -127,6 +128,21 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer
|
||||
const STEPControl_StepModelType mode,
|
||||
const Standard_Boolean compgraph,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
Handle(StepData_StepModel) aStepModel = Handle(StepData_StepModel)::DownCast(thesession->Model());
|
||||
if (!aStepModel.IsNull())
|
||||
{
|
||||
aStepModel->InternalParameters.InitFromStatic();
|
||||
}
|
||||
return Transfer(sh, mode, aStepModel->InternalParameters, compgraph, theProgress);
|
||||
}
|
||||
|
||||
IFSelect_ReturnStatus STEPControl_Writer::Transfer
|
||||
(const TopoDS_Shape& sh,
|
||||
const STEPControl_StepModelType mode,
|
||||
const StepData_ConfParameters& theParams,
|
||||
const Standard_Boolean compgraph,
|
||||
const Message_ProgressRange& theProgress)
|
||||
{
|
||||
Standard_Integer mws = -1;
|
||||
switch (mode) {
|
||||
@@ -144,6 +160,13 @@ IFSelect_ReturnStatus STEPControl_Writer::Transfer
|
||||
XSAlgo::AlgoContainer()->PrepareForTransfer(); // update unit info
|
||||
Model()->SetLocalLengthUnit(UnitsMethods::GetCasCadeLengthUnit());
|
||||
}
|
||||
if (!thesession->Model().IsNull())
|
||||
{
|
||||
Handle(StepData_StepModel)::DownCast(thesession->Model())->InternalParameters = theParams;
|
||||
}
|
||||
Handle(STEPControl_ActorWrite) ActWrite =
|
||||
Handle(STEPControl_ActorWrite)::DownCast(WS()->NormAdaptor()->ActorWrite());
|
||||
ActWrite->SetGroupMode(Handle(StepData_StepModel)::DownCast(thesession->Model())->InternalParameters.WriteAssembly);
|
||||
return thesession->TransferWriteShape(sh, compgraph, theProgress);
|
||||
}
|
||||
|
||||
|
@@ -23,6 +23,7 @@
|
||||
|
||||
#include <Standard_Real.hxx>
|
||||
#include <IFSelect_ReturnStatus.hxx>
|
||||
#include <StepData_ConfParameters.hxx>
|
||||
#include <STEPControl_StepModelType.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Message_ProgressRange.hxx>
|
||||
@@ -89,6 +90,14 @@ public:
|
||||
const Standard_Boolean compgraph = Standard_True,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Translates shape sh to a STEP entity
|
||||
Standard_EXPORT IFSelect_ReturnStatus Transfer
|
||||
(const TopoDS_Shape& sh,
|
||||
const STEPControl_StepModelType mode,
|
||||
const StepData_ConfParameters& theParams,
|
||||
const Standard_Boolean compgraph = Standard_True,
|
||||
const Message_ProgressRange& theProgress = Message_ProgressRange());
|
||||
|
||||
//! Writes a STEP model in the file identified by filename.
|
||||
Standard_EXPORT IFSelect_ReturnStatus Write (const Standard_CString theFileName);
|
||||
|
||||
|
Reference in New Issue
Block a user