mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0028315: Data Exchange - Import/Export GD&Ts without semantic
Implement import/export of Dimensions without semantic. Add new type of dimension for GDTs with presentation and connecting to shapes. Update test cases. Small corrections for issue CR28315
This commit is contained in:
@@ -175,6 +175,7 @@
|
||||
#include <StepShape_Vertex.hxx>
|
||||
#include <StepToGeom.hxx>
|
||||
#include <StepVisual_AnnotationCurveOccurrence.hxx>
|
||||
#include <StepVisual_AnnotationFillArea.hxx>
|
||||
#include <StepVisual_AnnotationPlane.hxx>
|
||||
#include <StepVisual_DraughtingCallout.hxx>
|
||||
#include <StepVisual_DraughtingCalloutElement.hxx>
|
||||
@@ -1396,6 +1397,8 @@ Standard_Boolean STEPCAFControl_Reader::ReadLayers (const Handle(XSControl_WorkS
|
||||
if ( ! enti->IsKind ( tSVPLA ) ) continue;
|
||||
Handle(StepVisual_PresentationLayerAssignment) SVPLA =
|
||||
Handle(StepVisual_PresentationLayerAssignment)::DownCast(enti);
|
||||
if (SVPLA->AssignedItems().IsNull())
|
||||
continue;
|
||||
|
||||
Handle(TCollection_HAsciiString) descr = SVPLA->Description();
|
||||
Handle(TCollection_HAsciiString) hName = SVPLA->Name();
|
||||
@@ -1767,6 +1770,7 @@ static Standard_Boolean GetMassConversionFactor(Handle(StepBasic_NamedUnit)& NU,
|
||||
}
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : readPMIPresentation
|
||||
//purpose : read polyline or tessellated presentation for
|
||||
@@ -1782,25 +1786,26 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
||||
if (thePresentEntity.IsNull())
|
||||
return Standard_False;
|
||||
Handle(Transfer_TransientProcess) aTP = theTR->TransientProcess();
|
||||
Handle(StepVisual_AnnotationCurveOccurrence) anACO;
|
||||
Handle(StepVisual_AnnotationOccurrence) anAO;
|
||||
NCollection_Vector<Handle(StepVisual_StyledItem)> anAnnotations;
|
||||
if (thePresentEntity->IsKind(STANDARD_TYPE(StepVisual_AnnotationCurveOccurrence)))
|
||||
if (thePresentEntity->IsKind(STANDARD_TYPE(StepVisual_AnnotationOccurrence)))
|
||||
{
|
||||
anACO = Handle(StepVisual_AnnotationCurveOccurrence)::DownCast(thePresentEntity);
|
||||
thePresentName = anACO->Name();
|
||||
if (!anACO.IsNull())
|
||||
anAnnotations.Append(anACO);
|
||||
anAO = Handle(StepVisual_AnnotationOccurrence)::DownCast(thePresentEntity);
|
||||
if (!anAO.IsNull()) {
|
||||
thePresentName = anAO->Name();
|
||||
anAnnotations.Append(anAO);
|
||||
}
|
||||
}
|
||||
else if (thePresentEntity->IsKind(STANDARD_TYPE(StepVisual_DraughtingCallout)))
|
||||
{
|
||||
Handle(StepVisual_DraughtingCallout) aDCallout =
|
||||
Handle(StepVisual_DraughtingCallout)::DownCast(thePresentEntity);
|
||||
thePresentName = aDCallout->Name();
|
||||
for (Standard_Integer i = 1; i <= aDCallout->NbContents() && anACO.IsNull(); i++) {
|
||||
anACO = aDCallout->ContentsValue(i).AnnotationCurveOccurrence();
|
||||
if (!anACO.IsNull())
|
||||
for (Standard_Integer i = 1; i <= aDCallout->NbContents() && anAO.IsNull(); i++) {
|
||||
anAO = Handle(StepVisual_AnnotationOccurrence)::DownCast(aDCallout->ContentsValue(i).Value());
|
||||
if (!anAO.IsNull())
|
||||
{
|
||||
anAnnotations.Append(anACO);
|
||||
anAnnotations.Append(anAO);
|
||||
continue;
|
||||
}
|
||||
Handle(StepVisual_TessellatedAnnotationOccurrence) aTesselation =
|
||||
@@ -1824,11 +1829,11 @@ Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresen
|
||||
for (; i < anAnnotations.Length(); i++)
|
||||
{
|
||||
Handle(StepVisual_StyledItem) anItem = anAnnotations(i);
|
||||
anACO = Handle(StepVisual_AnnotationCurveOccurrence)::DownCast(anItem);
|
||||
anAO = Handle(StepVisual_AnnotationOccurrence)::DownCast(anItem);
|
||||
TopoDS_Shape anAnnotationShape;
|
||||
if (!anACO.IsNull())
|
||||
if (!anAO.IsNull())
|
||||
{
|
||||
Handle(StepRepr_RepresentationItem) aCurveItem = anACO->Item();
|
||||
Handle(StepRepr_RepresentationItem) aCurveItem = anAO->Item();
|
||||
anAnnotationShape = STEPConstruct::FindShape(aTP, aCurveItem);
|
||||
if (anAnnotationShape.IsNull())
|
||||
{
|
||||
@@ -2384,8 +2389,8 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIter.Value());
|
||||
if (aGISU.IsNull())
|
||||
continue;
|
||||
for (Standard_Integer i = 1; i <= aGISU->NbIdentifiedItem(); i++) {
|
||||
TDF_Label aShapeL = getShapeLabel(aGISU->IdentifiedItemValue(i), theWS, aSTool);
|
||||
for (Standard_Integer j = 1; j <= aGISU->NbIdentifiedItem(); j++) {
|
||||
TDF_Label aShapeL = getShapeLabel(aGISU->IdentifiedItemValue(j), theWS, aSTool);
|
||||
if (!aShapeL.IsNull())
|
||||
aShapeLabels.Append(aShapeL);
|
||||
}
|
||||
@@ -2398,19 +2403,19 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
Handle(StepDimTol_PlacedDatumTargetFeature) aDT = Handle(StepDimTol_PlacedDatumTargetFeature)::DownCast(aSAs.Value(i));
|
||||
if (aDT.IsNull())
|
||||
continue;
|
||||
Handle(XCAFDimTolObjects_DatumObject) aDatObj = new XCAFDimTolObjects_DatumObject();
|
||||
Handle(XCAFDimTolObjects_DatumObject) aDatTargetObj = new XCAFDimTolObjects_DatumObject();
|
||||
XCAFDimTolObjects_DatumTargetType aType;
|
||||
if (!STEPCAFControl_GDTProperty::GetDatumTargetType(aDT->Description(), aType))
|
||||
continue;
|
||||
aDatObj->SetDatumTargetType(aType);
|
||||
aDatTargetObj->SetDatumTargetType(aType);
|
||||
Standard_Boolean isValidDT = Standard_False;
|
||||
|
||||
// Feature for datum target
|
||||
TDF_LabelSequence aDTShapeLabels;
|
||||
Interface_EntityIterator anIter = aGraph.Sharings(aDT);
|
||||
Interface_EntityIterator aDTIter = aGraph.Sharings(aDT);
|
||||
Handle(StepRepr_FeatureForDatumTargetRelationship) aRelationship;
|
||||
for (; anIter.More() && aRelationship.IsNull(); anIter.Next()) {
|
||||
aRelationship = Handle(StepRepr_FeatureForDatumTargetRelationship)::DownCast(anIter.Value());
|
||||
for (; aDTIter.More() && aRelationship.IsNull(); aDTIter.Next()) {
|
||||
aRelationship = Handle(StepRepr_FeatureForDatumTargetRelationship)::DownCast(aDTIter.Value());
|
||||
}
|
||||
if (!aRelationship.IsNull()) {
|
||||
Handle(StepRepr_ShapeAspect) aSA = aRelationship->RelatingShapeAspect();
|
||||
@@ -2419,8 +2424,8 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(aSAIter.Value());
|
||||
if (aGISU.IsNull())
|
||||
continue;
|
||||
for (Standard_Integer i = 1; i <= aGISU->NbIdentifiedItem(); i++) {
|
||||
TDF_Label aShapeL = getShapeLabel(aGISU->IdentifiedItemValue(i), theWS, aSTool);
|
||||
for (Standard_Integer j = 1; j <= aGISU->NbIdentifiedItem(); j++) {
|
||||
TDF_Label aShapeL = getShapeLabel(aGISU->IdentifiedItemValue(j), theWS, aSTool);
|
||||
if (!aShapeL.IsNull()) {
|
||||
aDTShapeLabels.Append(aShapeL);
|
||||
isValidDT = Standard_True;
|
||||
@@ -2431,12 +2436,12 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
|
||||
if (aType != XCAFDimTolObjects_DatumTargetType_Area && !isValidDT) {
|
||||
// Try another way of feature connection
|
||||
for (anIter.Start(); anIter.More(); anIter.Next()) {
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIter.Value());
|
||||
for (aDTIter.Start(); aDTIter.More(); aDTIter.Next()) {
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(aDTIter.Value());
|
||||
if (aGISU.IsNull())
|
||||
continue;
|
||||
for (Standard_Integer i = 1; i <= aGISU->NbIdentifiedItem(); i++) {
|
||||
TDF_Label aShapeL = getShapeLabel(aGISU->IdentifiedItemValue(i), theWS, aSTool);
|
||||
for (Standard_Integer j = 1; j <= aGISU->NbIdentifiedItem(); j++) {
|
||||
TDF_Label aShapeL = getShapeLabel(aGISU->IdentifiedItemValue(j), theWS, aSTool);
|
||||
if (!aShapeL.IsNull()) {
|
||||
aDTShapeLabels.Append(aShapeL);
|
||||
isValidDT = Standard_True;
|
||||
@@ -2461,7 +2466,7 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
if (anItemIndex > 0) {
|
||||
Handle(Transfer_Binder) aBinder = aTP->MapItem(anItemIndex);
|
||||
TopoDS_Shape anItemShape = TransferBRep::ShapeResult(aBinder);
|
||||
aDatObj->SetDatumTarget(anItemShape);
|
||||
aDatTargetObj->SetDatumTarget(anItemShape);
|
||||
isValidDT = Standard_True;
|
||||
}
|
||||
}
|
||||
@@ -2484,21 +2489,21 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
if (!aSRWP.IsNull()) {
|
||||
isValidDT = Standard_True;
|
||||
// Collect parameters of datum target
|
||||
for (Standard_Integer i = aSRWP->Items()->Lower(); i <= aSRWP->Items()->Upper(); i++)
|
||||
for (Standard_Integer j = aSRWP->Items()->Lower(); j <= aSRWP->Items()->Upper(); j++)
|
||||
{
|
||||
if (aSRWP->ItemsValue(i).IsNull())
|
||||
if (aSRWP->ItemsValue(j).IsNull())
|
||||
continue;
|
||||
if (aSRWP->ItemsValue(i)->IsKind(STANDARD_TYPE(StepGeom_Axis2Placement3d)))
|
||||
if (aSRWP->ItemsValue(j)->IsKind(STANDARD_TYPE(StepGeom_Axis2Placement3d)))
|
||||
{
|
||||
Handle(StepGeom_Axis2Placement3d) anAx
|
||||
= Handle(StepGeom_Axis2Placement3d)::DownCast(aSRWP->ItemsValue(i));
|
||||
= Handle(StepGeom_Axis2Placement3d)::DownCast(aSRWP->ItemsValue(j));
|
||||
Handle(Geom_Axis2Placement) anAxis = StepToGeom::MakeAxis2Placement(anAx);
|
||||
aDatObj->SetDatumTargetAxis(anAxis->Ax2());
|
||||
aDatTargetObj->SetDatumTargetAxis(anAxis->Ax2());
|
||||
}
|
||||
else if (aSRWP->ItemsValue(i)->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit)))
|
||||
else if (aSRWP->ItemsValue(j)->IsKind(STANDARD_TYPE(StepRepr_ReprItemAndLengthMeasureWithUnit)))
|
||||
{
|
||||
Handle(StepRepr_ReprItemAndLengthMeasureWithUnit) aM =
|
||||
Handle(StepRepr_ReprItemAndLengthMeasureWithUnit)::DownCast(aSRWP->ItemsValue(i));
|
||||
Handle(StepRepr_ReprItemAndLengthMeasureWithUnit)::DownCast(aSRWP->ItemsValue(j));
|
||||
Standard_Real aVal = aM->GetMeasureWithUnit()->ValueComponent();
|
||||
StepBasic_Unit anUnit = aM->GetMeasureWithUnit()->UnitComponent();
|
||||
Standard_Real aFact = 1.;
|
||||
@@ -2511,9 +2516,9 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
aVal = aVal * aFact;
|
||||
if (aM->Name()->String().IsEqual("target length") ||
|
||||
aM->Name()->String().IsEqual("target diameter"))
|
||||
aDatObj->SetDatumTargetLength(aVal);
|
||||
aDatTargetObj->SetDatumTargetLength(aVal);
|
||||
else
|
||||
aDatObj->SetDatumTargetWidth(aVal);
|
||||
aDatTargetObj->SetDatumTargetWidth(aVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2526,17 +2531,17 @@ static Standard_Boolean setDatumToXCAF(const Handle(StepDimTol_Datum)& theDat,
|
||||
TDF_Label aDatL = aDGTTool->AddDatum();
|
||||
aDat = XCAFDoc_Datum::Set(aDatL);
|
||||
aDGTTool->SetDatum(aDTShapeLabels, aDatL);
|
||||
aDatObj->SetName(theDat->Identification());
|
||||
aDatObj->SetPosition(thePositionCounter);
|
||||
aDatTargetObj->SetName(theDat->Identification());
|
||||
aDatTargetObj->SetPosition(thePositionCounter);
|
||||
if (!theXCAFModifiers.IsEmpty())
|
||||
aDatObj->SetModifiers(theXCAFModifiers);
|
||||
aDatTargetObj->SetModifiers(theXCAFModifiers);
|
||||
if (theXCAFModifWithVal != XCAFDimTolObjects_DatumModifWithValue_None)
|
||||
aDatObj->SetModifierWithValue(theXCAFModifWithVal, theModifValue);
|
||||
aDatTargetObj->SetModifierWithValue(theXCAFModifWithVal, theModifValue);
|
||||
aDGTTool->SetDatumToGeomTol(aDatL, theGDTL);
|
||||
aDatObj->IsDatumTarget(Standard_True);
|
||||
aDatObj->SetDatumTargetNumber(aDT->TargetId()->IntegerValue());
|
||||
readAnnotation(aTR, aDT, aDatObj);
|
||||
aDat->SetObject(aDatObj);
|
||||
aDatTargetObj->IsDatumTarget(Standard_True);
|
||||
aDatTargetObj->SetDatumTargetNumber(aDT->TargetId()->IntegerValue());
|
||||
readAnnotation(aTR, aDT, aDatTargetObj);
|
||||
aDat->SetObject(aDatTargetObj);
|
||||
isExistDatumTarget = Standard_True;
|
||||
}
|
||||
}
|
||||
@@ -3814,51 +3819,123 @@ Standard_Boolean STEPCAFControl_Reader::ReadGDTs(const Handle(XSControl_WorkSess
|
||||
}
|
||||
}
|
||||
else if (anEnt->IsKind(STANDARD_TYPE(StepVisual_DraughtingCallout)) ||
|
||||
anEnt->IsKind(STANDARD_TYPE(StepVisual_AnnotationCurveOccurrence)))
|
||||
anEnt->IsKind(STANDARD_TYPE(StepVisual_AnnotationOccurrence)))
|
||||
{
|
||||
// read common PMIs: presentation, which is not connected to any PMI.
|
||||
Handle(StepVisual_AnnotationPlane) anAnPlane;
|
||||
Handle(StepAP242_DraughtingModelItemAssociation) aDMIA;
|
||||
Standard_Boolean isCommonLabel = Standard_True;
|
||||
for (Interface_EntityIterator anIter = aGraph.Sharings(anEnt); anIter.More(); anIter.Next())
|
||||
{
|
||||
if (anIter.Value()->IsKind(STANDARD_TYPE(StepVisual_AnnotationPlane)))
|
||||
anAnPlane = Handle(StepVisual_AnnotationPlane)::DownCast(anIter.Value());
|
||||
else
|
||||
isCommonLabel = Standard_False;
|
||||
// Protection against import presentation twice
|
||||
Handle(StepVisual_DraughtingCallout) aDC;
|
||||
for (Interface_EntityIterator anIter = aGraph.Sharings(anEnt); anIter.More() && aDC.IsNull(); anIter.Next()) {
|
||||
aDC = Handle(StepVisual_DraughtingCallout)::DownCast(anIter.Value());
|
||||
}
|
||||
if (!isCommonLabel)
|
||||
if (!aDC.IsNull())
|
||||
continue;
|
||||
// create empty Dimension
|
||||
TDF_Label aGDTL = aDGTTool->AddDimension();
|
||||
Handle(XCAFDoc_Dimension) aDim = XCAFDoc_Dimension::Set(aGDTL);
|
||||
TCollection_AsciiString aStr("DGT:Common_label");
|
||||
TDataStd_Name::Set(aGDTL, aStr);
|
||||
TDF_LabelSequence anEmptySeq1, anEmptySeq2;
|
||||
aDGTTool->SetDimension(anEmptySeq1, anEmptySeq2, aGDTL);
|
||||
Handle(XCAFDimTolObjects_DimensionObject) aDimObj = new XCAFDimTolObjects_DimensionObject();
|
||||
// read annotations
|
||||
Standard_Real aFact = 1.0;
|
||||
if (!anAnPlane.IsNull())
|
||||
{
|
||||
Handle(StepVisual_DraughtingModel) aDModel;
|
||||
for (Interface_EntityIterator anIter = aGraph.Sharings(anAnPlane); anIter.More() && aDModel.IsNull(); anIter.Next())
|
||||
{
|
||||
if (anIter.Value()->IsKind(STANDARD_TYPE(StepVisual_DraughtingModel)))
|
||||
aDModel = Handle(StepVisual_DraughtingModel)::DownCast(anIter.Value());
|
||||
}
|
||||
if (!aDModel.IsNull())
|
||||
GetLengthConversionFactorFromContext(aDModel->ContextOfItems(), aFact);
|
||||
// Read presentations for PMIs without semantic data.
|
||||
Handle(StepAP242_DraughtingModelItemAssociation) aDMIA;
|
||||
TDF_LabelSequence aShapesL;
|
||||
for (Interface_EntityIterator anIter = aGraph.Sharings(anEnt); anIter.More() && aDMIA.IsNull(); anIter.Next()) {
|
||||
aDMIA = Handle(StepAP242_DraughtingModelItemAssociation)::DownCast(anIter.Value());
|
||||
}
|
||||
gp_Ax2 aPlaneAxes;
|
||||
readAnnotationPlane(anAnPlane, aFact, aPlaneAxes);
|
||||
if (!aDMIA.IsNull()) {
|
||||
// Check entity, skip all, attached to GDTs
|
||||
Handle(StepRepr_ShapeAspect) aDefinition = aDMIA->Definition().ShapeAspect();
|
||||
if (!aDefinition.IsNull()) {
|
||||
Standard_Boolean isConnectedToGDT = Standard_False;
|
||||
// Skip if definition is a datum
|
||||
if (aDefinition->IsKind(STANDARD_TYPE(StepDimTol_Datum)) ||
|
||||
aDefinition->IsKind(STANDARD_TYPE(StepDimTol_DatumTarget)) ||
|
||||
aDefinition->IsKind(STANDARD_TYPE(StepDimTol_DatumFeature)) ||
|
||||
aDefinition->IsKind(STANDARD_TYPE(StepRepr_CompShAspAndDatumFeatAndShAsp))) {
|
||||
isConnectedToGDT = Standard_True;
|
||||
}
|
||||
// Skip if any GDT is applied to definition
|
||||
for (Interface_EntityIterator anIter = aGraph.Sharings(aDefinition); anIter.More() && !isConnectedToGDT; anIter.Next()) {
|
||||
if (anIter.Value()->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)) ||
|
||||
anIter.Value()->IsKind(STANDARD_TYPE(StepShape_DimensionalLocation)) ||
|
||||
anIter.Value()->IsKind(STANDARD_TYPE(StepDimTol_GeometricTolerance))) {
|
||||
isConnectedToGDT = Standard_True;
|
||||
continue;
|
||||
}
|
||||
Handle(StepRepr_ShapeAspectRelationship) aSAR = Handle(StepRepr_ShapeAspectRelationship)::DownCast(anIter.Value());
|
||||
if (!aSAR.IsNull()) {
|
||||
Handle(StepRepr_ShapeAspect) aSA = aSAR->RelatedShapeAspect();
|
||||
if (!aSA.IsNull()) {
|
||||
if (aSA->IsKind(STANDARD_TYPE(StepDimTol_Datum)) ||
|
||||
aSA->IsKind(STANDARD_TYPE(StepDimTol_DatumTarget)) ||
|
||||
aSA->IsKind(STANDARD_TYPE(StepDimTol_DatumFeature)) ||
|
||||
aSA->IsKind(STANDARD_TYPE(StepRepr_CompShAspAndDatumFeatAndShAsp))) {
|
||||
isConnectedToGDT = Standard_True;
|
||||
}
|
||||
for (Interface_EntityIterator aDimIter = aGraph.Sharings(aSA); aDimIter.More() && !isConnectedToGDT; aDimIter.Next()) {
|
||||
if (aDimIter.Value()->IsKind(STANDARD_TYPE(StepShape_DimensionalSize)) ||
|
||||
aDimIter.Value()->IsKind(STANDARD_TYPE(StepShape_DimensionalLocation)) ||
|
||||
aDimIter.Value()->IsKind(STANDARD_TYPE(StepDimTol_GeometricTolerance))) {
|
||||
isConnectedToGDT = Standard_True;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isConnectedToGDT)
|
||||
continue;
|
||||
}
|
||||
else if (aDMIA->Definition().PropertyDefinition().IsNull())
|
||||
continue;
|
||||
|
||||
// Get shapes
|
||||
NCollection_Sequence<Handle(StepRepr_ShapeAspect)> aSAs;
|
||||
collectShapeAspect(aDefinition, theWS, aSAs);
|
||||
for (Standard_Integer aSAIt = 1; aSAIt <= aSAs.Length(); aSAIt++) {
|
||||
Handle(StepAP242_GeometricItemSpecificUsage) aGISU;
|
||||
for (Interface_EntityIterator anIter = aGraph.Sharings(aSAs.Value(aSAIt)); anIter.More() && aGISU.IsNull(); anIter.Next())
|
||||
aGISU = Handle(StepAP242_GeometricItemSpecificUsage)::DownCast(anIter.Value());
|
||||
if (aGISU.IsNull())
|
||||
continue;
|
||||
for (Standard_Integer anItemIt = 1; anItemIt <= aGISU->NbIdentifiedItem(); anItemIt++) {
|
||||
TDF_Label aLabel = getShapeLabel(aGISU->IdentifiedItemValue(anItemIt), theWS, XCAFDoc_DocumentTool::ShapeTool(theDoc->Main()));
|
||||
if (!aLabel.IsNull())
|
||||
aShapesL.Append(aLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
Standard_Boolean isCommonLabel = (aShapesL.Length() == 0);
|
||||
|
||||
// Calculate unit
|
||||
Standard_Real aFact = 1.0;
|
||||
if (!aDMIA.IsNull() && !aDMIA->UsedRepresentation().IsNull())
|
||||
GetLengthConversionFactorFromContext(aDMIA->UsedRepresentation()->ContextOfItems(), aFact);
|
||||
|
||||
// Presentation
|
||||
TopoDS_Shape aPresentation;
|
||||
Handle(TCollection_HAsciiString) aPresentName;
|
||||
Bnd_Box aBox;
|
||||
readPMIPresentation(anEnt, aTR, aFact, aPresentation, aPresentName, aBox);
|
||||
// populate Dimension
|
||||
aDimObj->SetType(XCAFDimTolObjects_DimensionType_CommonLabel);
|
||||
aDimObj->SetPlane(aPlaneAxes);
|
||||
if (!readPMIPresentation(anEnt, aTR, aFact, aPresentation, aPresentName, aBox))
|
||||
continue;
|
||||
// Annotation plane
|
||||
Handle(StepVisual_AnnotationPlane) anAnPlane;
|
||||
for (Interface_EntityIterator anIter = aGraph.Sharings(anEnt); anIter.More() && anAnPlane.IsNull(); anIter.Next())
|
||||
anAnPlane = Handle(StepVisual_AnnotationPlane)::DownCast(anIter.Value());
|
||||
|
||||
// Set object to XCAF
|
||||
TDF_Label aGDTL = aDGTTool->AddDimension();
|
||||
Handle(XCAFDimTolObjects_DimensionObject) aDimObj = new XCAFDimTolObjects_DimensionObject();
|
||||
Handle(XCAFDoc_Dimension) aDim = XCAFDoc_Dimension::Set(aGDTL);
|
||||
TCollection_AsciiString aStr("DGT:");
|
||||
if (isCommonLabel) {
|
||||
aStr.AssignCat("Common_label");
|
||||
aDimObj->SetType(XCAFDimTolObjects_DimensionType_CommonLabel);
|
||||
}
|
||||
else {
|
||||
aStr.AssignCat("Dimension");
|
||||
aDimObj->SetType(XCAFDimTolObjects_DimensionType_DimensionPresentation);
|
||||
}
|
||||
TDataStd_Name::Set(aGDTL, aStr);
|
||||
TDF_LabelSequence anEmptySeq2;
|
||||
aDGTTool->SetDimension(aShapesL, anEmptySeq2, aGDTL);
|
||||
gp_Ax2 aPlaneAxes;
|
||||
if (!anAnPlane.IsNull()) {
|
||||
if (readAnnotationPlane(anAnPlane, aFact, aPlaneAxes))
|
||||
aDimObj->SetPlane(aPlaneAxes);
|
||||
}
|
||||
aDimObj->SetPresentation(aPresentation, aPresentName);
|
||||
aDim->SetObject(aDimObj);
|
||||
}
|
||||
|
@@ -238,11 +238,6 @@
|
||||
#include <XSControl_TransferWriter.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
|
||||
static NCollection_Vector<Handle(StepVisual_AnnotationPlane)> gdtAnnotationPlanes;
|
||||
static Handle(StepVisual_DraughtingModel) gdtPresentationDM;
|
||||
static Handle(StepVisual_HArray1OfPresentationStyleAssignment) gdtPrsCurveStyle;
|
||||
static Handle(StepRepr_ProductDefinitionShape) gdtCommonPDS;
|
||||
|
||||
// added by skl 15.01.2004 for D> writing
|
||||
//#include <StepRepr_CompoundItemDefinition.hxx>
|
||||
//#include <StepRepr_CompoundItemDefinitionMember.hxx>
|
||||
@@ -319,6 +314,8 @@ void STEPCAFControl_Writer::Init (const Handle(XSControl_WorkSession)& WS,
|
||||
myFiles.Clear();
|
||||
myLabEF.Clear();
|
||||
myLabels.Clear();
|
||||
myGDTPresentationDM = new StepVisual_DraughtingModel();
|
||||
myGDTPrsCurveStyle = new StepVisual_HArray1OfPresentationStyleAssignment(1, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -2285,11 +2282,11 @@ static Handle(StepRepr_ReprItemAndMeasureWithUnit) CreateDimValue(const Standard
|
||||
//purpose : auxiliary (write Shape_Aspect entity for given shape)
|
||||
//=======================================================================
|
||||
|
||||
static Handle(StepRepr_ShapeAspect) WriteShapeAspect (const Handle(XSControl_WorkSession) &WS,
|
||||
const TDF_Label theLabel,
|
||||
const TopoDS_Shape theShape,
|
||||
Handle(StepRepr_RepresentationContext)& theRC,
|
||||
Handle(StepAP242_GeometricItemSpecificUsage)& theGISU)
|
||||
Handle(StepRepr_ShapeAspect) STEPCAFControl_Writer::WriteShapeAspect (const Handle(XSControl_WorkSession) &WS,
|
||||
const TDF_Label theLabel,
|
||||
const TopoDS_Shape theShape,
|
||||
Handle(StepRepr_RepresentationContext)& theRC,
|
||||
Handle(StepAP242_GeometricItemSpecificUsage)& theGISU)
|
||||
{
|
||||
// Get working data
|
||||
const Handle(Interface_InterfaceModel) &Model = WS->Model();
|
||||
@@ -2359,12 +2356,14 @@ static Handle(StepRepr_ShapeAspect) WriteShapeAspect (const Handle(XSControl_Wor
|
||||
//function : WritePresentation
|
||||
//purpose : auxiliary (write annotation plane and presentation)
|
||||
//======================================================================
|
||||
static void WritePresentation(const Handle(XSControl_WorkSession) &WS,
|
||||
const TopoDS_Shape thePresentation,
|
||||
const Handle(TCollection_HAsciiString)& thePrsName,
|
||||
const gp_Ax2 theAnnotationPlane,
|
||||
const gp_Pnt theTextPosition,
|
||||
const Handle(Standard_Transient) theDimension)
|
||||
void STEPCAFControl_Writer::WritePresentation(const Handle(XSControl_WorkSession) &WS,
|
||||
const TopoDS_Shape thePresentation,
|
||||
const Handle(TCollection_HAsciiString)& thePrsName,
|
||||
const Standard_Boolean hasSemantic,
|
||||
const Standard_Boolean hasPlane,
|
||||
const gp_Ax2 theAnnotationPlane,
|
||||
const gp_Pnt theTextPosition,
|
||||
const Handle(Standard_Transient) theDimension)
|
||||
{
|
||||
if (thePresentation.IsNull())
|
||||
return;
|
||||
@@ -2374,7 +2373,7 @@ static void WritePresentation(const Handle(XSControl_WorkSession) &WS,
|
||||
// Presentation
|
||||
Handle(StepVisual_TessellatedGeometricSet) aGeomSet = STEPCAFControl_GDTProperty::GetTessellation(thePresentation);
|
||||
Handle(StepVisual_TessellatedAnnotationOccurrence) aTAO = new StepVisual_TessellatedAnnotationOccurrence();
|
||||
aTAO->Init(new TCollection_HAsciiString(), gdtPrsCurveStyle, aGeomSet);
|
||||
aTAO->Init(new TCollection_HAsciiString(), myGDTPrsCurveStyle, aGeomSet);
|
||||
StepVisual_DraughtingCalloutElement aDCElement;
|
||||
aDCElement.SetValue(aTAO);
|
||||
Handle(StepVisual_HArray1OfDraughtingCalloutElement) aTAOs = new StepVisual_HArray1OfDraughtingCalloutElement(1, 1);
|
||||
@@ -2384,14 +2383,22 @@ static void WritePresentation(const Handle(XSControl_WorkSession) &WS,
|
||||
aDCallout->Init(aPrsName, aTAOs);
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) aDCsForDMIA = new StepRepr_HArray1OfRepresentationItem(1, 1);
|
||||
aDCsForDMIA->SetValue(1, aDCallout);
|
||||
myGDTAnnotations.Append(aDCallout);
|
||||
StepAP242_ItemIdentifiedRepresentationUsageDefinition aDimension;
|
||||
aDimension.SetValue(theDimension);
|
||||
Handle(TCollection_HAsciiString) aDMIAName;
|
||||
if (hasSemantic)
|
||||
aDMIAName = new TCollection_HAsciiString("PMI representation to presentation link");
|
||||
else
|
||||
aDMIAName = new TCollection_HAsciiString();
|
||||
Handle(StepAP242_DraughtingModelItemAssociation) aDMIA =
|
||||
new StepAP242_DraughtingModelItemAssociation();
|
||||
aDMIA->Init(new TCollection_HAsciiString("PMI representation to presentation link"),
|
||||
new TCollection_HAsciiString(), aDimension, gdtPresentationDM, aDCsForDMIA);
|
||||
aDMIA->Init(aDMIAName, new TCollection_HAsciiString(), aDimension, myGDTPresentationDM, aDCsForDMIA);
|
||||
aModel->AddWithRefs(aDMIA);
|
||||
|
||||
if (!hasPlane)
|
||||
return;
|
||||
|
||||
// Annotation plane
|
||||
// Presentation Style
|
||||
Handle(StepVisual_NullStyleMember) aNullStyle = new StepVisual_NullStyleMember();
|
||||
@@ -2402,7 +2409,7 @@ static void WritePresentation(const Handle(XSControl_WorkSession) &WS,
|
||||
aStyles->SetValue(1, aStyleItem);
|
||||
Handle(StepVisual_PresentationStyleAssignment) aPrsStyle = new StepVisual_PresentationStyleAssignment();
|
||||
aPrsStyle->Init(aStyles);
|
||||
Handle(StepVisual_HArray1OfPresentationStyleAssignment) aPrsStyles =
|
||||
Handle(StepVisual_HArray1OfPresentationStyleAssignment) aPrsStyles =
|
||||
new StepVisual_HArray1OfPresentationStyleAssignment(1, 1);
|
||||
aPrsStyles->SetValue(1, aPrsStyle);
|
||||
// Plane
|
||||
@@ -2424,63 +2431,7 @@ static void WritePresentation(const Handle(XSControl_WorkSession) &WS,
|
||||
// Init AnnotationPlane entity
|
||||
Handle(StepVisual_AnnotationPlane) anAnnPlane = new StepVisual_AnnotationPlane();
|
||||
anAnnPlane->Init(new TCollection_HAsciiString(), aPrsStyles, aPlane, aDCsForAnnPln);
|
||||
gdtAnnotationPlanes.Append(anAnnPlane);
|
||||
aModel->AddWithRefs(anAnnPlane);
|
||||
}
|
||||
|
||||
//======================================================================
|
||||
//function : WritePresentation
|
||||
//purpose : auxiliary (write annotation plane and presentation for common labels)
|
||||
//======================================================================
|
||||
static void WritePresentation(const Handle(XSControl_WorkSession) &WS,
|
||||
const TopoDS_Shape thePresentation,
|
||||
const Handle(TCollection_HAsciiString)& thePrsName,
|
||||
const gp_Ax2 theAnnotationPlane)
|
||||
{
|
||||
if (thePresentation.IsNull())
|
||||
return;
|
||||
// Get working data
|
||||
const Handle(Interface_InterfaceModel) &aModel = WS->Model();
|
||||
|
||||
// Presentation
|
||||
Handle(StepVisual_TessellatedGeometricSet) aGeomSet = STEPCAFControl_GDTProperty::GetTessellation(thePresentation);
|
||||
Handle(StepVisual_TessellatedAnnotationOccurrence) aTAO = new StepVisual_TessellatedAnnotationOccurrence();
|
||||
aTAO->Init(new TCollection_HAsciiString(), gdtPrsCurveStyle, aGeomSet);
|
||||
StepVisual_DraughtingCalloutElement aDCElement;
|
||||
aDCElement.SetValue(aTAO);
|
||||
Handle(StepVisual_HArray1OfDraughtingCalloutElement) aTAOs = new StepVisual_HArray1OfDraughtingCalloutElement(1, 1);
|
||||
aTAOs->SetValue(1, aDCElement);
|
||||
Handle(StepVisual_DraughtingCallout) aDCallout = new StepVisual_DraughtingCallout();
|
||||
Handle(TCollection_HAsciiString) aPrsName = thePrsName.IsNull() ? new TCollection_HAsciiString() : thePrsName;
|
||||
aDCallout->Init(aPrsName, aTAOs);
|
||||
aModel->AddWithRefs(aDCallout);
|
||||
|
||||
// Annotation plane
|
||||
// Presentation Style
|
||||
Handle(StepVisual_NullStyleMember) aNullStyle = new StepVisual_NullStyleMember();
|
||||
aNullStyle->SetEnumText(0, ".NULL.");
|
||||
StepVisual_PresentationStyleSelect aStyleItem;
|
||||
aStyleItem.SetValue(aNullStyle);
|
||||
Handle(StepVisual_HArray1OfPresentationStyleSelect) aStyles = new StepVisual_HArray1OfPresentationStyleSelect(1, 1);
|
||||
aStyles->SetValue(1, aStyleItem);
|
||||
Handle(StepVisual_PresentationStyleAssignment) aPrsStyle = new StepVisual_PresentationStyleAssignment();
|
||||
aPrsStyle->Init(aStyles);
|
||||
Handle(StepVisual_HArray1OfPresentationStyleAssignment) aPrsStyles =
|
||||
new StepVisual_HArray1OfPresentationStyleAssignment(1, 1);
|
||||
aPrsStyles->SetValue(1, aPrsStyle);
|
||||
// Plane
|
||||
Handle(StepGeom_Plane) aPlane = new StepGeom_Plane();
|
||||
Handle(StepGeom_Axis2Placement3d) anAxis = STEPCAFControl_GDTProperty::GetAxis2Placement3D(theAnnotationPlane);
|
||||
aPlane->Init(new TCollection_HAsciiString(), anAxis);
|
||||
// Annotation plane element
|
||||
StepVisual_AnnotationPlaneElement aPlaneElement;
|
||||
aPlaneElement.SetValue(aDCallout);
|
||||
Handle(StepVisual_HArray1OfAnnotationPlaneElement) aDCsForAnnPln = new StepVisual_HArray1OfAnnotationPlaneElement(1, 1);
|
||||
aDCsForAnnPln->SetValue(1, aPlaneElement);
|
||||
// Init AnnotationPlane entity
|
||||
Handle(StepVisual_AnnotationPlane) anAnnPlane = new StepVisual_AnnotationPlane();
|
||||
anAnnPlane->Init(new TCollection_HAsciiString(), aPrsStyles, aPlane, aDCsForAnnPln);
|
||||
gdtAnnotationPlanes.Append(anAnnPlane);
|
||||
myGDTAnnotations.Append(anAnnPlane);
|
||||
aModel->AddWithRefs(anAnnPlane);
|
||||
}
|
||||
|
||||
@@ -2490,11 +2441,11 @@ static void WritePresentation(const Handle(XSControl_WorkSession) &WS,
|
||||
// necessary entities and link them to already written datum
|
||||
// in case of multiple features association)
|
||||
//=======================================================================
|
||||
static Handle(StepDimTol_Datum) WriteDatumAP242(const Handle(XSControl_WorkSession) &WS,
|
||||
const TDF_LabelSequence theShapeL,
|
||||
const TDF_Label theDatumL,
|
||||
const Standard_Boolean isFirstDTarget,
|
||||
const Handle(StepDimTol_Datum) theWrittenDatum)
|
||||
Handle(StepDimTol_Datum) STEPCAFControl_Writer::WriteDatumAP242(const Handle(XSControl_WorkSession) &WS,
|
||||
const TDF_LabelSequence theShapeL,
|
||||
const TDF_Label theDatumL,
|
||||
const Standard_Boolean isFirstDTarget,
|
||||
const Handle(StepDimTol_Datum) theWrittenDatum)
|
||||
{
|
||||
// Get working data
|
||||
const Handle(Interface_InterfaceModel) &Model = WS->Model();
|
||||
@@ -2538,7 +2489,7 @@ static Handle(StepDimTol_Datum) WriteDatumAP242(const Handle(XSControl_WorkSessi
|
||||
}
|
||||
if (aPDS.IsNull()) {
|
||||
// Workaround for datums without shape
|
||||
aPDS = gdtCommonPDS;
|
||||
aPDS = myGDTCommonPDS;
|
||||
Interface_EntityIterator aSDRIt = aGraph.Sharings(aPDS);
|
||||
Handle(StepShape_ShapeDefinitionRepresentation) aSDR;
|
||||
for (aSDRIt.Start(); aSDRIt.More() && aSDR.IsNull(); aSDRIt.Next())
|
||||
@@ -2719,7 +2670,8 @@ static Handle(StepDimTol_Datum) WriteDatumAP242(const Handle(XSControl_WorkSessi
|
||||
}
|
||||
|
||||
//Annotation plane and Presentation
|
||||
WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->GetPlane(), anObject->GetPointTextAttach(), aSA);
|
||||
WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), Standard_True, anObject->HasPlane(),
|
||||
anObject->GetPlane(), anObject->GetPointTextAttach(), aSA);
|
||||
|
||||
return aDatum;
|
||||
}
|
||||
@@ -3163,10 +3115,10 @@ static Handle(StepDimTol_HArray1OfDatumSystemOrReference) WriteDatumSystem(const
|
||||
//function : WriteToleranceZone
|
||||
//purpose : auxiliary (write tolerace zones)
|
||||
//=======================================================================
|
||||
static void WriteToleranceZone (const Handle(XSControl_WorkSession) &WS,
|
||||
const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject,
|
||||
const Handle(StepDimTol_GeometricTolerance)& theEntity,
|
||||
const Handle(StepRepr_RepresentationContext)& theRC)
|
||||
void STEPCAFControl_Writer::WriteToleranceZone (const Handle(XSControl_WorkSession) &WS,
|
||||
const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject,
|
||||
const Handle(StepDimTol_GeometricTolerance)& theEntity,
|
||||
const Handle(StepRepr_RepresentationContext)& theRC)
|
||||
{
|
||||
// Get working data
|
||||
const Handle(Interface_InterfaceModel) &Model = WS->Model();
|
||||
@@ -3212,11 +3164,11 @@ static void WriteToleranceZone (const Handle(XSControl_WorkSession) &WS,
|
||||
//purpose : auxiliary (write Geometric_Tolerance entity for given shapes,
|
||||
// label and datum system)
|
||||
//======================================================================
|
||||
static void WriteGeomTolerance (const Handle(XSControl_WorkSession) &WS,
|
||||
const TDF_LabelSequence theShapeSeqL,
|
||||
const TDF_Label theGeomTolL,
|
||||
const Handle(StepDimTol_HArray1OfDatumSystemOrReference)& theDatumSystem,
|
||||
const Handle(StepRepr_RepresentationContext)& theRC)
|
||||
void STEPCAFControl_Writer::WriteGeomTolerance (const Handle(XSControl_WorkSession) &WS,
|
||||
const TDF_LabelSequence theShapeSeqL,
|
||||
const TDF_Label theGeomTolL,
|
||||
const Handle(StepDimTol_HArray1OfDatumSystemOrReference)& theDatumSystem,
|
||||
const Handle(StepRepr_RepresentationContext)& theRC)
|
||||
{
|
||||
// Get working data
|
||||
const Handle(Interface_InterfaceModel) &Model = WS->Model();
|
||||
@@ -3385,7 +3337,8 @@ static void WriteGeomTolerance (const Handle(XSControl_WorkSession) &WS,
|
||||
Model->AddWithRefs(aGeomTol);
|
||||
WriteToleranceZone(WS, anObject, aGeomTol, theRC);
|
||||
//Annotation plane and Presentation
|
||||
WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->GetPlane(), anObject->GetPointTextAttach(), aGeomTol);
|
||||
WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), Standard_True, anObject->HasPlane(),
|
||||
anObject->GetPlane(), anObject->GetPointTextAttach(), aGeomTol);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -3752,7 +3705,7 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTs (const Handle(XSControl_WorkSe
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_WorkSession) &WS,
|
||||
const TDF_LabelSequence &labels ) const
|
||||
const TDF_LabelSequence &labels )
|
||||
{
|
||||
// Get working data
|
||||
const Handle(Interface_InterfaceModel) &aModel = WS->Model();
|
||||
@@ -3767,15 +3720,13 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
return Standard_False;
|
||||
|
||||
// Common entities for presentation
|
||||
gdtPresentationDM = new StepVisual_DraughtingModel();
|
||||
STEPConstruct_Styles aStyles (WS);
|
||||
Handle(StepVisual_Colour) aCurvColor = aStyles.EncodeColor(Quantity_NOC_WHITE);
|
||||
Handle(StepRepr_RepresentationItem) anItem = NULL;
|
||||
gdtPrsCurveStyle = new StepVisual_HArray1OfPresentationStyleAssignment(1, 1);
|
||||
gdtPrsCurveStyle->SetValue(1, aStyles.MakeColorPSA(anItem, aCurvColor, aCurvColor));
|
||||
myGDTPrsCurveStyle->SetValue(1, aStyles.MakeColorPSA(anItem, aCurvColor, aCurvColor));
|
||||
Interface_EntityIterator aModelIter = aModel->Entities();
|
||||
for (; aModelIter.More() && gdtCommonPDS.IsNull(); aModelIter.Next())
|
||||
gdtCommonPDS = Handle(StepRepr_ProductDefinitionShape)::DownCast(aModelIter.Value());
|
||||
for (; aModelIter.More() && myGDTCommonPDS.IsNull(); aModelIter.Next())
|
||||
myGDTCommonPDS = Handle(StepRepr_ProductDefinitionShape)::DownCast(aModelIter.Value());
|
||||
|
||||
TDF_LabelSequence aDGTLabels;
|
||||
STEPConstruct_DataMapOfAsciiStringTransient aDatumMap;
|
||||
@@ -3830,7 +3781,11 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
continue;
|
||||
if (anObject->GetType() == XCAFDimTolObjects_DimensionType_CommonLabel)
|
||||
{
|
||||
WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->GetPlane());
|
||||
Handle(StepRepr_ShapeAspect) aSA = new StepRepr_ShapeAspect();
|
||||
aSA->Init(new TCollection_HAsciiString(), new TCollection_HAsciiString(), myGDTCommonPDS, StepData_LTrue);
|
||||
aModel->AddWithRefs(aSA);
|
||||
WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->HasPlane(),
|
||||
Standard_False, anObject->GetPlane(), anObject->GetPointTextAttach(), aSA);
|
||||
}
|
||||
|
||||
if (!DGTTool->GetRefShapeLabel(aDimensionL, aFirstShapeL, aSecondShapeL))
|
||||
@@ -3889,6 +3844,13 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
aSecondSA = aCSA;
|
||||
}
|
||||
|
||||
if (anObject->GetType() == XCAFDimTolObjects_DimensionType_DimensionPresentation)
|
||||
{
|
||||
WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->HasPlane(),
|
||||
Standard_False, anObject->GetPlane(), anObject->GetPointTextAttach(), aFirstSA);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Write dimensions
|
||||
StepShape_DimensionalCharacteristic aDimension;
|
||||
if (anObject->HasPoint() || anObject->HasPoint2())
|
||||
@@ -3958,7 +3920,8 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
// Write values
|
||||
WriteDimValues(WS, anObject, aRC, aDimension);
|
||||
//Annotation plane and Presentation
|
||||
WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->GetPlane(), anObject->GetPointTextAttach(), aDimension.Value());
|
||||
WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), Standard_True, anObject->HasPlane(),
|
||||
anObject->GetPlane(), anObject->GetPointTextAttach(), aDimension.Value());
|
||||
}
|
||||
// Write Derived geometry
|
||||
if (aConnectionPnts.Length() > 0) {
|
||||
@@ -3989,16 +3952,16 @@ Standard_Boolean STEPCAFControl_Writer::WriteDGTsAP242 (const Handle(XSControl_W
|
||||
}
|
||||
|
||||
// Write Draughting model for Annotation Planes
|
||||
if (gdtAnnotationPlanes.Length() == 0)
|
||||
if (myGDTAnnotations.Length() == 0)
|
||||
return Standard_True;
|
||||
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) aItems =
|
||||
new StepRepr_HArray1OfRepresentationItem(1, gdtAnnotationPlanes.Length());
|
||||
new StepRepr_HArray1OfRepresentationItem(1, myGDTAnnotations.Length());
|
||||
for (Standard_Integer i = 1; i <= aItems->Length(); i++) {
|
||||
aItems->SetValue(i, gdtAnnotationPlanes.Value(i - 1));
|
||||
aItems->SetValue(i, myGDTAnnotations.Value(i - 1));
|
||||
}
|
||||
gdtPresentationDM->Init(new TCollection_HAsciiString(), aItems, aRC);
|
||||
aModel->AddWithRefs(gdtPresentationDM);
|
||||
myGDTPresentationDM->Init(new TCollection_HAsciiString(), aItems, aRC);
|
||||
aModel->AddWithRefs(myGDTPresentationDM);
|
||||
|
||||
return Standard_True;
|
||||
}
|
||||
|
@@ -29,6 +29,15 @@
|
||||
#include <Standard_CString.hxx>
|
||||
#include <STEPControl_StepModelType.hxx>
|
||||
#include <TDF_LabelSequence.hxx>
|
||||
#include <StepAP242_GeometricItemSpecificUsage.hxx>
|
||||
#include <StepDimTol_Datum.hxx>
|
||||
#include <StepDimTol_GeometricTolerance.hxx>
|
||||
#include <StepDimTol_HArray1OfDatumSystemOrReference.hxx>
|
||||
#include <StepRepr_ProductDefinitionShape.hxx>
|
||||
#include <StepVisual_DraughtingModel.hxx>
|
||||
#include <StepVisual_HArray1OfPresentationStyleAssignment.hxx>
|
||||
#include <XCAFDimTolObjects_GeomToleranceObject.hxx>
|
||||
|
||||
class XSControl_WorkSession;
|
||||
class TDocStd_Document;
|
||||
class TDF_Label;
|
||||
@@ -174,7 +183,7 @@ protected:
|
||||
Standard_EXPORT Standard_Boolean WriteDGTs (const Handle(XSControl_WorkSession)& WS, const TDF_LabelSequence& labels) const;
|
||||
|
||||
//! Write D>s assigned to specified labels, to STEP model, according AP242
|
||||
Standard_EXPORT Standard_Boolean WriteDGTsAP242 (const Handle(XSControl_WorkSession)& WS, const TDF_LabelSequence& labels) const;
|
||||
Standard_EXPORT Standard_Boolean WriteDGTsAP242 (const Handle(XSControl_WorkSession)& WS, const TDF_LabelSequence& labels);
|
||||
|
||||
//! Write materials assigned to specified labels, to STEP model
|
||||
Standard_EXPORT Standard_Boolean WriteMaterials (const Handle(XSControl_WorkSession)& WS, const TDF_LabelSequence& labels) const;
|
||||
@@ -192,6 +201,23 @@ protected:
|
||||
|
||||
|
||||
private:
|
||||
Standard_EXPORT Handle(StepRepr_ShapeAspect) WriteShapeAspect(const Handle(XSControl_WorkSession) &WS,
|
||||
const TDF_Label theLabel, const TopoDS_Shape theShape, Handle(StepRepr_RepresentationContext)& theRC,
|
||||
Handle(StepAP242_GeometricItemSpecificUsage)& theGISU);
|
||||
|
||||
Standard_EXPORT void WritePresentation(const Handle(XSControl_WorkSession) &WS, const TopoDS_Shape thePresentation,
|
||||
const Handle(TCollection_HAsciiString)& thePrsName, const Standard_Boolean hasSemantic, const Standard_Boolean hasPlane,
|
||||
const gp_Ax2 theAnnotationPlane, const gp_Pnt theTextPosition, const Handle(Standard_Transient) theDimension);
|
||||
|
||||
Standard_EXPORT Handle(StepDimTol_Datum) WriteDatumAP242(const Handle(XSControl_WorkSession) &WS, const TDF_LabelSequence theShapeL,
|
||||
const TDF_Label theDatumL, const Standard_Boolean isFirstDTarget, const Handle(StepDimTol_Datum) theWrittenDatum);
|
||||
|
||||
Standard_EXPORT void WriteToleranceZone(const Handle(XSControl_WorkSession) &WS, const Handle(XCAFDimTolObjects_GeomToleranceObject)& theObject,
|
||||
const Handle(StepDimTol_GeometricTolerance)& theEntity, const Handle(StepRepr_RepresentationContext)& theRC);
|
||||
|
||||
Standard_EXPORT void WriteGeomTolerance(const Handle(XSControl_WorkSession) &WS, const TDF_LabelSequence theShapeSeqL,
|
||||
const TDF_Label theGeomTolL, const Handle(StepDimTol_HArray1OfDatumSystemOrReference)& theDatumSystem,
|
||||
const Handle(StepRepr_RepresentationContext)& theRC);
|
||||
|
||||
|
||||
|
||||
@@ -207,7 +233,10 @@ private:
|
||||
MoniTool_DataMapOfShapeTransient myMapCompMDGPR;
|
||||
Standard_Boolean myDGTMode;
|
||||
Standard_Boolean myMatMode;
|
||||
|
||||
NCollection_Vector<Handle(StepRepr_RepresentationItem)> myGDTAnnotations;
|
||||
Handle(StepVisual_DraughtingModel) myGDTPresentationDM;
|
||||
Handle(StepVisual_HArray1OfPresentationStyleAssignment) myGDTPrsCurveStyle;
|
||||
Handle(StepRepr_ProductDefinitionShape) myGDTCommonPDS;
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user