New Widget system for 3DCoin (Aimed to be used with direct modeling tools)

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
kwahoo
Posts: 410
Joined: Fri Nov 29, 2013 3:09 pm
Contact:

Re: New Widget system for 3DCoin (Aimed to be used with direct modeling tools)

Postby kwahoo » Sat Mar 27, 2021 7:32 pm

marja1 wrote:
Fri Mar 26, 2021 1:49 pm
I choose coin3d. I will try my best to find the easiest way to implement the desired functionality.
You need sometime to understand how you do things..
I do some similar tinkering for VR/XR interaction. The basic idea is:
a) build a separate Coin3D scenegraph just for menu items,
b) do picking action (SoRayPickingAction) for "menu scenegraph", find what menu item was hit
c) if nothing was hit, perform picking action for "world" scenegraph
d) check what was hit, use SoDetail to find which part of shape was hit, find normal face (that will be useful for rendering manipulators)
e) find corresponding TopoShape using getViewProviderByPath (similar to this https://forum.freecadweb.org/viewtopic.php?t=25355 )
marja1
Posts: 157
Joined: Wed Jan 06, 2021 2:00 pm

Re: New Widget system for 3DCoin (Aimed to be used with direct modeling tools)

Postby marja1 » Sat Mar 27, 2021 10:02 pm

HI,
Thank you very much .. Valuable input .. It will help me.
I am glad to show you all some efforts I made to make the widgets working. At the moment I just made the fr_widget_line. which should draw a line.
There will be two windows widget : One for the coin3d (the example is using it) and the other for the QT(not implemented yet). Both they will get their own widgets.

Please try it out
use the following example :

Code: Select all

import fr_coinwindow as wn
import fr_line_widget as line
wn=wn.Fr_CoinWindow(0,0,0,100,100,0,"MyWindow")
ln =line.Fr_Line_Widget(10,10,0,20,20,0)
wn.addChild(ln)
wn.show()
Now the branch is as follow :
https://github.com/MariwanJ/Design456/tree/widgets

You need to clone the whole and checkout the desired branch (widgets)
  • go to the Mod directory in your user account:
  • git checkout widgets
  • run the macro as shown above
Any code/help is highly appreciated. I am glad that there are people interested in my effort. I hope and wish that this effort will lead to a real good work for FreeCAD.
marja1
Posts: 157
Joined: Wed Jan 06, 2021 2:00 pm

Re: New Widget system for 3DCoin (Aimed to be used with direct modeling tools)

Postby marja1 » Tue Mar 30, 2021 2:34 pm

wmayer wrote:
Thu Mar 25, 2021 10:17 am
Here is an overview of the classes offered by the official OpenInventor SDK: https://developer.openinventor.com/refm ... g_viz.html

It offers a lot of basic GUI elements but it won't be much fun to try to extend Coin3D by such functionality -- and the good thing is that we don't have to.
When we moved from SoQt to Quarter a couple of years ago we modified the Quarter code and replaced the very base class QOpenGLWidget with QGraphicsView.

This means you can use the functionality offered by QGraphicsView / QGraphicsScene and you can easily embed your custom widgets which I hardly believe is so easily doable with the official OpenInventor API.
If something is not a part of FreeCAD, it is not worth it to suggest it to other. I cannot force people to install several libraries only since my workbench will use it.
So, DialogViz and it's class are not relevant in this attempt.
Some one suggested also
https://github.com/looooo/pivy
But none of these project are documented with samples. And they aren't a part of FreeCAD. Which tell me to not touch them.
Really, I am lost. Documentation of most of the libraries used in Freecad is disaster. No examples, no real tutorial nothing .. you are out there without help. This forum will not help so much as you are ashamed to ask so much.
thanks anyway.
User avatar
looo
Posts: 3627
Joined: Mon Nov 11, 2013 5:29 pm

Re: New Widget system for 3DCoin (Aimed to be used with direct modeling tools)

Postby looo » Tue Mar 30, 2021 2:55 pm

marja1 wrote:
Tue Mar 30, 2021 2:34 pm
Some one suggested also
https://github.com/looooo/pivy
But none of these project are documented with samples. And they aren't a part of FreeCAD. Which tell me to not touch them.
pivy is a dependency of FreeCAD and should be included in every bundle. You referred to my fork which I only use to make PR's for the main repo which is: https://github.com/coin3d/pivy
marja1
Posts: 157
Joined: Wed Jan 06, 2021 2:00 pm

Re: New Widget system for 3DCoin (Aimed to be used with direct modeling tools)

Postby marja1 » Tue Mar 30, 2021 4:52 pm

Code: Select all

pivy is a dependency of FreeCAD and should be included in every bundle. You referred to my fork which I only use to make PR's for the main repo which is: https://github.com/coin3d/pivy

I was not clear .. I was referring to this project:
https://developer.openinventor.com/refm ... g_viz.html

and the second was

https://github.com/coin3d/pivy/blob/mas ... _init__.py
marja1
Posts: 157
Joined: Wed Jan 06, 2021 2:00 pm

Re: New Widget system for 3DCoin (Aimed to be used with direct modeling tools)

Postby marja1 » Thu Apr 01, 2021 8:55 pm

After many many days, I could write my first widget which you can test it now.
please read what I wrote here

https://forum.freecadweb.org/viewtopic. ... 50#p493250
I have the instruction how to use it