Results 1 to 8 of 8

Thread: Load Different Profile (arg) With a Drawing

  1. #1
    I could stop if I wanted to
    Join Date
    2003-09
    Posts
    381

    Default Load Different Profile (arg) With a Drawing

    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

  2. #2
    Certified AUGI Addict rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Houston
    Posts
    7,519

    Default Re: Load Different Profile (arg) With a Drawing

    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.

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

  3. #3
    I could stop if I wanted to 09silverado's Avatar
    Join Date
    2005-12
    Location
    Connecticut
    Posts
    484

    Default Re: Load Different Profile (arg) With a Drawing

    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.
    Thank you kindly
    Cad Committee Technical Adviser
    R14 - C3D 2012
    http://www.youtube.com/user/butzers03xtreme I drive a Silverado, its loud and i like it

  4. #4
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: Load Different Profile (arg) With a Drawing

    You could place rkmcswain'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.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  5. #5
    I could stop if I wanted to
    Join Date
    2003-09
    Posts
    381

    Default Re: Load Different Profile (arg) With a Drawing

    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

  6. #6
    Certified AUGI Addict rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Houston
    Posts
    7,519

    Default Re: Load Different Profile (arg) With a Drawing

    You could use a sysvar reactor (:VLR-SysVar-Reactor) to monitor the "DWGNAME" system variable. An example is here:
    http://rkmcswain.blogspot.com/2007/0...their-own.html

  7. #7
    Certifiable AUGI Addict irneb's Avatar
    Join Date
    2007-07
    Location
    Jo'burg SA
    Posts
    4,344

    Default Re: Load Different Profile (arg) With a Drawing

    Or a docmanager reactor, e.g.
    Code:
    (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.
    Knowledge is proportional to experience, but wisdom is inversely proportional to ego!
    My little bit of "wisdom": Hind-sight is useless, unless used to improve the next forethought!

  8. #8
    I could stop if I wanted to
    Join Date
    2003-09
    Posts
    381

    Default Re: Load Different Profile (arg) With a Drawing

    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

Similar Threads

  1. Load Deck Profile???!
    By aaronhacker92 in forum Revit Architecture - General
    Replies: 1
    Last Post: 2010-06-20, 12:05 PM
  2. arg. profile file won't load
    By Mac Demer in forum AutoCAD General
    Replies: 7
    Last Post: 2009-07-15, 08:15 PM
  3. Unable to Load Profile
    By quigin in forum DWG TrueView - General
    Replies: 0
    Last Post: 2007-11-21, 04:53 PM
  4. Profile file will not load
    By Mac Demer in forum AutoCAD General
    Replies: 3
    Last Post: 2006-07-11, 03:59 AM
  5. how do I load a floor edge profile?
    By noah in forum Revit Architecture - General
    Replies: 14
    Last Post: 2005-10-27, 04:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •