You are here

Pass command line arguments to application?

4 posts / 0 new
Last post
exec
Offline
Last seen: 6 years 8 months ago
Joined: 2017-06-10 06:24
Pass command line arguments to application?

Salut!

I cannot figure out how to pass command line arguments to Blender.exe
Is it possible?

Finally, I've figured out how to open FBX* file in Blender*
(Blender is 3d graphics editor. FBX is non-native format, that must be imported, instead of opening).

The command line is:

blender.exe -P im_fbx.py -- MyModel.fbx

(while im_fbx.py reads:
import sys
import bpy
argv = sys.argv
argv = argv[argv.index("--") + 1:] # get all args after "--"
bpy.ops.import_scene.fbx(filepath=argv[0])

)

So, my question is:

How can I pass all these parameters to BlenderPortable.exe?

BlenderPortable.exe -P im_fbx.py -- MyModel.fbx
just does not work. Blenders starts shiny empty scene.

Thank you!
P.S. Yes, I have read https://portableapps.com/node/19115

John T. Haller
John T. Haller's picture
Offline
Last seen: 3 hours 33 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Path

The command line is passed in unaltered on our end directly to blender.exe. Blender Portable doesn't add additional command line parameters itself to portablize as its handled with environment variables. It's possible that the path to your .py file isn't being found due to the additional directories and working directory settings. It may work if you use a full path.

Sometimes, the impossible can become possible, if you're awesome!

mwayne
Offline
Last seen: 1 hour 54 min ago
Developer
Joined: 2012-01-03 09:23
Command line

Copy the BlenderPortable.ini from Other\Source next to the BlenderPortable.exe and write your parameters into the "AdditionalParameters=" entry.

exec
Offline
Last seen: 6 years 8 months ago
Joined: 2017-06-10 06:24
1) John T. Haller. For some

1) John T. Haller. For some reason it worked now. Probably previous trials has paths specified not too accurately. Thank you!
2) mwayne. How this method supposes me to associate .fbx-files with BlenderPortable?

Log in or register to post comments