[Temporarly Solved] Design456 will die if I don't get some help

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
vm4dim
Posts: 129
Joined: Tue Nov 23, 2021 1:05 am

Re: Design456 will die if I don't get some help

Post by vm4dim »

ImplicitCAD only produced static STL file, not 3D View.
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Design456 will die if I don't get some help

Post by onekk »

Maybe using a two level approach.

when you move a face:

1) vertexes of shape are extracted and a fake "disposable" representation in coin3D showing only object skeleton (this will only affect memory and not the final document).

2) Once mouse is released, the new object is recalculated based on the vertex moved and recomputed.

In many CAD there is a similar outline representation when altering existing objects, but you have to:

1) extract vertexes
2) generate the outline
3) generate a transformation mat that alter the original shape or recreate the shape.

It will be more easy for a cuboid shape, little challenging if you alter shapes with curved edges and maybe if these edges are made of "non circular arcs".

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

Re: Design456 will die if I don't get some help

Post by mariwan »

onekk wrote: Sat Nov 27, 2021 11:56 am Maybe using a two level approach.

when you move a face:

1) vertexes of shape are extracted and a fake "disposable" representation in coin3D showing only object skeleton (this will only affect memory and not the final document).

2) Once mouse is released, the new object is recalculated based on the vertex moved and recomputed.

In many CAD there is a similar outline representation when altering existing objects, but you have to:

1) extract vertexes
2) generate the outline
3) generate a transformation mat that alter the original shape or recreate the shape.

It will be more easy for a cuboid shape, little challenging if you alter shapes with curved edges and maybe if these edges are made of "non circular arcs".

Regards

Carlo D.
My experience with Coin3D : It is not easy to use. Doesn't have support for simple drawings. You need tons of rows to draw something basic.
You can look at my FR_WIDGET which I made several templates for drawings (line, square, polygon ..etc)
As you said, for edges of straight line might be possible to do it in COIN3D but any curvature face (which is not abnormal) will bey very difficult to do.
Now, I could just drag the edge and after mouse release create the object, but that is not beautiful at all.
I am still thinking what I can do. I thought about drawing OpenGL, VKT, ..etc .. Don't have so much experience .. Could we find a simple toolkit that help us in drawing in the scene? not sure. I am searching.
I need a toolkit that can draw easily in the scene and be easy to draw. I wish to NOT use COIN3D at all.
If I can find anything simpler, better than COIN, that will help not just me .. all FreeCAD developer to eliminate totally COIN3D and start using my widget tool as I will switch the drawing to the new tool.
Let us see if anyone else can come with other ideas.
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Design456 will die if I don't get some help

Post by onekk »

Try to read some OpenInventor material (Coin3D is an implmentation of OpenInventor).

In the beginning of FreeCAD developers have found Coin3D better than the OCCT supplied visualizer.

Try to see how:
PythonOCC https://github.com/tpaviot/pythonocc

PyOCCT https://github.com/trelau/pyOCCT

DeclaraCAD https://declaracad.com/

And others have solved the problem.

There is also some work by RealThunder to a new "rendering" engine.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Design456 will die if I don't get some help

Post by adrianinsaval »

onekk wrote: Sat Nov 27, 2021 2:22 pm Try to see how:
PythonOCC https://github.com/tpaviot/pythonocc

PyOCCT https://github.com/trelau/pyOCCT

DeclaraCAD https://declaracad.com/

And others have solved the problem.
anything that is scripted probably didn't even think about this problem because it involves providing feedback from mouse interactions
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

Re: Design456 will die if I don't get some help

Post by mariwan »

Anything based on OpenCasCade will result in the same slowness.
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Design456 will die if I don't get some help

Post by onekk »

Why?

coin3d is not used by other cad.

if you want to use other 3d engine than OCCT you are deciding to not use the core of FreeCAD.

different thing is the graphic engine those who show 3d model in screen FreeCAD use coin3D but as example OCCT bundle use a VTK based rendering. engine.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

Re: Design456 will die if I don't get some help

Post by mariwan »

After a long thinking, try and error .. I have no choice at the moment than COIN3D to do the redrawing.
I don't like COIN3D ... And I think we need to find a replacement for that library.

I have many already ready-to-use drawing functions in my FR_WIDGET toolkit for COIN3D. So, rewriting the Design456_ExtendEdge was not so difficult.
You see in the video I am cheating in the redrawing and I use COIN3D to draw the faces. When user release the mouse, the object creates in OCCT and they are real.
Still I didn't implement the conversion back to the Solid. But that is not a big issue.

I looked at many 3D drawing libraries, that might replace the COIN3D ..But, in this short time, I didn't figure out how to inject that to the COIN3D scene. Might not be possible?
Latest technology regarding 3D drawings must be discussed and we need to put our first step in finding a new 3D drawing library. OpenGL will not last for ever.
There are still works to do for this tool.. in the video it fails sometimes due to different things. They will be fixed

phpBB [video]


Thanks for everyone tried to help.
User avatar
mariwan
Posts: 469
Joined: Wed Jan 06, 2021 2:00 pm

Re: [Temporarly Solved] Design456 will die if I don't get some help

Post by mariwan »

Here I show you the whole change in sequence. First is just COIN and later when user presses OK the real object recreates.
It is a solid object.
I think it is reasonable speed and might be acceptable .. Not perfect.

You see also that this tool is dangerous. You have to know what you are doing or the result will be a wrong-face at some places.
Might fix this issue by dividing the face in to 2 triangles? This will be up to the request .. If people think that I should divide the face to two triangles as 123D Design do.. I will change my code.
Don't know why the coin Color became darker .. I don't change it. I have to look at it.


phpBB [video]
Post Reply