How to get Directory Entry Number?

Could you help me Please?

I'd like to get Directory Entry Number in the mapping shape data(IGES -->OpenCASCADE Shape). Until now, I have tried to code as Mr. Christian's guidance , but I have not a good result.

Because Christian got to summer vacation, I ask anybody a help.

following is my first method by now. =========================================

TopoDS_Shape IGESShape = myIgesReader.OneShape();

TopTools_IndexedDataMapOfShapeListOfShape aFaceShellMap;

TopExp::MapShapesAndAncestors(IGESShape , TopAbs_FACE, TopAbs_SHELL, aFaceShellMap);

nF = aFaceShellMap.Extent();

for(i=1; i

// When i randomly want to know Directory Entry Number of the fourth face in a mapping shape.

TopoDS_Face Face = TopoDS::Face(aFaceShellMap.FindKey(4));

Handle(XSControl_WorkSession) WS = myIgesReader.WS();

Handle(IGESData_IGESModel) model = myIgesReader.Model();

Handle(XSControl_TransferReader) TR = WS->TransferReader();

Standard_Integer modrec = 1; // recommended value

Handle(Standard_Transient) ent = TR->EntityFromShapeResult(Face ,modrec);

if(ent.IsNull()) { modrec = -1; ent = TR->EntityFromShapeResult(Face ,modrec); }

////Problem, ent.IsNull is to be Standard_True. I don't know this reason.

Standard_Integer dnum = model->Number(ent);

//// the result becomes dnum = 0.

Standard_Integer dnum1 = 2*dnum-1 ==========================================

In the first method, (ent.IsNull) is to be Standard_True, so I have not a result. I don't know this reason.(mapping data is not exist)

following is my second method by now. ==========================================

..............

modrec = 2;

Handle(Transfer_TransientProcess) TP = TR->TransientProcess();

if (TP.IsNull()) { return; }

Standard_Integer i, nb = TP->NbMapped();

//// nb is zero(no mapping), so not run FOR syntax.

//// Mapping data is not, What's meaning?

for (i = 1; i Mapped(i);

TopoDS_Shape sh = TransferBRep::ShapeResult(TP,ent);

if (sh.IsNull()) { ent.Nullify(); continue; } if (sh.IsSame(Face)) break;

ent.Nullify(); }

Standard_Integer dnum = model->Number(ent);

Standard_Integer dnum1 = 2*dnum-1; ==========================================

In the Second Method, Mapping data(Standard_Integer nb) is zero, What's meaning?

Could you check my coding data please?, and explain these reasons. Could you tell me another method to find Directory Entry Number?

Have a good day.

Pavel Durandin's picture

Dear Park jw,

> Could you help me Please?

> I'd like to get Directory Entry Number in
> the mapping shape data(IGES
> -->OpenCASCADE Shape). Until now, I have
> tried to code as Mr. Christian's guidance ,
> but I have not a good result.

> Because Christian got to summer vacation, I
> ask anybody a help.

> following is my first method by now.
>

The method you used is OK, but it is necessary to initialize XSControl_TransferReader by Transfer_TransientProcess which is used in IGES transfer. Please find here under my modifications:

=========================================

> TopoDS_Shape IGESShape =
> myIgesReader.OneShape();

> TopTools_IndexedDataMapOfShapeListOfShape
> aFaceShellMap;

> TopExp::MapShapesAndAncestors(IGESShape ,
> TopAbs_FACE, TopAbs_SHELL, aFaceShellMap);

> nF = aFaceShellMap.Extent();

> for(i=1; i // When i randomly want to know
> Directory Entry Number of the fourth face in
> a mapping shape.

> TopoDS_Face Face =
> TopoDS::Face(aFaceShellMap.FindKey(4));

> Handle(XSControl_WorkSession) WS =
> myIgesReader.WS();

> Handle(IGESData_IGESModel) model =
> myIgesReader.Model();

> Handle(XSControl_TransferReader) TR =
> WS->TransferReader();

You should add the following string:

TR->SetTransientProcess(myIgesReader.TransientProcess());

> Standard_Integer modrec = 1; // recommended
> value

> Handle(Standard_Transient) ent =
> TR->EntityFromShapeResult(Face ,modrec);

> if(ent.IsNull()) { modrec = -1; ent =
> TR->EntityFromShapeResult(Face ,modrec);
> }

> ////Problem, ent.IsNull is to be
> Standard_True. I don't know this reason.

After this modification ent should not be a null. In addition, I can recommend to obtain Model via WorkSession.

> Standard_Integer dnum =
> model->Number(ent);

> //// the result becomes dnum = 0.

> Standard_Integer dnum1 = 2*dnum-1
>

> Have a good day.

Best regards,

Pavel.