Talk:Python scripting tutorial

From FreeCAD Documentation
Revision as of 16:08, 28 May 2023 by Dan kirshner (talk | contribs)

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 ()

--Dan kirshner (talk) 16:08, 28 May 2023 (UTC)