mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0027455: Implementation of connection points
Add Import/Export connection points. Make some improvements in STEP reading in collections shapes, to which dimension is attached. Update tests.
This commit is contained in:
@@ -103,6 +103,7 @@
|
||||
#include <StepRepr_AssemblyComponentUsage.hxx>
|
||||
#include <StepRepr_CharacterizedDefinition.hxx>
|
||||
#include <StepRepr_CompoundRepresentationItem.hxx>
|
||||
#include <StepRepr_DerivedShapeAspect.hxx>
|
||||
#include <StepRepr_DescriptiveRepresentationItem.hxx>
|
||||
#include <StepRepr_HArray1OfRepresentationItem.hxx>
|
||||
#include <StepRepr_MeasureRepresentationItem.hxx>
|
||||
@@ -119,6 +120,7 @@
|
||||
#include <StepRepr_ReprItemAndPlaneAngleMeasureWithUnit.hxx>
|
||||
#include <StepRepr_SequenceOfRepresentationItem.hxx>
|
||||
#include <StepRepr_ShapeAspect.hxx>
|
||||
#include <StepRepr_ShapeAspectDerivingRelationship.hxx>
|
||||
#include <StepRepr_CompositeShapeAspect.hxx>
|
||||
#include <StepRepr_AllAroundShapeAspect.hxx>
|
||||
#include <StepRepr_CompShAspAndDatumFeatAndShAsp.hxx>
|
||||
@@ -1724,7 +1726,7 @@ static Standard_Boolean GetMassConversionFactor(Handle(StepBasic_NamedUnit)& NU,
|
||||
|
||||
//=======================================================================
|
||||
//function : readAnnotation
|
||||
//purpose : return annotation plane and position for given GDT
|
||||
//purpose : read annotation plane and position for given GDT
|
||||
// (Dimension, Geometric_Tolerance, Datum_Feature or Placed_Datum_Target_Feature)
|
||||
//=======================================================================
|
||||
void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
||||
@@ -1983,6 +1985,97 @@ void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
|
||||
return;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : readConnectionPoints
|
||||
//purpose : read connection points for given dimension
|
||||
//=======================================================================
|
||||
void readConnectionPoints(const Handle(XSControl_TransferReader)& theTR,
|
||||
const Handle(Standard_Transient) theGDT,
|
||||
const Handle(XCAFDimTolObjects_DimensionObject)& theDimObject)
|
||||
{
|
||||
Handle(Transfer_TransientProcess) aTP = theTR->TransientProcess();
|
||||
const Interface_Graph& aGraph = aTP->Graph();
|
||||
|
||||
if (theGDT->IsKind(STANDARD_TYPE(StepShape_DimensionalSize))) {
|
||||
// retrieve derived geometry
|
||||
Handle(StepShape_DimensionalSize) aDim = Handle(StepShape_DimensionalSize)::DownCast(theGDT);
|
||||
Handle(StepRepr_DerivedShapeAspect) aDSA = Handle(StepRepr_DerivedShapeAspect)::DownCast(aDim->AppliesTo());
|
||||
if (aDSA.IsNull())
|
||||
return;
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = NULL;
|
||||
for (Interface_EntityIterator anIt = aGraph.Sharings(aDSA); aGISU.IsNull() && anIt.More(); anIt.Next()) {
|
||||
aGISU = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIt.Value());
|
||||
}
|
||||
if (aGISU.IsNull() || aGISU->NbIdentifiedItem() == 0)
|
||||
return;
|
||||
Handle(StepGeom_CartesianPoint) aPoint = Handle(StepGeom_CartesianPoint)::DownCast(aGISU->IdentifiedItem()->Value(1));
|
||||
if (aPoint.IsNull()) {
|
||||
// try Axis2Placement3d.location instead of CartesianPoint
|
||||
Handle(StepGeom_Axis2Placement3d) anA2P3D =
|
||||
Handle(StepGeom_Axis2Placement3d)::DownCast(aGISU->IdentifiedItem()->Value(1));
|
||||
if (anA2P3D.IsNull())
|
||||
return;
|
||||
aPoint = anA2P3D->Location();
|
||||
}
|
||||
|
||||
// set connection point to object
|
||||
gp_Pnt aPnt(aPoint->CoordinatesValue(1), aPoint->CoordinatesValue(2), aPoint->CoordinatesValue(3));
|
||||
theDimObject->SetPoint(aPnt);
|
||||
}
|
||||
else if (theGDT->IsKind(STANDARD_TYPE(StepShape_DimensionalLocation))) {
|
||||
// retrieve derived geometry
|
||||
Handle(StepShape_DimensionalLocation) aDim = Handle(StepShape_DimensionalLocation)::DownCast(theGDT);
|
||||
Handle(StepRepr_DerivedShapeAspect) aDSA1 = Handle(StepRepr_DerivedShapeAspect)::DownCast(aDim->RelatingShapeAspect());
|
||||
Handle(StepRepr_DerivedShapeAspect) aDSA2 = Handle(StepRepr_DerivedShapeAspect)::DownCast(aDim->RelatedShapeAspect());
|
||||
if (aDSA1.IsNull() && aDSA2.IsNull())
|
||||
return;
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU1 = NULL;
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU2 = NULL;
|
||||
if (!aDSA1.IsNull()) {
|
||||
for (Interface_EntityIterator anIt = aGraph.Sharings(aDSA1); aGISU1.IsNull() && anIt.More(); anIt.Next()) {
|
||||
aGISU1 = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIt.Value());
|
||||
}
|
||||
}
|
||||
if (!aDSA2.IsNull()) {
|
||||
for (Interface_EntityIterator anIt = aGraph.Sharings(aDSA2); aGISU2.IsNull() && anIt.More(); anIt.Next()) {
|
||||
aGISU2 = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIt.Value());
|
||||
}
|
||||
}
|
||||
// first point
|
||||
if (!aGISU1.IsNull() && aGISU1->NbIdentifiedItem() > 0) {
|
||||
Handle(StepGeom_CartesianPoint) aPoint = Handle(StepGeom_CartesianPoint)::DownCast(aGISU1->IdentifiedItem()->Value(1));
|
||||
if (aPoint.IsNull()) {
|
||||
// try Axis2Placement3d.location instead of CartesianPoint
|
||||
Handle(StepGeom_Axis2Placement3d) anA2P3D =
|
||||
Handle(StepGeom_Axis2Placement3d)::DownCast(aGISU1->IdentifiedItem()->Value(1));
|
||||
if (!anA2P3D.IsNull())
|
||||
aPoint = anA2P3D->Location();
|
||||
}
|
||||
if (!aPoint.IsNull()) {
|
||||
// set connection point to object
|
||||
gp_Pnt aPnt(aPoint->CoordinatesValue(1), aPoint->CoordinatesValue(2), aPoint->CoordinatesValue(3));
|
||||
theDimObject->SetPoint(aPnt);
|
||||
}
|
||||
}
|
||||
// second point
|
||||
if (!aGISU2.IsNull() && aGISU2->NbIdentifiedItem() > 0) {
|
||||
Handle(StepGeom_CartesianPoint) aPoint = Handle(StepGeom_CartesianPoint)::DownCast(aGISU2->IdentifiedItem()->Value(1));
|
||||
if (aPoint.IsNull()) {
|
||||
// try Axis2Placement3d.location instead of CartesianPoint
|
||||
Handle(StepGeom_Axis2Placement3d) anA2P3D =
|
||||
Handle(StepGeom_Axis2Placement3d)::DownCast(aGISU2->IdentifiedItem()->Value(1));
|
||||
if (!anA2P3D.IsNull())
|
||||
aPoint = anA2P3D->Location();
|
||||
}
|
||||
if (!aPoint.IsNull()) {
|
||||
// set connection point to object
|
||||
gp_Pnt aPnt(aPoint->CoordinatesValue(1), aPoint->CoordinatesValue(2), aPoint->CoordinatesValue(3));
|
||||
theDimObject->SetPoint2(aPnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ReadDatums
|
||||
//purpose : auxilary
|
||||
@@ -2433,7 +2526,49 @@ static Standard_Boolean readDatumsAP242(const Handle(Standard_Transient)& theEnt
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : craeteGeomTolObjectInXCAF
|
||||
//function : collectShapeAspect
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static void collectShapeAspect(const Handle(StepRepr_ShapeAspect)& theSA,
|
||||
const Handle(XSControl_WorkSession)& theWS,
|
||||
NCollection_Sequence<Handle(StepRepr_ShapeAspect)>& theSAs)
|
||||
{
|
||||
Handle(XSControl_TransferReader) aTR = theWS->TransferReader();
|
||||
Handle(Transfer_TransientProcess) aTP = aTR->TransientProcess();
|
||||
const Interface_Graph& aGraph = aTP->Graph();
|
||||
// Retrieve Shape_Aspect, connected to Representation_Item from Derived_Shape_Aspect
|
||||
if (theSA->IsKind(STANDARD_TYPE(StepRepr_DerivedShapeAspect))) {
|
||||
Interface_EntityIterator anIter = aGraph.Sharings(theSA);
|
||||
Handle(StepRepr_ShapeAspectDerivingRelationship) aSADR = NULL;
|
||||
for (; aSADR.IsNull() && anIter.More(); anIter.Next()) {
|
||||
aSADR = Handle(StepRepr_ShapeAspectDerivingRelationship)::DownCast(anIter.Value());
|
||||
}
|
||||
if (!aSADR.IsNull())
|
||||
collectShapeAspect(aSADR->RelatedShapeAspect(), theWS, theSAs);
|
||||
}
|
||||
else {
|
||||
// Find all children Shape_Aspect
|
||||
Standard_Boolean isSimple = Standard_True;
|
||||
Interface_EntityIterator anIter = aGraph.Sharings(theSA);
|
||||
for (; anIter.More(); anIter.Next()) {
|
||||
if (anIter.Value()->IsKind(STANDARD_TYPE(StepRepr_ShapeAspectRelationship)) &&
|
||||
!anIter.Value()->IsKind(STANDARD_TYPE(StepShape_DimensionalLocation))) {
|
||||
Handle(StepRepr_ShapeAspectRelationship) aSAR =
|
||||
Handle(StepRepr_ShapeAspectRelationship)::DownCast(anIter.Value());
|
||||
if (aSAR->RelatingShapeAspect() == theSA) {
|
||||
collectShapeAspect(aSAR->RelatedShapeAspect(), theWS, theSAs);
|
||||
isSimple = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
// If not Composite_Shape_Aspect (or subtype) append to sequence.
|
||||
if (isSimple)
|
||||
theSAs.Append(theSA);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : createGeomTolObjectInXCAF
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
@@ -2459,6 +2594,7 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
// find RepresentationItem for current Ent
|
||||
NCollection_Sequence<Handle(Standard_Transient)> aSeqRI1, aSeqRI2;
|
||||
|
||||
// Collect all Shape_Aspect entities
|
||||
Interface_EntityIterator anIter = aGraph.Shareds(theEnt);
|
||||
for(anIter.Start(); anIter.More(); anIter.Next()) {
|
||||
Handle(Standard_Transient) anAtr = anIter.Value();
|
||||
@@ -2492,69 +2628,27 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
Interface_EntityIterator anIterDim = aGraph.Shareds(anAtr);
|
||||
for(anIterDim.Start(); anIterDim.More(); anIterDim.Next())
|
||||
{
|
||||
Handle(Standard_Transient) anAtrDim = anIterDim.Value();
|
||||
if(anAtrDim->IsKind(STANDARD_TYPE(StepRepr_CompositeShapeAspect)) ||
|
||||
anAtrDim->IsKind(STANDARD_TYPE(StepRepr_CompShAspAndDatumFeatAndShAsp)))
|
||||
{
|
||||
Interface_EntityIterator anIterCSA = aGraph.Sharings(anAtrDim);
|
||||
for(anIterCSA.Start(); anIterCSA.More(); anIterCSA.Next()) {
|
||||
if (anIterCSA.Value()->IsKind(STANDARD_TYPE(StepRepr_ShapeAspectRelationship))){
|
||||
Interface_EntityIterator anIterSAR = aGraph.Shareds(anIterCSA.Value());
|
||||
for(anIterSAR.Start(); anIterSAR.More(); anIterSAR.Next()) {
|
||||
if (anIterSAR.Value()->IsKind(STANDARD_TYPE(StepRepr_ShapeAspect))){
|
||||
aSAs.Append(Handle(StepRepr_ShapeAspect)::DownCast(anIterSAR.Value()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(anAtrDim->IsKind(STANDARD_TYPE(StepRepr_ShapeAspect)))
|
||||
{
|
||||
aSAs.Append( Handle(StepRepr_ShapeAspect)::DownCast(anAtrDim));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(anAtr->IsKind(STANDARD_TYPE(StepRepr_CompositeShapeAspect)) ||
|
||||
anAtr->IsKind(STANDARD_TYPE(StepRepr_CompShAspAndDatumFeatAndShAsp)))
|
||||
{
|
||||
//processing for composite entity
|
||||
Handle(Standard_Transient) anAtrTmp = anAtr;
|
||||
if(anAtr->IsKind(STANDARD_TYPE(StepRepr_AllAroundShapeAspect)))
|
||||
{
|
||||
// if applyed AllAround Modifier
|
||||
isAllAround = Standard_True;
|
||||
Interface_EntityIterator anIterAASA = aGraph.Sharings(anAtrTmp);
|
||||
for(anIterAASA.Start(); anIterAASA.More(); anIterAASA.Next()) {
|
||||
if (anIterAASA.Value()->IsKind(STANDARD_TYPE(StepRepr_ShapeAspectRelationship))){
|
||||
Interface_EntityIterator anIterSAR = aGraph.Shareds(anIterAASA.Value());
|
||||
for(anIterSAR.Start(); anIterSAR.More(); anIterSAR.Next()) {
|
||||
if ((anIterSAR.Value()->IsKind(STANDARD_TYPE(StepRepr_CompositeShapeAspect)) ||
|
||||
anIterSAR.Value()->IsKind(STANDARD_TYPE(StepRepr_CompShAspAndDatumFeatAndShAsp))) &&
|
||||
anAtrTmp != anIterSAR.Value()){
|
||||
anAtrTmp = anIterSAR.Value();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Interface_EntityIterator anIterCSA = aGraph.Sharings(anAtrTmp);
|
||||
for(anIterCSA.Start(); anIterCSA.More(); anIterCSA.Next()) {
|
||||
if (anIterCSA.Value()->IsKind(STANDARD_TYPE(StepRepr_ShapeAspectRelationship))){
|
||||
Interface_EntityIterator anIterSAR = aGraph.Shareds(anIterCSA.Value());
|
||||
for(anIterSAR.Start(); anIterSAR.More(); anIterSAR.Next()) {
|
||||
if (anIterSAR.Value()->IsKind(STANDARD_TYPE(StepRepr_ShapeAspect))){
|
||||
aSAs.Append(Handle(StepRepr_ShapeAspect)::DownCast(anIterSAR.Value()));
|
||||
}
|
||||
}
|
||||
Handle(StepRepr_ShapeAspect) aSA = Handle(StepRepr_ShapeAspect)::DownCast(anIterDim.Value());
|
||||
if(!aSA.IsNull()) {
|
||||
collectShapeAspect(aSA, theWS, aSAs);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(anAtr->IsKind(STANDARD_TYPE(StepRepr_ShapeAspect)))
|
||||
{
|
||||
//default
|
||||
aSAs.Append( Handle(StepRepr_ShapeAspect)::DownCast(anAtr));
|
||||
if(anAtr->IsKind(STANDARD_TYPE(StepRepr_AllAroundShapeAspect)))
|
||||
{
|
||||
// if applyed AllAround Modifier
|
||||
isAllAround = Standard_True;
|
||||
}
|
||||
// dimensions and default tolerances
|
||||
Handle(StepRepr_ShapeAspect) aSA = Handle(StepRepr_ShapeAspect)::DownCast(anAtr);
|
||||
if(!aSA.IsNull()) {
|
||||
collectShapeAspect(aSA, theWS, aSAs);
|
||||
}
|
||||
}
|
||||
|
||||
// Collect all representation items
|
||||
if(!aSAs.IsEmpty())
|
||||
{
|
||||
//get representation items
|
||||
@@ -2767,8 +2861,8 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
else
|
||||
{
|
||||
if(aGISU.IsNull()) continue;
|
||||
if(aGISU->NbIdentifiedItem() > 0) {
|
||||
aSeqRI.Append(aGISU->IdentifiedItemValue(1));
|
||||
for (Standard_Integer i = 1; i <= aGISU->NbIdentifiedItem(); i++) {
|
||||
aSeqRI.Append(aGISU->IdentifiedItemValue(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2785,6 +2879,7 @@ static TDF_Label createGDTObjectInXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
|
||||
TDF_LabelSequence aShLS1, aShLS2;
|
||||
|
||||
// Collect shapes
|
||||
for(Standard_Integer i = aSeqRI1.Lower(); i <= aSeqRI1.Upper() ;i++)
|
||||
{
|
||||
Standard_Integer anIndex = aTP->MapIndex(aSeqRI1.Value(i));
|
||||
@@ -3058,7 +3153,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
}
|
||||
else
|
||||
{
|
||||
// calss of tolerance
|
||||
// class of tolerance
|
||||
aLAF = aTMD.LimitsAndFits();
|
||||
}
|
||||
}
|
||||
@@ -3249,6 +3344,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
if(aDimL.FindAttribute(XCAFDoc_Dimension::GetID(),aDim))
|
||||
{
|
||||
readAnnotation(aTR, theEnt, aDimObj);
|
||||
readConnectionPoints(aTR, theEnt, aDimObj);
|
||||
aDim->SetObject(aDimObj);
|
||||
}
|
||||
}
|
||||
|
@@ -112,6 +112,9 @@
|
||||
#include <StepGeom_Surface.hxx>
|
||||
#include <StepRepr_CompGroupShAspAndCompShAspAndDatumFeatAndShAsp.hxx>
|
||||
#include <StepRepr_CompositeShapeAspect.hxx>
|
||||
#include <StepRepr_ConstructiveGeometryRepresentation.hxx>
|
||||
#include <StepRepr_ConstructiveGeometryRepresentationRelationship.hxx>
|
||||
#include <StepRepr_DerivedShapeAspect.hxx>
|
||||
#include <StepRepr_DescriptiveRepresentationItem.hxx>
|
||||
#include <StepRepr_FeatureForDatumTargetRelationship.hxx>
|
||||
#include <StepRepr_HArray1OfRepresentationItem.hxx>
|
||||
@@ -127,6 +130,7 @@
|
||||
#include <StepRepr_ReprItemAndPlaneAngleMeasureWithUnit.hxx>
|
||||
#include <StepRepr_ReprItemAndPlaneAngleMeasureWithUnitAndQRI.hxx>
|
||||
#include <StepRepr_ShapeAspect.hxx>
|
||||
#include <StepRepr_ShapeAspectDerivingRelationship.hxx>
|
||||
#include <StepRepr_ShapeAspectRelationship.hxx>
|
||||
#include <StepRepr_SpecifiedHigherUsageOccurrence.hxx>
|
||||
#include <StepRepr_ValueRange.hxx>
|
||||
@@ -2703,7 +2707,7 @@ static void WriteDimValues(const Handle(XSControl_WorkSession) &WS,
|
||||
Handle(StepGeom_Axis2Placement3d) anOrientation = new StepGeom_Axis2Placement3d();
|
||||
gp_Dir aDir;
|
||||
theObject->GetDirection(aDir);
|
||||
GeomToStep_MakeCartesianPoint MkPoint(theObject->GetPoints()->Value(1));
|
||||
GeomToStep_MakeCartesianPoint MkPoint(gp_Pnt(0, 0, 0));
|
||||
Handle(StepGeom_CartesianPoint) aLoc = MkPoint.Value();
|
||||
Handle(StepGeom_Direction) anAxis = new StepGeom_Direction();
|
||||
Handle(TColStd_HArray1OfReal) aCoords = new TColStd_HArray1OfReal(1, 3);
|
||||
@@ -2785,6 +2789,59 @@ static void WriteDimValues(const Handle(XSControl_WorkSession) &WS,
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteDerivedGeometry
|
||||
//purpose : auxiliary (write connection point for dimensions)
|
||||
//======================================================================
|
||||
static void WriteDerivedGeometry (const Handle(XSControl_WorkSession) &WS,
|
||||
const Handle(XCAFDimTolObjects_DimensionObject)& theObject,
|
||||
const Handle(StepRepr_ConstructiveGeometryRepresentation) theRepr,
|
||||
Handle(StepRepr_ShapeAspect)& theFirstSA,
|
||||
Handle(StepRepr_ShapeAspect)& theSecondSA,
|
||||
NCollection_Vector<Handle(StepGeom_CartesianPoint)>& thePnts)
|
||||
{
|
||||
const Handle(Interface_InterfaceModel) &aModel = WS->Model();
|
||||
// First point
|
||||
if (theObject->HasPoint()) {
|
||||
GeomToStep_MakeCartesianPoint aPointMaker(theObject->GetPoint());
|
||||
Handle(StepGeom_CartesianPoint) aPoint = aPointMaker.Value();
|
||||
thePnts.Append(aPoint);
|
||||
Handle(StepRepr_DerivedShapeAspect) aDSA = new StepRepr_DerivedShapeAspect();
|
||||
aDSA->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), theFirstSA->OfShape(), StepData_LFalse);
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = new StepAP242_GeometricItemSpecificUsage();
|
||||
StepAP242_ItemIdentifiedRepresentationUsageDefinition aDefinition;
|
||||
aDefinition.SetValue(aDSA);
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) anItem = new StepRepr_HArray1OfRepresentationItem(1, 1);
|
||||
anItem->SetValue(1, aPoint);
|
||||
aGISU->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), aDefinition, theRepr, anItem);
|
||||
Handle(StepRepr_ShapeAspectDerivingRelationship) aSADR = new StepRepr_ShapeAspectDerivingRelationship();
|
||||
aSADR->Init(new TCollection_HAsciiString(), Standard_False, new TCollection_HAsciiString(), aDSA, theFirstSA);
|
||||
theFirstSA = aDSA;
|
||||
aModel->AddWithRefs(aGISU);
|
||||
aModel->AddWithRefs(aSADR);
|
||||
}
|
||||
|
||||
// Second point (for locations)
|
||||
if (theObject->HasPoint2()) {
|
||||
GeomToStep_MakeCartesianPoint aPointMaker(theObject->GetPoint2());
|
||||
Handle(StepGeom_CartesianPoint) aPoint = aPointMaker.Value();
|
||||
thePnts.Append(aPoint);
|
||||
Handle(StepRepr_DerivedShapeAspect) aDSA = new StepRepr_DerivedShapeAspect();
|
||||
aDSA->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), theFirstSA->OfShape(), StepData_LFalse);
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = new StepAP242_GeometricItemSpecificUsage();
|
||||
StepAP242_ItemIdentifiedRepresentationUsageDefinition aDefinition;
|
||||
aDefinition.SetValue(aDSA);
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) anItem = new StepRepr_HArray1OfRepresentationItem(1, 1);
|
||||
anItem->SetValue(1, aPoint);
|
||||
aGISU->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), aDefinition, theRepr, anItem);
|
||||
Handle(StepRepr_ShapeAspectDerivingRelationship) aSADR = new StepRepr_ShapeAspectDerivingRelationship();
|
||||
aSADR->Init(new TCollection_HAsciiString(), Standard_False, new TCollection_HAsciiString(), aDSA, theSecondSA);
|
||||
theSecondSA = aDSA;
|
||||
aModel->AddWithRefs(aGISU);
|
||||
aModel->AddWithRefs(aSADR);
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : WriteDatumSystem
|
||||
//purpose : auxiliary (write Write datum system for given
|
||||
@@ -3611,6 +3668,14 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
//------------------//
|
||||
aDGTLabels.Clear();
|
||||
DGTTool->GetDimensionLabels(aDGTLabels);
|
||||
// Auxiliary entities for derived geometry
|
||||
Handle(StepRepr_ConstructiveGeometryRepresentation) aCGRepr =
|
||||
new StepRepr_ConstructiveGeometryRepresentation();
|
||||
Handle(StepRepr_ConstructiveGeometryRepresentationRelationship) aCGReprRel =
|
||||
new StepRepr_ConstructiveGeometryRepresentationRelationship();
|
||||
NCollection_Vector<Handle(StepGeom_CartesianPoint)> aConnectionPnts;
|
||||
Handle(StepRepr_RepresentationContext) dummyRC;
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) dummyGISU;
|
||||
for (Standard_Integer i = 1; i <= aDGTLabels.Length(); i++) {
|
||||
TDF_Label aDimensionL = aDGTLabels.Value(i);
|
||||
TDF_LabelSequence aFirstShapeL, aSecondShapeL;
|
||||
@@ -3624,8 +3689,6 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
continue;
|
||||
|
||||
// Write links with shapes
|
||||
Handle(StepRepr_RepresentationContext) dummyRC;
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) dummyGISU;
|
||||
Handle(StepRepr_ShapeAspect) aFirstSA, aSecondSA;
|
||||
if (aFirstShapeL.Length() == 1) {
|
||||
TopoDS_Shape aShape = XCAFDoc_ShapeTool::GetShape(aFirstShapeL.Value(1));
|
||||
@@ -3679,6 +3742,8 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
|
||||
// Write dimensions
|
||||
StepShape_DimensionalCharacteristic aDimension;
|
||||
if (anObject->HasPoint() || anObject->HasPoint2())
|
||||
WriteDerivedGeometry(WS, anObject, aCGRepr, aFirstSA, aSecondSA, aConnectionPnts);
|
||||
XCAFDimTolObjects_DimensionType aDimType = anObject->GetType();
|
||||
if (STEPCAFControl_GDTProperty::IsDimensionalLocation(aDimType)) {
|
||||
// Dimensional_Location
|
||||
@@ -3746,6 +3811,15 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
//Annotation plane and Presentation
|
||||
WritePresentation(WS, anObject->GetPresentation(), anObject->GetPlane(), anObject->GetPointTextAttach(), aDimension.Value());
|
||||
}
|
||||
// Write Derived geometry
|
||||
if (aConnectionPnts.Length() > 0) {
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) anItems = new StepRepr_HArray1OfRepresentationItem(1, aConnectionPnts.Length());
|
||||
for (Standard_Integer i = 0; i < aConnectionPnts.Length(); i++)
|
||||
anItems->SetValue(i + 1, aConnectionPnts(i));
|
||||
aCGRepr->Init(new TCollection_HAsciiString(), anItems, dummyRC);
|
||||
aCGReprRel->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), dummyGISU->UsedRepresentation(), aCGRepr);
|
||||
aModel->AddWithRefs(aCGReprRel);
|
||||
}
|
||||
|
||||
//----------------------------//
|
||||
// write Geometric Tolerances //
|
||||
|
Reference in New Issue
Block a user