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

Script Language for Selecting and Editing Configurations

Discussion in 'Alibre Script' started by Brandon_Velmex, Nov 13, 2020.

  1. I am trying to write a script which will build a proper assembly out of existing configurations once the menus are all complete. However, all the existing tutorials are based around building a new configuration, or a new assembly. My question is: what are the specific Python script commands for choosing and activating a configuration from existing configurations already present in the assembly?

    Failing that, can I choose to create a new assembly and populate it with a pre-made assembly?

    I am trying to build a script which will allow my salesforce to build their own 3D models to export to customers, for some background.

  2. DavidJ

    DavidJ Alibre Super User Staff Member

    You probably want
    Configuration GetConfiguration ( string Name )


    Activate ( )
  3. I am avoiding an error message by using: "Assem.GetConfiguration('Manual')" but nothing happens when I believe the script should be switching the assembly configuration to "Manual".
    Last edited: Nov 13, 2020
  4. DavidJ

    DavidJ Alibre Super User Staff Member

    I'm not an expert, but check

    1. are you instantiating a configuration object from the assembly(or part)? - something like
    myAssem = CurrentAssembly()
    myConfig = myAssem.GetConfiguration("Manual")

    2. make sure that the name given exactly matches the name of the configuration, make sure the commands have capitals where needed.

    There are others here who understand this much better than I do.
  5. Thanks David that worked like a charm!
    the ".Activate()" line is what did it.

    Is there some database which contains Alibre specific commands?
  6. DavidJ

    DavidJ Alibre Super User Staff Member

    I found all that in the Alibre Script Reference - it's accessible from Script -> Help. The Reference supplements the Quick Start , it's not exactly user friendly but using the 2 together I've been able to slowly work improve my knowledge and abilities.
    Brandon_Velmex likes this.
  7. Lew_Merrick

    Lew_Merrick Alibre Super User

    Things such as this are why we need a well indexed User's Manual. -- Lew
  8. Thanks David, I'll check it out!

    I agree Lew.
  9. Lew_Merrick

    Lew_Merrick Alibre Super User

    No, Script Help is a waste of time and effort! -- Lew
  10. NateLiqGrav

    NateLiqGrav Alibre Super User

    I found it lacking some details but not a waste.

    Lew - Start a new thread asking for help.
  11. Lew_Merrick

    Lew_Merrick Alibre Super User

    Hi Nate -- I have been using Wizo Script for several years now. I have a number of "How To" and "Lessons Learned" documents that I have shared with Andy Ayre. I admit that, as somebody who began "programming" in Algol, Python regularly sends me screaming. That aside (and the fact that I stared "programming" with the RS-02 operating system) I do perfom a number of "tasks" using Wizo/Alibre Script -- though there is much more I would like to be able to do. [We need a command that fits components to a "full screen" view from within a Script. Etc.] Hopefully the attached (2015) document will help somebody. -- Lew

    Attached Files:

  12. NateLiqGrav

    NateLiqGrav Alibre Super User

    FYI Comments can be added just after Parameter creation.
    Units.Current = UnitTypes.Inches
    Prt = CurrentPart()
    ParamBob = Prt.AddParameter('Bob', ParameterTypes.Distance, ParameterUnits.Inches, 10.25)
    ParamBob.Comment = 'Test Comment'
  13. Lew_Merrick

    Lew_Merrick Alibre Super User

    Hi Nate -- Could you "flesh out" more of the "why & whatfor" on this? I was a decent FORTH coder back in the 1970's and learned BCPL and C somewhat later. You use it or you lose it (and I have "lost it"). I tend to be "comment heavy" in what passes as my coding or I would not understand it a week later. Should you like to "revise" my document, let me know (tangent@olympus.net) as improvements are always in order! -- Lew
  14. NateLiqGrav

    NateLiqGrav Alibre Super User

    It is response to your pdf saying you couldn't add comments to parameters. It's 5 lines and the first 3 of them are setup just to have a parameter to add a comment to (which is the 4th line) and the last one is to print to console to confirm what happened. I think it's pretty self explanatory when you look at the method names.
  15. Lew_Merrick

    Lew_Merrick Alibre Super User

    Hi Nate -- At the time I wrote that (2015) that was the extent of information I had from Andy Ayre. More information is good! I would like to see a well written and well indexed "User's Guide" for "Alibre Script." I believe I sent Andy all such information I have written and, should it be helpful, I will post it here (in Resources) -- with Andy's permission. -- Lew

Share This Page