
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Envision CAD &#124; MicroStation Training &#38; InRoads Training &#187; Tips</title>
	<atom:link href="http://envisioncad.com/category/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://envisioncad.com</link>
	<description>CAD Resources &#38; Training</description>
	<lastBuildDate>Thu, 26 Jan 2012 14:52:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Clean Up After&#160;Yourself</title>
		<link>http://envisioncad.com/tips/clean-up-after-yourself/</link>
		<comments>http://envisioncad.com/tips/clean-up-after-yourself/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 14:46:03 +0000</pubDate>
		<dc:creator>Matt Jacoby</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://envisioncad.com/?p=3090</guid>
		<description><![CDATA[You have probably heard some of these simple rules of life:
- If you open something, close it
- If you turn something on, turn it off
- If you spill something, wipe it up
These same rules apply to macro development. Many programmers get sloppy because they assume the computer will clean up for them. In most cases [...]]]></description>
			<content:encoded><![CDATA[<p>You have probably heard some of these simple rules of life:<br />
- If you open something, close it<br />
- If you turn something on, turn it off<br />
- If you spill something, wipe it up</p>
<p>These same rules apply to macro development. Many programmers get sloppy because they assume the computer will clean up for them. In most cases it does, but not always as soon as we would like. It is always good practice to clean up after yourself when exiting a routine or macro. This means closing any files you opened, unloading forms, etc.</p>
<p>Review the following function. You will see that the function level objects eEnum and eScan are set to Nothing prior to exiting.</p>
<p><code>Public Function ScanText() As Boolean<br />
    Dim eEnum As ElementEnumerator<br />
    Dim eScan As ElementScanCriteria</p>
<p>    Set eScan = New ElementScanCriteria<br />
    With eScan<br />
        .ExcludeAllTypes<br />
        .IncludeType msdElementTypeText<br />
    End With</p>
<p>    Set eEnum = ActiveModelReference.Scan(eScan)</p>
<p>    Do While eEnum.MoveNext<br />
        '<br />
        ' do something with the text elements<br />
        '<br />
    Loop</p>
<p>    Set eEnum = Nothing<br />
    Set eScan = Nothing<br />
    ScanText = True<br />
End Function</code></p>
<p>For global (or Public) objects that are used by multiple routines you will need to construct an exit routine to be used as a common exit point for your macro. In the example below the ExitMacro routine unloads any forms and sets all public objects to Nothing.</p>
<p><code>Public gMyCollection As Collection<br />
Public Sub MyMacro()<br />
    Set gMyCollection = New Collection</p>
<p>    frmMacro.Show<br />
End Sub</p>
<p>Public Sub ExitMacro()<br />
    Unload frmMacro<br />
    Set gMyCollection = Nothing<br />
End Sub</code></p>
]]></content:encoded>
			<wfw:commentRss>http://envisioncad.com/tips/clean-up-after-yourself/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VBA&#160;Help</title>
		<link>http://envisioncad.com/tips/vba-help/</link>
		<comments>http://envisioncad.com/tips/vba-help/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 16:43:29 +0000</pubDate>
		<dc:creator>Matt Jacoby</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://envisioncad.com/?p=3061</guid>
		<description><![CDATA[MicroStation VBA has a very robust help system with many examples for common tasks. To get help on a VBA function, property, etc. hit F2 on the keyboard to open the Object Browser. Selecting an item in the browser window will display the arguments and return value for the object. For more information right click [...]]]></description>
			<content:encoded><![CDATA[<p>MicroStation VBA has a very robust help system with many examples for common tasks. To get help on a VBA function, property, etc. hit <strong>F2</strong> on the keyboard to open the <strong><em>Object Browser</em></strong>. Selecting an item in the browser window will display the arguments and return value for the object. For more information right click to display the pop-up menu and select <strong>Help</strong> from the list.</p>
<p>￼<img src="/wp-content/images/vbahelp-1.jpg" border="0" alt="" /></p>
<p>The MicroStation VBA help window will open with the help information displayed for the selected object. Many items will have additional code examples to get a better understanding of how the object is used. If additional examples are available the <strong>Example</strong> link will be highlighted. Click on the link to view the example(s).<br />
￼<br />
￼<img src="/wp-content/images/vbahelp-2.jpg" border="0" alt="" /></p>
<p>If multiple examples for the object are available you will be prompted to select the one that most closely matches your need.</p>
<p>￼<img src="/wp-content/images/vbahelp-3.jpg" border="0" alt="" /><br />
￼<br />
The example code is displayed in the right pane of the help window. The object you selected will be used in the code sample and it will be highlighted.<br />
￼<br />
￼<img src="/wp-content/images/vbahelp-4.jpg" border="0" alt="" /></p>
<p>Additional code examples are available by expanding the <strong>Examples</strong> folder under the <strong><em>Contents</em></strong> tab on the left side of the help window.</p>
]]></content:encoded>
			<wfw:commentRss>http://envisioncad.com/tips/vba-help/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Optimized Fence&#160;Clipping</title>
		<link>http://envisioncad.com/tips/optimized-fence-clipping/</link>
		<comments>http://envisioncad.com/tips/optimized-fence-clipping/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 22:47:20 +0000</pubDate>
		<dc:creator>Matt Jacoby</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[fence]]></category>

		<guid isPermaLink="false">http://envisioncad.com/?p=2920</guid>
		<description><![CDATA[There is a toggle that will allow you to fence clip elements in different fashions.  Depending on how you want to your fence clipping operation to perform, it can automatically close shapes, surfaces and solids or you can trim the elements.   Under Workspace>Preferences>Operation there is the option to Optimized Fence Clipping.  [...]]]></description>
			<content:encoded><![CDATA[<p>There is a toggle that will allow you to fence clip elements in different fashions.  Depending on how you want to your fence clipping operation to perform, it can automatically close shapes, surfaces and solids or you can trim the elements.   Under <strong>Workspace>Preferences>Operation</strong> there is the option to <strong>Optimized Fence Clipping</strong>.  </p>
<p>￼<img src="/wp-content/images/fenceclipping-1.jpg" alt="" /></p>
<p>The operations copy, move, rotate, scale, mirror and stretch would all work similarly.<br />
The following screen shots show you the end result of the Fence Clip Delete command. The three blue elements are going to be deleted by the fence using the clip mode.</p>
<p> ￼￼<img src="/wp-content/images/fenceclipping-2.jpg" alt="" /></p>
<p>If “Use Optimized Fence Clipping” is toggled off the fence clipping operation will drop the closed shapes to individual elements as shown below.</p>
<p>￼￼<img src="/wp-content/images/fenceclipping-3.jpg" alt="" /></p>
<p>If “Use Optimized Fence Clipping” is toggled on the fence clipping operation will automatically close the shapes for you as shown below. </p>
<p>￼￼<img src="/wp-content/images/fenceclipping-4.jpg" alt="" /></p>
<p>By default “Use Optimized Fence Clipping” option is toggled ON.  </p>
<p>I find myself using this option when I am working with contours that are closed shapes and I need to clip out a section of contours.  I will turn Optimized Fence Clipping off so when the contours are clipped I am not left with a vertical wall of contours.</p>
]]></content:encoded>
			<wfw:commentRss>http://envisioncad.com/tips/optimized-fence-clipping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Protecting&#160;VBA’s</title>
		<link>http://envisioncad.com/tips/protecting-vbas/</link>
		<comments>http://envisioncad.com/tips/protecting-vbas/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 22:33:04 +0000</pubDate>
		<dc:creator>Matt Jacoby</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://envisioncad.com/?p=2922</guid>
		<description><![CDATA[If you have done much MicroStation VBA development at all you realize how easy it is for a casual or curious user to open the VBA Editor and possibly break your code.  For internal company deployments you can modify the security on the .mvba files so that these users have read-only access. When distributing [...]]]></description>
			<content:encoded><![CDATA[<p>If you have done much MicroStation VBA development at all you realize how easy it is for a casual or curious user to open the VBA Editor and possibly break your code.  For internal company deployments you can modify the security on the .mvba files so that these users have read-only access. When distributing your VBA’s to clients or consultants you may not have that level of control. The VBA Editor allows for password protecting your .mvba files. By protecting your files with a password users are still able to run the macros but cannot view or edit the source code without entering the password.</p>
<p>To password protect your VBA macro:</p>
<ol>
<li>Select <strong>Tools > Default Properties</strong> from the VBA Editor top menu bar.</li>
<li>In the Project Properties dialog click the <strong>Protection</strong> tab.</li>
<li>Enter your password into the password fields at the bottom</li>
<li>Click the <strong>OK</strong> button in the dialog to save the password</li>
</ol>
<p><img src="/wp-content/images/protectingvbas.png" alt="" /></p>
<p><strong>Note:</strong> This password protection offers only minimal protection for your VBA. There are many VBA password cracking tools available that will allow more sophisticated users to bypass this protection measure.</p>
]]></content:encoded>
			<wfw:commentRss>http://envisioncad.com/tips/protecting-vbas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Annotate MicroStation Graphics with&#160;InRoads</title>
		<link>http://envisioncad.com/tips/annotate-microstation-graphics-with-inroads/</link>
		<comments>http://envisioncad.com/tips/annotate-microstation-graphics-with-inroads/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 14:05:12 +0000</pubDate>
		<dc:creator>Matt Jacoby</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[annotate]]></category>
		<category><![CDATA[InRoads]]></category>

		<guid isPermaLink="false">http://envisioncad.com/?p=2880</guid>
		<description><![CDATA[Now you can annotate MicroStation graphics using an InRoads Feature Style.  This will allow you to label lines and arcs just as you would without having to import the data into a Geometry Project.

From the InRoads pull down menu  File > View Geometry > Annotate Graphics. The Annotate Graphics dialog will appear.
Select a Feature [...]]]></description>
			<content:encoded><![CDATA[<p>Now you can annotate MicroStation graphics using an InRoads Feature Style.  This will allow you to label lines and arcs just as you would without having to import the data into a Geometry Project.</p>
<ol>
<li>From the InRoads pull down menu <strong> File > View Geometry > Annotate Graphics</strong>. The Annotate Graphics dialog will appear.</li>
<li>Select a Feature Style name.</li>
<li><strong>&lt;D&gt;</strong> the <strong>Apply</strong> button the dialog will minimize allowing you to identify a graphic.</li>
<li><strong>&lt;D&gt;</strong> to <strong>Accept</strong> the graphic then <strong>&lt;R&gt;</strong> to complete the command.</li>
</ol>
<p><img src="/wp-content/images/annotategraphics1.jpg" border="0" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://envisioncad.com/tips/annotate-microstation-graphics-with-inroads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the Macro Recorder to Capture&#160;Commands</title>
		<link>http://envisioncad.com/tips/using-the-macro-recorder-to-capture-commands/</link>
		<comments>http://envisioncad.com/tips/using-the-macro-recorder-to-capture-commands/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 22:09:02 +0000</pubDate>
		<dc:creator>Matt Jacoby</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://envisioncad.com/?p=2878</guid>
		<description><![CDATA[The MicroStation VBA Macro Recorder is a useful tool beyond just capturing workflows for creating your own macros. A common dilemma for users wanting to create Batch Process scripts, or their own custom toolboxes is knowing the key-in commands they need for the task they want to accomplish. Using the Macro Recorder to capture the [...]]]></description>
			<content:encoded><![CDATA[<p>The MicroStation VBA Macro Recorder is a useful tool beyond just capturing workflows for creating your own macros. A common dilemma for users wanting to create Batch Process scripts, or their own custom toolboxes is knowing the key-in commands they need for the task they want to accomplish. Using the Macro Recorder to capture the necessary commands in a vba macro can provide the key-in entries required for both applications. The command in double quotes after the CadInputQueue.SendCommand statement can be copied and pasted into a Batch Processor script, or used for the Key-in entry for a custom toolbox button.</p>
<p>Sample MicroStation commands captured using the VBA Macro Recorder<br />
￼<br />
<code><br />
Sub Macro1()<br />
        Dim startPoint As Point3d<br />
	Dim point As Point3d, point2 As Point3d<br />
        Dim lngTemp As Long</p>
<p>        ' Start a command<br />
        CadInputQueue.SendCommand "CHOOSE ALL"</p>
<p>        CadInputQueue.SendCommand "CHOOSE NONE"</p>
<p>        CadInputQueue.SendCommand "PLACE DIALOGTEXT ICON"</p>
<p>        CommandState.StartDefaultCommand<br />
End Sub<br />
</code></p>
<p> Copy and pasting a command into a Batch Process script file<br />
￼<br />
<img src="/wp-content/images/macro_recorder1.jpg" border="0" alt="" /></p>
<p>Copying a command key-in to create a custom toolbox button.</p>
<p><img src="/wp-content/images/macro_recorder2.jpg" border="0" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://envisioncad.com/tips/using-the-macro-recorder-to-capture-commands/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Use Constants for Common&#160;Values</title>
		<link>http://envisioncad.com/tips/use-constants-for-common-values/</link>
		<comments>http://envisioncad.com/tips/use-constants-for-common-values/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 21:47:16 +0000</pubDate>
		<dc:creator>Matt Jacoby</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://envisioncad.com/?p=2830</guid>
		<description><![CDATA[Some developers will calculate common values in code every time they are needed in an
application. This slows down your application as it has to calculate the value every time.
Others will enter in the straight numeric value, which is just frowned upon programming
practice. The best way to handle these values is to use VBA Constants.
'Common degree [...]]]></description>
			<content:encoded><![CDATA[<p>Some developers will calculate common values in code every time they are needed in an<br />
application. This slows down your application as it has to calculate the value every time.<br />
Others will enter in the straight numeric value, which is just frowned upon programming<br />
practice. The best way to handle these values is to use VBA Constants.</p>
<p><code>'Common degree values in Radians<br />
Public Const RAD_90 As Double = 1.5707963267949<br />
Public Const RAD_180 As Double = 3.1415926535898<br />
Public Const RAD_270 As Double = 4.7123889803847<br />
Public Const RAD_360 As Double = 6.2831853071796</p>
<p>'Geometric related constants<br />
Public Const PI As Double = 3.14159265358979<br />
Public Const PId2 As Double = 1.5707963267949<br />
Public Const PIx2 As Double = 6.28318530717959<br />
Public Const ONE_THIRD As Double = 0.33333333<br />
Public Const FOUR_THIRDS As Double = 1.33333333</code></p>
<p>When the constants are defined in a code module they can be used anywhere in your<br />
project like in the following routines.</p>
<p><code>Public Function GetBearingAngle(ByVal deltaX As Double, ByVal deltaY As Double, _<br />
ByRef strNS As String, ByRef strEW As String) as Double</p>
<p>Dim dAngle As Double</p>
<p>dAngle = Atn2(deltaX, deltaY)</p>
<p>Select Case True<br />
Case (dAngle <= RAD_90)<br />
strNS = "N"<br />
strEW = "E"</p>
<p>Case (dAngle <= RAD_180)<br />
strNS = "S"</p>
<p>strEW = "E"<br />
dAngle = RAD_180 - dAngle</p>
<p>Case (dAngle <= RAD_270)<br />
strNS = "S"<br />
strEW = "W"<br />
dAngle = RAD_90 - ((dAngle - RAD_270) * -1)</p>
<p>Case Else<br />
strNS = "N"<br />
strEW = "W"<br />
dAngle = RAD_360 - dAngle<br />
End Select</p>
<p>'Angle is returned in decimal degrees, must be converted to DMS<br />
GetBearingAngle = dAngle<br />
End Sub</p>
<p>Public Function AreaCircle(ByVal dRadius As Double) As Double<br />
AreaCircle = PI * (dRadius ^ 2)<br />
End Function</p>
<p>Public Function CircumferenceCircle(ByVal dRadius As Double) As Double<br />
CircumferenceCircle = 2 * PI * dRadius<br />
End Function</p>
<p>Public Function AreaSphere(ByVal dRadius As Double) As Double<br />
AreaSphere = 4 * PI * (dRadius ^ 2)<br />
End Function</p>
<p>Public Function VolumeSphere(ByVal dRadius As Double) As Double<br />
VolumeSphere = FOUR_THIRDS * PI * (dRadius ^ 3)<br />
End Function</code></p>
]]></content:encoded>
			<wfw:commentRss>http://envisioncad.com/tips/use-constants-for-common-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autorun MicroStation&#160;VBA</title>
		<link>http://envisioncad.com/tips/autorun-microstation-vba/</link>
		<comments>http://envisioncad.com/tips/autorun-microstation-vba/#comments</comments>
		<pubDate>Wed, 10 Aug 2011 21:58:38 +0000</pubDate>
		<dc:creator>Matt Jacoby</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://envisioncad.com/?p=2711</guid>
		<description><![CDATA[A common question asked by new VBA developers is how to automatically start a macro when you start MicroStation. There are several steps involved in this process.

Set your VBA project to autoload when MicroStation starts. This can be done by either adding the name of your VBA project to the MS_VBAAUTOLOADPROJECTS workspace variable, or by [...]]]></description>
			<content:encoded><![CDATA[<p>A common question asked by new VBA developers is how to automatically start a macro when you start MicroStation. There are several steps involved in this process.</p>
<ol>
<li>Set your VBA project to autoload when MicroStation starts. This can be done by either adding the name of your VBA project to the MS_VBAAUTOLOADPROJECTS workspace variable, or by simply checking the Auto-Load column in the VBA Project Manager dialog.</li>
<li>In your code module you must create a sub named OnProjectLoad. This sub will be executed when your macro is loaded by MicroStation.</li>
<li>The VBA is loaded prior to the MicroStation Manager dialog being displayed, or any file being opened. This means you must add in an event handler to monitor for file open and close events so that the VBA will know when MicroStation has opened a file.</li>
<li>After the VBA knows a file is open you can call other Sub and/or Function routines to operate on the file.</li>
</ol>
<p>The example code modules below show the required subs to automatically run a VBA macro.</p>
<p><strong>Module Code</strong><br />
<code><br />
Dim myOpen As clsFileOpenClose</p>
<p>Sub OnProjectLoad()<br />
    '<br />
    ' Autorun macro code goes here<br />
    '<br />
    MsgBox "Your macro is loaded – Welcome to MicroStation!"<br />
    MonitorFileOpenClose<br />
End Sub</p>
<p>Sub MonitorFileOpenClose()<br />
    Set myOpen = New clsFileOpenClose<br />
End Sub</p>
<p>Class Module Code - clsFileOpenClose<br />
Dim WithEvents objApp As Application<br />
Private isFirstFile As Boolean</p>
<p>Private Sub Class_Initialize()<br />
    Set objApp = Application<br />
    isFirstFile = True<br />
End Sub</p>
<p>Private Sub objApp_OnDesignFileClosed(ByVal FileName As String)<br />
    MsgBox "Closing file " &#038; FileName, vbInformation<br />
End Sub</p>
<p>Private Sub objApp_OnDesignFileOpened(ByVal FileName As String)<br />
    '<br />
    ' Do something different if this is the first file<br />
    '<br />
    If isFirstFile Then<br />
        MsgBox "Your first file is open: " &#038; FileName<br />
            &#038; vbCrLf &#038; "Have a great CAD experience!", vbInformation    </p>
<p>        isFirstFile = False<br />
    Else<br />
        MsgBox "Opening file " &#038; FileName, vbInformation<br />
    End If</p>
<p>    '<br />
    ' Call your automatic processing sub/function code from here<br />
    '<br />
End Sub<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://envisioncad.com/tips/autorun-microstation-vba/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>3D Primitive Solids Slab and&#160;Pyramid</title>
		<link>http://envisioncad.com/tips/3d-primitive-solids-slab-and-pyramid/</link>
		<comments>http://envisioncad.com/tips/3d-primitive-solids-slab-and-pyramid/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 20:12:04 +0000</pubDate>
		<dc:creator>Matt Jacoby</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[solid]]></category>

		<guid isPermaLink="false">http://envisioncad.com/?p=2667</guid>
		<description><![CDATA[In this tutorial we will demonstrate the 3D primitive solids tools using AccuDraw. We will build a street light using the Slab Solid and Pyramid Solid tools.

]]></description>
			<content:encoded><![CDATA[<p>In this tutorial we will demonstrate the 3D primitive solids tools using AccuDraw. We will build a street light using the Slab Solid and Pyramid Solid tools.</p>
<p><embed src="http://blip.tv/play/AYLGymMC" type="application/x-shockwave-flash" width="480" height="300" wmode="transparent" allowscriptaccess="always" allowfullscreen="true" ></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://envisioncad.com/tips/3d-primitive-solids-slab-and-pyramid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MicroStation&#160;GetInput</title>
		<link>http://envisioncad.com/tips/microstation-getinput/</link>
		<comments>http://envisioncad.com/tips/microstation-getinput/#comments</comments>
		<pubDate>Mon, 11 Jul 2011 19:56:09 +0000</pubDate>
		<dc:creator>Matt Jacoby</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://envisioncad.com/?p=2660</guid>
		<description><![CDATA[For those of you still wanting to convert MicroStation User Commands (UCM’s) to VBA
one way to ease your transition is to use the VBA CadInputQueue.GetInput method for
getting input from the user. This method most closely mimics the GET function in the
UCM language.
The example function below shows how you can use the GetInput method for placing [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you still wanting to convert MicroStation User Commands (UCM’s) to VBA<br />
one way to ease your transition is to use the VBA CadInputQueue.GetInput method for<br />
getting input from the user. This method most closely mimics the GET function in the<br />
UCM language.</p>
<p>The example function below shows how you can use the GetInput method for placing a<br />
fence block. There is also a good example of using GetInput in the MicroStation VBA<br />
Help examples.</p>
<p><code>Public Function PlaceFenceBlock() As Boolean<br />
Dim ciMessage As CadInputMessage<br />
Dim IsFirstPoint As Boolean</p>
<p>PlaceFenceBlock = False<br />
IsFirstPoint = True<br />
CadInputQueue.SendKeyin "Place Fence Block"</p>
<p>Do While True<br />
Set ciMessage = CadInputQueue.GetInput</p>
<p>Select Case ciMessage.InputType<br />
'<br />
' User Keyin Input<br />
'<br />
Case msdCadInputTypeKeyin<br />
CadInputQueue.SendKeyin ciMessage.Keyin</p>
<p>'<br />
' Users selects a different MicroStation command<br />
'<br />
Case msdCadInputTypeCommand</p>
<p>CadInputQueue.SendReset<br />
CommandState.StartDefaultCommand<br />
Exit Function</p>
<p>'<br />
' User clicks Reset<br />
'<br />
Case msdCadInputTypeReset<br />
CadInputQueue.SendReset</p>
<p>'<br />
' If the user has not clicked any data points<br />
' then exit the function<br />
' otherwise reset flag to the first point<br />
'<br />
If IsFirstPoint Then<br />
CommandState.StartDefaultCommand<br />
Exit Function<br />
Else<br />
IsFirstPoint = True<br />
End If</p>
<p>'<br />
' User clicks Data Point<br />
'<br />
Case msdCadInputTypeDataPoint<br />
CadInputQueue.SendDataPoint ciMessage.Point<br />
End Select</p>
<p>If IsFirstPoint Then<br />
IsFirstPoint = False<br />
Else<br />
Exit Do<br />
End If<br />
Loop</p>
<p>PlaceFenceBlock = True<br />
End Function</code></p>
<p><strong>Note:</strong> Use caution if using the GetInput method in combination with UserForms as<br />
incorrect implementation can cause MicroStation lock up.</p>
]]></content:encoded>
			<wfw:commentRss>http://envisioncad.com/tips/microstation-getinput/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

