Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
Open CASCADEShowroomGet it!Developer CornerSupport and ProductsAbout us
Technical overview
Areas of use
Advantages
FAQ
Screenshots
Shape factory
Shape gallery
Demonstrations
What's new
System requirements
Download Center
Public license
Documentation
Getting started
Forums
Open Source community
Training and e-learning
A-la Carte Support
Value-added software
Complementary Components
Customer Corner
Company Profile
Marketing Materials
Contact Us
News
Home / Developer Corner / Forums / Usage issues / How to Extract entity names or features from step file and express to xml file.

How to Extract entity names or features from step file and express to xml file.

How to Extract entity names or features from step file and express to xml file.
Fong Heng 2012/11/19 12:07
Hi everyone,
This is a first time that i use the open cascade and i want to ask everyone how to Extract entity names or features from step file and express to xml file? one more what is a shapeName from this parameter in this function and how can i get it? hope can anyone help me:

TopoDS_Shape getShape(char* shapeName,STEPControl_Reader reader)
{
const TCollection_AsciiString ascShapeName(shapeName);

               const Handle(XSControl_WorkSession)& theSession = reader.WS();
const Handle(Interface_InterfaceModel)& theModel = theSession->Model();
const Handle(XSControl_TransferReader)& aReader = theSession->TransferReader();
const Handle(Transfer_TransientProcess)& tp = aReader->TransientProcess();

Standard_Integer nb = theModel->NbEntities();
TopoDS_Shape retShape;
for(Standard_Integer i=1; i<=nb; i++)
{
Handle(StepRepr_Representation) ent =
Handle(StepRepr_Representation)::DownCast
(theModel->Value(i));

if (ent.IsNull()) continue;
Handle(Transfer_Binder) binder = tp->Find(ent);
if (binder.IsNull()) continue;
TopoDS_Shape oneShape = TransferBRep::ShapeResult(binder);
if (oneShape.IsNull()) continue;

if (ent->Name().IsNull())
continue;

if(ent->Name()->String().IsEqual(ascShapeName))
{
retShape = oneShape;
}
}

return retShape;
}


thank in advantage.
Hennig 2012/11/22 19:12
Hallo Fong
When you open the step file in an editor a face will look like:     

#17 = ADVANCED_FACE('IAmAFace',(#18),#32,.T.);

You can call your function now: getShape('IAmAFace') and it will return the shape belonging to this Name. But before you have to set your reader:

STEPControl_Reader reader;
reader.ReadFile(yourFile)

Hope i could help. And is this function working in your case?
greetings
paul

Ear MongHeng 2012/11/23 09:39
Thank for explain.

onemore after i get shape object(TopoDS_Shape myshape = getShape("iAmAFace")), how to get value and string like(#18,#32,T,ADVANCE_FACE) or what should i do next? can you explain more and how to use shape object after get it. i don't my question is it right or worry?

Thank again in advance. from cambodia student.
Hennig 2012/11/28 12:00
hallo,

to get the other informations is not easy. depend on what you want to do after. for example a information about the kind of shape you get with myShape.ShapeType().

And with the shape Object you can do nearly everything, what OCC offers. You can project, intersect or split ist. Whatever you want. For some operations you have to get the geometry from the shape.

read the following blog. its really good for startin with OCC: http://opencascade.blogspot.co.at/2009/02/topology-and-geometry-in-open-cascade.html

greetings

Ear MongHeng 2012/11/30 19:22
Thank for reply.
 
 
Latest news
  • Open CASCADE Technology 6.7.1 is available for download!
  • Open CASCADE Technology 6.7.0 is available for download!
  • Open CASCADE Technology 6.6.0 is available for download!

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map