Mon, 12/19/2022 - 16:43
Hi,
I am working on a project which has multiple modules dealing with different aspects of geometry generation.
We are using one TDocStd_Document per study in the project. Study means an opened case which can have more than one above mentioned modules.
And we are using separate dedicated label from TDocStd_Document to each module. Like (0:1, 0:2, 0:3...)
Is it possible to initialize XCAFDoc_DocumentTool attribute in each of those labels?
Or is there any other way I can use XCAF structure initialized different labels that I can use independently?
Thanks in advance.
Vinojan T.
Tue, 12/20/2022 - 04:22
Hello,
It is possible. But I cannot guarantee that it will work successfully in all user cases.
XCAFDoc_DocumentTool - it is a just attribute. You can put it whenever you want. By default it put on first child of root. The code is opensource, that is why, you can see creation stage (XCAFDoc_DocumentTool::Set). We interested in method XCAFDoc_DocumentTool::DocLabel, that return created first child or find existed).
To put this attribute on 0:2 or other label (before it was only 0:1). You need to use the next code:
Unfortunatelly, I think you will need to rework all XCAF tools to work with you code. But if you upgrade it, working with manylavel document attribute will be easy.
The other best way to configure working document tool - is refence on root. you can validate this reference externally. For example, you can create child 0:3 and create reference on it (document tool attribute will be created automatically). Then all tools and all alghoritms recognize 0:3 as a valid document tool.
Code sample to create reference:
If you need more information, please let me know.
Best regards, Dmitrii.
Tue, 12/20/2022 - 04:32
I really recommend to use the second sample. It very helpful for lesson workspace. Using second sample you can choose active document, create new. All algorithm will be work successfully.
The first sample just to view for setting attribute.
Best regards, Dmitrii.
Mon, 12/26/2022 - 07:43
Hi Dmitrii, Thank you for your quick response and it is working well with the second sample you mentioned. Now, I can initialize multiple XCAFDoc_DocumentTool attribute in different TDF_Label s of same TDocStd_Document. Then when I am switching between modules, I have to set the root node and document tool label relations as in the attached image.
Thank you again Dmitrii.
Vinojan T.