howto File>New in text editor script

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

HansHolland
Posts: 3
Joined: Sun Oct 21, 2012 4:46 pm
Location: Netherlands

howto File>New in text editor script

Postby HansHolland » Sun Oct 21, 2012 5:28 pm

Hi,
I'm new to Blender / Python. I use version 2.64 to view a 3Dmodel generated, for now, by other software (Wavefront .obj format), so I have to switch over and over between generator and viewer. To speed this, I have this script in the Blender text editor:

import bpy
bpy.ops.import_scene.obj( filepath = "c:\models\model1.obj" )
bpy.data.objects["model1"].scale = (25, 25, 25)


Before running the script however, I still have to manually remove the currently displayed model1 using File > New (CTRL N). How can I automate also this in the script? It's a basic question, but I'd like to have this running while starting to learn B/P at the same time!
Thanks :D

HansHolland
Posts: 3
Joined: Sun Oct 21, 2012 4:46 pm
Location: Netherlands

Re: howto File>New in text editor script

Postby HansHolland » Mon Oct 22, 2012 8:31 am

better description: scripting Blender GUI commands
Is there a useful add-on for this for my stuff?

CoDEmanX
Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Mon Oct 22, 2012 11:34 pm

bpy.ops.wm.read_homefile()
I'm sitting, waiting, wishing, building Blender in superstition...

HansHolland
Posts: 3
Joined: Sun Oct 21, 2012 4:46 pm
Location: Netherlands

Postby HansHolland » Wed Oct 24, 2012 12:32 am

thanks CoDEmanX!


Return to “Python”

Who is online

Users browsing this forum: No registered users and 2 guests