Implement new function to find Product_Definition_Shape entity.
Modify Reader to add possibility of import DGTs, connected to some geometry items.
Update test cases.
return Standard_True;
}
+//=======================================================================
+//function : FindShapeIndexForDGT
+//purpose : auxiliary find shape index in map og imported shapes
+//=======================================================================
+static Standard_Integer FindShapeIndexForDGT(const Handle(Standard_Transient)& theEnt,
+ const Handle(XSControl_WorkSession)& theWS)
+{
+ const Handle(Transfer_TransientProcess) &aTP = theWS->TransferReader()->TransientProcess();
+ // try to find index of given entity
+ Standard_Integer anIndex = aTP->MapIndex(theEnt);
+ if (anIndex > 0)
+ return anIndex;
+ // if theEnt is a geometry item try to find its topological item
+ const Interface_Graph& aGraph = aTP->Graph();
+ Interface_EntityIterator anIter = aGraph.Sharings(theEnt);
+ for (anIter.Start(); anIter.More(); anIter.Next()) {
+ if (anIter.Value()->IsKind(STANDARD_TYPE(StepShape_TopologicalRepresentationItem)))
+ {
+ anIndex = aTP->MapIndex(anIter.Value());
+ if (anIndex > 0)
+ return anIndex;
+ }
+ }
+ return 0;
+}
//=======================================================================
//function : setDatumToXCAF
aRI = aPGISU->IdentifiedItemValue(i);
}
if(aRI.IsNull()) continue;
- Standard_Integer index = aTP->MapIndex(aRI);
+ Standard_Integer index = FindShapeIndexForDGT(aRI, theWS);
TopoDS_Shape aSh;
if(index >0) {
Handle(Transfer_Binder) binder = aTP->MapItem(index);
anItem = aPGISU->IdentifiedItemValue(1);
}
if(anItem.IsNull()) continue;
- Standard_Integer anItemIndex = aTP->MapIndex(anItem);
+ Standard_Integer anItemIndex = FindShapeIndexForDGT(anItem, theWS);
if(anItemIndex >0) {
Handle(Transfer_Binder) binder = aTP->MapItem(anItemIndex);
TopoDS_Shape anItemShape = TransferBRep::ShapeResult(binder);
}
}
+
//=======================================================================
//function : createGeomTolObjectInXCAF
//purpose :
// Collect shapes
for(Standard_Integer i = aSeqRI1.Lower(); i <= aSeqRI1.Upper() ;i++)
{
- Standard_Integer anIndex = aTP->MapIndex(aSeqRI1.Value(i));
+ Standard_Integer anIndex = FindShapeIndexForDGT(aSeqRI1.Value(i), theWS);
TopoDS_Shape aSh;
if(anIndex >0) {
Handle(Transfer_Binder) aBinder = aTP->MapItem(anIndex);
//for dimensional location
for(Standard_Integer i = aSeqRI2.Lower(); i <= aSeqRI2.Upper() ;i++)
{
- Standard_Integer anIndex = aTP->MapIndex(aSeqRI2.Value(i));
+ Standard_Integer anIndex = FindShapeIndexForDGT(aSeqRI2.Value(i), theWS);
TopoDS_Shape aSh;
if(anIndex >0) {
Handle(Transfer_Binder) aBinder = aTP->MapItem(anIndex);
for(anIterGRI.Start(); anIterGRI.More() && aPGISU.IsNull(); anIterGRI.Next()) {
aPRI = Handle(StepRepr_RepresentationItem)::DownCast(anIterGRI.Value());
}
- Standard_Integer anIndex = aTP->MapIndex(aPRI);
+ Standard_Integer anIndex = FindShapeIndexForDGT(aPRI, theWS);
TopoDS_Edge aSh;
if(anIndex >0) {
Handle(Transfer_Binder) aBinder = aTP->MapItem(anIndex);
return Standard_True;
}
+//=======================================================================
+//function : FindPDS
+//purpose : auxilary: find Product_definition_shape entity for given entity
+//=======================================================================
+static Handle(StepRepr_ProductDefinitionShape) FindPDS(const Interface_Graph &theGraph,
+ const Handle(Standard_Transient) &theEnt,
+ Handle(StepRepr_RepresentationContext) &theRC)
+{
+ if (theEnt.IsNull())
+ return NULL;
+ Handle(StepRepr_ProductDefinitionShape) aPDS;
+
+ // try to find shape_representation in sharings
+ Interface_EntityIterator anIter = theGraph.Sharings(theEnt);
+ for (anIter.Start(); anIter.More() && aPDS.IsNull(); anIter.Next()) {
+ Handle(StepShape_ShapeRepresentation) aSR = Handle(StepShape_ShapeRepresentation)::DownCast(anIter.Value());
+ if (aSR.IsNull())
+ continue;
+ theRC = aSR->ContextOfItems();
+ Interface_EntityIterator aSDRIt = theGraph.Sharings(aSR);
+ for (aSDRIt.Start(); aSDRIt.More() && aPDS.IsNull(); aSDRIt.Next()) {
+ Handle(StepShape_ShapeDefinitionRepresentation) aSDR =
+ Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(aSDRIt.Value());
+ if (aSDR.IsNull()) continue;
+ Handle(StepRepr_PropertyDefinition) aPropD = aSDR->Definition().PropertyDefinition();
+ if (aPropD.IsNull()) continue;
+ aPDS = Handle(StepRepr_ProductDefinitionShape)::DownCast(aPropD);
+ }
+ }
+ if (!aPDS.IsNull())
+ return aPDS;
+
+ anIter = theGraph.Sharings(theEnt);
+ for (anIter.Start(); anIter.More(); anIter.Next()) {
+ if (anIter.Value()->IsKind(STANDARD_TYPE(StepShape_TopologicalRepresentationItem)) ||
+ anIter.Value()->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationItem)))
+ {
+ aPDS = FindPDS(theGraph, anIter.Value(), theRC);
+ if (!aPDS.IsNull())
+ return aPDS;
+ }
+ }
+
+ return aPDS;
+}
+
//=======================================================================
//function : GetUnit
//purpose : auxiliary
//=======================================================================
-
static StepBasic_Unit GetUnit(const Handle(StepRepr_RepresentationContext)& theRC,
const Standard_Boolean isAngle = Standard_False)
{
Handle(StepRepr_ProductDefinitionShape) aPDS;
Handle(StepRepr_RepresentationContext) aRC;
Handle(Standard_Transient) anEnt = aSeqRI.Value(1);
- Handle(StepShape_AdvancedFace) anAF;
- Handle(StepShape_EdgeCurve) anEC;
- FindPDSforDGT(aGraph, anEnt, aPDS, aRC, anAF, anEC);
+ aPDS = FindPDS(aGraph, anEnt, aRC);
if(aPDS.IsNull())
return NULL;
Handle(StepVisual_HArray1OfDraughtingCalloutElement) aTAOs = new StepVisual_HArray1OfDraughtingCalloutElement(1, 1);
aTAOs->SetValue(1, aDCElement);
Handle(StepVisual_DraughtingCallout) aDCallout = new StepVisual_DraughtingCallout();
- aDCallout->Init(thePrsName, aTAOs);
+ Handle(TCollection_HAsciiString) aPrsName = thePrsName.IsNull() ? new TCollection_HAsciiString() : thePrsName;
+ aDCallout->Init(aPrsName, aTAOs);
Handle(StepRepr_HArray1OfRepresentationItem) aDCsForDMIA = new StepRepr_HArray1OfRepresentationItem(1, 1);
aDCsForDMIA->SetValue(1, aDCallout);
StepAP242_ItemIdentifiedRepresentationUsageDefinition aDimension;
Handle(StepVisual_HArray1OfDraughtingCalloutElement) aTAOs = new StepVisual_HArray1OfDraughtingCalloutElement(1, 1);
aTAOs->SetValue(1, aDCElement);
Handle(StepVisual_DraughtingCallout) aDCallout = new StepVisual_DraughtingCallout();
- aDCallout->Init(thePrsName, aTAOs);
+ Handle(TCollection_HAsciiString) aPrsName = thePrsName.IsNull() ? new TCollection_HAsciiString() : thePrsName;
+ aDCallout->Init(aPrsName, aTAOs);
aModel->AddWithRefs(aDCallout);
// Annotation plane
Handle(StepRepr_ProductDefinitionShape) aPDS;
Handle(StepRepr_RepresentationContext) aRC;
Handle(Standard_Transient) anEnt;
- Handle(StepShape_AdvancedFace) anAF;
- Handle(StepShape_EdgeCurve) anEC;
TopoDS_Shape aShape;
TopLoc_Location aLoc;
TColStd_SequenceOfTransient aSeqRI;
return NULL;
}
anEnt = aSeqRI.Value(1);
- FindPDSforDGT(aGraph, anEnt, aPDS, aRC, anAF, anEC);
+ aPDS = FindPDS(aGraph, anEnt, aRC);
if (aPDS.IsNull())
return NULL;
# !!!! This file is generated automatically, do not edit manually! See end script
set filename bug27645_nist_ftc_06_asme1_cr3000_rd.prt.stp
-puts "TODO CR26859 ALL:Error : 3 differences with reference data found :"
+puts "TODO CR26859 ALL:Error : 1 differences with reference data found :"
puts "TODO CR26859 ALL:Error on writing file"
set ref_data {
# !!!! This file is generated automatically, do not edit manually! See end script
set filename bug27808_nist_ftc_06_asme1_ct5240_rd.stp
-puts "TODO CR26859 ALL:Error : 3 differences with reference data found :"
-puts "TODO CR26859 ALL:Error on writing file"
set ref_data {
# !!!! This file is generated automatically, do not edit manually! See end script
set filename bug27645_nist_ftc_06_asme1_ct5240_rd-1.stp
-puts "TODO CR26859 ALL:Error : 3 differences with reference data found :"
-puts "TODO CR26859 ALL:Error on writing file"
set ref_data {
# !!!! This file is generated automatically, do not edit manually! See end script
set filename bug27808_nist_ftc_09_asme1_ct5240_rd.stp
-puts "TODO CR26859 ALL:Error : 2 differences with reference data found :"
-puts "TODO CR26859 ALL:Error on writing file"
set ref_data {
# !!!! This file is generated automatically, do not edit manually! See end script
set filename bug27808_nist_ftc_06_asme1_ct5240_rd.stp
-puts "TODO CR27235 ALL:Error : 4 differences with reference data found :"
-puts "TODO CR27235 ALL:Error on writing file"
set ref_data {
-Centre of mass: 4.9764239505863603 64.18438466729144 -67.058903377273126
-Mass: 24387.315415267363
+Centre of mass: 4.9764105227425732 64.184386470151395 -67.058886121406474
+Mass: 24387.315219228582
}
# !!!! This file is generated automatically, do not edit manually! See end script
set filename bug27645_nist_ftc_06_asme1_ct5240_rd-1.stp
-puts "TODO CR27235 ALL:Error : 4 differences with reference data found :"
-puts "TODO CR27235 ALL:Error on writing file"
set ref_data {
Centre of mass: 126.40116834489778 1630.2833705491985 -1703.2961457827012
# !!!! This file is generated automatically, do not edit manually! See end script
set filename bug27808_nist_ftc_09_asme1_ct5240_rd.stp
-puts "TODO CR27235 ALL:Error : 4 differences with reference data found :"
-puts "TODO CR27235 ALL:Error on writing file"
set ref_data {
Centre of mass: -20.281360550123736 7.5575111121398644 -1.4132597243023584