Lisp to reload profile

Discussion in 'AutoCAD' started by DB, Sep 28, 2004.

  1. DB

    DB Guest

    Hi all, I am after code to reload a profile.
    We have a default profile which is loaded using /p in the icon
    target.

    How ever when this file is amended the profile needs to be manually
    reloaded which involves setting the unnamed profile as current then deleting
    and then importing the corporate profile again.

    Is the profile held as a set var ?
    Does any one haev code to reload a profile ?

    Regards
    DB
     
    DB, Sep 28, 2004
    #1
  2. DB

    BillZ Guest

    This is how I do it:

    (vla-importprofile (vla-get-profiles (vla-get-preferences (vlax-get-acad-object)))
    yourprofilename (strcat "G:\\Autolisp\\AutoCAD_2005_Support\\Profiles\\" yourprofilename ".arg") 1)
    (vla-put-activeprofile (vla-get-profiles (vla-get-preferences (vlax-get-acad-object))) yourprofilename)


    Bill
     
    BillZ, Sep 28, 2004
    #2
  3. DB

    DB Guest

    Bill I have amended the file as below - What do i do with it now to get it
    running in CAD ??
    I want this loaded for all users too ?.


    (vla-importprofile (vla-get-profiles (vla-get-preferences
    (vlax-get-acad-object)))
    Acad_2004_General (strcat
    "F:\\AutoCAD\\AutoCAD_2004\\Install\\Profiles\\Acad_2004_General.arg") 1)
    (vla-put-activeprofile (vla-get-profiles (vla-get-preferences
    (vlax-get-acad-object))) Acad_2004_General)


    "G:\\Autolisp\\AutoCAD_2005_Support\\Profiles\\" yourprofilename ".arg") 1)
    (vlax-get-acad-object))) yourprofilename)
     
    DB, Sep 28, 2004
    #3
  4. DB

    DB Guest

    I have now saved the file as a Lisp and loaded but get the following error

    APPLOAD profile.lsp successfully loaded.
    Command: ; error: ActiveX Server returned an error: Parameter not optional
    Command:
     
    DB, Sep 28, 2004
    #4
  5. DB

    BillZ Guest

    What do i do with it now to get it
    running in CAD ??<<<

    Not sure exactly what you are trying to do.
    You say you're loading the profile at startup through the shortcut. Then why do you need to re-load the profile again?

    IMO: Each user should have their own profile that gets saved somewhere on the network.

    Are you saying that each user starts with a generic profile and then sometime during the drawing session you import the profile again for some reason?

    Bill
     
    BillZ, Sep 29, 2004
    #5
  6. DB

    DB Guest

    Yes Bill,

    Every user loads a corporate profile from the network. The problem is
    when I up date it it does not reload automatically as it is only loaded the
    first time.

    So I need to set the unnamed profile current.
    Delete the old corporate profile
    Then reimport the corporate profile
    and then set the corporate profile current.

    Each user does not have their own profile. They all use the
    corporate one.

    Cheers
    DB


    why do you need to re-load the profile again?
    sometime during the drawing session you import the profile again for some
    reason?
     
    DB, Sep 29, 2004
    #6
  7. DB

    BillZ Guest

    I am not a setup expert so maybe someone else can jump in here with good advice.

    The code I gave you will import and set current whatever profile you wish without setting the current one to unnamed.

    With that said:
    I would think that if you put this code in each installation of AutoCAD's acad.lsp file, then your updated company profile would be imported and set current each time a user started an AutoCAD session.
    Importing and setting a profile curerent During an AutoCAD session could be done by loading and running the lisp at each machine.

    (defun Update_Profle ()
    (vla-importprofile (vla-get-profiles (vla-get-preferences (vlax-get-acad-object))) "YourProfileName" (strcat "G:\\Autolisp\\AutoCAD_2005_Support\\Profiles\\" "YourProfileName" ".arg") 1)
    (vla-put-activeprofile (vla-get-profiles (vla-get-preferences (vlax-get-acad-object))) "YourProfileName")
    ) ;;end defun

    Bill
     
    BillZ, Sep 30, 2004
    #7
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.