Wednesday, August 21, 2013

Quick way to restore AutoCAD Profile Settings

It's not easy to remember where some of the default AutoCAD support content is located. For example, if you want to test a ctb file real quick you might change the Plot Style Table Search Path in your current profile. If this happens to be your Unnamed Profile (out of the box AutoCAD profile) you probably want to change this back to the default path when you are done testing. The default path for the Plot Style Table Search Path is:

C:\Users\username\appdata\roaming\autodesk\autocad 2013 - English\r19.0\enu\plotters\plot styles which is also %RoamableRootFolder%\support.

Instead of memorizing this path, a quick and easy way to restore the default is to delete the temporary path. This will set the path back to the default location.

For example, if I change my Plot Style Table Search Path to a custom location:

 
Then, when I am ready to change it back: highlight the path, click Remove (the path becomes blank), then click Ok.
 
 
 
A dialog saying: "...a path was not specified. The default location will be used..." will display. Click Ok and the path is restored to the default.

 
 
 
This can come in handy for a quick test situation or when helping another CAD operator restore a profile path that was inadvertently changed.


Monday, July 8, 2013

Use Acad.rx to load CADWorx Plant and Equipment at the same time

If you use CADWorx Plant Professional and find yourself going back and forth between CADWorx Plant (piping/structural) and CADWorx Equipment, you might like to have these both load through the same session. This can be done by combining the arx calls to both applications in the same Acad.rx (runtime) file. (Even if you do not use CADWorx this post should provide some good information about the Acad.rx file and how it works)

When AutoCAD is launched it searches for an Acad.rx (runtime file) in the support folders defined by the user profile. Any .arx files listed within the Acad.rx file are then automatically loaded. This is the mechanism CADWorx uses to load into AutoCAD. Note, AutoCAD will only acknowledge the first Acad.rx file it finds and will not look for additional Acad.rx files.

When CADWorx Plant is launched the top support path in the user profile (out-of-the-box) is C:\CADWorx 2013\Plant\Support. There is an Acad.rx file in this folder that loads 2 .arx files

Both of these .arx files are located in this same folder, therefore AutoCAD is able to locate and load them (because this folder is a support path) and CADWorx Plant is now loaded.
 
 
Now that we have covered the high level, here are the steps to get CADWorx Plant and Equipment to load at the same time:
 
Using Notepad, add a single line of text to load the CADWorxEquipment2013.arx file
 
 
This will instruct AutoCAD to load the CADWorxEquipment2013.arx file. However, AutoCAD will not be able to locate the .arx file because it is not in one of the support paths defined by the CADWorx Plant user profile.
 
So the next (and last) step is to add the CADWorx Equipment support path to the CADWorx Plant user profile. Important: Make sure to add the ..\equipment\support path below the ..\plant\support path. Otherwise, AutoCAD will load the Acad.rx found in ..\equipment\support (remember, the first one it finds) and it will not load Plant.
 
After doing this, launching CADWorx Plant will load both Plant and Equipment.
 
A few things to consider depending on your environment are:
  • If you are managing CADWorx in a network environment you will need to update each user's Acad.rx file or make sure all users are using the same network based profile that is setup to load both Plant and Equipment.
  • If your license plan has separate licenses for Plant and Equipment, this method will use 1 of each license.
  • If you are already using an Acad.rx to load other .arx files you will either need to consolidate all of the .arx calls into 1 file or load the other .arx files using a different method. Of course, if you have been using CADWorx this is either not an issue or has already been sorted out.

Thursday, May 9, 2013

Create a custom ribbon tab using the custom CUI

In a post last week we looked at reasons the custom.cui can be a great spot for users to create their own custom AutoCAD content. After some feedback I am realizing it would be helpful to walk through creating a custom element from scratch and having that load from the custom.cui.

As mentioned, the custom.cui is partially loaded into the acad.cui by default.
Creating CUI elements in here is the same process as in the acad.cui. Expand the Custom CUI node and locate the type of element you want to add. For this example we will:
  • Create a new Ribbon Tab
  • Create a new Ribbon Panel
  • Create a custom command to add to the Panel
  • Make sure the new Ribbon Tab is available in your AutoCAD environment
Create a new Ribbon Tab by right clicking on the Tabs element and select New Tab.
 
Give the new tab a name and it will now be displayed in Custom, Ribbon, Tabs.
Next, create a new Panel that will be added to the tab. Remember, a Tab can host multiple panels. We will just create one panel for this exercise. To create the new Panel, right click on the Panels element and select New Panel.
Give the new panel a name and it will now be displayed in Custom, Ribbon, Panels.
Let's define a custom command that we can add to our new panel. Click the Create a new command button and a new command will be added to the Command List pane in the CUI Editor. Give the new command a name.
Once the command is created we can define what the command should do. This example is a custom command that is defined in an external file (either Lisp or dll). As long as this file is loaded through the custom.mnl then it will be loaded in the drawing.
Now that our command is created we can add it to our custom panel. To do this drag the command up to the panel location where the command should be. Note: if you drag the command to the left (off the CUI dialog) then move your mouse up to where the panel is before bringing the mouse back over the CUI dialog this will prevent any scrolling that can happen if you try to drag the command straight up.
After adding the command to the Ribbon Panel there are some properties that you may want to adjust for how it displays on the actual panel. This gets into the layout of the CUI Ribbon Elements but for this example I am selecting the large icon with text option.
Now that we have a custom command and a custom ribbon panel, we need to add the panel to the custom Ribbon Tab. To do this just drag the panel onto the tab.
Lastly, we need to make this Ribbon Tab available in AutoCAD. If the custom Ribbon Tab that was created does not automatically show up in AutoCAD this will be controlled by the active workspace. To turn the custom Ribbon Tab on in the active workspace click Customize Workspace (in the CUI dialog)
 
then scroll down to the Partial Customization Files and locate the Custom Ribbon Tab. Check the box next to this element.
Click Done to finish Customizing the workspace and then Apply the CUI changes.
The new tab, panel, and command should now be available in AutoCAD.
 
You will also notice after doing this that the custom command now exists in the Custom menu source in the CUI Command List.
 
By creating this structure this allows users to create multiple custom commands and panels and easily transport them to a new workstation or a new version of AutoCAD just by bringing the custom.cuix file (and associated mnl, lisps, dll's, etc.) along with it.
 
One approach could be to create a Custom subfolder in the same folder where the custom.cuix and custom.mnl are located. Custom code can be stored in this folder as well as the icons for the ribbon panels.


 

 


 

 

 


 
 

 

Thursday, May 2, 2013

Use Dropbox to deploy a network based AutoCAD environment

Managing an AutoCAD environment from a single source on a shared network server has several benefits. Delivering consistent standards, customizations, and more, to multiple users is the goal of a streamlined AutoCAD environment.

With recent technology trends and so much movement towards the cloud, new opportunities are becoming available. Without the expense of purchasing, building, and maintaining an enterprise network, Dropbox provides a free cloud based solution that can reach all around the globe. Dropbox is free to setup and you will instantly have plenty of storage capacity for an entire AutoCAD environment (and more).

To combine the power of Dropbox with the flexibility of AutoCAD it will require installing the desktop version of Dropbox (not just using the web based interface). Also, it is important to use the default install path for Dropbox (C:\Users\...\Dropbox). Otherwise, as you will soon see we would not be able to share content with multiple users.

Dropbox functions exactly like any other folder on your computer except that when you are connected to the Internet it will synch with your Dropbox folder in the cloud. This allows you to have access to all of your content whether you are offline or online. You can create as many subfolders in your Dropbox folder as you would like and those folders can be shared with other Dropbox users.

If Dropbox is installed in the default location as mentioned above it can be accessed through the windows system variable %UserProfileFolder%. This means we can customize our AutoCAD based user profile using "%UserProfileFolder%\Dropbox\shared folder name". This path will resolve to everyones' Dropbox folder and allow the AutoCAD profile to load properly. Note: In order for everyone to synch to the same folder the folder must be shared by the original creator.

Here is an example of a custom profile that loads an Enterprise Menu File (which of course also loads an .mnl with the same name and in the same location) from Dropbox, changes the plot style path to a location on Dropbox, and adds a support path to Dropbox.


This sets the stage to do pretty much anything you want with an AutoCAD profile. When this profile is loaded into AutoCAD the paths above resolve to each individual user's Dropbox location which is synched from the master folder that was originally shared from Dropbox (Note: only the SLD subfolder in this example is shared, not the entire Dropbox folder).
 
Using Dropbox to manage an AutoCAD environment allows a lot of possibilities. If a team is spread out across the globe Dropbox will keep them in synch. Also, it does not require an Internet connection so team members can work offline (as long as they were connected initially to receive the content from Dropbox). The next time they connect to the Internet Dropbox will automatically update their folder with any new content from the master folder in the cloud. Another point to reiterate is that everyone is always accessing content from their local C:\ drive which is quick and efficient regardless of location.
 
This post focuses on managing an AutoCAD environment within Dropbox, but of course working drawing files can be stored there too.






Wednesday, May 1, 2013

Automatically create PDF or DWF files from AutoCAD

As electronic drawing formats (PDF and DWF) are becoming more popular both for internal checks during the design process and even final deliverables, it is important to have good workflows for this. A very handy feature for creating PDF and DWF files (that in my experience seems to be fairly unknown) is Auto Publish.
Auto Publish is found on the Plot and Publish tab in the options dialog.

There are quite a few options available in the Auto Publish Settings dialog. Some of the key ones are:
  • Publish on Close, Save, or to prompt before publishing
  • Choosing the file format, PDF or DWF
  • Single-Sheet or Multi-Sheet
  • The output location. Drawing Folder creates the file in the same folder the drawing is in. A full path could be provided here as well. Note: these settings are stored in the registry so this path can be added to a network based profile so multiple workstations output to the same location.

Once the preferred settings are made the Auto Publish needs to be toggled on before it will be in effect.

In my settings I chose to publish a PDF when I close my drawing file. I also specified the location to be the Drawing Folder. With these settings in place and the Automatic Publish toggled on when I close my drawing a PDF is automatically created.

Notice the layout tab name is added to the filename just like when publishing directly from AutoCAD. In the future the PDF will automatically be overwritten when I close the file again.

Auto Publish is a very flexible feature and the settings are stored in the AutoCAD profile which makes it great for managing a network based AutoCAD environment. The Automatic Publish toggle is off by default and there is not a registry key for this state. When the toggle is on and if you want to force it to be on through the AutoCAD profile here is the registry key for that (in the General section of the registry)
"AUTOMATICPUB"=dword:00000001

The Auto Publish settings are also stored in the AutoCAD profile in the AcAutoPublishOpts section of the registry.

Take some time to explore all of the options with Auto Publish, this can offer several streamlined workflows to the design environment.




Monday, April 29, 2013

Migrating .Net Apps to AutoCAD 2013

As I began migrating my .Net apps developed in Visual Studio 2010/AutoCAD 2011 to AutoCAD 2013, I quickly realized a new .dll reference is required. After updating the project references with the 2013 versions of acdbmgd.dll and acmgd.dll then re-building the solution I was presented with the following error message:
The type or namespace name could not be found
 
The additional .dll that is required is the accoremgd.dll (located in the root AutoCAD 2013 install location). Add this reference and I assume continue to set copy local to False (same as acdbmgd and acmgd). Also, make sure to set the Target Framework to .NET 4 (should be the default) and you should now be ready to be programming on the AutoCAD 2013 platform.
 
 
 
 


Friday, April 26, 2013

The AutoCAD custom.cui is a perfect place for custom content

Even in a managed network environment where custom CAD content is maintained and deployed, it is still nice for individual users to have the ability to add their own customizations. An administrator can maintain control of an environment but it can be good to encourage creativity for users. This gives them a chance to explore the AutoCAD CUI environment, make custom CUI elements (ribbon tabs, panels, menus, etc.) and develop useful (or just fun) macros and custom commands. The perfect place for all of this to happen is the custom.cui that is delivered with AutoCAD and resides on the local C:\ drive.

The delivered acad.cui file already has the custom.cui partially loaded. This means that every time the acad.cui file is loaded it will load the partial custom.cui file.


The custom.cui is located in the same appdata\roaming\autodesk\....\support folder that the acad.cui is. There is not a custom.mnl by default, but as we have discussed in earlier posts AutoCAD will look for a .mnl file that has the same name as all loaded CUI files. This means if we create a custom.mnl file and store it in the above location, our individual custom content in the .mnl will be automatically loaded every time AutoCAD loads! Note, one of the most helpful uses of an .mnl file is it can be an access point to load other lisp files, dll files, arx files, and more.

Using the custom.cui is a streamlined way for individual users to add creative and custom user interface elements, commands, and macros to their environment and still keep it separate from the acad.cui and network delivered content. Furthermore, this makes upgrading simple for individual users since they will just need to grab their custom.cui (and .mnl if one was created) and introduce it in the next version of AutoCAD (some tweaking may be necessary depending on differences in CUI handling from version to version).

To get started, launch AutoCAD and browse to the custom.cui as shown above. Refer to this earlier post as a refresher on how to create a custom ribbon element.

Saturday, January 19, 2013

Use Startup Switch /b to Add AutoCAD Support Path When Launching AutoCAD

We have talked about loading a specific network based AutoCAD profile when AutoCAD is launched. To do this we use the Profile startup switch /p at the AutoCAD startup command line. For example, "C:\Program Files\Autodesk\AutoCAD 2011\acad.exe" /p "C:\SLD\Support\Profile.arg" in the AutoCAD Shortcut Target will launch AutoCAD 2011 into the profile defined in the Profile.arg file. If a Profile parameter is not specified AutoCAD will load the last used AutoCAD user profile. Also, if a .dwg file is opened by double clicking on it in Windows Explorer the last used AutoCAD user profile will be loaded (this may not be a desirable workflow).

/p is called a startup switch. There are several other switches that can be passed to AutoCAD during the startup sequence. Visit this Autodesk page for a complete list of startup switches. Let's look at a very flexible switch, the Script switch /b. This switch executes an AutoCAD script during the startup sequence. Once we have an access point via a script we can do almost anything. This example will execute a script file that calls a lisp routine. The lisp routine will add a support path to the existing AutoCAD support paths defined by the current AutoCAD user profile. This can be handy if you are not controlling which profile a user is launching but want to ensure they have certain support paths available.

To start, we need to create our lisp file that the script will call. The lisp code is accessing the AutoCAD environment variable to determine the current defined AutoCAD support paths and then adds the new support path (or paths) at the end.

Next, we will create a script file that calls the command defined in our lisp routine. The script file just needs to load the lisp routine and execute our command.
Now we need an AutoCAD desktop icon that launches the version you are working with and calls our script file. I copied the out-of-the-box AutoCAD Shortcut and renamed it for this example.

Then right click and select properties and on the Shortcut tab add the /b startup switch in the target to point to your script file. Note, the .scr extension is left off and use quotes especially if there are spaces in the path location.
The /b startup switch is added just after the acad.exe action. You can have multiple startup switches so we could also point to a profile (using /p) or several other options. In this example the full Target text path is:

"C:\Program Files\Autodesk\AutoCAD 2011\acad.exe" /b "C:\SLD\Support\Script\addSupportPath"

Now when AutoCAD is launched from this icon since we are not specifying a profile with the /p startup switch, the last used AutoCAD based user profile will load. Regardless of which profile that is our /b startup switch will call our script file. Our script file loads our lisp routine and executes the command to update the AutoCAD support path.
The AutoCAD startup switches can provide quite a bit of flexibility. Especially once you gain access to the startup sequence with a script file that opens the door to load lisp code, .Net dll's, and more. Depending on how you choose to manage your environment or what you are trying to accomplish this can provide a streamlined solution.