Talk:Python scripting tutorial

From FreeCAD Documentation
Revision as of 15:59, 28 May 2023 by Dan kirshner (talk | contribs) (Created page with "Roy 043: thanks for the corrections and formatting! The one thing I would request is that one does need to either have a document already open, or do doc = App.newDocument (). Otherwise it can be quite mysterious to click the Execute button and have nothing happen. The code I would suggest to cover both cases is: doc = App.ActiveDocument if not doc: doc = App.newDocument ()")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Roy 043: thanks for the corrections and formatting!

The one thing I would request is that one does need to either have a document already open, or do doc = App.newDocument (). Otherwise it can be quite mysterious to click the Execute button and have nothing happen.

The code I would suggest to cover both cases is:

doc = App.ActiveDocument
if not doc:
    doc = App.newDocument ()