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

Alibre Script throwing fatal error when doing "cls".

Discussion in 'Alibre Script' started by oldfox, Dec 8, 2019.

  1. oldfox

    oldfox Alibre Super User

    I usually batch hardware such as screws when I'm working on a new project. Consequently the console
    gets a little loaded up sometimes. I then do a "cls" which used to work just fine. Now It's throwing a fatal
    Windows error. It doesn't break anything but it sure is frustrating to have go open AD again.

    I'm running Win7 SP1 and the latest version of Alibre Design Expert.

    Does anyone have a fix for this?

    AlibreScript Error.jpg .
  2. Lew_Merrick

    Lew_Merrick Alibre Super User

    Oldfox -- What I do is to create a "Standard Hardwae Directory" within my "Project Directory" (as shown in the image below) such that: (A) all "Standard Hardware" is archived within my "Project ZIP Archive" and (B) "Standard Hardware" so associated is maintained in the form it was available when the Project was last updated -- Lew Project Directory Structure.PNG
  3. simonb65

    simonb65 Alibre Super User

    Lew, the question was about why 'CLS' was causing a crash ... not about the structuring method!
  4. idslk

    idslk Alibre Super User

    Hello Chris,

    are you creating screws with the script all the time you need one? Are they different? Do you create them as new parts into the Assembly?
    If you create the part newly every time in your process, it might be that the script sessions no correctly closed, but thats a question for Andy...

  5. Lew_Merrick

    Lew_Merrick Alibre Super User

    Ah, but maintaining "Libraries" makes selecting and applying "Standard Components" easy an fast.
  6. oldfox

    oldfox Alibre Super User

    Hi Stefan,

    As you can see, there is a bit of the console "cleared" at the top but not all the way down. Other times it clears to the command line but
    still throws the error. o_O

    Each project that involves items for which I have a script for, I place in a "Hardware" directory under the project directory. I might have
    misused the term "batch" I only do one screw at a time, of course, using the script. Makes no never mind to me if they are standard or
    not. I wind up with every screw, nut and washer needed in the project. It's just today that I have encountered this error. I am
    using Build 20072.

    What about "Non-standard" items?
  7. Lew_Merrick

    Lew_Merrick Alibre Super User

    Then, in my nomenclature, they are either made items of they are modified items.
  8. oldfox

    oldfox Alibre Super User

  9. NateLiqGrav

    NateLiqGrav Alibre Super User

    I've noticed that eventually (thousands of print() commands) the command prompt stops working and I need to close the console window and create a new one from the AlibreScript menu.

    I've also noticed when printing a ton of things that it is faster to accumulate them in a string with multiple lines and then print that string. For example:
    Win = Windows()
    # this is slow
    for i in range(0, 500):
    print('That was slow!\n')
    Win.InfoDialog("The program gets here but is still printing slowly. Wait for it to stop before closing this window.", "Printing")
    # this is fast
    outputstring = ''
    for i in range(0, 500):
        outputstring += '\n' + str(i)
    print('That was fast!\n')
  10. oldfox

    oldfox Alibre Super User

    @ Nate

    Thanks. I'm going to play with this code and see if it does anything to help any of my scripts. I'll post my results in this thread when
    I know something.

Share This Page