Checking for CADWorx*

Today’s post is one that I’m shocked I haven’t written already.  A while back I was pondering how to load my shortcuts for P&ID and not for plant.  I tend to have a complicated setup since I use CADWorx, but also have to teach/demo CADWorx.  Personally, I like the ribbons, but the bulk of my command entry is done via left-hand keyboard shortcuts.  I have a bunch of shortcuts for AutoCAD functions, and some that pertain to CADWorx P&ID, and some that I want to use with Plant.  Here’s what I decided to do:

1. Store all my generic AutoCAD shortcuts in my pgp file.  When I’m in “personal” mode (not demo-ing or training) I have access to these since my pgp is loaded from my profile settings.


2. Store my CADWorx P&ID and Plant shortcuts in separate lisp files.  Here’s a clip of my P&ID Shortcuts.


The final piece of magic is done my a routine that check’s to see if a particular .arx file is loaded.

(defun checkarx (progplusstar)
(setq listarxs(vlax-safearray->List(vlax-variant-value(vlax-invoke-method(vlax-get-acad-object)’ListArx))))
(setq blfound nil)
(foreach arxfile listarxs
(wcmatch arxfile progplusstar)(progn (setq blfound T )(setq foundarx arxfile))
(setq blreturn blfound)

To use the routine, use lisp like the following:

(defun Loadshortcuts()

;check to see if there is an arx whose name starts with cadworxp&id
(if (checkarx "cadworxp&id*");do some action here
(load "PIDShortcuts")

And that’s all there is to it!

  • chillme1


    Thanks for sharing and find this one of the main websites to gain more understanding of the application.
    Loading Shortcuts Question:
    I am a programming novice but have learned to use the autoload statement in an acaddoc.lsp file to load several lisp routines.
    Do you use the autoload statements to load other routines? Are there disadvantages in defining shortcuts via a single acaddoc.lsp file?

    ARX Load Section Question:
    I would appreciate some clarification. The final section appears to combine the (2) two topics together, activating the ARX file checking along with the shortcuts loading: (load “PIDShortcuts”).

    • I avoid the acaddoc.lsp simply because so many other applications like to use it. A lot of AutoCAD verticals modify it, so I keep my stuff out of it to avoid conflicts. Autoload is great for load other frequently used routines. In an admin environment I recommand creating a company cui and using that to load shortcuts, but that’s another post :).

      Yes, that bottom clip is an illustration of what I use the checking mechanism for (loading my P&ID shortcuts).

  • chillme1

    I recognize the situation both you and my other reseller and consultant business-based, colleagues are in and agree with you on all points.

    In fact, setting up a custom CUI is on my agenda via related learning materials from previous Autodesk University sessions by Robert Bell. Have you heard of him?

    Both insulated from the multi-AutoCAD vertical world and currenlty enjoying a truly rare gem of a CAD design position, I am just ‘starting’ my process design and CADWorx experience after 15+ years in mechanical design.

    Your contributions keep me connected and informed.
    Process design guys are a rarity in my area (TN).

    • I learned a lot about cui from Robert Bell. You can’t go wrong with his stuff.