Jump to content

Profile file (.ARG) to load thru LISP program


The Courage Dog

Recommended Posts

HI...i'm working in different projects with different cad standards & library blocks. To make these things organized i have created project-specific PROFILE (.ARG file) that can be imported from "TOOLS" then "OPTIONS" then "PROFILES". The annoying part is that everytime i work to a particular project i have to import again the right PROFILE (.ARG) file in order to get the necessary settings (i.e. support file path, menus, CUI, paths for PC3, plotsstyles, templates...etc..)

 

My question is this...is there a short-cut way like a LISP routine that can be just load so that the needed PROFILE (.arg) file will automatically imported? instead of going to "tools" "options" "profiles" again and again.

 

your response is highly appreciated....

 

thanks

the courage dog

Link to comment
Share on other sites

Not sure if this would work?

 

{untested}

 

(defun c:PutProf ()
 (vl-load-com)
 (if (findfile "profile.arg")
   (vla-put-ActiveProfile
     (vla-get-Profiles
       (vla-get-Preferences
         (vla-get-ActiveDocument
           (vlax-get-acad-object)))) "profile")
   (princ "\n<< Profile.arg could not be found >>"))
 (princ))

 

(Change all instances of "profile" to the correct Name)

Link to comment
Share on other sites

Mr. Lee Mac,

i've tried your code but it doesn;t worked out. Anybody there who has the idea?

 

thanks for everybody who have replied me.

Link to comment
Share on other sites

Mr. Lee Mac,

i've tried your code but it doesn;t worked out. Anybody there who has the idea?

 

thanks for everybody who have replied me.

 

ASMI's first code in that thread posted works in a similar way to mine, so I'd be intrigued to know why mine failed... :P

Link to comment
Share on other sites

i got your code commandobill...what if my profile (.arg) file is in different path, how do i update it to your code? one thing more, do i have to change ÄLL the words "ProfileName" into my profle name? sorry i not quite good in programming.

Link to comment
Share on other sites

ASMI's first code in that thread posted works in a similar way to mine, so I'd be intrigued to know why mine failed... :P

 

Well for starters you are checking to see if the file exists but you are never loading it into Autocad. Then your Hierarchy is a little off for getting the profiles you went a little too deep by getting the activedocument. Not too shabby for untested though 8)

 

i got your code commandobill...what if my profile (.arg) file is in different path, how do i update it to your code? one thing more, do i have to change ÄLL the words "ProfileName" into my profle name? sorry i not quite good in programming.

 

Here i changed ASMI's code so that it will check to see if it is loaded in autocad and if not it will search the file location that you specify to see if the file exists and if it does it will load it. All you have to do is change c:\\ to whatever drive you keep your profiles in.

 

(defun c:LoadProfile( / profCol profLst ProfileName)
 (vl-load-com)
 (setq ProfileName (getstring "\nEnter the name of the profile you wish to load: "))
 (setq profCol ; get profiles collection
    (vla-get-Profiles
      (vla-get-Preferences
        (vlax-get-acad-object))))
 (vla-GetAllProfileNames profCol 'profLst)
 
 (if (and (not (member ProfileName (vlax-safearray->list profLst))) ; if profile exists
      (findfile (setq Profileloc (strcat "c:\\" Profilename ".arg"))))
   (progn
     (vla-importprofile profcol Profilename Profileloc :vlax-false)
     (vla-GetAllProfileNames profCol 'profLst)))
 (if (member ProfileName (vlax-safearray->list proflst))
   (progn
     (if
   (vl-catch-all-error-p
     (vl-catch-all-apply
       'vla-put-ActiveProfile
       (list profCol ProfileName))) ; profile loading and error catching
   (princ
     (strcat "\nError loading profile <"
         ProfileName ">.")); error message
   (princ
     (strcat "\nProfile <" ProfileName
         "> successfully loaded. ")); success message
   ); end if
     ); end progn
   (princ
     (strcat "\nProfile <" ProfileName "> not found. ")); not found message
   ); end if
 (princ)
 ); end of LoadProfile

Link to comment
Share on other sites

i followed your instruction, this is what appears on my autocad screen:

 

Command: appload

LOADPROFILE.LSP successfully loaded.

 

Command: ; error: syntax error

Link to comment
Share on other sites

you are absolutely right Mr. Lee, i haven't copied all the code....

it is working perfectly now....

 

thanks mr. commandbill & lee mac, you are both great.

Link to comment
Share on other sites

you are absolutely right Mr. Lee, i haven't copied all the code....

it is working perfectly now....

 

thanks mr. commandbill & lee mac, you are both great.

 

I'm glad you got it working Courage Dog - Nice one Bill :)

Link to comment
Share on other sites

you are absolutely right Mr. Lee, i haven't copied all the code....

it is working perfectly now....

 

thanks mr. commandbill & lee mac, you are both great.

 

Your very welcome!

 

I'm glad you got it working Courage Dog - Nice one Bill :)

 

Thank you! 8)

Link to comment
Share on other sites

  • 3 weeks later...

hi i'm back, the routine works fine on my machine, when i try to use it to other machine it does not load the profile, it says "profile not found".

 

This is what i did:

In the appload dialog box, start-up suit, content, i add the PROFILE.LSP, i put it also in the History List to make sure it will be loaded everytime i open my autocad.

 

by the way the PROFILE.LSP is on server.

 

My question is why it is not working to other machine, i mean fellow cad can't load PROFILE using this rouine .:(

Link to comment
Share on other sites

hi i'm back, the routine works fine on my machine, when i try to use it to other machine it does not load the profile, it says "profile not found".

 

This is what i did:

In the appload dialog box, start-up suit, content, i add the PROFILE.LSP, i put it also in the History List to make sure it will be loaded everytime i open my autocad.

 

by the way the PROFILE.LSP is on server.

 

My question is why it is not working to other machine, i mean fellow cad can't load PROFILE using this rouine .:(

 

I think Bill has set it to search the C:\\ drive - perhaps this is wrong for where your profile file is located?

 

Or perhaps the search paths on the other computers need to be set up differently?

 

Lee

Link to comment
Share on other sites

  • 14 years later...

Hello,

 

I am using the lisp above to load a profile at startup.

The profile is loaded but for some reason it is not fully loaded.

Not all paths are loaded and also the cui is not loaded. 

Do you have an dea why this can be?

 

Regards,

Jochem

Link to comment
Share on other sites

Not the answer to the question but you can copy the desktop icon for CAD edit the properties as to which profile is tp be loaded on starting cad. In the icon PROPERTIES is the start up and the /P is the profile to use eg /P <<CIV3D Metric>>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...