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

0 Members and 1 Guest are viewing this topic.

jvillarreal

  • Bull Frog
  • Posts: 332
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: 332
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: 332
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: 332
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: 332
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 »

ant.roman

  • Mosquito
  • Posts: 3
Re: Table Importer - Microstation
« Reply #5 on: March 16, 2023, 05:03:06 PM »
jvillarreal,

I've been looking for a solution around this (without Axiom, etc.) and it seems like this is exactly what I'm looking for except I seem to be getting an error when importing the file.

Following the steps of importing from the Visual Basic Editor, I get an imported module that seems like nonsense when opening the code. I have also tried importing by going to Utilities>Macro>Project Manager>Load Project. Once the file is loaded, opening the Visual Basic Editor again and trying to double click on the "TableTools" mvba, I'm prompted to enter a password. I'm very unfamiliar with mvba files in general, and especially in microstation.

Is there something that I may be doing wrong in the process of trying to import the mvba file?

Thanks

jvillarreal

  • Bull Frog
  • Posts: 332
Re: Table Importer - Microstation
« Reply #6 on: March 21, 2023, 10:53:06 AM »
Hi ant.roman,

Have you tried running the table import macro after selecting cells in Excel?
Or are you just trying to see the source code?

ant.roman

  • Mosquito
  • Posts: 3
Re: Table Importer - Microstation
« Reply #7 on: March 21, 2023, 11:13:00 AM »
I've attached the error that shows when I attempt to run the macro when I import from Utilities>Macro>Project Manager>Load Project. This error shows even after selecting cells in Excel.

When attempting to import file using Alt+F11 as you originally stated, it seems to me (as both a newbie coder and microstation user) that when uploading as "Import File", microstation doesn't seem to like the mvba file type as the file types it wants to read are: .frm, .bas, .cls. Regardless, I can change it to all file types and import the mvba file this way and it then imports the file as a Module. When doing this, the only macro names there are to run from the tabletools.mvba file are two macros named "Cha"




jvillarreal

  • Bull Frog
  • Posts: 332
Re: Table Importer - Microstation
« Reply #8 on: March 21, 2023, 02:16:25 PM »
I believe I originally included a bas file which was later replaced by the mvba, but its been a while.
I've attached a different version of the file that you should be able to run through project manager.

jvillarreal

  • Bull Frog
  • Posts: 332
Re: Table Importer - Microstation
« Reply #9 on: March 21, 2023, 02:27:12 PM »
Actually, here's the unlocked version. Feel free to edit and make it your own.

ant.roman

  • Mosquito
  • Posts: 3
Re: Table Importer - Microstation
« Reply #10 on: March 21, 2023, 05:48:52 PM »
Thanks for this, it worked with no issues.