<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Automatically generate plots with VBA</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21826/automatically-generate-plots-with-vba</link><description>Bentley View, MicroStation, PowerDraft</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>Automatically generate plots with VBA</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21826/automatically-generate-plots-with-vba</link><pubDate>Thu, 09 Jul 2015 15:03:25 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:6877f13e-1181-4e74-9772-fbc1e8e0a224</guid><dc:creator>Maggie Fortescue</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21826/automatically-generate-plots-with-vba#comments</comments><description>Current Revision posted to MicroStation Wiki by Maggie Fortescue on 7/9/2015 3:03:25 PM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img style="border-width:0px;" alt=" " src="/cfs-file.ashx/__key/communityserver-components-sitefiles/TSG-Logo.png" width="189" height="60" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table style="width:500px;background-color:#dce5f0;border:#dce5f0 0px solid;" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MicroStation&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;08.11.09.578&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Environment:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Windows 7 32 bit,Windows 7 64 bit&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Programming&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Subarea:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;VBA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tristan Anderson, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Background Information&lt;/h1&gt;
&lt;p&gt;The question of how to simplify the creation of plots is often raised. If you want to create a plot, there are several steps that are generally necessary. If the plot is finished being created, there are often adjustments that were forgotten or steps performed incorrectly.&lt;/p&gt;
&lt;p&gt;To prevent these problems, you can automate the settings.&lt;/p&gt;
&lt;p&gt;MicroStation provides an example of a large amount of keyboard shortcuts that allow &amp;nbsp;full control of plots.&lt;/p&gt;
&lt;p&gt;This is a simple example for creating PDF documents.&lt;/p&gt;
&lt;h1&gt;Steps&lt;/h1&gt;
&lt;p&gt;First of all, we have to find out which Key-in commands MicroStation provides for plotting.&lt;/p&gt;
&lt;p&gt;All Key-in commands start with the keyword &amp;quot;print&amp;quot;, but the list will be empty at first, shown below:&lt;/p&gt;
&lt;p&gt;&lt;img src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-38/pri1.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;To display the list of commands, give the order &amp;quot;mdl load plotdlg&amp;quot;:&lt;/p&gt;
&lt;p&gt;&lt;img src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-38/pri2.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;In this example, I have used &amp;quot;silentload&amp;quot; rather than &amp;quot;load&amp;quot;. These commands do the same thing, but &amp;quot;silentload&amp;quot; does not show a dialog box.&lt;/p&gt;
&lt;p&gt;This is often desirable if you do not want the PlotPreview or for performance reasons.&lt;/p&gt;
&lt;p&gt;After loading the application, all key-in commands will be displayed:&lt;/p&gt;
&lt;p&gt;&lt;img src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-38/pri3.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The individual Key-in Command can easily be combined with a macro. Here is a summary of Key-in Commands in a VBA macro. For this, the &amp;quot;CadInputQueue.SendKeyin&amp;quot; VBA command is needed to be able to run VBA Key-ins. In this example, the following steps were performed:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select a driver. In this example, the PDF driver was used.&lt;/li&gt;
&lt;li&gt;Select a paper size: In this example, ANSI D was used.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Customizing the plot on paper:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Maximize plot&lt;/li&gt;
&lt;li&gt;Run the plot with the file-name of the PDF file using the VBA command from the current drawing name, model name, and extension.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Sub  printPDF ()
 
&amp;#39;All print load commands and view the Key-in dialog
CadInputQueue.SendKeyin &amp;quot;mdl load plotdlg&amp;quot;
 
Select &amp;#39;driver, here output to PDF
CadInputQueue.SendKeyin &amp;quot;print driver pdf.pltcfg&amp;quot;
 
&amp;#39;Specify paper size
CadInputQueue.SendKeyin &amp;quot;print paper-name ANSI D&amp;quot;
 
Fit &amp;#39;drawing
CadInputQueue.SendKeyin &amp;quot;print boundary fit all&amp;quot;
 
&amp;#39;Maximize plot size
CadInputQueue.SendKeyin &amp;quot;print maximize&amp;quot;
 
&amp;#39;Output of the PDF file in the same path of the drawing with model name and extension PDF:
Dim  file-name As  String
dateiname = ActiveDesignFile.FullName + &amp;quot;--&amp;quot; + ActiveModelReference.Name + &amp;quot;-PDFPLOT.PDF&amp;quot;
CadInputQueue.SendKeyin &amp;quot;print execute &amp;quot; + dateiname
 
End Sub&lt;/pre&gt;
&lt;blockquote style="margin-right:0px;" dir="ltr"&gt;
&lt;pre style="background:#ffffff;text-transform:none;font-weight:normal;color:#000000;font-style:normal;letter-spacing:normal;line-height:normal;text-indent:0px;"&gt;&lt;/pre&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: VBAWindows 7 32 bit, MicroStation, Windows 7 64 bit, Programming, en, 08.11.09.578, SELECTsupport&lt;/div&gt;
</description></item><item><title>Automatically generate plots with VBA</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21826/automatically-generate-plots-with-vba/revision/3</link><pubDate>Wed, 08 Jul 2015 20:40:41 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:6877f13e-1181-4e74-9772-fbc1e8e0a224</guid><dc:creator>Maggie Fortescue</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21826/automatically-generate-plots-with-vba#comments</comments><description>Revision 3 posted to MicroStation Wiki by Maggie Fortescue on 7/8/2015 8:40:41 PM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img style="border-width:0px;" alt=" " src="/cfs-file.ashx/__key/communityserver-components-sitefiles/TSG-Logo.png" width="189" height="60" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table style="width:500px;background-color:#dce5f0;border:#dce5f0 0px solid;" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MicroStation&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;08.11.09.578&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Environment:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Windows 7 32 bit,Windows 7 64 bit&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Programming&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Subarea:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;VBA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tristan Anderson, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Background Information&lt;/h1&gt;
&lt;p&gt;The question of how to simplify the creation of plots is often raised. If you want to create a plot, there are several steps that are generally necessary. If the plot is finished being created, there are often adjustments that were forgotten or steps performed incorrectly.&lt;/p&gt;
&lt;p&gt;To prevent these problems, you can automate the settings.&lt;/p&gt;
&lt;p&gt;MicroStation provides an example of a large amount of keyboard shortcuts that allow a full control of plots.&lt;/p&gt;
&lt;p&gt;This is a simple example for creating PDF documents.&lt;/p&gt;
&lt;h1&gt;Steps&lt;/h1&gt;
&lt;p&gt;First of all, we have to find out which Key-in commands MicroStation provides for plotting.&lt;/p&gt;
&lt;p&gt;All Key-in commands start with the keyword &amp;quot;print&amp;quot;, but the list will be empty at first, shown below:&lt;/p&gt;
&lt;p&gt;&lt;img src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-38/pri1.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;To display the list of commands, give the order &amp;quot;mdl load plotdlg&amp;quot;:&lt;/p&gt;
&lt;p&gt;&lt;img src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-38/pri2.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;In this example, I have used &amp;quot;silentload&amp;quot; rather than &amp;quot;load&amp;quot;. These commands do the same thing, but &amp;quot;silentload&amp;quot; does not show a dialog box.&lt;/p&gt;
&lt;p&gt;This is often desirable if you do not want the PlotPreview or for performance reasons.&lt;/p&gt;
&lt;p&gt;After loading the application, all key-in commands will be displayed:&lt;/p&gt;
&lt;p&gt;&lt;img src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-38/pri3.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The individual Key-in Command can easily be combined with a macro. Here is a summary of Key-in Commands in a VBA macro. For this, the &amp;quot;CadInputQueue.SendKeyin&amp;quot; VBA command is needed to be able to run VBA Key-ins. In this example, the following steps were performed:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select a driver. In this example, the PDF driver was used.&lt;/li&gt;
&lt;li&gt;Select a paper size: In this example, ANSI D was used.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Customizing the plot on paper:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Maximize plot&lt;/li&gt;
&lt;li&gt;Run the plot with the file-name of the PDF file using the VBA command from the current drawing name, model name, and extension.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Sub  printPDF ()
 
&amp;#39;All print load commands and view the Key-in dialog
CadInputQueue.SendKeyin &amp;quot;mdl load plotdlg&amp;quot;
 
Select &amp;#39;driver, here output to PDF
CadInputQueue.SendKeyin &amp;quot;print driver pdf.pltcfg&amp;quot;
 
&amp;#39;Specify paper size
CadInputQueue.SendKeyin &amp;quot;print paper-name ANSI D&amp;quot;
 
Fit &amp;#39;drawing
CadInputQueue.SendKeyin &amp;quot;print boundary fit all&amp;quot;
 
&amp;#39;Maximize plot size
CadInputQueue.SendKeyin &amp;quot;print maximize&amp;quot;
 
&amp;#39;Output of the PDF file in the same path of the drawing with model name and extension PDF:
Dim  file-name As  String
dateiname = ActiveDesignFile.FullName + &amp;quot;--&amp;quot; + ActiveModelReference.Name + &amp;quot;-PDFPLOT.PDF&amp;quot;
CadInputQueue.SendKeyin &amp;quot;print execute &amp;quot; + dateiname
 
End Sub&lt;/pre&gt;
&lt;blockquote style="margin-right:0px;" dir="ltr"&gt;
&lt;pre style="background:#ffffff;text-transform:none;font-weight:normal;color:#000000;font-style:normal;letter-spacing:normal;line-height:normal;text-indent:0px;"&gt;&lt;/pre&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: VBAWindows 7 32 bit, MicroStation, Windows 7 64 bit, Programming, en, 08.11.09.578, SELECTsupport&lt;/div&gt;
</description></item><item><title>Automatically generate plots with VBA</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21826/automatically-generate-plots-with-vba/revision/2</link><pubDate>Mon, 08 Jun 2015 17:45:34 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:6877f13e-1181-4e74-9772-fbc1e8e0a224</guid><dc:creator>Tristan Anderson</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21826/automatically-generate-plots-with-vba#comments</comments><description>Revision 2 posted to MicroStation Wiki by Tristan Anderson on 6/8/2015 5:45:34 PM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img style="border-width:0px;" alt=" " src="/cfs-file.ashx/__key/communityserver-components-sitefiles/TSG-Logo.png" width="189" height="60" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table style="width:500px;background-color:#dce5f0;border:#dce5f0 0px solid;" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MicroStation&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;08.11.09.578&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Environment:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Windows 7 32 bit,Windows 7 64 bit&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Programming&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Subarea:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;VBA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tristan Anderson, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Background Information&lt;/h1&gt;
&lt;p&gt;The question of how to simplify the creation of plots is often raised. If you want to create a plot, there are several steps that are generally necessary. If the plot is finished being created, there are often adjustments that were forgotten or steps performed incorrectly.&lt;/p&gt;
&lt;p&gt;To prevent these problems, you can automate the settings.&lt;/p&gt;
&lt;p&gt;Microstation provides an example of a large amount of keyboard shortcuts that allow a full control of plots.&lt;/p&gt;
&lt;p&gt;This is an simple example for creating PDF documents.&lt;/p&gt;
&lt;h1&gt;Steps&lt;/h1&gt;
&lt;p&gt;First of all, we have to find out which Keyin commands Microstation provides for plotting.&lt;/p&gt;
&lt;p&gt;All Keyin commands start with the keyword &amp;quot;print&amp;quot;, but the list will be empty at first, shown below:&lt;/p&gt;
&lt;p&gt;&lt;img src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-38/pri1.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;To display the list of commands, give the order &amp;quot;mdl load plotdlg&amp;quot;:&lt;/p&gt;
&lt;p&gt;&lt;img src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-38/pri2.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;In this example, I have used &amp;quot;silentload&amp;quot; rather than &amp;quot;load&amp;quot;. These commands do the same thing, but &amp;quot;silentload&amp;quot; does not show a dialog box.&lt;/p&gt;
&lt;p&gt;This is often desireable if you do not want the PlotPreview, for performance reasons, or that you simply do not want to see what is performed.&lt;/p&gt;
&lt;p&gt;After loading the application, all keyin commands will be displayed:&lt;/p&gt;
&lt;p&gt;&lt;img src="/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-38/pri3.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The individual Keyin Command can easily be combined with a macro. Here is a summary of Keyin Commands in a VBA macro. For this, the &amp;quot;CadInputQueue.SendKeyin&amp;quot; VBA command is needed to be able to run VBA Keyins. In this example, the following steps were performed:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select a driver. In this example, the PDF driver was used.&lt;/li&gt;
&lt;li&gt;Select a paper size: In this example, ANSI D was used.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Customizing the plot on paper:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Maximize plot&lt;/li&gt;
&lt;li&gt;Run the plot with the filename of the PDF file using the VBA command from the current drawing name, model name, and extension.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre class="brush: vb; fontsize: 100; first-line: 1; "&gt;Sub  printPDF ()
 
&amp;#39;All print load commands and view the Keyindialog
CadInputQueue.SendKeyin &amp;quot;mdl load plotdlg&amp;quot;
 
Select &amp;#39;driver, here output to PDF
CadInputQueue.SendKeyin &amp;quot;print driver pdf.pltcfg&amp;quot;
 
&amp;#39;Specify paper size
CadInputQueue.SendKeyin &amp;quot;print papername ANSI D&amp;quot;
 
Fit &amp;#39;drawing
CadInputQueue.SendKeyin &amp;quot;print boundary fit all&amp;quot;
 
&amp;#39;Maximize plot size
CadInputQueue.SendKeyin &amp;quot;print maximize&amp;quot;
 
&amp;#39;Output of the PDF file in the same path of the drawing with model name and extension PDF:
Dim  filename As  String
dateiname = ActiveDesignFile.FullName + &amp;quot;--&amp;quot; + ActiveModelReference.Name + &amp;quot;-PDFPLOT.PDF&amp;quot;
CadInputQueue.SendKeyin &amp;quot;print execute &amp;quot; + dateiname
 
End Sub&lt;/pre&gt;
&lt;blockquote style="margin-right:0px;" dir="ltr"&gt;
&lt;pre style="background:#ffffff;text-transform:none;font-weight:normal;color:#000000;font-style:normal;letter-spacing:normal;line-height:normal;text-indent:0px;"&gt;&lt;/pre&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: VBAWindows 7 32 bit, MicroStation, Windows 7 64 bit, Programming, en, 08.11.09.578, SELECTsupport&lt;/div&gt;
</description></item><item><title>Automatically generate plots with VBA</title><link>https://communities.bentley.com/products/microstation/w/microstation__wiki/21826/automatically-generate-plots-with-vba/revision/1</link><pubDate>Fri, 05 Jun 2015 15:55:56 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:6877f13e-1181-4e74-9772-fbc1e8e0a224</guid><dc:creator>Tristan Anderson</dc:creator><comments>https://communities.bentley.com/products/microstation/w/microstation__wiki/21826/automatically-generate-plots-with-vba#comments</comments><description>Revision 1 posted to MicroStation Wiki by Tristan Anderson on 6/5/2015 3:55:56 PM&lt;br /&gt;
&lt;h1&gt;&lt;b&gt;&lt;img style="border-left-width:0px;border-right-width:0px;border-bottom-width:0px;border-top-width:0px;" alt=" " src="http://communities.bentley.com/cfs-file.ashx/__key/communityserver-components-sitefiles/TSG-Logo.png" width="189" height="60" /&gt;&lt;/b&gt;&lt;/h1&gt;
&lt;table style="border-top:#dce5f0 0px solid;border-right:#dce5f0 0px solid;width:500px;border-bottom:#dce5f0 0px solid;border-left:#dce5f0 0px solid;background-color:#dce5f0;" border="0"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;span style="font-size:medium;"&gt;&lt;b&gt;Applies To&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Product(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MicroStation&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Version(s):&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;08.11.09.578 &lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Environment:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Windows 7 32 bit,Windows 7 64 bit&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Area:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Programming&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Subarea:&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;VBA&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;Original Author:&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tristan Anderson, Bentley Technical Support Group&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td style="text-align:right;"&gt;&lt;strong&gt;&amp;nbsp;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h1&gt;Background Information&lt;/h1&gt;
&lt;p&gt;The question of how to simplify the creation of plots is often raised. If you want to create a plot, there are several steps that are generally necessary. If the plot is finished being created, there are often adjustments that were forgotten or steps performed incorrectly.&lt;/p&gt;
&lt;p&gt;To prevent these problems, you can automate the settings.&lt;/p&gt;
&lt;p&gt;Microstation provides an example of a large amount of keyboard shortcuts that allow a full control of plots.&lt;/p&gt;
&lt;p&gt;This is an simple example for creating PDF documents. &lt;/p&gt;
&lt;h1&gt;Steps&lt;/h1&gt;
&lt;p&gt;First of all, we have to find out which Keyin commands Microstation provides for plotting.&lt;/p&gt;
&lt;p&gt;All Keyin commands start with the keyword &amp;quot;print&amp;quot;, but the list will be empty at first, shown below:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://communities.bentley.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-38/pri1.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;To display the list of commands, give the order &amp;quot;mdl load plotdlg&amp;quot;:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://communities.bentley.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-38/pri2.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;In this example, I have used &amp;quot;silentload&amp;quot; rather than &amp;quot;load&amp;quot;. These commands do the same thing, but &amp;quot;silentload&amp;quot; does not show a dialog box.&lt;/p&gt;
&lt;p&gt;This is often desireable if you do not want the PlotPreview, for performance reasons, or that you simply do not want to see what is performed.&lt;/p&gt;
&lt;p&gt;After loading the application, all keyin commands will be displayed:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://communities.bentley.com/cfs-file/__key/communityserver-wikis-components-files/00-00-00-03-38/pri3.jpg" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;The individual Keyin Command can easily be combined with a macro. Here is a summary of Keyin Commands in a VBA macro. For this, the &amp;quot;CadInputQueue.SendKeyin&amp;quot; VBA command is needed to be able to run VBA Keyins. In this example, the following steps were performed:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select a driver. In this example, the PDF driver was used.&lt;/li&gt;
&lt;li&gt;Select a paper size: In this example, ANSI D was used.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Customizing the plot on paper:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Maximize plot&lt;/li&gt;
&lt;li&gt;Run the plot with the filename of the PDF file using the VBA command from the current drawing name, model name, and extension.&lt;/li&gt;&lt;/ol&gt;
&lt;blockquote style="margin-right:0px;" dir="ltr"&gt;&lt;pre style="background:rgb(255,255,255);text-transform:none;font-weight:normal;color:rgb(0,0,0);font-style:normal;letter-spacing:normal;line-height:normal;text-indent:0px;"&gt;Under  printPDF ()
 
&lt;span style="color:rgb(63,127,89);"&gt;&amp;#39;All print load commands and view the Keyindialog&lt;/span&gt;
CadInputQueue.SendKeyin &lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;mdl load plotdlg&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;
 
Select &lt;span style="color:rgb(63,127,89);"&gt;&amp;#39;driver, here output to PDF&lt;/span&gt;
CadInputQueue.SendKeyin &lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;print driver pdf.pltcfg&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;
 
&lt;span style="color:rgb(63,127,89);"&gt;&amp;#39;Specify paper size&lt;/span&gt;
CadInputQueue.SendKeyin &lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;print papername ANSI D&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;
 
Fit &lt;span style="color:rgb(63,127,89);"&gt;&amp;#39;drawing&lt;/span&gt;
CadInputQueue.SendKeyin &lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;print boundary fit all&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;
 
&lt;span style="color:rgb(63,127,89);"&gt;&amp;#39;Maximize plot size&lt;/span&gt;
CadInputQueue.SendKeyin &lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;print maximize&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;
 
&lt;span style="color:rgb(63,127,89);"&gt;&amp;#39;Output of the PDF file in the same path of the drawing with model name and extension PDF:&lt;/span&gt;
&lt;span style="font-weight:bold;color:rgb(127,0,85);"&gt;Dim&lt;/span&gt;  filename &lt;span style="font-weight:bold;color:rgb(127,0,85);"&gt;As&lt;/span&gt;  &lt;span style="font-weight:bold;color:rgb(127,0,85);"&gt;String&lt;/span&gt;
dateiname = ActiveDesignFile.FullName + &lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;--&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt; + ActiveModelReference.Name + &lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;-PDFPLOT.PDF&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;
CadInputQueue.SendKeyin &lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;print execute &lt;/span&gt;&lt;span style="color:rgb(42,0,255);"&gt;&amp;quot;&lt;/span&gt; + dateiname
 
&lt;span style="font-weight:bold;color:rgb(127,0,85);"&gt;End&lt;/span&gt; &lt;span style="font-weight:bold;color:rgb(127,0,85);"&gt;Sub&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: VBAWindows 7 32 bit, MicroStation, Windows 7 64 bit, Programming, en, 08.11.09.578, SELECTsupport&lt;/div&gt;
</description></item></channel></rss>