}
return Standard_True;
}
-
//=======================================================================
-//function : readAnnotation
-//purpose : read annotation plane and position for given GDT
-// (Dimension, Geometric_Tolerance, Datum_Feature or Placed_Datum_Target_Feature)
+//function : readPMIPresentation
+//purpose : read polyline or tessellated presentation for
+// (Annotation_Curve_Occurrence or Draughting_Callout)
//=======================================================================
-void readAnnotation(const Handle(XSControl_TransferReader)& theTR,
- const Handle(Standard_Transient) theGDT,
- const Handle(Standard_Transient)& theDimObject)
+Standard_Boolean readPMIPresentation(const Handle(Standard_Transient)& thePresentEntity,
+ const Handle(XSControl_TransferReader)& theTR,
+ const Standard_Real theFact,
+ TopoDS_Shape& thePresentation,
+ Handle(TCollection_HAsciiString)& thePresentName,
+ Bnd_Box& theBox)
{
- Handle(TCollection_HAsciiString) aPresentName;
- TopoDS_Compound aResAnnotation;
Handle(Transfer_TransientProcess) aTP = theTR->TransientProcess();
- const Interface_Graph& aGraph = aTP->Graph();
- // find the proper DraughtingModelItemAssociation
- Interface_EntityIterator subs = aGraph.Sharings(theGDT);
- Handle(StepAP242_DraughtingModelItemAssociation) aDMIA;
- for (subs.Start(); subs.More() && aDMIA.IsNull(); subs.Next()) {
- if (!subs.Value()->IsKind(STANDARD_TYPE(StepAP242_DraughtingModelItemAssociation)))
- continue;
- aDMIA = Handle(StepAP242_DraughtingModelItemAssociation)::DownCast(subs.Value());
- Handle(TCollection_HAsciiString) aName = aDMIA->Name();
- aName->LowerCase();
- if (!aName->Search(new TCollection_HAsciiString("pmi representation to presentation link"))) {
- aDMIA = NULL;
- }
- }
- if (aDMIA.IsNull() || aDMIA->NbIdentifiedItem() == 0)
- return;
-
- // calculate units
- Handle(StepVisual_DraughtingModel) aDModel =
- Handle(StepVisual_DraughtingModel)::DownCast(aDMIA->UsedRepresentation());
- Standard_Real aFact = 1;
- if (!aDModel.IsNull())
- GetLengthConversionFactorFromContext(aDModel->ContextOfItems(), aFact);
-
- // retrieve AnnotationPlane
- Standard_Boolean isHasPlane = Standard_False;
- gp_Ax2 aPlaneAxes;
- Handle(StepRepr_RepresentationItem) aDMIAE = aDMIA->IdentifiedItemValue(1);
- if (aDMIAE.IsNull())
- return;
- subs = aGraph.Sharings(aDMIAE);
- Handle(StepVisual_AnnotationPlane) anAnPlane;
- for (subs.Start(); subs.More() && anAnPlane.IsNull(); subs.Next()) {
- anAnPlane = Handle(StepVisual_AnnotationPlane)::DownCast(subs.Value());
- }
- if (!anAnPlane.IsNull()) {
- Handle(StepRepr_RepresentationItem) aPlaneItem = anAnPlane->Item();
- Handle(StepGeom_Axis2Placement3d) aA2P3D;
- //retrieve axes from AnnotationPlane
- if (aPlaneItem->IsKind(STANDARD_TYPE(StepGeom_Plane))) {
- Handle(StepGeom_Plane) aPlane = Handle(StepGeom_Plane)::DownCast(aPlaneItem);
- aA2P3D = aPlane->Position();
- }
- else if (aPlaneItem->IsKind(STANDARD_TYPE(StepVisual_PlanarBox))) {
- Handle(StepVisual_PlanarBox) aBox = Handle(StepVisual_PlanarBox)::DownCast(aPlaneItem);
- aA2P3D = aBox->Placement().Axis2Placement3d();
- }
- // build gp_Ax2 from axes
- if (!aA2P3D.IsNull())
- {
- Handle(StepGeom_Direction) anAxis = aA2P3D->Axis(),
- aRefDir = aA2P3D->RefDirection();
- if (!anAxis.IsNull() && !aRefDir.IsNull()) {
- Handle(TColStd_HArray1OfReal) aCoords;
- aCoords = anAxis->DirectionRatios();
- gp_Dir aXDir(aCoords->Value(1), aCoords->Value(2), aCoords->Value(3));
- aCoords = aRefDir->DirectionRatios();
- gp_Dir aYDir(aCoords->Value(1), aCoords->Value(2), aCoords->Value(3));
- aPlaneAxes.SetDirection(aXDir.Crossed(aYDir));
- aPlaneAxes.SetYDirection(aYDir);
- //set location of the annotation plane
- Handle(TColStd_HArray1OfReal) aLocCoords;
- Handle(StepGeom_CartesianPoint) aLoc = aA2P3D->Location();
- gp_Pnt aLocPos( aLoc->CoordinatesValue(1) * aFact, aLoc->CoordinatesValue(2) * aFact, aLoc->CoordinatesValue(3) * aFact);
- aPlaneAxes.SetLocation(aLocPos);
- isHasPlane = Standard_True;
- }
- }
- }
-
- // set plane axes to XCAF
- if (isHasPlane) {
- if (theDimObject->IsKind(STANDARD_TYPE(XCAFDimTolObjects_DimensionObject))) {
- Handle(XCAFDimTolObjects_DimensionObject) anObj =
- Handle(XCAFDimTolObjects_DimensionObject)::DownCast(theDimObject);
- Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt(1, 1);
- anObj->SetPlane(aPlaneAxes);
- }
- else if (theDimObject->IsKind(STANDARD_TYPE(XCAFDimTolObjects_DatumObject))) {
- Handle(XCAFDimTolObjects_DatumObject) anObj =
- Handle(XCAFDimTolObjects_DatumObject)::DownCast(theDimObject);
- anObj->SetPlane(aPlaneAxes);
- }
- else if (theDimObject->IsKind(STANDARD_TYPE(XCAFDimTolObjects_GeomToleranceObject))) {
- Handle(XCAFDimTolObjects_GeomToleranceObject) anObj =
- Handle(XCAFDimTolObjects_GeomToleranceObject)::DownCast(theDimObject);
- anObj->SetPlane(aPlaneAxes);
- }
- }
-
- // Retrieve presentation
Handle(StepVisual_AnnotationCurveOccurrence) anACO;
- NCollection_Vector<Handle(StepVisual_TessellatedAnnotationOccurrence)> aTesselations;
NCollection_Vector<Handle(StepVisual_StyledItem)> anAnnotations;
- if (aDMIAE->IsKind(STANDARD_TYPE(StepVisual_AnnotationCurveOccurrence)))
+ if (thePresentEntity->IsKind(STANDARD_TYPE(StepVisual_AnnotationCurveOccurrence)))
{
- anACO = Handle(StepVisual_AnnotationCurveOccurrence)::DownCast(aDMIAE);
- if( !anACO.IsNull())
+ anACO = Handle(StepVisual_AnnotationCurveOccurrence)::DownCast(thePresentEntity);
+ thePresentName = anACO->Name();
+ if (!anACO.IsNull())
anAnnotations.Append(anACO);
}
-
- else if (aDMIAE->IsKind(STANDARD_TYPE(StepVisual_DraughtingCallout)))
+ else if (thePresentEntity->IsKind(STANDARD_TYPE(StepVisual_DraughtingCallout)))
{
Handle(StepVisual_DraughtingCallout) aDCallout =
- Handle(StepVisual_DraughtingCallout)::DownCast(aDMIAE);
+ 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())
+ if (!anACO.IsNull())
{
anAnnotations.Append(anACO);
continue;
}
- Handle(StepVisual_TessellatedAnnotationOccurrence) aTesselation =
+ Handle(StepVisual_TessellatedAnnotationOccurrence) aTesselation =
aDCallout->ContentsValue(i).TessellatedAnnotationOccurrence();
- if( !aTesselation.IsNull())
+ if (!aTesselation.IsNull())
anAnnotations.Append(aTesselation);
}
}
if (!anAnnotations.Length())
- return;
+ return Standard_False;
BRep_Builder aB;
+ TopoDS_Compound aResAnnotation;
aB.MakeCompound(aResAnnotation);
- Standard_Integer i =0;
+ Standard_Integer i = 0;
Bnd_Box aBox;
- Standard_Integer nbShapes =0;
- for( ; i < anAnnotations.Length(); i++)
+ Standard_Integer nbShapes = 0;
+ for (; i < anAnnotations.Length(); i++)
{
Handle(StepVisual_StyledItem) anItem = anAnnotations(i);
-
- aPresentName = anItem->Name();
-
anACO = Handle(StepVisual_AnnotationCurveOccurrence)::DownCast(anItem);
TopoDS_Shape anAnnotationShape;
- if(!anACO.IsNull())
+ if (!anACO.IsNull())
{
Handle(StepRepr_RepresentationItem) aCurveItem = anACO->Item();
- anAnnotationShape = STEPConstruct::FindShape (aTP,aCurveItem);
- if( anAnnotationShape.IsNull())
+ anAnnotationShape = STEPConstruct::FindShape(aTP, aCurveItem);
+ if (anAnnotationShape.IsNull())
{
Handle(Transfer_Binder) binder = theTR->Actor()->Transfer(aCurveItem, aTP);
- if ( ! binder.IsNull() && binder->HasResult() ) {
- anAnnotationShape = TransferBRep::ShapeResult ( aTP, binder );
+ if (!binder.IsNull() && binder->HasResult()) {
+ anAnnotationShape = TransferBRep::ShapeResult(aTP, binder);
}
}
}
else
{
Handle(StepRepr_RepresentationItem) aTessItem = anItem->Item();
- if(aTessItem.IsNull())
+ if (aTessItem.IsNull())
continue;
Handle(StepVisual_TessellatedGeometricSet) aTessSet = Handle(StepVisual_TessellatedGeometricSet)::DownCast(aTessItem);
- if( aTessSet.IsNull())
+ if (aTessSet.IsNull())
continue;
NCollection_Handle<StepVisual_Array1OfTessellatedItem> aListItems = aTessSet->Items();
Standard_Integer nb = aListItems.IsNull() ? 0 : aListItems->Length();
{
aTessCurve = Handle(StepVisual_TessellatedCurveSet)::DownCast(aListItems->Value(n));
}
- if( aTessCurve.IsNull())
+ if (aTessCurve.IsNull())
continue;
Handle(StepVisual_CoordinatesList) aCoordList = aTessCurve->CoordList();
- if( aCoordList.IsNull())
+ if (aCoordList.IsNull())
continue;
Handle(TColgp_HArray1OfXYZ) aPoints = aCoordList->Points();
Standard_Integer aNbC = (aCurves.IsNull() ? 0 : aCurves->Length());
TopoDS_Compound aComp;
aB.MakeCompound(aComp);
-
+
Standard_Integer k = 0;
- for( ; k < aNbC; k++)
+ for (; k < aNbC; k++)
{
Handle(TColStd_HSequenceOfInteger) anIndexes = aCurves->Value(k);
TopoDS_Wire aCurW;
aB.MakeWire(aCurW);
- for(Standard_Integer n = 1; n < anIndexes->Length(); n++)
+ for (Standard_Integer n = 1; n < anIndexes->Length(); n++)
{
Standard_Integer ind = anIndexes->Value(n);
Standard_Integer indnext = anIndexes->Value(n + 1);
- if( ind > aPoints->Length() || indnext > aPoints->Length())
+ if (ind > aPoints->Length() || indnext > aPoints->Length())
continue;
- gp_Pnt aP1(aPoints->Value(ind) * aFact);
- gp_Pnt aP2(aPoints->Value(indnext) * aFact);
+ gp_Pnt aP1(aPoints->Value(ind) * theFact);
+ gp_Pnt aP2(aPoints->Value(indnext) * theFact);
BRepBuilderAPI_MakeEdge aMaker(aP1, aP2);
- if( aMaker.IsDone())
+ if (aMaker.IsDone())
{
TopoDS_Edge aCurE = aMaker.Edge();
aB.Add(aCurW, aCurE);
}
anAnnotationShape = aComp;
}
- if(!anAnnotationShape.IsNull())
+ if (!anAnnotationShape.IsNull())
{
nbShapes++;
aB.Add(aResAnnotation, anAnnotationShape);
- if( i == anAnnotations.Length() - 1)
+ if (i == anAnnotations.Length() - 1)
BRepBndLib::AddClose(anAnnotationShape, aBox);
}
}
-
- if(!nbShapes)
+
+ thePresentation = aResAnnotation;
+ theBox = aBox;
+ return (nbShapes > 0);
+}
+
+//=======================================================================
+//function : readAnnotationPlane
+//purpose : read annotation plane
+//=======================================================================
+Standard_Boolean readAnnotationPlane(const Handle(StepVisual_AnnotationPlane) theAnnotationPlane,
+ const Standard_Real theFact,
+ gp_Ax2& thePlane)
+{
+ if (theAnnotationPlane.IsNull())
+ return Standard_False;
+ gp_Ax2 aPlaneAxes;
+ Handle(StepRepr_RepresentationItem) aPlaneItem = theAnnotationPlane->Item();
+ Handle(StepGeom_Axis2Placement3d) aA2P3D;
+ //retrieve axes from AnnotationPlane
+ if (aPlaneItem->IsKind(STANDARD_TYPE(StepGeom_Plane))) {
+ Handle(StepGeom_Plane) aPlane = Handle(StepGeom_Plane)::DownCast(aPlaneItem);
+ aA2P3D = aPlane->Position();
+ }
+ else if (aPlaneItem->IsKind(STANDARD_TYPE(StepVisual_PlanarBox))) {
+ Handle(StepVisual_PlanarBox) aBox = Handle(StepVisual_PlanarBox)::DownCast(aPlaneItem);
+ aA2P3D = aBox->Placement().Axis2Placement3d();
+ }
+ if (aA2P3D.IsNull())
+ return Standard_False;
+
+ // build gp_Ax2 from axes
+ Handle(StepGeom_Direction) anAxis = aA2P3D->Axis(),
+ aRefDir = aA2P3D->RefDirection();
+ if (anAxis.IsNull() || aRefDir.IsNull())
+ return Standard_False;
+
+ Handle(TColStd_HArray1OfReal) aCoords;
+ aCoords = anAxis->DirectionRatios();
+ gp_Dir aXDir(aCoords->Value(1), aCoords->Value(2), aCoords->Value(3));
+ aCoords = aRefDir->DirectionRatios();
+ gp_Dir aYDir(aCoords->Value(1), aCoords->Value(2), aCoords->Value(3));
+ aPlaneAxes.SetDirection(aXDir.Crossed(aYDir));
+ aPlaneAxes.SetYDirection(aYDir);
+ //set location of the annotation plane
+ Handle(TColStd_HArray1OfReal) aLocCoords;
+ Handle(StepGeom_CartesianPoint) aLoc = aA2P3D->Location();
+ gp_Pnt aLocPos(aLoc->CoordinatesValue(1) * theFact, aLoc->CoordinatesValue(2) * theFact, aLoc->CoordinatesValue(3) * theFact);
+ aPlaneAxes.SetLocation(aLocPos);
+ thePlane = aPlaneAxes;
+ return Standard_True;
+}
+
+//=======================================================================
+//function : readAnnotation
+//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,
+ const Handle(Standard_Transient) theGDT,
+ const Handle(Standard_Transient)& theDimObject)
+{
+ Handle(TCollection_HAsciiString) aPresentName;
+ TopoDS_Compound aResAnnotation;
+ Handle(Transfer_TransientProcess) aTP = theTR->TransientProcess();
+ const Interface_Graph& aGraph = aTP->Graph();
+ // find the proper DraughtingModelItemAssociation
+ Interface_EntityIterator subs = aGraph.Sharings(theGDT);
+ Handle(StepAP242_DraughtingModelItemAssociation) aDMIA;
+ for (subs.Start(); subs.More() && aDMIA.IsNull(); subs.Next()) {
+ if (!subs.Value()->IsKind(STANDARD_TYPE(StepAP242_DraughtingModelItemAssociation)))
+ continue;
+ aDMIA = Handle(StepAP242_DraughtingModelItemAssociation)::DownCast(subs.Value());
+ Handle(TCollection_HAsciiString) aName = aDMIA->Name();
+ aName->LowerCase();
+ if (!aName->Search(new TCollection_HAsciiString("pmi representation to presentation link"))) {
+ aDMIA = NULL;
+ }
+ }
+ if (aDMIA.IsNull() || aDMIA->NbIdentifiedItem() == 0)
+ return;
+
+ // calculate units
+ Handle(StepVisual_DraughtingModel) aDModel =
+ Handle(StepVisual_DraughtingModel)::DownCast(aDMIA->UsedRepresentation());
+ Standard_Real aFact = 1;
+ if (!aDModel.IsNull())
+ GetLengthConversionFactorFromContext(aDModel->ContextOfItems(), aFact);
+
+ // retrieve AnnotationPlane
+ Handle(StepRepr_RepresentationItem) aDMIAE = aDMIA->IdentifiedItemValue(1);
+ if (aDMIAE.IsNull())
+ return;
+ gp_Ax2 aPlaneAxes;
+ subs = aGraph.Sharings(aDMIAE);
+ Handle(StepVisual_AnnotationPlane) anAnPlane;
+ for (subs.Start(); subs.More() && anAnPlane.IsNull(); subs.Next()) {
+ anAnPlane = Handle(StepVisual_AnnotationPlane)::DownCast(subs.Value());
+ }
+ Standard_Boolean isHasPlane = readAnnotationPlane(anAnPlane, aFact, aPlaneAxes);
+
+ // set plane axes to XCAF
+ if (isHasPlane) {
+ if (theDimObject->IsKind(STANDARD_TYPE(XCAFDimTolObjects_DimensionObject))) {
+ Handle(XCAFDimTolObjects_DimensionObject) anObj =
+ Handle(XCAFDimTolObjects_DimensionObject)::DownCast(theDimObject);
+ Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt(1, 1);
+ anObj->SetPlane(aPlaneAxes);
+ }
+ else if (theDimObject->IsKind(STANDARD_TYPE(XCAFDimTolObjects_DatumObject))) {
+ Handle(XCAFDimTolObjects_DatumObject) anObj =
+ Handle(XCAFDimTolObjects_DatumObject)::DownCast(theDimObject);
+ anObj->SetPlane(aPlaneAxes);
+ }
+ else if (theDimObject->IsKind(STANDARD_TYPE(XCAFDimTolObjects_GeomToleranceObject))) {
+ Handle(XCAFDimTolObjects_GeomToleranceObject) anObj =
+ Handle(XCAFDimTolObjects_GeomToleranceObject)::DownCast(theDimObject);
+ anObj->SetPlane(aPlaneAxes);
+ }
+ }
+
+ // Retrieve presentation
+ Bnd_Box aBox;
+ if (!readPMIPresentation(aDMIAE, theTR, aFact, aResAnnotation, aPresentName, aBox))
return;
gp_Pnt aPtext(0., 0., 0.);
// if Annotation plane location inside bounding box set it to text position
// else set the center of bounding box to text position
- if(!aBox.IsVoid())
+ if (!aBox.IsVoid())
{
- Standard_Real aXmin, aYmin, aZmin,aXmax, aYmax, aZmax;
- aBox.Get(aXmin, aYmin, aZmin,aXmax, aYmax, aZmax);
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ aBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
if (isHasPlane && !aBox.IsOut(aPlaneAxes.Location())) {
aPtext = aPlaneAxes.Location();
}
Handle(TDocStd_Document)& theDoc) const
{
const Handle(Interface_InterfaceModel) &aModel = theWS->Model();
+ const Interface_Graph& aGraph = theWS->Graph();
+ const Handle(XSControl_TransferReader) &aTR = theWS->TransferReader();
Handle(StepData_StepModel) aSM = Handle(StepData_StepModel)::DownCast(aModel);
Interface_EntityIterator anI = aSM->Header();
Handle(HeaderSection_FileSchema) aH;
}
}
}
+ else if (anEnt->IsKind(STANDARD_TYPE(StepVisual_DraughtingCallout)) ||
+ anEnt->IsKind(STANDARD_TYPE(StepVisual_AnnotationCurveOccurrence)))
+ {
+ // 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;
+ }
+ if (!isCommonLabel)
+ 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);
+ }
+ gp_Ax2 aPlaneAxes;
+ readAnnotationPlane(anAnPlane, aFact, aPlaneAxes);
+ 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);
+ aDimObj->SetPresentation(aPresentation, aPresentName);
+ aDim->SetObject(aDimObj);
+ }
}
return Standard_True;
}
//======================================================================
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)
Handle(StepVisual_HArray1OfDraughtingCalloutElement) aTAOs = new StepVisual_HArray1OfDraughtingCalloutElement(1, 1);
aTAOs->SetValue(1, aDCElement);
Handle(StepVisual_DraughtingCallout) aDCallout = new StepVisual_DraughtingCallout();
- aDCallout->Init(new TCollection_HAsciiString(), aTAOs);
+ aDCallout->Init(thePrsName, aTAOs);
Handle(StepRepr_HArray1OfRepresentationItem) aDCsForDMIA = new StepRepr_HArray1OfRepresentationItem(1, 1);
aDCsForDMIA->SetValue(1, aDCallout);
StepAP242_ItemIdentifiedRepresentationUsageDefinition aDimension;
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();
+ aDCallout->Init(thePrsName, 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);
+ aModel->AddWithRefs(anAnnPlane);
+}
+
//=======================================================================
//function : WriteDatumAP242
//purpose : auxiliary (write Datum entity for given shape or write all
Model->AddWithRefs(aSDR);
//Annotation plane and Presentation
- WritePresentation(WS, anObject->GetPresentation(), anObject->GetPlane(), anObject->GetPointTextAttach(), aSA);
+ WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->GetPlane(), anObject->GetPointTextAttach(), aSA);
return aDatum;
}
Model->AddWithRefs(aGeomTol);
WriteToleranceZone(WS, anObject, aGeomTol, theRC);
//Annotation plane and Presentation
- WritePresentation(WS, anObject->GetPresentation(), anObject->GetPlane(), anObject->GetPointTextAttach(), aGeomTol);
+ WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->GetPlane(), anObject->GetPointTextAttach(), aGeomTol);
}
//=======================================================================
for (Standard_Integer i = 1; i <= aDGTLabels.Length(); i++) {
TDF_Label aDimensionL = aDGTLabels.Value(i);
TDF_LabelSequence aFirstShapeL, aSecondShapeL;
- if (!DGTTool->GetRefShapeLabel(aDimensionL, aFirstShapeL, aSecondShapeL))
- continue;
Handle(XCAFDoc_Dimension) aDimAttr;
if (!aDimensionL.FindAttribute(XCAFDoc_Dimension::GetID(),aDimAttr))
continue;
Handle(XCAFDimTolObjects_DimensionObject) anObject = aDimAttr->GetObject();
if (anObject.IsNull())
continue;
+ if (anObject->GetType() == XCAFDimTolObjects_DimensionType_CommonLabel)
+ {
+ WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->GetPlane());
+ }
+
+ if (!DGTTool->GetRefShapeLabel(aDimensionL, aFirstShapeL, aSecondShapeL))
+ continue;
// Write links with shapes
Handle(StepRepr_ShapeAspect) aFirstSA, aSecondSA;
// Write values
WriteDimValues(WS, anObject, aRC, aDimension);
//Annotation plane and Presentation
- WritePresentation(WS, anObject->GetPresentation(), anObject->GetPlane(), anObject->GetPointTextAttach(), aDimension.Value());
+ WritePresentation(WS, anObject->GetPresentation(), anObject->GetPresentationName(), anObject->GetPlane(), anObject->GetPointTextAttach(), aDimension.Value());
}
// Write Derived geometry
if (aConnectionPnts.Length() > 0) {
set ref_data {
- NbOfDimensions : 2
+ NbOfDimensions : 6
NbOfTolerances : 10
NbOfDatumFeature : 2
NbOfAttachedDatum : 9
NbOfDatumTarget : 2
0:1:1:2:2 Shape.5
- 0:1:4:10 Dimension.5.1 ( T 2, V 127, VL 64.515999999999991, VU 64.515999999999991, P 0 )
+ 0:1:4:14 Dimension.5.1 ( T 2, V 127, VL 64.515999999999991, VU 64.515999999999991, P 0 )
0:1:1:2:8 Shape.11
- 0:1:4:10 Dimension.11.1 ( T 2, V 127, VL 64.515999999999991, VU 64.515999999999991, P 0 )
+ 0:1:4:14 Dimension.11.1 ( T 2, V 127, VL 64.515999999999991, VU 64.515999999999991, P 0 )
0:1:1:2:9 Shape.12
0:1:4:1 GeomTolerance.12.1 ( T 13 TV 0, V 0.127 )
0:1:1:2:66 Shape.69
- 0:1:4:11 GeomTolerance.69.1 ( T 3 TV 0, V 0.050799999999999998 )
+ 0:1:4:15 GeomTolerance.69.1 ( T 3 TV 0, V 0.050799999999999998 )
0:1:1:2:67 Shape.70
- 0:1:4:11 GeomTolerance.70.1 ( T 3 TV 0, V 0.050799999999999998 )
+ 0:1:4:15 GeomTolerance.70.1 ( T 3 TV 0, V 0.050799999999999998 )
0:1:1:2:68 Shape.71
0:1:4:2 GeomTolerance.71.1 ( T 2 TV 0, V 0.88900000000000001 )
0:1:4:3 Datum.71.1.1 ( )
0:1:4:4 Datum.71.1.2 ( )
0:1:1:2:88 Shape.91
- 0:1:4:12 GeomTolerance.91.1 ( T 4 TV 1, V 0.76200000000000001 )
- 0:1:4:13 Datum.91.1.1 ( )
+ 0:1:4:16 GeomTolerance.91.1 ( T 4 TV 1, V 0.76200000000000001 )
+ 0:1:4:17 Datum.91.1.1 ( )
0:1:1:2:89 Shape.92
- 0:1:4:12 GeomTolerance.92.1 ( T 4 TV 1, V 0.76200000000000001 )
- 0:1:4:13 Datum.92.1.1 ( )
+ 0:1:4:16 GeomTolerance.92.1 ( T 4 TV 1, V 0.76200000000000001 )
+ 0:1:4:17 Datum.92.1.1 ( )
0:1:1:2:118 Shape.121
- 0:1:4:23 Datum target.121.1 ( T 3, A ( L (000), XD (10-0), RD (-010)), L 0 )
+ 0:1:4:27 Datum target.121.1 ( T 3, A ( L (000), XD (10-0), RD (-010)), L 0 )
0:1:1:2:123 Shape.126
- 0:1:4:21 Datum target.126.1 ( T 3, A ( L (000), XD (10-0), RD (-010)), L 0 )
+ 0:1:4:25 Datum target.126.1 ( T 3, A ( L (000), XD (10-0), RD (-010)), L 0 )
0:1:1:2:125 Shape.128
- 0:1:4:14 GeomTolerance.128.1 ( T 2 TV 0, V 0.63500000000000001 )
- 0:1:4:15 Datum.128.1.1 ( )
- 0:1:4:16 Datum.128.1.2 ( )
+ 0:1:4:18 GeomTolerance.128.1 ( T 2 TV 0, V 0.63500000000000001 )
+ 0:1:4:19 Datum.128.1.1 ( )
+ 0:1:4:20 Datum.128.1.2 ( )
0:1:1:2:141 Shape.144
- 0:1:4:17 GeomTolerance.144.1 ( T 2 TV 0, V 0.63500000000000001 )
- 0:1:4:18 Datum.144.1.1 ( )
- 0:1:4:19 Datum.144.1.2 ( )
+ 0:1:4:21 GeomTolerance.144.1 ( T 2 TV 0, V 0.63500000000000001 )
+ 0:1:4:22 Datum.144.1.1 ( )
+ 0:1:4:23 Datum.144.1.2 ( )
0:1:1:2:152 Shape.155
- 0:1:4:22 GeomTolerance.155.1 ( T 9 TV 0, V 0.254 )
- 0:1:4:23 Datum.155.1.1 ( )
+ 0:1:4:26 GeomTolerance.155.1 ( T 9 TV 0, V 0.254 )
+ 0:1:4:27 Datum.155.1.1 ( )
0:1:1:2:153 Shape.156
- 0:1:4:7 GeomTolerance.156.1 ( T 2 TV 0, V 0.38100000000000001 )
- 0:1:4:8 Datum.156.1.1 ( )
+ 0:1:4:9 GeomTolerance.156.1 ( T 2 TV 0, V 0.38100000000000001 )
+ 0:1:4:10 Datum.156.1.1 ( )
0:1:1:2:154 Shape.157
- 0:1:4:20 GeomTolerance.157.1 ( T 9 TV 0, V 0.254 )
- 0:1:4:21 Datum.157.1.1 ( )
+ 0:1:4:24 GeomTolerance.157.1 ( T 9 TV 0, V 0.254 )
+ 0:1:4:25 Datum.157.1.1 ( )
0:1:1:2:199 Shape.202
- 0:1:4:5 GeomTolerance.202.1 ( T 2 TV 0, V 0.050799999999999998 )
- 0:1:4:6 Datum.202.1.1 ( )
+ 0:1:4:7 GeomTolerance.202.1 ( T 2 TV 0, V 0.050799999999999998 )
+ 0:1:4:8 Datum.202.1.1 ( )
0:1:1:2:200 Shape.203
- 0:1:4:5 GeomTolerance.203.1 ( T 2 TV 0, V 0.050799999999999998 )
- 0:1:4:6 Datum.203.1.1 ( )
+ 0:1:4:7 GeomTolerance.203.1 ( T 2 TV 0, V 0.050799999999999998 )
+ 0:1:4:8 Datum.203.1.1 ( )
0:1:1:2:206 Shape.209
- 0:1:4:9 Dimension.209.1 ( T 2, V 254, VL 64.515999999999991, VU 64.515999999999991, P 0 )
+ 0:1:4:11 Dimension.209.1 ( T 2, V 254, VL 64.515999999999991, VU 64.515999999999991, P 0 )
0:1:1:2:207 Shape.210
- 0:1:4:9 Dimension.210.1 ( T 2, V 254, VL 64.515999999999991, VU 64.515999999999991, P 0 )
+ 0:1:4:11 Dimension.210.1 ( T 2, V 254, VL 64.515999999999991, VU 64.515999999999991, P 0 )
0:1:1:3:1 Shape.211
0:1:4:1 GeomTolerance.211.1 ( T 13 TV 0, V 0.127 )
}