What's new

Run Script From Batch

AwkwardAndNerdy

New Member
Hello,

I am trying to figure out if there is a way to execute an script in Alibre from batch. What I would like to do is be able to launch Alibre with a particular part (or assembly), then run a script that will update the global parameters and export a neutral CAD file.

I have figured out that I am able to open a part using the following command:

"<install_location>\Program\Alibre Design.exe" "path\to\part.ad_prt"

but I cannot seem to figure out if there are any other command line options that allow me to run a script on this part. Further, I cannot seem to figure out what the "help" argument is for determine what (if any) the available command line options are.

Does anyone have any suggestions for command line options for me to try? I am also open to other options if an alternative approach achieves the same automated solution.

Thanks in advance for any suggestions!
 

simonb65

Alibre Super User
Does anyone have any suggestions for command line options for me to try? I am also open to other options if an alternative approach achieves the same automated solution.
Alibre doesn't have a way to invoke it directly via the command line other than to open associated files.

Easiest way is to create an external application in either Python or C# that opens up an instance of Alibre, does the same actions as your script then exports the result, all using the Alibre API. Take a look at the Add-On's section of the Forum and check out the API section in the online help.

Alibre Script is just an internal scripting that utilises the API from within! You can do all of that outside Alibre with the API.
 

NateLiquidGravity

Alibre Super User
Actually Alibre Script is much more user friendly to program than using the API directly. It wraps many things in objects with more simple methods and properties. Alibre Script doesn't have all the abilities of the API wrapped though.
 

simonb65

Alibre Super User
Actually Alibre Script is much more user friendly to program than using the API directly.
The OP want's to run a batch, so that can possibly be achieved by a single AlibreScript (opening, processing and exporting) if the user wants to stay completely in the comfort zone of Alibre Scripting. It does currently have the API limitations you mention though, and I'm not sure if you can open parts/assemblies from within Alibre Script as the script is already associated with a part or just work on the current session(??)... unless you run the script in a new empty workspace?? (I've never tried, so couldn't comment further).

I personally find doing things from outside Alibre gives me the full scope and flexibility to do any pre/create/modify/post processing in a batch like manor.
 

DavidJ

Administrator
Staff member
You can open another Alibre file from a script in a particular file. I've used this approach when using a script to modify or export existing files. An Alibre file is required to contain the script, but it doesn't have to contain any geometry.
 

simonb65

Alibre Super User
You can open another Alibre file from a script in a particular file. I've used this approach when using a script to modify or export existing files. An Alibre file is required to contain the script, but it doesn't have to contain any geometry.
It's a pity scripts can just be standalone or available from the Home Window. i.e. No context or attachment to a part or assembly at all. That would be the logical place to do batch type operations on multiple parts/assemblies and still be running within the Alibre application with the same familiar interface that users are used to! Maybe another enhancement?
 

NateLiquidGravity

Alibre Super User
It's a pity scripts can just be standalone or available from the Home Window. i.e. No context or attachment to a part or assembly at all. That would be the logical place to do batch type operations on multiple parts/assemblies and still be running within the Alibre application with the same familiar interface that users are used to! Maybe another enhancement?
That's similar to how the original WizoScript add-on was. The editor was a separate window but you didn't have easy access to the current part or assembly as you do now.
 

AwkwardAndNerdy

New Member
Hello all,

I really appreciate the discussion! Thank you!

Easiest way is to create an external application in either Python or C# that opens up an instance of Alibre, does the same actions as your script then exports the result, all using the Alibre API. Take a look at the Add-On's section of the Forum and check out the API section in the online help.

Can you speak a bit more to this? It seems like this would be a good solution for me, but I'm a bit confused on the high-level mechanics of the API usage in this case. From what I've read from the API Help, it seems like all three types of APIs need to be invoked from within an already running instance of Alibre. I can understand how to launch Alibre from a Python/C# script, and I can understand how to use an API to perform the necessary actions within the Alibre, but I don't see how I can communicate with the API from outside of Alibre (i.e. batch, or external python script, etc.).

Any clarity you can bring to this would be greatly appreciated.

Thanks again!
 
Top