PDA

View Full Version : Load Different Profile (arg) With a Drawing


vferrara
2008-06-26, 03:29 PM
Good Morning AUGI Members,

Can anyone advise me if this is possible to accomplish....??

Can a specific profile (.agr file) be automatically set for different drawing files that are open during an AutoCAD session....??

Right now when I manually set a profile Test-1 for Drawing #1....that profile will remain current if I switch to Drawing #2. I would then need to manually set profile Test-2 current for Drawing #2.....etc.

Can different profiles automatically be set current when switching between drawing files....??

Any assistance would be appreciated.

Regards,
Vince

rkmcswain
2008-06-26, 06:52 PM
AutoCAD loads "acaddoc.lsp" each time a drawing is opened.
So you can put code (example below) into this file that sets whatever profile you want current. You will have to add more code to determine "which" profile to set current based on the criteria that you setup.


(vla-put-ActiveProfile
(vla-get-Profiles
(vla-get-Preferences (vlax-get-acad-object))
)
"test" ;;(replace with name of profile or variable)
)

03xtreme
2008-06-27, 01:44 PM
yes you can do this.

We have created profiles that are distributed with our newtork deployments, and what we have done is modified the "target" in the shortcut on your desktop. I also believe this affects the registry in some fashion.

Our target for LDT map is called "C:\Program Files\Autodesk Land Desktop 2007\acad.exe" /p "G:\sdskproj\1000-01\0-MMI-STANDARDS\Profiles\LDT2007\MMI-Map.arg"

Our target for LDT is called "C:\Program Files\Autodesk Land Desktop 2007\acad.exe" /p "G:\sdskproj\1000-01\0-MMI-STANDARDS\Profiles\LDT2007\MMI-LDT.arg"

Our target for LDT C3D is called "C:\Program Files\Autodesk Civil 3D 2007\acad.exe" /p "G:\sdskproj\1000-01\0-MMI-STANDARDS\Profiles\C3D2007\MMI-C3D.arg"

I made all of these custom profiles on a "mule" or "test" pc and added them to the deployment so that every pc uses the same profile settings and that we have a common repair bat written to fix them.

--you may want to consider different CUI instead of profiles unless you create a button to activate a lisp routine written above.

irneb
2008-07-01, 07:46 AM
You could place rkmcswain (http://forums.augi.com/member.php?u=74708)'s code in a SCR file. Then change the shortcut to include the relevant SCR after a /b switch. This will then run that script after opening AutoCAD from that shortcut. You simply create a 2nd SCR with the other Workspace's name - and link similarly with a 2nd shortcut to have AC open with the other WS.

vferrara
2008-07-02, 01:46 PM
Dear Rkmcswain,

Thank you for your response......!

The code you posted works great however, is there a way (maybe with a reactor) to run your code and make a profile change when switching from one opened drawing file to another....??

Let me give you an example:

User-1 opens Drawing-1 and sets Profile-1 active for that drawing. Then User-1 opens Drawing-2 and sets Profile-2 active for that drawing. When User-1 switches back to do work on Drawing-1 the active profile is still Profile-2 therefore User-1 would need to set Profile-1 active again to work on Drawing-1. Would it be possible to have a program (like a reactor) run automatically when User-1 switches back to Drawing-1 and set Profile-1 active. Likewise when User-1 switches over to Drawing-2 the active profile would be set to Profile-2.

Your code would need to be run automatically when switching between drawing files.

Any assistance would be appreciated.....!

Regards,
Vince

rkmcswain
2008-07-02, 02:25 PM
You could use a sysvar reactor (:VLR-SysVar-Reactor) to monitor the "DWGNAME" system variable. An example is here:
http://rkmcswain.blogspot.com/2007/03/system-variables-changing-on-their-own.html

irneb
2008-07-02, 04:51 PM
Or a docmanager reactor, e.g.(defun c:SaveProfile2DWG (/ profname)
(if (setq profname (vla-put-ActiveProfile (vla-get-Profiles (vla-get-Preferences (vlax-get-acad-object)))))
(vlax-ldata-put "SwitchProfiles" "Name" profname)
)
(princ)
)

(defun CheckAndSetProfile (calling-reactor commandInfo / profname)
(if (setq profname (vlax-ldata-get "SwitchProfiles" "Name"))
(vla-put-ActiveProfile (vla-get-Profiles (vla-get-Preferences (vlax-get-acad-object))) profname)
)
)
(vlr-docmanager-reactor "SwitchProfiles" '((:vlr-documentToBeActivated . CheckAndSetProfile)))You have to run the SaveProfile2DWG command to save the current profile as the DWG's default inside the DWG (I've used the ldata named dictionary as it's the easiest way). Then check which name was saved in the drawing (if at all) every time a drawing is activated. Switch if name was saved - otherwise do nothing.

Just remember that each of the users need to have the same profile names setup - as the name is now stored inside the DWG and not "linked" to a profile type.

vferrara
2008-07-07, 02:54 PM
Irneb,

Thank you for you response.....!

Since I would want this to run everytime the user switches from one drawing to another.......How would you recommend implementing/utilizing the code you posted......?? Should I load it everytime a drawing is opened, how would it run automatically when the user switches back to one of the drawings....??

Any help would be appreciated.

Regards,
Vince