Bootstrap AutoCAD Deployments for Customizations (8)

CAD Management
Color coding with the Visual LISP IDE. Bootstrap AutoCAD Deployments for Customizations.

Last week you saw how to gather catalog data so it could be added automatically to the Content Browser, a feature in such AutoCAD®-based products as AutoCAD Civil 3D and AutoCAD MEP (Bootstrap AutoCAD Deployments for Customizations Part 7). All we have to do now is work in a little more code.

Code… Why did it have to be more code?

Hey, I like to write code. And it feels great when you get AutoCAD to do exactly what you want. I’ve tried to make coding easy, and maybe even a bit fun, for you too.

OK. Let’s finish up. Here’s the code. The only parts you need to edit are at the very beginning and marked between comments.

;; Add catalog to Content Browser
;; Edit items below
(setq regKey "HKEY_CURRENT_USERSoftwareAutodeskAutodesk Content Browser78RegisteredCatalogs")
(setq itemID "{6F6953A6-B6DA-494B-83E4-21BCF9710EC9}")
(setq image "P:autocad_mep_2015tool_catalogsstantec_2048Imagesstantec_logo_2.png")
(setq url "P:autocad_mep_2015tool_catalogsstantec_2048stantec_2048_tools.atc")
(setq displayName "Stantec 2048 Tools")
(setq description "Stantec BC 2048's Devices and Tools")
(setq coverPage "P:autocad_mep_2015tool_catalogsstantec_2048cover_page.html")
(setq publisher "Stantec BC 2048")
(setq toolTip "Stantec BC 2048's Devices and Tools")
;; Edit items above
(vl-registry-write regKey "Registered" 0)
(setq regKey (strcat regKey "" itemID "-Catalog"))
(cond ((not (vl-registry-read regKey "ItemID"))
(mapcar (function (lambda (a) (vl-registry-write regKey (car a) (cdr a))))
(list (cons "ItemID" itemID)
(cons "Url" url)
(cons "DisplayName" displayName)
(cons "Description" description)
(cons "Image" image)
(cons "CoverPage" coverPage)
(cons "Publisher" publisher)
(cons "ToolTip" toolTip)
(cons "Type" 2)
(cons "AccessRight" "1")))))

Be mindful of the double backslashes–especially when you copy the registry key (the bit that starts with HKEY_CURRENT_USER) from the registry file into the code. Except for the registry key, you can copy and paste all items directly—just make sure you preserve the double quotes in each line. Using the Visual LISP IDE is nice here because of the syntax color coding. See Figure 1.

Color coding with the Visual LISP IDE. Bootstrap AutoCAD Deployments for Customizations.

Figure 1: Seeing colors with the Visual LISP IDE (integrated development environment).

Content Browser code explained

Lines 3 through 11 (the lines between the comments) set the data for the rest of the code.

(vl-registry-write regKey "Registered" 0)
This line informs the Content Browser that an unregistered catalog has been added thru the registry. The Content Browser will register any new catalogs the next time it is launched.

(setq regKey (strcat regKey "" itemID "-Catalog"))
This creates the registry key for the actual catalog. We’re redefining the variable regKey using the original value for the variable, and bugs can creep in when you change data in a variable to data from the same variable. But this is a simple bit of code so… go for it.

(cond ((not (vl-registry-read regKey "ItemID"))
This line checks to see if the catalog already exists. If it does, the rest of the code will not execute.

(mapcar (function (lambda (a) (vl-registry-write regKey (car a) (cdr a))))
(list (cons "ItemID" itemID)
(cons "Url" url)
(cons "DisplayName" displayName)
(cons "Description" description)
(cons "Image" image)
(cons "CoverPage" coverPage)
(cons "Publisher" publisher)
(cons "ToolTip" toolTip)
(cons "Type" 2)
(cons "AccessRight" "1")))))

This section of code writes each line of information into the registry, which ensures the catalog loads when the Content Browser launches. I set up the last two lines (the ones with “Type” and “AccessRight”) so they do not get data from the exported registry file. Why? Because….

  • Type = 2 means the catalog is storing content. Although catalogs can store a range of items, in my experience users want only the company content.
  • AccessRight = “1” means that the catalog is read-only to users. Why? So if you update content, users will be able to refresh it without having to delete and reload the content.

That wasn’t so bad, was it—especially after that monster bootstrap.lsp code? Speaking of bootstrap.lsp….

Add this code to bootstrap.lsp

You need to add this code to the bootstrap.lsp code so it runs as part of the bootstrap process. Place it between the (princ “nExecuting Bootstrap.”) and (setq includePaths 1) lines. See Figure 2.

See where to place the catalog code in the bootstrap.lsp code. Bootstrap AutoCAD deployments for customizations.

Figure 2: Place the catalog code right here in the bootstrap.lsp code. Done!

Bootstrap AutoCAD Deployments for Customizations: The End!

And that is it. Really.

Now that you’ve got deployment figured out, you should be able to roll out new versions of AutoCAD on time and without hassle—no matter how extensive your companywide AutoCAD customizations.

I hope you have enjoyed this series. Please feel free to contact me here or over Twitter (@r_robert_bell) if you have any questions or need some help.

To recap….

Bootstrapping AutoCAD from the secondary installer simplifies your AutoCAD deployment (IT will thank you), gives users a friction-free deployment experience, and ensures AutoCAD will always launch to the correct profile, regardless of how users start the software or whether they log on to multiple workstations. It’s easy to do—just add a single file to the deployment package and locate your customizations on the network—and it will ensure users keep right on ticking when they use new hardware.

Here’s the entire series, all together now:

Bootstrap AutoCAD Deployments for Customizations Part 1

Bootstrap AutoCAD Deployments for Customizations Part 2

Bootstrap AutoCAD Deployments for Customizations Part 3

Bootstrap AutoCAD Deployments for Customizations Part 4

Bootstrap AutoCAD Deployments for Customizations Part 5

Bootstrap AutoCAD Deployments for Customizations Part 6

Bootstrap AutoCAD Deployments for Customizations Part 7

Try AutoCAD free for 15 days
The AutoCAD Blog is all about helping you get the most out of AutoCAD. It's also the best way for you to connect with the makers of AutoCAD. Subscribe to keep up with AutoCAD

______
icon-svg-close-thick

Cookie preferences

Your privacy is important to us and so is an optimal experience. To help us customize information and build applications, we collect data about your use of this site.

May we collect and use your data?

Learn more about the Third Party Services we use and our Privacy Statement.

Strictly necessary – required for our site to work and to provide services to you

These cookies allow us to record your preferences or login information, respond to your requests or fulfill items in your shopping cart.

Improve your experience – allows us to show you what is relevant to you

These cookies enable us to provide enhanced functionality and personalization. They may be set by us or by third party providers whose services we use to deliver information and experiences tailored to you. If you do not allow these cookies, some or all of these services may not be available for you.

Customize your advertising – permits us to offer targeted advertising to you

These cookies collect data about you based on your activities and interests in order to show you relevant ads and to track effectiveness. By collecting this data, the ads you see will be more tailored to your interests. If you do not allow these cookies, you will experience less targeted advertising.

icon-svg-close-thick

THIRD PARTY SERVICES

Learn more about the Third-Party Services we use in each category, and how we use the data we collect from you online.

icon-svg-hide-thick

icon-svg-show-thick

Strictly necessary – required for our site to work and to provide services to you

Qualtrics
W
Akamai mPulse
W
Digital River
W
Dynatrace
W
Khoros
W
Launch Darkly
W
New Relic
W
Salesforce Live Agent
W
Wistia
W
Tealium
W
Upsellit
W
CJ Affiliates
W
Commission Factory
W
Google Analytics (Strictly Necessary)
W
Typepad Stats
W
Geo Targetly
W
SpeedCurve
W
Qualified
#

icon-svg-hide-thick

icon-svg-show-thick

Improve your experience – allows us to show you what is relevant to you

Google Optimize
W
ClickTale
W
OneSignal
W
Optimizely
W
Amplitude
W
Snowplow
W
UserVoice
W
Clearbit
#
YouTube
#

icon-svg-hide-thick

icon-svg-show-thick

Customize your advertising – permits us to offer targeted advertising to you

Adobe Analytics
W
Google Analytics (Web Analytics)
W
AdWords
W
Marketo
W
Doubleclick
W
HubSpot
W
Twitter
W
Facebook
W
LinkedIn
W
Yahoo! Japan
W
Naver
W
Quantcast
W
Call Tracking
W
Wunderkind
W
ADC Media
W
AgrantSEM
W
Bidtellect
W
Bing
W
G2Crowd
W
NMPI Display
W
VK
W
Adobe Target
W
Google Analytics (Advertising)
W
Trendkite
W
Hotjar
W
6 Sense
W
Terminus
W
StackAdapt
W
The Trade Desk
W
RollWorks
W

Are you sure you want a less customized experience?

We can access your data only if you select "yes" for the categories on the previous screen. This lets us tailor our marketing so that it's more relevant for you. You can change your settings at any time by visiting our privacy statement

Your experience. Your choice.

We care about your privacy. The data we collect helps us understand how you use our products, what information you might be interested in, and what we can improve to make your engagement with Autodesk more rewarding.

May we collect and use your data to tailor your experience?

Explore the benefits of a customized experience by managing your privacy settings for this site or visit our Privacy Statement to learn more about your options.