Search found 90 matches

by Bayesian
Tue Apr 14, 2020 2:07 pm
Forum: Python scripting and macros
Topic: Python console crashes when FreeCADGui.showMainWindow() is called
Replies: 4
Views: 1132

Re: Python console crashes when FreeCADGui.showMainWindow() is called

I would guess there is no error. I had the same problem when I worked on my Jupyter integration.

I think the problem is that showMainWindow doesn't start a QT EventLoop anymore. Earlier FC versions did, and so that code worked as is.
by Bayesian
Tue Apr 14, 2020 2:04 pm
Forum: Python scripting and macros
Topic: Importing STEP Files
Replies: 4
Views: 3662

Re: Importing STEP Files

Yes, I did exactly that and had the problems mentioned above.
by Bayesian
Mon Apr 13, 2020 3:56 am
Forum: Python scripting and macros
Topic: Importing STEP Files
Replies: 4
Views: 3662

Importing STEP Files

I'd like to import STEP files through the Python API. The only way I found so far is "Import.import". Side Note: "Import" is a legal name for a module, but maybe not the most appropriate... But that function always returns None. It creates a new document with one object. You can ...
by Bayesian
Sun Mar 29, 2020 3:48 pm
Forum: Python scripting and macros
Topic: Part.makeLoft from wires?
Replies: 5
Views: 938

Re: Part.makeLoft from wires?

For example this works well: templates = [] ell = Part.Ellipse(vector(0),5,4) template = ell.toNurbs().toShape().Edges[0].Edges[0] obj.Shape = template for i in np.linspace(0,10,int(10/0.2)): templates.append(template.copy()\ .translated(vector(0,0,i)).copy() .rotated(vector(0), vector(0,0,1), i / 4...
by Bayesian
Sun Mar 29, 2020 3:26 pm
Forum: Python scripting and macros
Topic: Part.makeLoft from wires?
Replies: 5
Views: 938

Re: Part.makeLoft from wires?

Yes, that helps I think, thank you!

I also think I need to be more careful what Objects to pass into the Loft. Not everything that looks like a wire is an edge.
by Bayesian
Sun Mar 29, 2020 2:14 pm
Forum: Python scripting and macros
Topic: Part.makeLoft from wires?
Replies: 5
Views: 938

Re: Part.makeLoft from wires?

No, I don't think my shapes intersect. The edges of each layer are touching to form a closed wire, but the layers don't touch each other.
by Bayesian
Sun Mar 29, 2020 1:35 pm
Forum: Python scripting and macros
Topic: Part.makeLoft from wires?
Replies: 5
Views: 938

Part.makeLoft from wires?

I'm using the latest development version installed through Conda on Ubuntu. I'd like to rotate and extrude a 2D Shape through Python. I have tried several Shapes as a combination of wires whose Edges are toching (Lines, Arcs etc). I have tried putting those Edges in a List,a Compound and a Wire. I m...
by Bayesian
Sat Mar 28, 2020 12:44 pm
Forum: Open discussion
Topic: Suggestion: Put integration of Jupyter and Asyncio into standard distribution
Replies: 18
Views: 2502

Re: Suggestion: Put integration of Jupyter and Asyncio into standard distribution

The following trick works (after %gui qt):

Code: Select all

import sys
del sys.meta_path[0]
by Bayesian
Sat Mar 28, 2020 12:35 pm
Forum: Open discussion
Topic: Suggestion: Put integration of Jupyter and Asyncio into standard distribution
Replies: 18
Views: 2502

Re: Suggestion: Put integration of Jupyter and Asyncio into standard distribution

Interstingly though, if I start a jupyter kernel in that environment, this code will open the main window: from PySide2.QtWidgets import (QLineEdit, QPushButton, QApplication, QVBoxLayout, QDialog) import freecad import FreeCADGui as gui %gui qt5 The next line must be in a new cell. gui.showMainWind...
by Bayesian
Sat Mar 28, 2020 12:20 pm
Forum: Open discussion
Topic: Suggestion: Put integration of Jupyter and Asyncio into standard distribution
Replies: 18
Views: 2502

Re: Suggestion: Put integration of Jupyter and Asyncio into standard distribution

I followed your instructions, and installed a conda environment on two different Ubuntu systems. showMainWindow from a python script (no jupyter involved) briefly shows a black window and crashes with no error message. No idea why. I'd like to promote Jupyter not just for core and addon developers, ...