1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

AlibreScript Hints and Tips

Discussion in 'General Discussion' started by ajayre, Jul 19, 2018.

  1. ajayre

    ajayre Alibre Super User

    Previously with WizoScript it ran as an independent program, so access to parts and assemblies was always via opening them from a file or referencing them by name if already open.

    That still works but AlibreScript runs inside part and assembly workspaces so it is possible to get the current part or assembly:

    Code:
    ThisPart = CurrentPart()
    
    Code:
    ThisAssy = CurrentAssembly()
    
    allowing a script to act on the current workspace.

    Andy
     
  2. ajayre

    ajayre Alibre Super User

    When editing a script, with the cursor in the script window press Ctrl+R to run it. Saves having to move the pointer to the ribbon or menu.

    Andy
     
  3. ajayre

    ajayre Alibre Super User

    Scripts do not need to be saved. They exist inside the part or assembly and saving the part or assembly saves the currently opened scripts inside the part/assembly.

    For example:

    1. Create a new part
    2. Open AlibreScript
    3. Create a new script
    4. Save the part
    5. Send to another user
    6. They open the part, open AlibreScript and can run the script!
    Andy
     
  4. ajayre

    ajayre Alibre Super User

    The user interface has a lot of flexibility, including grouping, side-by-side editing, collapsing to the sides and popping out:

    AlibreScript-UI.gif

    Andy
     
    RCH_Projects likes this.
  5. simonb65

    simonb65 Alibre Super User

    Would be nice to be able to add 'shortcuts' for scripts to the ribbon bar so that loading and running of everyday scripts was a single click.

    Also, can't the script engine be automatically enabled (or an option to do this) when Alibre is opened? I would like to see it more integrated and not just acting like an Add-On with its own ribbon tab.
     
  6. RCH_Projects

    RCH_Projects Alibre Super User

    Looks great Andy!

    Could I suggest that you add links to your latest downloads in your "signature" section. That way it is always there. I just can't find it off hand.

    Thank you, great work!
     
  7. Lew_Merrick

    Lew_Merrick Alibre Super User

    Andy -- Is the "include" statement the same for the math and xlsx" type of library inclusion? Nothing leaps out and bites me to say this is so.
     
  8. ajayre

    ajayre Alibre Super User

    Thanks for the kind words. :)

    Sorry, I am not sure what you mean. Do you mean my signature on this forum? What latest downloads?

    Andy
     
  9. ajayre

    ajayre Alibre Super User

    Sorry, I don't know what you are referring to. Nothing has changed with regards to the Python language or syntax, so whatever was working for you before should work now.

    Andy
     
  10. Lew_Merrick

    Lew_Merrick Alibre Super User

    I used to start such (xlsx accessing programs) with "from openpyxl import load_workbook" to get them to work. Is it the same? Irrational minds want to know...
     
  11. RCH_Projects

    RCH_Projects Alibre Super User

    Andy[/QUOTE]
    :oops: I see. I need to install 2018.1!

    (But perhaps a forum signature linking to your website or scripts).
     
  12. simonb65

    simonb65 Alibre Super User

    ... try 2018.1.1 !!
     
  13. simonb65

    simonb65 Alibre Super User

  14. RCH_Projects

    RCH_Projects Alibre Super User

    simonb65 likes this.
  15. NateLiqGrav

    NateLiqGrav Alibre Super User

    ^ This I am not a fan of. It would mean that instead of updating/changing/fixing one script I would have to update it for every part that has that script. correct?
     
  16. simonb65

    simonb65 Alibre Super User

    +1. Why are the Scripts saved in the part/assembly as once the script has run, it has already created the geometry, features and/or modified the part/assembly ! Does seem very illogical, and as @NateLiqGrav points out, it makes fixes to scripts and propagating that fix a nightmare!
    @ajayre/@Max , can you clarify the reasoning behind that logic in terms of how that workfl
     
  17. ajayre

    ajayre Alibre Super User

    You can also save the script and close the tab. Then the only copy of the script is the one on disk. If you don't want the script saved in the part file then just close the script tab.

    If you save the script to your local script library the same version is automatically one click away in every part/assy session you open.

    Andy
     
    simonb65 likes this.
  18. MarcusWolschon

    MarcusWolschon Senior Member

    An example of an "export STL and start external program with it" -script would be great
    I imagine for 3D printing that's something many people want to script first.
     
  19. ajayre

    ajayre Alibre Super User

  20. Ydl

    Ydl Member

    Hi all.

    Is anyone aware of whether it is possible to dock a scripting window inside the design area?
     

Share This Page