Author Topic: Table Importer - Microstation  (Read 871 times)

0 Members and 1 Guest are viewing this topic.

jvillarreal

  • Bull Frog
  • Posts: 305
Table Importer - Microstation
« on: February 28, 2018, 11:02:11 PM »
Its a long shot, but has anyone converted the Bentley provided table BASIC file to MVBA?
(Table.bas) or possibly code that maps excel lines/text to coordinates and arrays?

My new employer does not provide Axiom or any other third party software for importing tables from excel.

I have a q&d workaround for creating a csv file using a selected range in excel to work in conjunction with the bas, but was hoping somebody had something better they'd be willing to share.
« Last Edit: March 01, 2018, 03:38:34 PM by jvillarreal »

jvillarreal

  • Bull Frog
  • Posts: 305
Re: Table Import - Microstation
« Reply #1 on: March 01, 2018, 03:34:20 PM »
Alright, I see its been requested many times online by Microstation users, so I've written a mvba macro for importing a selected range of cells from Excel into a dgn. Could use some cleanup..but it gets the job done.
It would be much appreciated if someone with more experience could show how to link the excel file to the text elements.

Edit: Forgot to mention, this has been tested on v8i SS4
Edit 2: Code Removed
« Last Edit: March 06, 2018, 01:11:23 PM by jvillarreal »

jvillarreal

  • Bull Frog
  • Posts: 305
Re: Table Importer - Microstation
« Reply #2 on: March 02, 2018, 01:09:44 PM »
Edit: Code Removed

Small update to include text wrapping [even if Chr(10) was not used in excel]

Example Input and Output shown below:

To Import the file, Press Alt+F11 to open the Visual Basic Editor
Right Click on your Default.mvba and Select Import File

Required References:
Visual Basic Editor (Alt+F11) > Tools > References
These should automatically be selected after importing the macro, but if not, references needed for the macro to function (and for possible future modification) are shown below:

Note:
Text Settings can be found in the AddCell Function.
Settings have been set up to work with a 1:10 scaled drawing.


« Last Edit: March 06, 2018, 01:28:13 PM by jvillarreal »

jvillarreal

  • Bull Frog
  • Posts: 305
Re: Table Importer - Excel to Microstation
« Reply #3 on: March 06, 2018, 01:05:29 PM »
Edit: Code Removed

All objects are now placed in a cell for efficiency and an 'ExcelSheet' link to the ProjectWise worksheet is attached.
I'd prefer to have it automatically update upon opening the drawing, but this will have to do for now.

Additionally, the code has been updated to allow the user to control text settings with the  "Change Text Attributes" dialog box.

Updated Info:
TableImport.Excel2Table.mvba
Excel2Table allows a user to create a table in Microstation based on a  selected range of cells in an excel spreadsheet. Upon running the macro, if the user has not made a range selection, excel is started and the user is prompted to select a range before continuing. Once a selection has been made, the user can optionally modify text attributes for the table or continue with a point selection for table placement.
Each spreadsheet cell is then imitated (separate boxes & text) and the resulting objectsare placed in a Microstation table cell; This includes functionality for rotated Microstation views, merged cells and wrapped text in excel; and settings for vertical margins and text properties (color, justification, width, height and font)
« Last Edit: March 07, 2018, 07:21:03 PM by jvillarreal »

jvillarreal

  • Bull Frog
  • Posts: 305
Re: Table Importer - Microstation
« Reply #4 on: March 07, 2018, 07:20:49 PM »
Final Update - I was able to link the table to excel by naming the cell with the table range; then creating a sub to open the attached link, select the range according to the cell name, and replace the table cell.
                     Modifying the new cell origin to match the original origin allowed consistent placement for rotated views;
« Last Edit: April 24, 2018, 12:08:45 PM by jvillarreal »