Search found 2764 matches

by keithsloan52
Tue Apr 09, 2019 1:19 pm
Forum: Python scripting and macros
Topic: Can a Part Object be a group.
Replies: 26
Views: 7396

Re: Can a Part Object be a group.

So given I have selected the GDMLPolycone, why does it try and act on one of the children that is not selected? Okay I revisited my code and the penny dropped. The function of the toggle is to toggle the display for the selected object and all the childred, so the attempt to toggle the GDMLzplane i...
by keithsloan52
Tue Apr 09, 2019 12:49 pm
Forum: Python scripting and macros
Topic: Can a Part Object be a group.
Replies: 26
Views: 7396

Re: Can a Part Object be a group.

Here's a test: Don't set the display mode. Just create the object and the ViewProvider. Then, in the GUI, click the object and select the 'View' tab in the properties panel below. From there try changing the display mode. Thanks for the suggestion and tried it. I am able to toggle the DisplayMode o...
by keithsloan52
Tue Apr 09, 2019 11:22 am
Forum: Python scripting and macros
Topic: Can a Part Object be a group.
Replies: 26
Views: 7396

Re: Can a Part Object be a group.

You are probably accessing DisplayMode before viewprovider proxy was added (I think, display modes are populated and attach method is called immediately after that). ViewProviderExtension(mypolycone.ViewObject) mypolycone.ViewObject.DisplayMode = "Shaded" Well I can only set mypolycone.Vi...
by keithsloan52
Tue Apr 09, 2019 10:25 am
Forum: Python scripting and macros
Topic: Can a Part Object be a group.
Replies: 26
Views: 7396

Re: Can a Part Object be a group.

Okay on testing I ran into a further challenge. Have a function that accesses ViewObject.DisplayMode When this functions tries to do this an object defined with an Extension I get an error Running the Python command 'ToggleCommand' failed: Traceback (most recent call last): File "/usr/lib/freec...
by keithsloan52
Mon Apr 08, 2019 9:20 pm
Forum: Python scripting and macros
Topic: Can a Part Object be a group.
Replies: 26
Views: 7396

Re: Can a Part Object be a group.

Thanks adding using a new ViewFinder with the extension fixed the problem
by keithsloan52
Mon Apr 08, 2019 6:08 am
Forum: Python scripting and macros
Topic: Can a Part Object be a group.
Replies: 26
Views: 7396

Re: Can a Part Object be a group.

Wonder if @ickby has any advice, as trying to find out more about extensions found he/she came up with the idea and proposed it see https://forum.freecadweb.org/viewtopic.php?t=16021 . Plus @wmayer is the goto on FreeCAD but very busy with all the things he does. Guess I could try looking at the sou...
by keithsloan52
Sun Apr 07, 2019 5:32 pm
Forum: Python scripting and macros
Topic: Can a Part Object be a group.
Replies: 26
Views: 7396

Re: Can a Part Object be a group.

Still, no idea why it won't add the group directly to another group. Still, calling "App.ActiveDocument.addObject()" first, then "my_group.addObject()" will also get it done, it's just an extra step. Tried FreeCAD.ActiveDocument.addObject() ( Did not want to import FreeCAD as Ap...
by keithsloan52
Sun Apr 07, 2019 5:12 pm
Forum: Python scripting and macros
Topic: Can a Part Object be a group.
Replies: 26
Views: 7396

Re: Can a Part Object be a group.

Changing to App::FeaturePython as was pointed out also got rid of the crash, Thanks for the spot. But still the zplane objects get created in the base document and not as children of the polycone. Not sure about Windows installation but it is a plain python Module so all you should have to do is cop...
by keithsloan52
Sun Apr 07, 2019 2:24 pm
Forum: Python scripting and macros
Topic: Can a Part Object be a group.
Replies: 26
Views: 7396

Re: Can a Part Object be a group.

Just to say the latest source attempt is at https://github.com/KeithSloan/FreeCAD_Python_GDML

In branch workbench-dev

@DeepSOIC @Joel_graff
by keithsloan52
Sun Apr 07, 2019 2:14 pm
Forum: Python scripting and macros
Topic: Can a Part Object be a group.
Replies: 26
Views: 7396

Re: Can a Part Object be a group.

Okay I can avoid the crash by replacing myzplane=mypolycone.newObject('App::DocumentObjectPython','zplane')ndnnding t with myzplane=mypolycone.newObject('App::DocumentObjectGroupPython','zplane') But the zplane objects get created in the base document rather than a child of mypolycone zplanes.png i....