~~~~~
Default value is 1 (ON).
+<h4>read.step.constructivegeom.relationship:</h4>
+
+Boolean flag regulating translation of "CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP" entities that define
+position of constructive geometry entities contained in "CONSTRUCTIVE_GEOMETRY_REPRESENTATION" with respect to the
+main representation of the shape (product).
+
+By default, the flag is set to 0 (OFF) so these entities are not translated.
+Set this flag to 1 (ON) if you need to translate constructive geometry entities associated with the parts:
+
+~~~~~
+if (!Interface_Static::SetIVal("read.step.constructivegeom.relationship", 1)) { .. error .. }
+~~~~~
+
+The "CONSTRUCTIVE_GEOMETRY_REPRESENTATION" entity is translated into compound of two unlimited planar faces,
+whose location is result of translation of corresponding "AXIS_PLACEMENT" entity.
+Note that appropriate interpretation of the translated data should be done after translation.
+
+The result of translation can be obtained either for the "CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP" entity,
+of for each of the two "AXIS2_PLACEMENT_3D" entities referenced by it. as follows:
+
+~~~~~
+ STEPControl_Reader aReader;
+ ... // translate file and parse STEP model to find relevant axis entity
+ Handle(StepGeom_Axis2Placement3d) aSTEPAxis = ...;
+ Handle(Transfer_Binder) aBinder = aReader->WS()->TransferReader()->TransientProcess()->Find(aSTEPAxis);
+ Handle(TransferBRep_ShapeBinder) aShBinder = Handle(TransferBRep_ShapeBinder)::DownCast(aBinder);
+ if (! aShBinder.IsNull())
+ {
+ TopoDS_Face aFace = TopoDS::Face (aShBinder->Result());
+ if (! aFace.IsNull())
+ {
+ Handle(Geom_Plane) aSurf = Handle(Geom_Plane)::DownCast (BRep_Tool::Surface (aFace));
+ if (! aSurf.IsNull())
+ {
+ gp_Ax3 anAxis = aSurf->Placement();
+ ... // use the axis placement data
+ }
+ }
+ }
+~~~~~
+
@subsubsection occt_step_2_3_4 Performing the STEP file translation
Perform the translation according to what you want to translate. You can choose either root entities (all or selected by the number of root), or select any entity by its number in the STEP file. There is a limited set of types of entities that can be used as starting entities for translation. Only the following entities are recognized as transferable:
#include <UnitsMethods.hxx>
#include <XSAlgo.hxx>
#include <XSAlgo_AlgoContainer.hxx>
+#include <StepRepr_ConstructiveGeometryRepresentationRelationship.hxx>
+#include <StepRepr_ConstructiveGeometryRepresentation.hxx>
+#include <Geom_Plane.hxx>
IMPLEMENT_STANDARD_RTTIEXT(STEPControl_ActorRead,Transfer_ActorOfTransientProcess)
// should be taken into account
Standard_Integer readSRR = Interface_Static::IVal("read.step.shape.relationship");
+ Standard_Integer readConstructiveGeomRR = Interface_Static::IVal("read.step.constructivegeom.relationship");
// 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
Handle(Standard_Type) tSRR = STANDARD_TYPE(StepRepr_ShapeRepresentationRelationship);
for (subs1.Start(); subs1.More(); subs1.Next()) {
Handle(Standard_Transient) anitem = subs1.Value();
- if ( anitem->DynamicType() != tSRR ) continue;
- Handle(StepRepr_ShapeRepresentationRelationship) SRR =
- Handle(StepRepr_ShapeRepresentationRelationship)::DownCast(anitem);
- Standard_Integer nbrep = ( rep == SRR->Rep1() ? 2 : 1 );
- // SKL for bug 29068: parameter useTrsf is used because if root entity has connection with other
- // by ShapeRepresentationRelationship then result after such transferring need to transform also.
- // This case is from test "bugs modalg_7 bug30196"
- binder = TransferEntity(SRR, TP, nbrep, useTrsf);
- if ( ! binder.IsNull() ) {
- theResult = TransferBRep::ShapeResult (binder);
- Result1 = theResult;
- B.Add(Cund, theResult);
- nbShapes++;
+ if( !anitem->IsKind(STANDARD_TYPE(StepRepr_RepresentationRelationship)))
+ continue;
+ if (anitem->DynamicType() == tSRR)
+ {
+ Handle(StepRepr_ShapeRepresentationRelationship) SRR =
+ Handle(StepRepr_ShapeRepresentationRelationship)::DownCast(anitem);
+ Standard_Integer nbrep = (rep == SRR->Rep1() ? 2 : 1);
+ // SKL for bug 29068: parameter useTrsf is used because if root entity has connection with other
+ // by ShapeRepresentationRelationship then result after such transferring need to transform also.
+ // This case is from test "bugs modalg_7 bug30196"
+ binder = TransferEntity(SRR, TP, nbrep, useTrsf);
+ if (! binder.IsNull()) {
+ theResult = TransferBRep::ShapeResult (binder);
+ Result1 = theResult;
+ B.Add(Cund, theResult);
+ nbShapes++;
+ }
+ }
+ else if(readConstructiveGeomRR && anitem->IsKind(STANDARD_TYPE(StepRepr_ConstructiveGeometryRepresentationRelationship)))
+ {
+ Handle(StepRepr_ConstructiveGeometryRepresentationRelationship) aCSRR =
+ Handle(StepRepr_ConstructiveGeometryRepresentationRelationship)::DownCast(anitem);
+ binder = TransferEntity(aCSRR, TP);
+ if (! binder.IsNull())
+ {
+ Result1 = TransferBRep::ShapeResult (binder);
+ B.Add(Cund, Result1);
+ nbShapes++;
+ }
}
}
}
}
+//=======================================================================
+//function : TransferEntity
+//purpose :
+//=======================================================================
+
+
+Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(
+ const Handle(StepRepr_ConstructiveGeometryRepresentationRelationship)& theCGRR,
+ const Handle(Transfer_TransientProcess)& theTP)
+{
+
+ Handle(TransferBRep_ShapeBinder) shbinder;
+ if (theCGRR.IsNull())
+ return shbinder;
+ Standard_Boolean resetUnits = Standard_False;
+ Handle(StepRepr_Representation) oldSRContext = mySRContext;
+ TopoDS_Compound aComp;
+ BRep_Builder aB;
+ aB.MakeCompound(aComp);
+ for (Standard_Integer i = 1; i <= 2; i ++)
+ {
+ Handle(StepRepr_ConstructiveGeometryRepresentation) aCRepr =
+ Handle(StepRepr_ConstructiveGeometryRepresentation)::DownCast(i == 1 ? theCGRR->Rep1() : theCGRR->Rep2() );
+ if(aCRepr.IsNull())
+ continue;
+ if(mySRContext.IsNull() || aCRepr->ContextOfItems() != mySRContext->ContextOfItems())
+ {
+ PrepareUnits(aCRepr,theTP);
+ resetUnits = Standard_True;
+ }
+ Standard_Integer j =1;
+ Handle(StepGeom_Axis2Placement3d) anAxis1;
+ Handle(StepGeom_Axis2Placement3d) anAxis2;
+ for( ; j <= 2; j++ )
+ {
+ Handle(StepRepr_RepresentationItem) anItem = aCRepr->ItemsValue(j);
+ Handle(StepGeom_Axis2Placement3d) aStepAxis =
+ Handle(StepGeom_Axis2Placement3d)::DownCast(anItem);
+ if( !aStepAxis.IsNull())
+ {
+ Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement (aStepAxis);
+ if(anAxis.IsNull())
+ continue;
+ Handle(Geom_Plane) aPlane = new Geom_Plane(gp_Ax3(anAxis->Ax2()));
+ TopoDS_Face aPlaneFace;
+ aB.MakeFace(aPlaneFace, aPlane, Precision::Confusion());
+ Handle(TransferBRep_ShapeBinder) axisbinder = new TransferBRep_ShapeBinder (aPlaneFace);
+ theTP->Bind(aStepAxis, axisbinder);
+ aB.Add(aComp, aPlaneFace);
+ }
+ }
+
+ }
+ shbinder = new TransferBRep_ShapeBinder (aComp);
+ mySRContext = oldSRContext;
+ if(oldSRContext.IsNull() || resetUnits)
+ PrepareUnits(oldSRContext,theTP);
+
+ theTP->Bind(theCGRR, shbinder);
+
+ return shbinder;
+
+}
+
//=======================================================================
//function : IsNeedRepresentation
//purpose :
Interface_Static::Init("step", "read.step.all.shapes", '&', "eval On");
Interface_Static::SetIVal("read.step.all.shapes", 0);
+ // Mode for reading constructive geometry representation relationship to read
+ //StepRepr_ConstructiveGeometryRepresentation method implemented only for StepGeom_MakeAxis2Placement3d
+ //for axis placements representing axis for suplemented geometry. Axis placements are translated to planar faces with CS
+ //equal to translated axis placements
+ Interface_Static::Init("step","read.step.constructivegeom.relationship",'e',"");
+ Interface_Static::Init("step","read.step.constructivegeom.relationship",'&',"enum 0");
+ Interface_Static::Init("step","read.step.constructivegeom.relationship",'&',"eval OFF");
+ Interface_Static::Init("step","read.step.constructivegeom.relationship",'&',"eval ON");
+ Interface_Static::SetCVal("read.step.constructivegeom.relationship","OFF");
+
init = Standard_True;
}