Geometry picking

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
cline
Posts: 56
Joined: Tue Dec 29, 2009 11:43 pm

Re: Geometry picking

Post by cline »

I agree that a redraw for every pixel is too much. Still, we could display a text message in a status area describing the geometry. A timer could wake every 100msec or so to see if the user has been idle, and if so mark the picked geometry. This would be obviously slow to the user, requiring a slight pause to get the feedback, but since it wouldn't interfere with the actual process of left click selection I suspect it could be acceptable, or even welcome. (I often run CAD through a VNC connection and don't find the delay interferes with my work, but others will undoubtedly feel differently).

The approach I am advocating is definitely modal. There are times when selection should be limited. Choosing a contour for a machining operation (where angular continuity is relevant and gaps may be present) should have a different presentation than selecting an outline to fill or extrude. Indeed, the machining example may be so workbench specific that it does not belong in the selection module at all.

To be honest, I don't have a clear vision of how interaction should be handled in FreeCAD. I respect the work that has been done so far, but I see a need to support workbenches in a manner that will be manageable as FreeCAD grows. And it looks to me like FreeCAD is on a path towards explosive growth.
midgetfc
Posts: 60
Joined: Fri May 15, 2009 2:50 pm

Re: Geometry picking

Post by midgetfc »

I'm trying to get an "inside" view of the navigation models in FreeCAD, but stumble upon a few things I'm no able to sort out alone.
In the function CADNavigationStyle::processSoEvent (file Gui/NavigationStyle.cpp, line 1174), I don't understand why the variables MoveMode, MoveModeMoved, ZoomMode, RotMode, dCliBut3 are declared static, as if they had to keep some state info between calls to the function, but are all reset to false before they are used.
And consequently, for example if the processed event is a left button press, is the code between lines 1238 and 1249 executed in some circumstances (in a if (MoveMode) block)?
I hope you'll forgive my "noobness". I must be missing something...
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Geometry picking

Post by wmayer »

First of all the implementation of CADNavigationStyle::processSoEvent is a mess. I have to clean up with some flaws there, especially with the static variables you have mentioned.

Nevertheless, the static boolean work as expected because they are set to false the very first time the method is executed. For the second and all further times the method gets called the variables are not longer reset to false. That's why they are static, otherwise the static keyword wouldn't make sense.
And consequently, for example if the processed event is a left button press, is the code between lines 1238 and 1249 executed in some circumstances (in a if (MoveMode) block)?
Yes, this block is executed when you have pressed the middle and then the left mouse button.
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Geometry picking

Post by jriegel »

Yes its a bit messy.

A clean way would be to use a state machine or workflow engine to do this... But who has time to
reimplement working code to just make it nice?!

For the picking stuff I would make a different approach. The left click (if not handled through the mouse model) is
handled mostly in the SoFCSelection node of the picked geometry. I would reroute this click through the Gui::Control
class to have a single point of access to change picking behavior. CADNavigationStyle::processSoEvent is not really the
right place to do it, because you dont know what kind of geometry is under the mouse. That comes later in the way of
the Action tthrough the scene graph (in the SoFCSelection node)...
After rerouting the left click through Control a interface to change the behavour acording to the geometry under the mouse
is easy.

That would be my take on that.
Stop whining - start coding!
midgetfc
Posts: 60
Joined: Fri May 15, 2009 2:50 pm

Re: Geometry picking

Post by midgetfc »

Thank you for the fast and cute responses.
I still have a long way to go improving my c++ :oops:
Jurgen's proposal for the picking stuff seems in fact a very promising way to settle the matter.
User avatar
yorik
Founder
Posts: 13665
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Geometry picking

Post by yorik »

Just for everybody to know, Ken Cline has just made an impressive cleanup, optimization & upgrade work on the draft module, that I just committed now. There might still be one small thing here and there in the Draft module that is not working like it was, but several parts of the code have gained much simplicity and stability... Great job!
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Geometry picking

Post by NormandC »

That's interesting Yorik, is there a FreeCAD download available with this updated Draft module?
cline
Posts: 56
Joined: Tue Dec 29, 2009 11:43 pm

Re: Geometry picking

Post by cline »

The updated Draft is in the SVN repository. You have to check it out and compile it yourself, but it is available.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Geometry picking

Post by NormandC »

Thanks. I've never compiled a package before, but I've decided to take the plunge. I'm downloading and installing the prerequisites right now. That will add 644MB to my system!!! No matter, I have room to spare. :D
wmayer
Founder
Posts: 20319
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Geometry picking

Post by wmayer »

Actually you should be able to just download the Draft files and use them as they are. Since the Draft is 100% Python code no compiling needs to be done.
At http://free-cad.svn.sourceforge.net/vie ... Mod/Draft/ you'll find the link "Download GNU tarball" where you can the whole source files at once.
Post Reply