Tue, 10/10/2023 - 18:51
Hello, I'm reading the shapes information from a stp file and I'm trying to find the "part number" (or "product number", the identification code of a part or an assemlby) but the part/product name is what i get (the nomenclature string). I can see that if the .stp file contain, for a given product, only the part number, it is loaded correctly inside the shape information, instead, if "name" and "part number" are both present inside the the .stp file, for a given document, only the name is loaded inside the shape. This is how I read the name from the label:
TDF_LabelSequence l_comps = TDF_LabelSequence();
std::string nameOfElem = "";
static Standard_Boolean b = aShapeTool->GetComponents(lab, l_comps);
Handle(TDataStd_Name) N;
if (b && lab.FindAttribute(TDataStd_Name::GetID(), N)) {
TCollection_ExtendedString name = N->Get();
nameOfElem = TCollection_AsciiString(name).ToCString();
std::cout << nameOfElem << std::endl;
}
Based on this hierarchy
the code print the part name for the first highlighted item and the part number for the second highlighted item in the image. This is a part of the step file content
Where the first highlighted item has a part name and a part number (but the part name is used as name inside the shape structure) and the second highlighted item has only the part number (which is used as name).
I would like to access the part number because this is the string I need.
Tue, 10/10/2023 - 19:45
Hello, currect version of STEP reader support by default "name". If there is no "name" used "part number" instead. We don't give the API to configure the behavior. But you are free to modify source code to import what you need. You need to modify "STEPCAFControl_Reader::ReadNames". We have some plans on options for this kind of information, but it will not a part of closed release. There is just a original source code:
Besr regards, Dmitrii.
Wed, 10/11/2023 - 09:46
thank you