Tue, 10/24/2023 - 23:08
Hi.
How can I read the GENERAL_PROPERTY of each nodes?
Should I use one of this tools?
m_stepData = new STEP_Data(cafReader.Reader());
m_shapeTool = XCAFDoc_DocumentTool::ShapeTool(doc->Main());
m_colorTool = XCAFDoc_DocumentTool::ColorTool(doc->Main());
m_gdtTool = XCAFDoc_DocumentTool::DimTolTool(doc->Main());
m_viewTool = XCAFDoc_DocumentTool::ViewTool(doc->Main());
Is there an example available?
Here is the file : http://davidemercanti.altervista.org/sources/1M001934.stp
Thankx
Wed, 10/25/2023 - 19:56
Hello,
Current version of OCCT do not support import of User-Defined Attributes.
But this functionality is planned on one of the next releases.
Best regards, Dmitrii.
Wed, 10/25/2023 - 22:37
so it is not possible to traverse step model
Handle(StepBasic_GeneralProperty) gp = Handle(StepBasic_GeneralProperty)::DownCast(entity);
string id = gp->Id()->ToCString();
string name = gp->Name()->ToCString();
string desc = gp->Description()->ToCString();
and recover the value of the property and know which instance it is connected to?
Thu, 10/26/2023 - 18:31
In your case - yes.
But there are a little more step entities and processing ways.
Best regards, Dmitrii.
Thu, 10/26/2023 - 21:25
Can you show me an example on how to retrieve the value of a userproperty of a specific instance?
Thank you
Wed, 11/01/2023 - 14:20
Hello, yes. I will attach a new ticket a little later this week. The current functionality will be a part of 7.8.0. It will be a beta version of reading this type of data.
If there will not news on this week, please return to me with new message.
I will include this information(metadata) XCAFDoc_NamedData into XCAF. Can be extracted from Shape label by ShapeTool.
New realization will include a new flag to read or not metadata and will have only limited functionality(by default this data will not read, you will need to enable the flag). But we will update this in the next release.
Best regards, Dmitrii.
Tue, 11/14/2023 - 10:16
Hello. Any news about this subject?
Tue, 11/14/2023 - 12:49
Hello,
The first commit will be on current or next week. 0033530: Data Exchange, Step Import - Implemen GENERAL_PROPERTY support - MantisBT (opencascade.org)
Best regards, Dmitrii.
Tue, 11/14/2023 - 18:51
Dimitrii
I have tried many ways to retrieve color from a shape in a STEP file.
The XCAFDoc_ColorTool does not work. It always returns false.
I have tried looping through the entities, something like
Standard_Integer nb = aModel->NbEntities();
float rgb[3] = { 0,0,0 };
for (int i = 1; i <= nb; i++) {
const Handle(Standard_Transient)& anEntity = aModel->Value(i);
Standard_CString name = aModel->TypeName(anEntity);
Standard_CString classname = aModel->ClassName(name);
if (anEntity->IsKind(STANDARD_TYPE(StepVisual_ColourRgb))) {
Handle(StepVisual_ColourRgb) aPD = Handle(StepVisual_ColourRgb)::DownCast(anEntity);
rgb[0] += aPD->Red();
rgb[1] += aPD->Green();
rgb[2] += aPD->Blue();
but it collects all color entities. I haven't found the way to pick the entities belonging to that shape.
Is there a way to find what entities are descendant of a shape or a label ?
Thanks
Josep
Tue, 11/14/2023 - 19:06
This is the code I have tried
The GetColor doesn't work
Tue, 11/14/2023 - 20:42
The shape variant does not work either
All these calls return false too.
Josep
Wed, 11/15/2023 - 13:58
Hello,to find each shape with color, you are free to use revert iteration (iterate over colour to find shape labels).
If you need to find shapes that have a "cascade" color(color from father and upper), You can use XCAFPrs::CollectStyleSettings withing XCAFPrs.hxx it helps to connect color with not-directed color
Best regards, Dmitrii.
Mon, 11/27/2023 - 15:42
Hello,
Unfortunatelly, according Recommented Practices https://www.mbx-if.org/documents/rec_prac_user_def_attributes_v18.pdf There is a problem to store the data into XCAF.
Because in some cases data has no "key" only "value" on other case they are not connected with geometry. That is why we can't include int into 7.8. But we have a lot of plane for full integartion of "user defined attributes" on one of the next releases.
Best regards, Dmitrii.