Is it possible to create PMI for gltf files and make it visible

Hi,team.I am stucked by the problem showing above. I know that gltf formate doesn`t back up PMI,but I still wonder if there is any way to achieve such goal.
Thanks,best regard.Ji

Patrik Mueller's picture

Hi,

interesting idea - I think defining a glTF extension could be a possilbilty. But the interpretation of such an extension is application dependend.

Greets,

Patrik

Dmitrii Pasukhin's picture

As I know, gltf does not support PMI directly. But it supports texts (OCC do not support this type of gltf data)

But as a solution, you can export 2D pmi representation to 3D and tessellate it (for example pipe). This way helps to visualize PMI.

Best regards, Dmitrii.

王 冕's picture

Hello,Dmitrii.
Sorry to bother you again.Would you tell me which class should I refer to.
I cant find informations about pmi in User Guides->Visualization.Is it in some other name?
Best regards,Ji.

Dmitrii Pasukhin's picture

Hello, PMI in  OCCT is represented as a XCAF object (that read from STEP).

To extract data from it you need to use XCAFDoc_DimensionTool. And it can be extracted as a general TopoDS_Shape.
Best regards, Dmitrii.

王 冕's picture

Hello,Dimtrii.
I`ve left a question in another post,the link is written below.
https://dev.opencascade.org/node/84632#comment-25198
Are those PMIs graphical or characterically?
Best Regard,Ji.

Dmitrii Pasukhin's picture

Each PMI in step should contain a graphical representation. We keep them as a TopoDS_Shape and it can be extracted from the TDF_Label. But sometimes there no TopoDS_Shape there are can be aproblem with OCCT(bug) or invalid STEP file.

Best regards, Dmitrii.

王 冕's picture

Hi,Dimtrii.
As you know,I am tring to extract PMI from stp,then write into gltf,and then visualize it. I`m using a json lib to do the writting step. I think TopoDS_Shape cant be written into a gltf extension.So I wonder if the PMI data can be extracted in the form of strings.
By the way,last time,you told me to export 2D pmi representation to 3D and tessellate it (for example pipe),I am not so familiar with those concepts.
So I decided to try the extract-write in-visualize route.Can I just extract the PMI in strings,and write them into a Graphic3d_Group object.Maybe atach them to the gltf geometric model then,I assume?
Is that seems feasible for you?
Pardon me for my poor knowledge of occt,there aren`t many matierials in Chinese.The concepts of some words are not so clear for me to understand.
Best Regard,Ji.

ilyas yigit's picture

Hello Dimitrii,
I am Ilyas from Istanbul - Turkiye

please look at the video at link below
https://www.youtube.com/watch?v=-YYY-Q3J5UA&t=34s

It is Tube Bending Simulation application using drectx.
It is read the geometry of the tube model from step file using occ Api.. i am a bit little familiar with open cascade core.

But, I want to develop new simulation app using open cascade. this will required because it is difficult to prepare machine model with drectx mesh.

So,
1-) i will import machine model from step file.
(This is not problem because it is need only require simple rotation and move operation on OCC Shapes..

But,
2-) i will import the tube model from step file and simulate it dynamicaly (This is realy problem for me.)
It is difficult to create torus dynamicaly from angel >0 and to angle 90 (for example) to simulate when model is shown on 3d viewer.

I know it is regure deep knowledge about OCC core. But i dont have time for that. because my intend is not write 3D cad programs.

I know that you can solve easly this.
My need is simple..
a-) Read the geometry of tube model (length of cylinder, major radius of Torus Axis of shapes, and like that.) from step file,
(It can be Toroidal, Cylinder or B-Spline Surface.. the models will be ignored if it is not cylinder and tube like. )
b-) Create again the shape (torus, cylinder like shape) dynamicaly when it is displaying on 3d viewer..

All my need is a and b branch.

If you can write simple sample code for this need, please write to me about if it is possible and the cost of to me.

Thank you

Attachments: 
王 冕's picture

Hi,Patrik.
Thanks for your comment.I`ve comprehend that ,the key to achieve it is to interpretate the information and project it on a selected 2D plane,but I don`t know which class or function could be useful for that.
Best regard,Ji.

Patrik Mueller's picture

Hi Ji,

I think this depends on your use case and how you define the extensions: you could just write the properties inside glTF or you could additionally write the presentations inside glTF.
As Dmitrii wrote: "you can export 2D pmi representation to 3D and tessellate it" - or take a look at PrsDim classes as inspiration.

I never needed it, so good luck about this topic.

Greets,

Patrik

王 冕's picture

Hi,Patrik.
Thanks a lot for your and Dimitri`s help,it seems to be a feasible way.
I will show the result here,once I figured out whether it could be solved or not.
Best regards,Ji.