Forcing a Profile from Network

I’ve been working quite a bit on making C3D play nicely in a PowerCivil environment. One of the things that we ran into was using the PowerCivil launcher to pull up C3D and make sure the environment was the exact one we wanted. The first answer was to launch a specific profile to make sure the support paths, lsps, and other settings we wanted were queued up at the launch. Of course, users sometimes mess with their profile, leading to problems. The solution there was to call the network version of the profile at each launch, but if you’ve ever tried this, you know that AutoCAD won’t read the network .ARG file if that profile name already exists. So, what’s a Type A Cad Manager to do to make sure that the program launches the exact same way every time? Make the jump to find out.

First, you’ll need to have your Profile set up in C3D, then export it. I’m going to drop mine on C:\Profiles\ to make this simple. If you look at an ARG file, it’s really a tweaked out Registry file, so that should give you some idea of where we’re headed. Once you have your profile setup and exported, create a new shortcut. I like to modify the existing one, so here’s what mine looks like. Note that I’ve included a full path in the Profile part of the shortcut. This will at least tell C3D to pull from the stored version once it can’t find the local version.

image

Now, how to get rid of that local version? DOS. Yes, DOS. A little old DOS prompt does wonders. It’s heavy handed, and does require using a batch script to handle the actions, but if you’re in the type of environment where PowerCivil is in play and where you want this level of control, adding one more thing to a script isn’t a big deal.

Here’s the command you’re after:

REG DELETE

If you look at the Registry on your machines, you’ll find the profile appears down in a Profiles key. I’ve modified the image so you can see it better, but here’s the path for Civil 3D 2010 on W7. You’ll want to experiment a little bit to find the path on your computer. When you do find your profile, right-click, and you can select Copy Key Name. Now you know what you have to delete.

image

Make sure you’re outside of C3D, then move to a DOS prompt and REG DELETE “[Your key]” /F Make sure you use quotes around your profile name just in case you have spaces, etc in the profile name. You will probably have to right-click to paste, but when you run that command, POOF goes the profile. You’ll see a message like you do here.

image

If you jump back into your Registry, you can refresh (F5) and you’ll see the profile key is gone. Relaunch from your hard coded icon, and you’re back to the stock profile configuration.

We chose to simply put this in the login script, but I’m sure you could find a way to run it before every launch if you’re really obsessed. I’ll leave that part up to you, but if you need some help, leave a comment!

4 comments

  1. Clem Kuns says:

    Now THIS is the good stuff I like to hear about! Good tip JW.

  2. Matt Stachoni says:

    James,

    There are a few minor errors to note in this post.

    First, the ARG file is definitely NOT a “tweaked out Registry file.” An .ARG file looks a lot like a .reg file, but they are not equal and cannot be used interchangeably.

    An .ARG differs from a .REG in three very distinct and important ways:

    1. It references “logical” paths to files and folders which are defined elsewhere, either in Windows or in the Registry. For example, a quick glance at an .ARG in a text editor will list folders like “%UserProfileFolder%,” “%InstallFolder%,” “%LocalRootFolder%” and “%RoamableRootFolder%” and so on.

    If you check the same value in the Registry Editor, you will find many of these paths are evaluated out as the actual paths, not these logical ones. Some logical paths point to paths which then also contain logical paths as well.

    When C3D (or any AutoCAD vertical product) imports an ARG file (using the /p switch or through Options > Profiles), it translates most of these logical paths into hard coded ones; e.g., %UserProfileFolder% becomes “C:\Users\Bob,” which is then written into memory and the Registry and is shown in Options > Files.

    When a profile is exported to .ARG, C3D again translates these hard coded paths back out to their logical paths.

    This mechanism is how an .ARG file can be portable across users and operating systems.

    2. The .ARG file also contains XML code at the end of the file, which defines the status of your tool palette, ribbon, and other UI elements.

    3. Given the previous two items, if you simply rename an .ARG to a .REG and import it, you will most likely have a huge mess on your hands, as Windows will not try to translate something like “%RoamableRootFolder%” into anything meaningful. And the XML will simply be ignored.

    As far as ensuring the correct profile is used, an easier method may be to simply rename the current profile in Options > Profiles. This also renames the Registry key under which the profile itself is stored. Then, get out of C3D, and relaunch it using the desktop icon which points to the correct profile using the /p switch.

    Because that profile no longer exists in the Registry, C3D will re-import it from the .ARG file.

    Thanks!

    • Nice essay Matt, I’m still not paying you per word!

      While you definitely have the details correct, I’d still say tweaked out is close enough for the casual user, much as a .doc is a tweaked out text file. It wasn’t meant to be a hardcore, rename and double-click kind of comparison.

      On your last point, I’d agree, but this is for IT guys that don’t want to touch the machine, or the Acad environment really. While you could put in a nice reactor to rename the profile as part of exiting, I like this better in that it’s damned hard to circumvent by the user, especially if IT controls the launching mechanism as they do in a ProjectWise environment.

      • Matt Stachoni says:

        Hee hee, yeah, I don’t write ’em short and sweet!

        I guess my main point was to warn anyone from renaming an .arg to a .reg which can have really, really, really bad results – DAMHIKT :). I’ve also noticed that Autodesk’s handling of how things get written to .arg files changes from release to release.

        And from one gearhead to another, I personally prefer the scripting route myself, for the same reasons you mention – that I can remotely fix a user’s profile problems with very little effort.