Pivy_trackers 2D geometry library

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Pivy_trackers 2D geometry library

Post by Joel_graff »

I've been reworking the tracker code that I've developed as a part of my Trails workbench and have created a separate repo with just that code. It includes one example, designed to be incorporated into a workbench, that gives a basic idea of how it works.

I've also begun writing the wiki documentation on github. At the moment, the Scenegraph Structure page is mostly complete.

Links:

pivy_trackers repo: https://github.com/joelgraff/pivy_trackers
documentation wiki: https://github.com/joelgraff/pivy_trackers/wiki
original forum reference: https://forum.freecadweb.org/viewtopic. ... &start=810

There's still some features that haven't been implemented (like linking trackers together and dragging), but basic node picking is functioning, at least. :)
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: Pivy_trackers 2D geometry library

Post by carlopav »

That's really interesting to me: you know I was playing with looo's pivy graphics and draft trackers... I'm keeping track so when I'll have again some time I'll check it out carefully!
follow my experiments on BIM modelling for architecture design
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Pivy_trackers 2D geometry library

Post by looo »

nice to see this brought to the next level!

I worked on a similar tool some time ago and ended up with something like this (which adds a draggable marker - to drag press "g")

Code: Select all


import pivy
view = Gui.ActiveDocument.ActiveView
sg = view.getSceneGraph()
rm = view.getSoRenderManager()
interaction = pivy.graphics.InteractionSeparator(rm)
marker = pivy.graphics.Marker([[0,0,0]], dynamic=True)
interaction += marker
sg += interaction
interaction.register()
So while this might miss some documentation, the work was directly added to pivy which in my eyes makes the most sense for such a library (as it is not really dependent on FreeCAD). Anyway, I think your work is a great addition and I will for sure test the examples.
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Pivy_trackers 2D geometry library

Post by Joel_graff »

looo wrote: Tue Oct 08, 2019 9:38 pm So while this might miss some documentation, the work was directly added to pivy which in my eyes makes the most sense for such a library (as it is not really dependent on FreeCAD). Anyway, I think your work is a great addition and I will for sure test the examples.
That's not a bad way to look at it.

I'll have to look at your code - I admit my grasp of what Coin3D has to offer is probably a bit limited, as I don't recognize some of the references in it.

Unfortunately, in order to offer a more fully-featured system, I had to include some dependencies - like the DraftGui.todo class (which depends on QTimer), as well as the need to reference a 3DInventorViewer object, which is entirely a FreeCAD class. There may be a way to better abstract the view state code to help eliminate that dependency. There's also a dependency on SoFcSelection...

Anyway, I'm sure there's a lot of things I could do better. Nevertheless, I've sort of developed an arbitrary rule that each class / file will have no more than 200 lines (and preferrably less than 100), which seems to help me break things down and keep the code more manageable.

I'll be working on it over the next couple of weeks. Hopefully will have drag functionality added soon as well as more examples.

Right now, the example only allows you to do simple single-select and multi-selection of elements (as well as mouseover highlighting).
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Pivy_trackers 2D geometry library

Post by Joel_graff »

Just a quick update: I've provided some general overview as well as more specific documentation on the github wiki. There's some 29 pages currently created, most of them are empty. But, clicking on the "Module API" and "Scenegraph" links in the sidebar will bring up most of the documentation that has been written thus far.

It provides (I think) a good description of how things work. At least, it'll make understanding the code a bit easier.

Hopefully will get more done next week.

https://github.com/joelgraff/pivy_trackers/wiki
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Pivy_trackers 2D geometry library

Post by Kunda1 »

Fantastic work!
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
yorik
Founder
Posts: 13642
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Pivy_trackers 2D geometry library

Post by yorik »

Awesome job Joel!! I need to have a better look at it...
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Pivy_trackers 2D geometry library

Post by Joel_graff »

Just an update. Documentation is nearing 50% complete, though the worst is yet to come.

I've written docs for the lower-level support classes and a couple of the 'traits'. Trying to include examples as I go, though I don't actually have time to test them. :?

That said, it's also helping me discover a bunch of useless functions / code that I forgot about, so it's certainly a good exercise.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
Joel_graff
Veteran
Posts: 1949
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: Pivy_trackers 2D geometry library

Post by Joel_graff »

Documentation is (mostly) complete for the classes which currently exist in pivy_trackers. I've also created some example code which can be viewed in the examples section.

Example code is intended to be incorporated as a command in a workbench, or may alternately be instanced directly from the Python console.

I will post updates here and update the documentation accordingly as new features / bug fixes are made.

https://github.com/joelgraff/pivy_trackers/wiki
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails

pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Pivy_trackers 2D geometry library

Post by Kunda1 »

Will there be screencasts ? : :ugeek: :mrgreen:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply