Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

A working Excel Spreadsheet with VBA to draw objects in BricsCAD

It is working! The version I have attached is fairly simple, which would help those who are trying to understand how it works. The VBA code is thoroughly annotated.

There are probably some lines of code that might not be necessary. They are annotated as such.
I find that as my list of model# get long, the user has to scroll back up to the top to press the macro button. I am not sure how best to make this better. Perhaps there should be a VBA form that pops up when you press that button. And this form shows the list of model numbers. Ideally, that box may permit the user to filter the list or sort the list on various columns. But, I have struggled enough to get it to this point, that I want to leave it as it is for a while.

There is one important issue in regards to your Windows environment. Depending upon your security settings in Windows, you may have to set "Run as Administrator" in a few places. Otherwise Windows will prevent one program from controlling another. BricsCAD itself needs to be "run as admin". To do this, you have to find the BricsCAD.exe file, and right-click it and choose "Run this program as an administrator" on the Compatibility tab. After this, you must do the same for any shortcuts you use to start BricsCAD. Excel must have the same thing done to it.

Since VBA is not on all versions of BricsCAD, and not everyone has MS Office, ideally this concept will be redone using perhaps LISP to read an external file. However, since creating a complex script involves a lot of trial and error, it is very helpful if that external file is a spreadsheet that is read natively.

As I say in the included read-me, the program's existence was very much dependent upon the many on this forum, and the support staff at BricsCAD, who helped me when I got stuck... which was a lot.

[Edit, a few minutes after posting this, I realized that my simplification efforts had broken some parts of the script. So, the upload is now corrected]

-Joe Dunfee

Comments

  • You can freeze and split panes in Excel. You can probably use this technique to ensure the button is always visible at the top of the screen.
    See: https://support.office.com/en-us/article/Freeze-panes-to-lock-rows-and-columns-dab2ffc9-020d-4026-8121-67dd25f2508f

  • I actually was aware of that feature, and often use it myself. But, I am always hesitant to include features that newer users are not aware of, and try to leave a spreadsheet in a condition that they understand how to deal with it.

    However, you mentioning it, caused me to reevaluate. I realize now that I was being overly concerned about it. Really only a few CAD users will be dealing with it, I can train them if they are not already familiar with that Excel feature. Or, simply add an explanation in one of my instruction text boxes.

    Thanks for the reminder.

    -Joe

  • Hey Joe,

    I was interested in your program and downloaded it from the above link, however the readme.txt file won't extract... error code 0x80004005
    Strange since it is just a txt file... any thoughts?

  • I could not extract it either. I couldn't even remember what I wrote. But, I was glad to see that I had saved the TXT file. Here is the content.

    This is a spreadsheet with a macro embedded that will read a line of commands in Excel, and put them into BricsCAD. It functions similarly to a script file. It can replace the function of a dynamic block with a table, which is not available in BricsCAD.

    This example version simply draws a rectangle and places the model# of a refrigeration condensing unit. It does this by first opening a new drawing, drawing the lines and text, and then it converts it to a block. That block is then placed into the clipboard and the temporary drawing closed. You can place the block by clicking anywhere in the original drawing.

    PREPARING THE WINDOWS ENVIRONMENT, TO PERMIT THE PROGRAM TO RUN
    There is one important issue in regards to your Windows environment. Depending upon your security settings in Windows, you may have to set "Run as Administrator" in a few places. Otherwise Windows will prevent one program from controlling another. BricsCAD itself needs to be "run as admin". To do this, you have to find the BricsCAD.exe file, and right-click it and choose "Run this program as an administrator" on the Compatibility tab. After this, you must do the same for any shortcuts you use to start BricsCAD. Excel must have the same thing done to it.

    USING THE MACRO
    To use the program, you will probably want BricsCAD open and a drawing open, where you want to insert the new block. Open Excel, and this spreadsheet.
    Select any cell on the row of the model you wish to create, and click the button that says “Copy Block to Clipboard”.

    IMPORTANT INFORMATION FOR CREATING YOUR OWN VERSION.
    1. The Data tab should contain the dimensional data that the script needs to fill in the values. (The tab name does not matter)
    2. The Script tab, must be named “Script” for the macro to recognize it.
    3. It does not care if a cell is a text or number format, because every cell will be converted to text when the script is formed.
    4. The first row that can have a part and script is row #6.
    5. The script must start on column A.

    Many thanks to the people on the BricsCAD user’s forum, and the BricsCAD support staff. Without them, this program would not have come together.

    -Joe Dunfee

  • Since there were problems with my zip file, I thought I should just upload the individual files. The spreadsheet itself is not permitted in its raw format. Perhaps because an embedded macro can potentially contain malicious code.

    -Joe

    txt
    txt
    Read-Me.txt
    2K
    zip
    zip
    Draw from Excel.zip
    39K
This discussion has been closed.
Origami
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam