bugpyFormex - Bugs: bug #43977, Provide an easy way to add a...


bug #43977: Provide an easy way to add a button+function to the GUI

Submitted by:  francesco <francio>
Submitted on:  Sun 11 Jan 2015 04:41:54 PM UTC  
Category:  GUI Severity:  1 - Wish
Item Group:  Feature request Status:  Fixed
Privacy:  Public Assigned to:  Benedict Verhegghe <bverheg>
Open/Closed:  Closed

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Thu 19 Feb 2015 05:34:13 PM UTC, comment #10: 

I put an outline.png in commit  9fea628 we can use for this.

Maybe we could add an enter like Add Button in some menu (eg Tools)
with a list of possible buttons to add which migth require multiple interations with the GUI (eg Save Picture , Outline)

if you dont like this idea I suppose the bug can be closed

francesco <francio>
Project Member
Tue 20 Jan 2015 09:41:40 AM UTC, comment #9: 

Well, it turns out we already have this functionality (what do we NOT have ;-)

Here is an example adding a button calling the geometry_menu.addOutline function. It uses the 'question' icon: somebody should create a better one.

from gui import toolbar
from plugins import geometry_menu as gm
toolbar.addButton(pf.GUI.modebar,"Add the outline to the current rendering",'question',gm.addOutline)

We should probably add this hint to the manual before closing this bug.

Benedict Verhegghe <bverheg>
Project AdministratorIn charge of this item.
Sun 18 Jan 2015 05:38:35 PM UTC, comment #8: 

In 0e8a6fc an option was added in the Geometry menu to compute and
draw the outline of the current scene.

We still should add a simple general mechanism for letting users add a button to the GUI.

Therefore, I kept this bug open but renamed it to reflect this wish.

Benedict Verhegghe <bverheg>
Project AdministratorIn charge of this item.
Sat 17 Jan 2015 10:47:50 PM UTC, comment #7: 

Why would you want to reposition it?
If you want it as attached to the model, we should just create world coordinate geometry from the contour and draw that.
I think that is the most sensible thing to do.

This could become a nice function for the geometry menu, but I do not think we should add a button for it. There are so many functions in the menu (or even not there) that might be more useful to have a button for it. I suggest we add instead a general mechanism for the user to easily add a button calling any function.

Benedict Verhegghe <bverheg>
Project AdministratorIn charge of this item.
Sat 17 Jan 2015 09:22:37 PM UTC, comment #6: 

maybe we should scale rotate and center it with the model. the user can use smallestDirection and vectorRotation to reposition it on the xy plane. I think we should go this way, otherwise we lose the information on the camera posoition. Or the other option is to return the contour on the xy plane and the position of the camera

francesco <francio>
Project Member
Sat 17 Jan 2015 05:21:50 PM UTC, comment #5: 

Button or menu, that is just cosmetic change. But what is the button function supposed to do?

What should happen with the contour when the rendering changes?

- Should the contour be scaled/rotated/translated with the model?
- Or should automatically a new contour (in the current camera xy plane) be computed?

Benedict Verhegghe <bverheg>
Project AdministratorIn charge of this item.
Sat 17 Jan 2015 03:52:48 PM UTC, comment #4: 

I think the button is handier, maybe not in GUI by default but something like the saveView button that appears only when the menu entry is selected. but for the moment the entry in a menu would suffice.

In my idea it was only the current contour rendering, i am not sure waht you mean with "every rendering the contour is draw"

francesco <francio>
Project Member
Thu 15 Jan 2015 07:49:42 PM UTC, comment #3: 

I am not sure what you precisely expect from the button:

- create (and store) the contour of the current rendering, or
- (de)activate a mode so that for every rendering the contour is drawn (like viewport annotations in the geometry menu). Drawing such contours in 3 axis directions could be a nice surplus over the bbox drawing).

In any case, I think we can first develop the functionality and put it in a menu (this can easily be done by the user), and if useful and requested add a specialized GUI button.

We should probably add some general, user friendly way to add a GUI button executing some function.

Benedict Verhegghe <bverheg>
Project AdministratorIn charge of this item.
Mon 12 Jan 2015 08:43:15 PM UTC, comment #2: 

I split this bug report in two: the suggestions of Gianluca in
should further be discussed in

This bug report should only be about adding a button to the GUI (for showing the contours or more general).

Benedict Verhegghe <bverheg>
Project AdministratorIn charge of this item.
Mon 12 Jan 2015 08:43:18 AM UTC, comment #1: 

Very nice feature. I was wandering if this could be done (and improved) also without vmtk:
- display an object in pyFormex
- get the pixels from the screen (e.g. save as image.png and read back the image.png in pyFormex). Assign prop 0 to pixels of background.
- getborderMesh() of the pixels without prop 0 (2D quad mesh) = line mesh of contour

1) The accuracy of the contour could be chosen by choosing the pixel resolution of the image.

2) An advantage of this method would be that if the object is colored by a field (e.g. a stress field from FEA) the contour line could inherit the colors of the pixels, generating a colored contour line. What do you guys think?

gianluca de santis <gianlucadesi>
Project Member
Sun 11 Jan 2015 04:41:54 PM UTC, original submission:  

I added in commit 0663338 I added a function in vtk_itk to get a mesh of lines of the contour of a displayed object in the GUI with an example to show the amazing quality of the results.

I want to have a button in the GUI for it. Can we add it?
I am not sure how to do it especially as it calls non required libraries of pyformex.

francesco <francio>
Project Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bverheg (Posted a comment)
  • -email is unavailable- added by gianlucadesi (Posted a comment)
  • -email is unavailable- added by francio (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-24 bverheg Open/ClosedOpen => Closed
    2015-01-20 bverheg StatusNone => Fixed
    2015-01-18 bverheg Severity3 - Normal => 1 - Wish
        Summaryadding button to get contour of a displayed object => Provide an easy way to add a button+function to the GUI

    Back to the top

    Powered by Savane 3.5