What's new

Using a code editor of choice and IronPython

Hunter

Senior Member
Hi, does anyone know how to use a standalone version of IronPython 2.7.7 to create Alibre scripts?

I'd like to use my own code editor (VS Code) to write and test scripts, so that I have access to code completion, syntax highlighting, etc. For example, how can I run the following Alibre Script in VS Code?

Python:
Win = Windows()

Win.InfoDialog('I am about to create a part', 'My Script')

Win.ErrorDialog("Oops. That didn't go as planned", 'My Script')

# returns True for 'yes' and False for 'no'
print Win.QuestionDialog('Shall I stop?', 'My Script')

Which Alibre DLLs do I need to import to get the same functionality as in Alibre Script editor? Is it possible?
 
Last edited:
Hi, does anyone know how to use a standalone version of IronPython 2.7.7 to create Alibre scripts?
Hi Hunter -- I use Notepad++ for (virtually) all my Alibre Script (among others) "code writing/editing" without a problem. I merely SaveAs the file as Blah.py. -- Lew
 

Hunter

Senior Member
I see that the built-in editor does have some code completion/hinting, but how to invoke this? I can get below to work by typing the dot, then the E, then a space, then the backspace key and then the drop-down list pops up. What am I missing here?
upload_2020-4-11_18-47-21.png
 

simonb65

Alibre Super User
I can get below to work by typing the dot, then the E, then a space, then the backspace key and then the drop-down list pops up. What am I missing here?
Nothing! ... I get the same. I don't really use the scripting, but from a Visual Studio background, I would have expected the hint dropdown after pressing the dot! Maybe @ajayre might be able to shed some light on it.
 

Hunter

Senior Member
The IntelliSense (code completion) functionality I'm after seems to be a bug in IronPython (although below is for 2.7.9 and Alibre uses 2.7.7)?
https://github.com/microsoft/PTVS/issues/5205

Does anybody have an answer for me on my first question in my first post?
[Edit] I can load AlibreX.dll, but not sure that it is the same library that Alibre Script exposes?
 

idslk

Alibre Super User
Hello Hunter,

question in bold? Neccessary?
Before you use bold uppercase, have you tried to take a look in the AlibreScriptAddOn.dll...
BTW for me the included Editor does the job well enough... ;-)

Regards
Stefan
 

Hunter

Senior Member
I'll try that, thanks.

As to your comment about the bold. I assume you're implying that I'm screaming? I'm not. There is a simple explanation: I grew up understanding that bold typeface is meant to imply emphasis, to draw attention. Your reference framework is obviously different to mine. Be that as it may, I apologise if it offended you.
 

simonb65

Alibre Super User
As to your comment about the bold. I assume you're implying that I'm screaming? I'm not. There is a simple explanation: I grew up understanding that bold typeface is meant to imply emphasis, to draw attention.
I'm with you on the bold emphasis. IF IT WAS ALL UPPER CASE ... I'D BE SHOUTING! :)
 

Stuart

Senior Member
I see that the built-in editor does have some code completion/hinting, but how to invoke this? I can get below to work by typing the dot, then the E, then a space, then the backspace key and then the drop-down list pops up. What am I missing here?

Hunter, did you ever figure out how to get code completion in an external IDE?

The built in editor is horribly frustrating for anyone that's used a real code editor. It doesn't even show the parameter descriptions that are in AlibreScriptAPI.xml.
 

Hunter

Senior Member
I see that the built-in editor does have some code completion/hinting, but how to invoke this? I can get below to work by typing the dot, then the E, then a space, then the backspace key and then the drop-down list pops up. What am I missing here?


Hunter, did you ever figure out how to get code completion in an external IDE?

The built in editor is horribly frustrating for anyone that's used a real code editor. It doesn't even show the parameter descriptions that are in AlibreScriptAPI.xml.
Hi Stuart,

No, I gave up on scripts soon after this. I wrote two scripts but found the coding experience too frustrating. Spoilt by other editors...

Regards
William
 

bolsover

Senior Member
I'm really a programmer raather than a designer.Berfore retirement, I spent 20 years as a freelance programmer for various clients -- mostly engineering/electronics manufacturing companies. much of my work involved various levels of complexity around job shop scheduling but I also wrote systems for VAT reporting (In Slovak!!) among many other data intensive applications.
Like others, I have battled with the Alibre scripting interface. I've had some success using Jetbrains PyCharm IDE - but have never been able to execute script directly from the IDE. The main issue is (I think) that the Alibre python API is compiled to a .dll and there is no way to link to that from the IDE.
 
Top