Search found 160 matches

by Markymark
Tue May 26, 2020 6:22 am
Forum: Python scripting and macros
Topic: addCommand: How to address variables of instance?
Replies: 10
Views: 273

Re: addCommand: How to address variables of instance?

you can do it this way link_to_command = MyCommand() FreeCADGui.addCommand('My_Command', link_to_command) This is the cleaner and more direct way. OK, thanks. But it is good to see it can be done with the __main__-module, as well. Doesn't seem to be very prevalent knowledge. The common way to solve...
by Markymark
Mon May 25, 2020 5:22 pm
Forum: Python scripting and macros
Topic: addCommand: How to address variables of instance?
Replies: 10
Views: 273

Re: addCommand: How to address variables of instance?

This is a very simple example how you can do it:
The module __main__ keeps a dict of the global variables.
Great, got it and learned something. This is quite hackish I think, but it was only intended for a quick fix anyway.

Thanks. Mark
by Markymark
Mon May 25, 2020 1:57 pm
Forum: Python scripting and macros
Topic: small GUI creation with pySide
Replies: 4
Views: 187

Re: small GUI creation with pySide

Which tutorial did you try? What is the problem?

https://wiki.freecadweb.org/Manual:Crea ... face_tools

If you follow the above link you will find a working solution. Tried just a few days ago.

Rgrds, m.
by Markymark
Mon May 25, 2020 12:43 pm
Forum: Python scripting and macros
Topic: addCommand: How to address variables of instance?
Replies: 10
Views: 273

Re: addCommand: How to address variables of instance?

That variable only exists when you actually run that command. I really have to wrap my head arround scopes once again and refresh this topic ... I was mislead by myself. Or do you mean you want to have a persistent "global" variable for all instances? I might be completly wrong, but shouldn't there...
by Markymark
Mon May 25, 2020 8:38 am
Forum: Python scripting and macros
Topic: addCommand: How to address variables of instance?
Replies: 10
Views: 273

addCommand: How to address variables of instance?

Define a command: class MyCommand: def __init__(self): self.flag_something = True Register command: FreeCADGui.addCommand('My_Command', MyCommand()) As far as I understand, there should now be an instance available. How can I address "flag_something"? Tried different approaches but to no avail. Than...
by Markymark
Wed May 20, 2020 4:20 pm
Forum: Python scripting and macros
Topic: User/Workbench View Panel.
Replies: 1
Views: 93

Re: User/Workbench View Panel.

As far as I can say this is up to date and a working (the recommended) solution:

https://wiki.freecadweb.org/Manual:Crea ... face_tools

Rgrds, m.
by Markymark
Wed May 20, 2020 7:24 am
Forum: Python scripting and macros
Topic: Properties: Expressions vs. direct values at once
Replies: 3
Views: 90

Re: Properties: Expressions vs. direct values at once

Did you try to just recompute the model? Yes, and it didn't change anything, BUT: doing a second explicit recompute (context menu + Recompute object) did the trick. The manual value is gone now! I hope this is not intended. Otherwise it would have been allowed to create such setting with the GUI. H...
by Markymark
Wed May 20, 2020 6:47 am
Forum: Python scripting and macros
Topic: Properties: Expressions vs. direct values at once
Replies: 3
Views: 90

Properties: Expressions vs. direct values at once

Could not find anything regarding this so far. Simple Cube. canvas.png Only the placement in x-direction is modified. Via expression the value is set to "=20". Manual editing this value/property is prevented afterwards. But you can still set the property via console. Both properties (value & express...
by Markymark
Wed May 20, 2020 6:28 am
Forum: Python scripting and macros
Topic: How to check instance of <Part object>?
Replies: 4
Views: 133

Re: How to check instance of <Part object>?

Code: Select all

The isDerivedFrom method can be used in subclasses
OK, thanks for sorting this out.

VG m.
by Markymark
Tue May 19, 2020 5:19 pm
Forum: Forum in Deutsch
Topic: Ubuntu 20.04 - beste Strategie
Replies: 4
Views: 177

Re: Ubuntu 20.04 - beste Strategie

OT: optimiert für Bild- und Videobearbeitung sowie CAD Wie sieht denn sowas konkret am Beispiel aus? Ich bin mit meinem am Anschlag. Mein Rechner ist 10 Jahre alt mit einer Workstation-Grafikkarte. Spätestens bei Blender ist Schluss. Mir graut es davor, mich mit dem Thema auseinander zu setzen ... d...