couple of questions

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!
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

couple of questions

Post by yorik »

Hi J & W,
I have a couple of questions/ideas:

1. I was thinking that the workbenches and their icons could be color-coded, especially the icons that appear in the tree view... For example everything related to meshes is blue, everything related to parts is green, everything that is annotations is yellow, something like that. How do you like the idea?

2. Ctrl+Z and Ctrl+Y don't produce "undo" and "redo" here on my system (although clicking the icons works well), would that be a bug? I'm not sure, because in the draft module I made stuff with Ctrl+Z too, so I'm confused. Can someone else please check?

3. I am trying to make a compound with several shapes, but I cannot make it work, the resulting compound is always empty... Is there a correct way to do that? I'm just doing like this: Part.makeCompound([shape1,shape2])

4. Copy/Cut/Paste is disabled, and I remember we had a talk once over the different things that can be done with copy/paste, like instanciating, or just copying, etc. Any new thought about that?
What would you think of setting up a basic system, just creating a new object and populating it with the contents of the copied object? That is, two completely independent objects. It would already be quite useful for example for copying objects from one document to another.
Of course you would have the problem of copying an object then pasting it in the same document, which would make both objects on exact same location, but I think that problems exists anywhere...

Cheers
Yorik
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: couple of questions

Post by jriegel »

Hi Yorik
yorikvanhavre wrote: 1. I was thinking that the workbenches and their icons could be color-coded, especially the icons that appear in the tree view... For example everything related to meshes is blue, everything related to parts is green, everything that is annotations is yellow, something like that. How do you like the idea?
Thats a good Idea, I would like to have FreeCAD a more consistend look!
yorikvanhavre wrote: 2. Ctrl+Z and Ctrl+Y don't produce "undo" and "redo" here on my system (although clicking the icons works well), would that be a bug? I'm not sure, because in the draft module I made stuff with Ctrl+Z too, so I'm confused. Can someone else please check?
You can switch the Undo/Redo on and off in the preferences.
Another thing is if you mean your Workbench. If you do python the Undo/Redo is not automatic, you have to mark Transaction to give the
system a conrner stone where its do its Undo. A good example how that works is the document tests:
http://free-cad.svn.sourceforge.net/vie ... iew=markup
starting from line 233
Or do you mean somethinge else?
yorikvanhavre wrote: 3. I am trying to make a compound with several shapes, but I cannot make it work, the resulting compound is always empty... Is there a correct way to do that? I'm just doing like this: Part.makeCompound([shape1,shape2])
Mhhhh... We have to check that.
yorikvanhavre wrote: 4. Copy/Cut/Paste is disabled, and I remember we had a talk once over the different things that can be done with copy/paste, like instanciating, or just copying, etc. Any new thought about that?
What would you think of setting up a basic system, just creating a new object and populating it with the contents of the copied object? That is, two completely independent objects. It would already be quite useful for example for copying objects from one document to another.
Of course you would have the problem of copying an object then pasting it in the same document, which would make both objects on exact same location, but I think that problems exists anywhere...
I thought a lot about that in the past. I discussed it also with Werner. I think a good design would be to let the ViewProvider of the Objects handle
requests for Cut/Copy/Paste and also Drag/Drop envents. So every Object can decide how to handle such a request. That means also the feedback
to the user if its possibel to drop/paste the object into another. The base classes of the main data types (Meshes/Parts) can implement the general cases and the children (like a Box feature) can do more specific stuff or disable droping/pasting at all. So I think that would be pretty flexible and would
allow the Workbench designers a lot cool features to do intuitive UIs.

But as always, its all layed out in my mind. But have no time so far to code it.... :-(

Cheers Jürgen
Stop whining - start coding!
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: couple of questions

Post by yorik »

Hi Jürgen,
About icons & colors, I had a couple of ideas too, I'll try to draw them, then I show you.

About Undo/Redo, I didn't express myself well, what I meant was just that the keyboard shortcuts (CtrlZ/CtrlY) don't work. The undo/redo system itself works fine. Talking about this, I have other strange things with keyboard shortucts. For example, try to assign the "D" key to any of the Draft commands? D is not assigned to anything, so freecad will let you assign it to something, but pressing D after that won't produce the command... It's just with some specific letters, while other work fine... I can test a bit better and make a good bug report, but I wanted to be sure it happens with other people too...

About Copy/Paste, that seems excellent! It makes sense, because only when the GUI is up you need the copy/cut/paste behaviour. In app-only mode, you easily copy the way you want with python.
Another idea could be let the workbench handle that... I find that really cool when decisions are delegated to workbenches, because there is something fantastic in that, for example on the same object, let's say a part shape, you can work in different ways, depending on which workbench is active. I have some ideas too for an edit mode too, I must write that down one of these days.

Anyway, I think things will be getting very interesting with that (dragging/dropping objects, things like that). Usual CAD apps are sometimes very clumsy when dealing with that, like if they don't like to use such "desktop" behaviours for so serious work...

Yorik
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: couple of questions

Post by jriegel »

Could be a focus problem. Normaly the widget with the focus get the first change to handle the key press. If not it goes to the app and the gui command is called. May be a widget is active which handles the D key? The tree? The standard behaviour is different on different platforms (e.g. Linux and Win32).

With the Workbench is a good Idea! We could give the first change to handle a drop/paste the Workbench. If it decide not to, the ViewProvider get the ball!

Jürgen
Stop whining - start coding!
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: couple of questions

Post by yorik »

jriegel wrote:Could be a focus problem. Normaly the widget with the focus get the first change to handle the key press. If not it goes to the app and the gui command is called. May be a widget is active which handles the D key? The tree? The standard behaviour is different on different platforms (e.g. Linux and Win32).
On your system keyboard shortcuts for undo & redo work? I just tested on a windows install and they don't work either. Is it only with me?

Another question I have: How does the macro system record actions? Does it only record python stuff done with runCommand? I'm writing a page on the wiki about macros, so I'm playing a bit with it... It's pretty cool! I wonder why I never touched that before :)

About Copy/Paste, yes, could be very nice... Copying to the clipboard should be handled by the system, I guess, right? Otherwise you copy an object in a workbench, paste it in anoter, and the second workbench doesn't know what clipboard to use. But when pasting, some Paste() method in the workbench could be called, and a list of objects in the clipboard is passed. Then the workbench decides what to do, creating another same object, at the same location or not (like inkscape), etc, etc... This would be simple to do and work well I think. The clipboard would only contain strings describing paths to document objects.
The problem would be when cutting... freecad should remove the object from the document, so how could it pass a reference to objects that are not present in the document anymore? Might be hard to solve...
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: couple of questions

Post by wmayer »

Hi,
On your system keyboard shortcuts for undo & redo work? I just tested on a windows install and they don't work either. Is it only with me?
For me it doesn't work either. I'll have a look on it ASAP.
Another question I have: How does the macro system record actions? Does it only record python stuff done with runCommand? I'm writing a page on the wiki about macros, so I'm playing a bit with it... It's pretty cool! I wonder why I never touched that before
It's actually quite simple. (Almost) all commands execute Python code which is written to the current macro file before in case there is one. All this is done with runCommand. With this approach we automatically test whether the Python code is working as expected. However, we have two drawbacks with this solution:
* The Python code is represented as a string literal. If there are errors inside you don't get compiler errors, of course. You must check what is happening at runtime to verify it.
* At the end the Python code invokes a Python extension (written in C/C++). If we change the interface there we also must probably adjust the Python code. We again don't get compiler errors in case the Python becomes invalid.
The goal should be to keep the interfaces as stable as possible because it will also make existing macros unusable.

BTW, macros can be added to FreeCAD as normal commands. You can define menu text, tool tip, icon and the macro. This command then can be used in custom toolbars.
About Copy/Paste, yes, could be very nice... Copying to the clipboard should be handled by the system, I guess, right? Otherwise you copy an object in a workbench, paste it in anoter, and the second workbench doesn't know what clipboard to use. But when pasting, some Paste() method in the workbench could be called, and a list of objects in the clipboard is passed. Then the workbench decides what to do, creating another same object, at the same location or not (like inkscape), etc, etc... This would be simple to do and work well I think. The clipboard would only contain strings describing paths to document objects.
I would implement a derived class from QMimeSource instead. Having described it as normal string you could never be sure when pasting whether you want it as string or document object.
The problem would be when cutting... freecad should remove the object from the document, so how could it pass a reference to objects that are not present in the document anymore? Might be hard to solve...
We already have this problem when deleting a single object from the document. Currently, we simply go through all other objects of the same document and check if the deleted object is referenced. If yes, we simply nullify the reference. Of course, this step is also undo/redo-able.

Cheers
Werner
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: couple of questions

Post by wmayer »

The undo/redo bug is fixed!
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: couple of questions

Post by jriegel »

The Ctrl+Z works neither for me. So its a bug!

The macro recording works at the moment only for C++ GuiCommands. But I think it would be possible to use
the code in a python command to record.. Would mean some extra lines of programming. It was not high on
the list, because We inteded the macro recording for people which use FreeCAD and for them a macro recording
is a good tool to get here feet wet in python and FreeCAD programming.
People who write own GuiCommands in python like you dont need the recording anymore. They do direct programming..

Jürgen
Stop whining - start coding!
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: couple of questions

Post by wmayer »

The macro recording works at the moment only for C++ GuiCommands. But I think it would be possible to use
That's not completely correct. In the file Commands.py in the module TemplatePyMod we have an implementation of a function "addCommand" which is able to extract the source code of a Python command and pass the code to the macro recording utility to store it in the file. But this is used only for a few commands in the TemplatePyMod and this solution only works if the Python command is stored in a .py file.
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: couple of questions

Post by jriegel »

You see,
you think of something and Werner has already implemented it!

A hurray for Werner!
Stop whining - start coding!
Post Reply