mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0027304: Implemetation of descriptions for Dimensions
- Add poles with array of descriptions and description names to DimensionObject, - Modify Import/Export STEP, - Add Draw commands for descriptions, - Create test, - Reorganize end script for test/gdt/dimensions.
This commit is contained in:
@@ -2890,6 +2890,7 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
Handle(StepShape_DimensionalLocation) aDimLocation =
|
||||
Handle(StepShape_DimensionalLocation)::DownCast(theEnt);
|
||||
|
||||
aDimObj = new XCAFDimTolObjects_DimensionObject();
|
||||
Standard_Real aDim1=-1.,aDim2=-1.,aDim3=-1.;
|
||||
Handle(StepShape_TypeQualifier) aTQ;
|
||||
Handle(StepShape_ValueFormatTypeQualifier) aVFTQ;
|
||||
@@ -3008,6 +3009,11 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
aVFTQ = aQRI->Qualifiers()->Value(l).ValueFormatTypeQualifier();
|
||||
}
|
||||
}
|
||||
else if (aDRI->IsKind(STANDARD_TYPE(StepRepr_DescriptiveRepresentationItem))) {
|
||||
Handle(StepRepr_DescriptiveRepresentationItem) aDescription =
|
||||
Handle(StepRepr_DescriptiveRepresentationItem)::DownCast(aDRI);
|
||||
aDimObj->AddDescription(aDescription->Description(), aDescription->Name());
|
||||
}
|
||||
else if(aDRI->IsKind(STANDARD_TYPE(StepRepr_CompoundRepresentationItem))) {
|
||||
aCRI = Handle(StepRepr_CompoundRepresentationItem)::DownCast(aDRI);
|
||||
}
|
||||
@@ -3059,7 +3065,6 @@ static void setDimObjectToXCAF(const Handle(Standard_Transient)& theEnt,
|
||||
|
||||
if(aDim1<0) return;
|
||||
|
||||
aDimObj = new XCAFDimTolObjects_DimensionObject();
|
||||
if(aDim2 < 0)
|
||||
aDimObj->SetValue(aDim1);
|
||||
else if (aDim3 < 0)
|
||||
|
@@ -236,11 +236,6 @@
|
||||
#include <XSControl_TransferWriter.hxx>
|
||||
#include <XSControl_WorkSession.hxx>
|
||||
|
||||
enum DimensionalValueNumber {
|
||||
DimensionalValueNumber_Nominal = 1,
|
||||
DimensionalValueNumber_Lower,
|
||||
DimensionalValueNumber_Upper
|
||||
};
|
||||
static NCollection_Vector<Handle(StepVisual_AnnotationPlane)> gdtAnnotationPlanes;
|
||||
static Handle(StepVisual_DraughtingModel) gdtPresentationDM;
|
||||
static Handle(StepVisual_HArray1OfPresentationStyleAssignment) gdtPrsCurveStyle;
|
||||
@@ -2613,14 +2608,15 @@ static void WriteDimValues(const Handle(XSControl_WorkSession) &WS,
|
||||
|
||||
// Values
|
||||
Handle(StepRepr_HArray1OfRepresentationItem) aValues;
|
||||
Standard_Integer aNbValItems = 1, aNbAddItems = 0;
|
||||
Standard_Integer aNbItems = 1, aValIt = 1;
|
||||
if (theObject->IsDimWithRange())
|
||||
aNbValItems += 2;
|
||||
aNbItems += 2;
|
||||
if (aModifiers.Length() > 0)
|
||||
aNbAddItems++;
|
||||
aNbItems++;
|
||||
if (theObject->GetType() == XCAFDimTolObjects_DimensionType_Location_Oriented)
|
||||
aNbAddItems++;
|
||||
aValues = new StepRepr_HArray1OfRepresentationItem(1, aNbValItems + aNbAddItems);
|
||||
aNbItems++;
|
||||
aNbItems += theObject->NbDescriptions();
|
||||
aValues = new StepRepr_HArray1OfRepresentationItem(1, aNbItems);
|
||||
|
||||
// Nominal value
|
||||
Standard_Real aNominal = theObject->GetValue();
|
||||
@@ -2662,22 +2658,27 @@ static void WriteDimValues(const Handle(XSControl_WorkSession) &WS,
|
||||
aQRI->SetQualifiers(aQualifiers);
|
||||
Handle(StepRepr_ReprItemAndMeasureWithUnit) anItem = CreateDimValue(aNominal, aUnit,
|
||||
new TCollection_HAsciiString("nominal value"), aMeasureName, isAngle, Standard_True, aQRI);
|
||||
aValues->SetValue(DimensionalValueNumber_Nominal, anItem);
|
||||
aValues->SetValue(aValIt, anItem);
|
||||
aValIt++;
|
||||
}
|
||||
// Without qualifiers
|
||||
else {
|
||||
Handle(StepRepr_ReprItemAndMeasureWithUnit) anItem = CreateDimValue(aNominal, aUnit,
|
||||
new TCollection_HAsciiString("nominal value"), aMeasureName, isAngle);
|
||||
aValues->SetValue(DimensionalValueNumber_Nominal, anItem);
|
||||
aValues->SetValue(aValIt, anItem);
|
||||
aValIt++;
|
||||
}
|
||||
|
||||
// Ranges
|
||||
if (theObject->IsDimWithRange()) {
|
||||
Handle(StepRepr_ReprItemAndMeasureWithUnit) aLowerItem = CreateDimValue(theObject->GetLowerBound(), aUnit,
|
||||
new TCollection_HAsciiString("lower limit"), aMeasureName, isAngle);
|
||||
Handle(StepRepr_ReprItemAndMeasureWithUnit) anUpperItem = CreateDimValue(theObject->GetUpperBound(), aUnit,
|
||||
new TCollection_HAsciiString("upper limit"), aMeasureName, isAngle);
|
||||
aValues->SetValue(DimensionalValueNumber_Lower, aLowerItem);
|
||||
aValues->SetValue(DimensionalValueNumber_Upper, anUpperItem);
|
||||
aValues->SetValue(aValIt, aLowerItem);
|
||||
aValIt++;
|
||||
aValues->SetValue(aValIt, anUpperItem);
|
||||
aValIt++;
|
||||
}
|
||||
|
||||
// Modifiers
|
||||
@@ -2694,7 +2695,8 @@ static void WriteDimValues(const Handle(XSControl_WorkSession) &WS,
|
||||
aModifItems->SetValue(i, aModifItem);
|
||||
}
|
||||
aCompoundRI->Init(new TCollection_HAsciiString(), aModifItems);
|
||||
aValues->SetValue(aNbValItems + 1, aCompoundRI);
|
||||
aValues->SetValue(aValIt, aCompoundRI);
|
||||
aValIt++;
|
||||
}
|
||||
|
||||
// Orientation
|
||||
@@ -2711,7 +2713,18 @@ static void WriteDimValues(const Handle(XSControl_WorkSession) &WS,
|
||||
aCoords->SetValue(3, aDir.Z());
|
||||
anAxis->Init(new TCollection_HAsciiString(), aCoords);
|
||||
anOrientation->Init(new TCollection_HAsciiString("orientation"), aLoc, Standard_True, anAxis, Standard_False, NULL);
|
||||
aValues->SetValue(aValues->Length(), anOrientation);
|
||||
aValues->SetValue(aValIt, anOrientation);
|
||||
aValIt++;
|
||||
}
|
||||
|
||||
// Descriptions
|
||||
if (theObject->HasDescriptions()) {
|
||||
for (Standard_Integer i = 0; i < theObject->NbDescriptions(); i++) {
|
||||
Handle(StepRepr_DescriptiveRepresentationItem) aDRI = new StepRepr_DescriptiveRepresentationItem();
|
||||
aDRI->Init(theObject->GetDescriptionName(i), theObject->GetDescription(i));
|
||||
aValues->SetValue(aValIt, aDRI);
|
||||
aValIt++;
|
||||
}
|
||||
}
|
||||
|
||||
for (Standard_Integer i = 1; i <= aValues->Length(); i++)
|
||||
|
Reference in New Issue
Block a user