Talk:Python scripting tutorial

From FreeCAD Documentation

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)

Hi Dan,
We almost never use these Talk pages. Whatever you write here will most likely not be noticed by other editors. it is better to use User_talk pages when you want to get in touch with another editor. The editor is then notified. Or write a PM in the forum.
What you are suggesting in terms of Python code does not make sense to me. You assume that a Python script will always interact with a document, but that need not be the case at all.
Example:
import Part

box = Part.makeBox(10, 10, 10)
print(box.Volume)
BTW: If you have not done so already, please have a look at WikiPages.
--Roy 043 (talk) 22:51, 28 May 2023 (UTC)