I have tried some sections of a bigger script and results are not working yet but I understand it will progress soon. Best results I have got with GTP4o1 not tunned but very similar to the AlibreScript Code Assistant and Alibre Script API Expert. My two main conclusions after a couple of days trying are:
1. If some complex tasks it uses to repeat errors and I have found interesting to prompt advise to prevent these then iterations are much less. Example of these are:
Please take into account next general instructions when generating or reviewing code.
- Make the code like an expert in Alibre Design Scripting and Alibre Design API.
- Import all Alibre classes and functions.
- The script must be done and reviews in all versions with IronPython 2.7.10.0 which is the version used by Alibre Design Scripting section and API.
- Load all the needed general library and functions for Alibre Script with IronPython 2.7.10.0
- Integrate Win = Windows() into the script for consistency or potential future use.
- Do not use f-string Compatibility since is not compatible, use .format() or string concatenation to ensure compatibility with IronPython 2.7.10.0
- The use of a main() function is not standard, as scripts in Alibre are typically executed directly from the scripting console without requiring an explicit entry point. To adapt your script to this style, please remove the main() function and ensure the logic runs at the global scope without affecting functionality.
- The exit() function is not directly available in IronPython 2.7, which is used in the Alibre Design scripting environment. To properly handle script termination, use the return statement.
- The return statement outside of any function is not valid in IronPython scripts for Alibre Design. In the Alibre Design scripting environment, scripts are executed directly without requiring an explicit entry point (like a main() function). The return statement in this context is unnecessary and should be replaced with a different way.
- The windows object does not have an OpenPart method. Instead, the correct way to work with the current part in the Alibre scripting environment is by using CurrentPart() to get the currently active part in the session.
- The GlobalParameters object has to be utilized to open, modify, and save the parameter values properly about the GPF.
- Alibre Script, Parameters is a property, not a callable method.
- Add debugging prints for console feedback in each step of the scripts so that we can see in console what the script is doing and then we can understand the reading, outputs and other data are properly managed and generated.
- To display messages to the user, in Alibre scripts use console messages (print()) for debugging and not the Win.Prompt() method neither Win.MessageBox().
- Comment each line with the detail of what each line is doing and how work the related glasses, methods and functions involved in the line with main parameters and attribute used and available for these.
2. For doing some scripts I definitively need significant help from a human very familiar with Alibre Scripting or become familiar by in depth analyze of each class, method, functions and process involved in the particula Alibre Scripting.
EXAMPLE OF PROMPT USED + GENERAL SPECS ABOVEç
I am not sure it can be really done with actual API but I am trying just to follow and iteration to iteration fix the errors.
Please create a script to read parameters ranges and steps from the GPF, global parameters file. The number of parameters to read data, NUM_USED_PRM, is equal to the number of parameters in the GPF which are marked as favorite in it. There are 4 types of data to read associated to each parameter marked as favorite. The order of the parameters defined must be the order in the list of favorite parameters in the read GPF.
- First interesting data is the name of each global parameter used,
- Second used data to set for each parameter is the minimum value each parameter will take in next operations and is called MINV_PRM_ followed by the name of the parameter. We need to read this value from the GPF and it is defined in the GPF so that it is not favorite and is the name of the related parameter followed by _MIN.
- Third used data to set for each parameter is the minimum value each parameter will take in next operations and is called MAXV_PRM_ followed by the name of the parameter. We need to read this value from the GPF and it is defined in the GPF so that it is not favorite and is the name of the related parameter followed by _MAX.
- Fourth used data is set for each parameter is an integer, the number of different values that the parameter will have in next operations. It is called NUMV_PRM_ followed by the name of the parameter. We need to read this value from the GPF and it is defined in the GPF so that it is not favorite and is the name of the related parameter followed by _STEPS.
Print each read data in the console for proper execution tracking and debugging.