Archive | MicroStation PowerDraft RSS for this section

CadPilot – Menu Item Help Files

by Lorrie Mattor,

Create help files for any command within CadPilot menus!

Toolbar menus are loaded from menu xml files as specified by your current configuration and appear in CadPilot toolbars.





If a Help File command is associated with the menu icon then the cursor will appear as a hand while floating over the menu icon.  When the icon is selected the Help file will open.  To execute the menu command simply slide your cursor over the command text until the cursor displays as an Arrow.






There may be times when a Help file is not associated with the Menu icon, in these cases the cursor will be displayed as an Arrow and the Menu command will be issued (even when selecting the icon).







If your command does not have a help file associated with it and you feel it would be helpful, contact your CadPilot Administrator (Cad Manager) to add it to the CadPilot menu.

Lorrie is a Technical Consultant for specializing in CadPilot integration, system’s analysis, technical writing and data manipulation.

Launching External Programs and CADpilot

by Mark Stefanchuk,

Yesterday I was looking at launching external applications from my favorite CAD programs. Launching standard Windows office applications are generally supported, but I wanted to see if I could launch an executable developed by someone other than Microsoft. Sure enough, there are several posts out there that document how to do this, but I thought it might be helpful to see how to handle it in both MicroStation and AutoCAD. And many of our CADpilot customers have asked the same thing, specifically “how do I launch an external application using CADpilot?” So, I’ve included a couple of CADpilot examples too.


In MicroStation this is easy. Use the “%” symbol before the application name. For example,


As long as snagit32.exe is found in a PATH folder the program will launch. If it’s not in the path then you can always be explicit. For example,

%"C:\Program Files (x86)\SDJElectra\SegmentTables\Program\segmenttables.exe"

The quotes are necessary because there are spaces in the path spec.


In AutoCAD it takes a little more effort, but you can do it. The START command will launch most windows programs found in PATH. If it’s not found in path you will need to use the SHELL command. For example,

SHELL "C:\Program Files (x86)\SDJElectra\SegmentTables\Program\segmenttables.exe"

These will start a command window which then executes the request.

You can also set up an alias by editing the acad.pgp file. To open this file in Civil3d go to the Manage tab on the ribbon menu and click “Edit Aliases”. This will open the file in notepad. You can find more information on how to add aliases for external programs from the knowledgebase article, Starting Windows programs from the AutoCAD command line.

The interesting thing about the alias file is that it is user specific. If you do a Save-As from notepad you will see that the acad.pgp file is located in the users AppData folder. It will move with the user’s roaming profile, but everyone could have a different acad.pgp.

That’s great. It gives your users control over their personal CAD environment. On the other hand, you will have to do some planning if you, as the CAD Manager, make changes to this file and want to deploy it to everyone on the team.


A somewhat biased plug – this is one of the many reasons I like CADpilot. The user can create her own aliases and you can deliver program launch commands for the whole team, or for segments of your team to a single location. Also, since CADpilot is a delivery and deployment platform you can make global changes very easily without making users exit their design session.

Ok, so for those of you already using CADpilot, launching commands is really easy. You use the “cadpilot ui run” command. In MicroStation it will look like this,

cadpilot ui run snagit32

and for AutoCAD,

(cadpilot-ui-run snagit32)

If you need to spec the whole path then use the following format.

(cadpilot-ui-run "C:/Program Files (x86)/SDJElectra/SegmentTables/Program/segmenttables.exe")

In the editor it would look like this.

On my development menu I’ve just added it as a test – like this,

It looks the same in both MicroStation and AutoCAD, there’s no DOS command shell opened when the command launches, and I only had to deploy it to one location.

I also discovered, today, that I can add my own variables to cadpilot.ui.cfg file. I added,

MYPATHVAR = C:/mydevpath/

The new commands for MicroStation and AutoCAD,

You don’t have to exit the CAD application either, just reload the menu.

If you’re not already a CADpilot user, download the demo version from

About Mark Stefanchuk: Mark is a VP and senior consultant with CAD Management Resources, Inc. He divides his time between developing innovative custom software solutions and helping clients navigate complex design automation environments. If you would like to find out how he can assist you with your design technology he can be reached by contacting us at

MicroStation Cell Copy VBA

by Mark Stefanchuk,

I’ve had several requests to update the cell copy MDL example I wrote for MicroStation SE. Thanks to Amos from Jacobs Engineering for the push earlier this year.

I had updated the MDL shortly after the first V8 release and it continued to work through V8 2004. More recent versions of MicroStation however, have introduced several changes that break this old command. Instead of just updating the MDL code, I decided to take a different approach.

The new version is written in VBA, which really simplifies the code and approach. Using the VBA IDE (integrated development environment), creating user forms (dialog boxes) is faster and easier than in MDL. And if you don’t know how to do something in VBA a quick web search will tell you how. So, for CAD managers who are pressed for time this is definitely the way to go.

The new program operates essentially like the old one. Load the source library into the left listbox. Load the destination library into the right listbox. Highlight the cells from the source library you want to add to the destination library and click the arrow button that points to the destination listbox. Click the Add button located at the bottom of the destination library listbox.

You can find a download link to the new version on our cadgurus page. The code is not locked – something I’m likely going to get grief for – “why are you giving away the store…” – “… because I like these cad manager types…”. And, as always these are examples that come with limited validation and error checking, so use at your own risk. Create backups of your libraries before modifying them with CellCopy, and be careful with the delete option. It will remove all cells from the library and you won’t be able to get them back if you haven’t first backed up the original.*

This is a MicroStation VBA. So you can load it using the “VBA Load (path + vba name)” key-in, for example “VBA LOAD C:\temp\cellcopy.mvba”. I usually use the VBA Project Manager so I can browse for the program and then set the Auto-Load option. (from the pull down menu, Utilities > Macro > Project Manager).

There are a couple of key coding points to make.

1) To copy the cells I use the information provided in the dialog box – the source and destination locations. The cell names are gathered by indexing the  destination listbox and grabbing the highlighted cell names. If the cell name is already in the library then the program will skip it.

2) Delete Cells (advanced) – I didn’t find a method in VBA to delete the cells, but I did find one in the MDL reference. This MDL function requires that you pass a pointer for the cell name string. How do you do that?!

This MicroStation V8i Bentley Community page refers to the undocumented VBA function VarPtr. It says that you should use this to pass a pointer of your char* or void*. The MDL function I used was mdlCell_deleteInLibrary and the MDL Funtion Reference says to pass a type of MSWChar const*. So, when I used VarPtr, the function didn’t work – it returned a cell not found error. Ok.

The same VarPtr discussion on the Bentley Community says to look at for more information. Here you will find several other undocumented pointer functions including StrPtr. This one works. Yay. The indexing logic for delete is the same as it is for copy and deleting cells requires these four lines.

One more thing about the example – the Windows Open File Dialog (browse for cell library) helper code (unmodified) can be found on la-solutions web site. Bookmark this site, especially if you are developing programs for MicroStation – there are plenty of great programming examples here.

* If you want to share cell copy with others on your team, but you don’t want them to be able to delete cells then just hide the delete button. You can turn off it’s visible property and/or you can just set the enabled property to false.

About Mark Stefanchuk: Mark is a senior consultant with CAD Management Resources, Inc. He divides his time between developing innovative custom software solutions and helping clients navigate complex design automation environments. If you would like to find out how he can assist you with your design technology he can be reached by contacting us at