Search found 124 matches

by marioalexis
Wed Feb 14, 2024 10:42 pm
Forum: Developers corner
Topic: Accessing FEM property value in another file
Replies: 4
Views: 498

Re: Accessing FEM property value in another file

The member attribute is an AnalysisMember object, which has a geos_beamsection attribute, but not a geos_beamsection_obj attribute.
See https://github.com/FreeCAD/FreeCAD/blob ... ls.py#L157
by marioalexis
Thu Aug 24, 2023 1:53 pm
Forum: Developers corner
Topic: Qt6 on MSVC requires /permissive- -- implies we need some fixes
Replies: 9
Views: 6316

Re: Qt6 on MSVC requires /permissive- -- implies we need some fixes

@chennes
PyArg_ParseTuple can't take a const char *,
Am I understanding your comment correctly?
This is currently used without problems.
by marioalexis
Sat Aug 05, 2023 2:40 am
Forum: Python scripting and macros
Topic: Is there a way to add a custom attribute to a 3D view object?
Replies: 4
Views: 646

Re: Is there a way to add a custom attribute to a 3D view object?

This type of monkey patching on FreeCAD and FreeCADGui modules or objects belonging to these modules as is currently done from the Draft workbench (for example FreeCAD.DraftWorkingPlane) is not a good practice. This type of variables or methods should be added in the Draft and DraftGui modules.
by marioalexis
Fri Jul 07, 2023 6:37 pm
Forum: Python scripting and macros
Topic: DocumentObjectGroupPython - onchange
Replies: 2
Views: 502

Re: DocumentObjectGroupPython - onchange

You need to add a proxy object to the Python feature App::DocumentObjectGroupPython which implement the onChanged method with the desired behavior when a property change: Plus=FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython","PLUS") class Proxy: def doit(self): p...
by marioalexis
Mon May 22, 2023 7:53 pm
Forum: Python scripting and macros
Topic: [Solved]command button is clickable under certain conditions
Replies: 2
Views: 667

Re: command button is clickable under certain conditions

You can use the Gui.CommandAction descriptor class.
Here is an example of how you can use it: https://github.com/FreeCAD/FreeCAD/pull/9171
by marioalexis
Tue Apr 18, 2023 2:45 pm
Forum: Python scripting and macros
Topic: second Parameter in getObject?
Replies: 2
Views: 470

Re: second Parameter in getObject?

There is no such thing as a second parameter in GetObject. GetObject only accepts a string with the name of the object or the ID number. The FullName attribute of SelectionObject is a string that represents a tuple with the code to get the object (in your case getObject("Part001")) and a l...
by marioalexis
Wed Apr 12, 2023 12:40 am
Forum: Python scripting and macros
Topic: How to attach 'random' Python data to a document or a 3D view?
Replies: 4
Views: 750

Re: How to attach 'random' Python data to a document or a 3D view?

If I don't misunderstand, you want to create a working plane in the active view for each document that is created. What you can do is use a DocumentObserver and add a slot that will be notified by a signal according to what happens in the system. Suppose you want to add an observer that is notified ...
by marioalexis
Tue Apr 11, 2023 1:47 pm
Forum: Python scripting and macros
Topic: How to attach 'random' Python data to a document or a 3D view?
Replies: 4
Views: 750

Re: How to attach 'random' Python data to a document or a 3D view?

I don't think adding attributes dynamically to App or Gui modules as is currently done in Draft is a good idea. You never know if you are overriding other attributes or functions. What happens if this strategy is generalized across others FreeCAD modules? Instead, the Draft working plane could be a ...
by marioalexis
Mon Apr 03, 2023 11:44 pm
Forum: Developers corner
Topic: Reference counter of deleted object is not zero!!!!!
Replies: 8
Views: 1077

Re: Reference counter of deleted object is not zero!!!!!

In StringIDPy.xml you have the attribute Reference='true'. Are you sure you want this? Base::Handled destructor is called but the reference count is not zero.
And the getPyObject function in StringID class is overridden. At first glance I do not see that it makes a reference increase.