The Courage Dog Posted June 11, 2009 Share Posted June 11, 2009 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 Quote Link to comment Share on other sites More sharing options...
NBC Posted June 11, 2009 Share Posted June 11, 2009 I don't have much idea, but I'm guessing this will have something to do with it - VLA-PUT-ACTIVEPROFILE Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 11, 2009 Share Posted June 11, 2009 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) Quote Link to comment Share on other sites More sharing options...
The Courage Dog Posted June 11, 2009 Author Share Posted June 11, 2009 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. Quote Link to comment Share on other sites More sharing options...
Commandobill Posted June 11, 2009 Share Posted June 11, 2009 See http://www.cadtutor.net/forum/showthread.php?t=11156 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 11, 2009 Share Posted June 11, 2009 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... Quote Link to comment Share on other sites More sharing options...
The Courage Dog Posted June 12, 2009 Author Share Posted June 12, 2009 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. Quote Link to comment Share on other sites More sharing options...
Commandobill Posted June 12, 2009 Share Posted June 12, 2009 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... 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 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 Quote Link to comment Share on other sites More sharing options...
The Courage Dog Posted June 13, 2009 Author Share Posted June 13, 2009 i followed your instruction, this is what appears on my autocad screen: Command: appload LOADPROFILE.LSP successfully loaded. Command: ; error: syntax error Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 13, 2009 Share Posted June 13, 2009 Are you sure you copied the entire code? It seems to load properly for me Quote Link to comment Share on other sites More sharing options...
The Courage Dog Posted June 13, 2009 Author Share Posted June 13, 2009 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. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted June 13, 2009 Share Posted June 13, 2009 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 Quote Link to comment Share on other sites More sharing options...
Commandobill Posted June 15, 2009 Share Posted June 15, 2009 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! Quote Link to comment Share on other sites More sharing options...
The Courage Dog Posted July 5, 2009 Author Share Posted July 5, 2009 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 . Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 5, 2009 Share Posted July 5, 2009 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 Quote Link to comment Share on other sites More sharing options...
The Courage Dog Posted July 6, 2009 Author Share Posted July 6, 2009 yes, i did change the path from c:\\ drive - into our server drive R:\\ Quote Link to comment Share on other sites More sharing options...
JochemB Posted August 17, 2023 Share Posted August 17, 2023 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 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted August 19, 2023 Share Posted August 19, 2023 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>> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.