May 20th, 2013
Written by Rod Wing.
Many times in a macro you want to save user input so that it is stored and then recalled as the program’s default values the next time they run your application. This can be done by writing these values to an ini file, or some other formatted ascii file, then reading and decoding that file the next time the user starts your application. That is the hard way, the easy way is to use the Windows Registry. VBA has a special location set aside in the Windows Registry for storing VBA program settings:
HKEY_CURRENT_USER\Software\VB and VBA Program Settings
VBA provides the GetSetting and SaveSetting functions for storing and retrieving your macro’s settings from this location.
GetSetting
The VBA GetSetting function returns a value stored in the Windows Registry. The registry values are stored and returned as String values. Any numeric, or other non-string values, must be converted to the proper type prior to assigning them to your variables or controls.
stringValue = GetSetting(appname, section, key, default)
The GetSetting function has the following arguments:
- appname – the name of your program or macro
- section – a way to subdivide your saved settings, it is usually best to use the form name or class name
- key – the control name, member name, or variable name of the item being stored
- default – the default value to use if the setting is not found in the registry
SaveSetting
The VBA SaveSetting function stores a value in the Windows Registry. Since the registry entries are stored as String values any numeric, or other non-string values, must be converted to strings prior to saving.
SaveSetting appname, section, key, setting
The SaveSetting function has the following arguments:
- appname – the name of your program or macro
- section – a way to subdivide your saved settings, it is usually best to use the form name or class name
- key – the control name, member name, or variable name of the item being stored
- setting – the value being saved in the registry, saved as a String value.
Example
The example below is the code behind a UserForm and illustrates the use of the GetSetting and SaveSetting functions. When the UserForm is loaded (or initialized) the UserForm_Initialize sub is called and reads in our default values from the registry. After the user clicks on the form’s OK button the cmdOK_Click sub is executed and the form settings are saved to the macro’s registry location.
The UserForm has three controls:
txtFileName – a Text Box for storing the name of a file
ckReadOnly – a Check Box storing our Boolean value
cmdOK – a Command Button used to trigger saving the values to the registry
You will also see that this example is storing and recalling the screen position of the user form (Top and Left values). This allows you to place the UserForm in the last location where the user had it positioned. Since the Top and Left are Long data types the Cstr() function must be used to convert them to strings when saving to the registry. Likewise the CLng() function must be used when retrieving the values out of the registry to convert them from strings back to longs.
Option Explicit
Private Sub UserForm_Initialize()
Me.txtFileName.Text = GetSetting _
("MyMacro", "Settings", "FileName", "")
Me.ckReadOnly.Value = CBool(GetSetting _
("MyMacro", "Settings", "ReadOnly", "True"))
Me.Top = CLng(GetSetting _
("MyMacro", "Settings", "FormTop", "0"))
Me.Left = CLng(GetSetting _
("MyMacro", "Settings", "FormLeft", "0"))
End Sub
Private Sub cmdOK_Click()
SaveSetting "MyMacro", "Settings", _
"FileName", Me.txtFileName.Text
SaveSetting "MyMacro", "Settings", _
"ReadOnly", CStr(Me.ckReadOnly.Value)
SaveSetting "MyMacro", "Settings", _
"FormTop", CStr(Me.Top)
SaveSetting "MyMacro", "Settings", _
"FormLeft", CStr(Me.Left)
Unload Me
End Sub
The image below shows the saved registry settings in the Registry Editor window.

Last Month’s VBA Tip – ByRef and ByVal
Don’t want to miss out on other great information? Subscribe to this blog or our monthly eNewsletter now!
Learn More ◊ Contact us today ◊ Newsletter ◊

Tags: VBA
Posted in Tips | No Comments »
May 17th, 2013
Written by Ronald Brys.
An overview of the OpenRoads technology incorporated into InRoads, GEOPAK, and MXROAD software. The general concept of terrain models, interactive corridor modeling, dynamic views, and data storage in a MicroStation file is presented.
Trouble viewing this video watch the same video on Youtube.
More on OpenRoads: How NOT to implement OpenRoads
Don’t want to miss out on other great information? Subscribe to this blog or our monthly eNewsletter now!
Learn More ◊ Contact us today ◊ Newsletter ◊

Posted in Blog | No Comments »
May 9th, 2013
How NOT to implement OpenRoads
At EnvisionCAD we have been working with OpenRoads Technology for a while now. We are updating and writing new training material for OpenRoads. [Continue Reading]
CAD Manager? What do they do anyway?
The CAD Manager can often seem to be invisible. After all, if the job is done well, you never really think about CAD Manager… [Continue Reading]
Free VBA Macro: Where Did I Come From?
This tool allows the user to select a cell in a design file and then search multiple cell libraries for a matching cell name. Cell libraries containing a matching cell name are listed in the dialog. [Get it while it's free]
Multiple CAD Heads Are Better Than One
If you multiply your CAD experts it’s going to result in infinite fun (insert slightly sarcastic tone here, unless of course you find CAD as fun as we do)! [Continue Reading]
The EnvisionCAD Theory
Behind the Scenes: Harlem Shake. [Continue Reading]
InRoads Site Training
A 3-day class using InRoads software for site design using the Site Modeler commands new in the SELECTseries releases of InRoads. This course highlights surface modeling, earthwork computations and other site design commands. Seats are still available! [Register Today!]
Corridor Modeling for GEOPAK and InRoads – 5/28/13
A 2-day class covering components, templates, and roadway designer. This course includes the workflow necessary for the migration of GEOPAK data for use with Bentley’s roadway designer technology. [Register Today!]
Mobile Apps for Video Training
We would like to announce the release of the Digital Library Video Training App for both Android and Apple mobile devices. [Continue Reading]
Tips & Tricks
InRoads: InRoads Tracking Command
VBA: ByRef and ByVal
MicroStation: Move Part of a Cell

|
|
|
|
Posted in Newsletter Archives | No Comments »
May 3rd, 2013
Written by Ron Brys

Photo by Mikie T.
At EnvisionCAD we have been working with OpenRoads Technology for a while now. We are updating and writing new training material for OpenRoads. If you are responsible for the administration of InRoads or GEOPAK for an office of 2 users or 200 users, here are just a few things NOT to do when you implement OpenRoads at your office.
1) Simply download the update and throw it on user’s machines.
Open Roads is a new technology which means new workflows, tools and resources. Users will immediately lose time in production trying to setup and locate tools that were once there.
2) Tell users to just start using it.
Surface, Cross Sections, Geometry and Site Design all have new tools and workflows. Creating design will necessitate a workflow review and a plan to teach the users the new workflows.
3) Wait until the phone rings to figure out where Templates, Roadway Designer, Cross Section and Site Modeler tools have gone.
That’s right, some of the tools that have been in InRoads since the beginning are no longer in the same spot. For users this is comparable to a Zombie Apocalypse and you will be getting a lot of calls and emails about it.
4) IRD files. What do you mean they don’t import into SS3?
InRoads Roadway Design (IRD) files are the core of any roadway project. Hours are spent defining, editing, and running the corridor. The Project Managers will not be happy with you if the users have to recreate all the work.
5) Resource development? We’ll do that later.
There is no later! Resources are the foundation of a project. They also drive the standards that are mandatory by most agencies. The XIN and DDB files that you are currently using can be implemented into OpenRoads technology but there are new resources that need to be defined.
The OpenRoads technology is powerful and the future of Bentley Civil software is bright. Just keep in mind that workflows and standards need to be reevaluated prior to implementing the software otherwise there will be lost time in production for your departments.
People also read – CAD Management – Should you outsource?
Don’t want to miss out on other great information? Subscribe to this blog or our monthly eNewsletter now!
Learn More ◊ Contact us today ◊ Newsletter ◊

Tags: administration, InRoads, OpenRoads
Posted in Blog | No Comments »
May 2nd, 2013
Written by Lisa Polonski
Edited by EnvisionCAD
The old adage, “Two heads are better than one.” has stood the test of time. From, the Doublemint® gum slogan we’re told it’s “Double your pleasure®, Double Your Fun™”, while the 90′s hit song by the Nelson brothers, took it a step further to tell us it’s “double the pleasure, triple the fun”. To the layman, the meaning is taken simply to be a testament to collaboration. Some tasks are accomplished more easily by two (or more) people working together than by just one individual left to his own devices.
Well, the same goes for CAD Management. Clearly, if you multiply your CAD experts it’s going to result in infinite fun (insert slightly sarcastic tone here, unless of course you find CAD as fun as we do)! I guess the real fun comes in when you take the proverb in its most literal form and actually multiply the heads of a CAD expert for sheer improvement! That’s an image tough to shake!
Multiple experienced CAD Managers = ↑ ease and speed of task completion

All nerdy fun aside, you could easily agree that the collaboration of multiple experienced CAD managers must result in increased ease and speed of task completion along with the well-executed solving of problems. A team of individuals with varied CAD backgrounds working together brings more expertise than any one individual standing alone. AutoCAD, Civil3D, Map 3D, 3DS Max Design, MicroStation, InRoads, GEOPAK, Bentley Map, ERSI, GIS, and Survey are just some of the technologies that a strong CAD manager candidate must know how to navigate to be successful. This is where a partnership with a team of multiple individuals clearly comes in ahead.
CAD Managed Services offers the benefit of “multiple CAD heads”, without the human engineering required to create a monster! It’s also devoid of the overhead related to hiring several CAD managers internally. It offers the expertise of many at minimal cost related to the realized ROI. Now that’s proof that “multiple CAD heads are better than one”!
For more insight on just what the multi-headed solution can offer check out this combined resume. For further information about CAD Managed Services fill out a contact form or give us a call at 608.836.3903.
People also read – CAD Management – Should you outsource?
Don’t want to miss out on other great information? Subscribe to this blog or our monthly eNewsletter now!
Learn More ◊ Contact us today ◊ Newsletter ◊

Posted in Blog | No Comments »
April 30th, 2013
Written by Bob Mecham.
Do you find yourself needing to move only a part of a cell and your CAD Manager tells you not to drop any cells? Well here is a way to do both.
Using the Stretch Elements command you can move elements within the cell. In this example, I have a Bar scale cell that needs the text moved from the bottom to the top.

1. Select the Stretch Elements icon.
2. In the Tool Settings dialog check ON Stretch Cells.
3. Place two data points to define the fence.
4. Place a data point in the view to move the elements.
Before:

After:

People who liked this also read: Change AccuDraw Display
Don’t want to miss out on other great information? Subscribe to our monthly eNewsletter now!
Learn More ◊ Contact us today ◊ Newsletter ◊

Tags: Cell, MicroStation
Posted in Tips | No Comments »
April 30th, 2013
Written by Rod Wing.
The ByRef and ByVal keywords are used when passing variables to subroutines and functions. Passing arguments by reference (ByRef) passes the memory location of the variable which means that any changes made to the variable during the procedure are permanent. Passing arguments by value (ByVal) only passes a copy of the variable so that any changes to the variable during the procedure are only made on the copy. If neither qualifier is specified the variable is passed ByRef.
Example
In the example below, three variables (i,j,k) are passed to the sub AddOne. The variable i is passed with no qualifier, j is passed ByRef, and k is passed ByVal. The values for all three variables are printed out after returning from the sub. Note that the value for i is updated just as the value for j while the value for k is unchanged.
Public Sub MyMacro()
Dim i As Long
Dim j As Long
Dim k As Long
i = 10
j = 10
k = 10
AddOne i, j, k
Debug.Print "i=" & CStr(i) & ", j=" & CStr(j) & ", k=" & CStr(k)
End Sub
Private Sub AddOne(i As Long, ByRef j As Long, ByVal k As Long)
i = i + 1
j = j + 1
k = k + 1
End Sub

Previous VBA Tip: Putting Your Macro to Sleep
Don’t want to miss out on other great information? Subscribe to this blog or our monthly eNewsletter now!
Learn More ◊ Contact us today ◊ Newsletter ◊

Tags: VBA
Posted in Tips | No Comments »
April 29th, 2013
Written by Ronald Brys.
Dynamic reporting and annotation of surface and alignment data.
Trouble viewing this video watch the same video on Youtube.
Tags: EnvisionCAD, Geometry, InRoads, Surface
Posted in Video Tips | No Comments »
April 26th, 2013
Written by Bethany Borsody.
By now most everyone has heard about and seen the Harlem Shake videos that became wildly popular. But just like most fads, they got old quickly. From that perspective Bob had an idea for our very own Harlem Shake video. The Harlem Shake video featuring Bob and accompanied by Eric and myself can be seen here.
Below are ‘behind the scenes’ photos. You’ll see that no Camcorders were involved in the producing of this video. Instead Bob’s phone was strategically rubber-banded to a tripod in order to capture footage. But is just one angle of this video enough? Of course not. Therefore Eric set up his phone on top of a ladder to catch a completely different view of the action. Did too much thought go into producing this video? Perhaps. Was it worth it? We think yes.



Previous ‘The EnvisionCAD Theory’ Blogs:
OpenRoads Release
Introduction
Don’t want to miss out on future EnvisionCAD Theory blogs? Subscribe to this blog and our monthly eNewsletter now!
Learn More ◊ Contact us today ◊ Newsletter ◊

Tags: EnvisionCAD, EnvisionCAD Theory
Posted in Blog | No Comments »
April 25th, 2013
Written by Bob Mecham
The CAD Manager can often seem to be invisible. After all, if the job is done well, you never really think about CAD Manger. Things just work. When new software is released, a new plotter is delivered, or standards need maintenance, things get upgraded, set up, and continue to work. Whether you have the title of CAD Manager or you are just trying to manage your company’s CAD system on your own time and the weekends, no one really seems to notice the impact.
No one notices the efforts of the CAD Manager until he changes jobs and there is no longer a CAD Manager. Then they say, “Well, it used to work.”
It just so happens, within a week, I received calls from two different individuals that had recently changed jobs and were trying to complete project work. Both had years of CAD and Design experience but neither had served in CAD Manager roles. As they were trying to complete projects, they found themselves spending more time trying to comply with the client standards than actually working on the design. The individuals realized quickly the lost time in production as they were fighting client standards and deliverables.

Photo by Mikie T.
I’m not writing this so that us CAD managers can cry in our beers. Rather, as CAD Managers it is necessary that we toot our own horns and be our own agents.
When you complete a project, whether it is deploying a client standard or setting up a plotting solution, make sure everyone knows about it and make note of any time and cost savings that were associated with it. Hard data related to specific tasks you execute can be invaluable, especially related to ROI. The CAD Managers I know are a humble group and enjoy what they do, but in today’s world of social media you need to make sure you are out in front and being heard.
For those of you just realizing the importance of a Managed CAD solution who still do not have the time or resources to handle it internally, consider outsourcing your CAD Management. An outsourced CAD Manager will not only get all of your CAD software compliant with company standards, they will also help with upgrades and automated tasks that take you out of production.
How do you make sure that your work is noticed? Share your CAD Manager story below.
People also read - CAD Management – Should you outsource?
Don’t want to miss out on other great information? Subscribe to this blog or our monthly eNewsletter now!
Learn More ◊ Contact us today ◊ Newsletter ◊

Tags: administration, CAD Management
Posted in Blog | 1 Comment »