I would like to import a custom profile using the acaddoc.lsp file.
Then if possible, set the newly imported profile current.
Can anyone wrote a lisp routine to do that?
Thanks.
(defun c:custprofimport (/ profile2import profilename proprefs) (vl-load-com) (setq profile2import "L:\\MyTest.arg" profilename "<<NewProfile>>" proprefs (vla-get-profiles (vla-get-preferences (vlax-get-acad-object))) ) (vla-importprofile proprefs profilename profile2import :vlax-true) (vla-put-activeprofile proprefs profilename) (princ) ) ;;to use in acaddoc.lsp, add the code to that file, then follow it with this: (c:custprofimport) ;;make sure to set the path & name first!
I pased this into acaddoc.lsp in the installation support folder
((defun c:custprofimport (/ profile2import profilename proprefs)
(vl-load-com) (setq profile2import "R:\\ACAD\\PROFILES\\PPI-CIVIL 3D\\2014\\PPI-C3D 2014x64.ARG"
profilename "PPI-C3D 2014x64"
proprefs (vla-get-profiles (vla-get-preferences (vlax-get-acad-object))) )
(vla-importprofile proprefs profilename profile2import :vlax-true)
(vla-put-activeprofile proprefs profilename)
(princ) )
;;to use in acaddoc.lsp, add the code to that file, then follow it with this:
(c:custprofimport)
;;make sure to set the path & name first!
When I open C3D, I get this message in attached file.
That worked.
And it did exactly what I asked for. Thanks so much for the help.
Unfortunately that doesn't get me where I wanted to go.
1. Using that code in the acaddoc.lsp file tries to reimport the arg file every time a new drawing is started and I get an error message for that.
2. Even though it imported the arg file, it didn't set it current (kind of). The Options/Profiles tab says it is the current profile, but the ribbon and custom workspace don't show up unless I select the "Set Current" button.
That being said, #1 above shows that I need to go about this a different way. So let me back up and explain better what i do now and the issue I have.
1. install C3D using a network deploy.
2. Open C3d on workstation using "Imperial" icon, import custom profile and close.
3. Copy shortcut icon to desktop with \p switch to use custom profile, and \w switch to use workspace. (worked fine in 2009-2013)
Issue: Using this method creates a problem with pressure networks when breaking a pipe. Downstream piece disappears.
Note: My custom profile was created using the OTB 2014 profile, adding search paths and saving as new name. (Learned that lesson in v2013 implementation)
Here's what I found works:
1. Open C3D with "Imperial" icon
2. "Set Current" custom profile that I imported previously
3. Set to custom workspace
4. Pressure networks work fine.
The custom shortcut icon is exactly the same as the OTB "Imperial" icon except for the /p and /w switches.
Rather than try to import the profile automatically, maybe I need to do that step manually, and in the acaddoc.lsp, just set the profile current and then maybe set the current workspace. I could live with that if my pressure networks worked fine.
Sorry for the long post. I hope it explains better what I'm trying to do.
I can't say that I've experienced the issue you describe with the pipes, but perhaps this will help. I renamed the command, added a check for the existence of the Profile and load it if not found. I then set it current and set the specified WS current.
(defun c:setcustprof (/ names namesarray profile2import profilename proprefs wspacename) (vl-load-com) (setq profile2import "L:\\ArgFile.arg" profilename "<<CustomName>>" wspacename "MYWS" proprefs (vla-get-profiles (vla-get-preferences (vlax-get-acad-object))) ) (vla-getallprofilenames proprefs 'namesarray) (setq names (vlax-safearray->list namesarray)) (if (not (member profilename names)) (vla-importprofile proprefs profilename profile2import :vlax-true) ) (if (/= (vla-get-activeprofile proprefs) profilename) (vla-put-activeprofile proprefs profilename) ) (if (/= (getvar 'wscurrent) wspacename) (setvar 'wscurrent wspacename) ) (princ) )
Excellent! It works.....except
There's something that's not finishing the "Set Current" command after it imports the profile.
The Profiles tab in Options says that the custom profile is current, and the search paths are correct, but unless I click the "Set Current" button, the custom workspace or any workspace loads. The custom workspace doesn't even show up in the workspace dropdown until I click the "Set Current" button.
Funny thing is, there are no error messages in the command line at startup. ???
Thanks for all your help.