Howdy, Stranger!

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

Thinking about using constraints inside a block that is driven by separate program

You may have seen my threads as i seek to use Excel to drive the creation of objects in BricsCAD. Currently, it is simply copying a series of commands from within Excel and then pasting them to the command line of BricsCAD. This functions like a script.

With the current approach, I am drawing every object from scratch. However, I imagine that if I can somehow manipulate a constrained drawing, I can more easily use complex drawings. The workflow might be as follows;

  1. Create a drawing with constraints and attributes. Save it for use later as a block. I will call this an “Auto Block”.
  2. Create a spreadsheet with the names of the dimensional constraints and attributes as column headings. It should also have the name of the Auto Block it was created to work with. This spreadsheet will have a row for each variation of the block, which will probably have a part number associated with it.
  3. To use the Automatic Block, open the spreadsheet associated with it. Choose which row to use, and click a button to send the block to BricsCAD.
    a) The program will open the associated drawing to use as a block.
    b) The Program will edit each of the dimensional constraints and attributes.
    c) The program will turn all the entities in that drawing into a block named with the name of the Auto Block drawing, with the model# appended.
    d) The program will then copy that block to the clipboard, and close the Auto Block drawing.
  4. The user can then go to the drawing where he wants to use the block, and then paste it.

I automatically went to the idea of writing the process in Excel VBA, because VBA is not well documented for use in BricsCAD. But, I imagine the process would work better inside of BricsCAD. Then, the user might initiate the special “Auto Block” routine, which would give him a menu of Auto Block files to choose from, and present them with a menu of choices for that block. The choices might just be a list of model#’s. But, for example, if the parts were bearings, it might ideally also be possible to sort by load capacity, and choose a bearing based on that.

It may also be good to use a different program from Excel, since there are some fairly good open-source spreadsheets out there. I also do suspect that it is important to use a spreadsheet, rather than just editing a table. This is so the user can use formulas to help fill out some of the dimensional values.

However, I have no idea if it is possible for a routine (VBA or any other program) to be able to "see" a dimensional constraint in BricsCAD and edit its value.

Do you all think this is viable?



  • edited June 2017

    Interesting thought Joe. Two ideas:

    • Create a parameter list with parametric data from a sheet.
    • Make your "Auto Block" and supply entities with extended data (DXF code -3) from the parameter list.
    • Let LISP browse through the entities and, if it finds a match in the parameter list, change the assoc(iated) entity data accordingly.

    Another, and probably easier, approach:

    • Create a table in a spreadsheet
    • Paste results to a text file, one part per line
    • Use LISP to read the text lines until it finds a part match, retrieve var "script", and execute (command var), where var is one entry of multiple variables on a line of text
    • Never realized it myself, but this way a universal piece of LISP can be used for different geometry, using the spreadsheet as the CAD program :-)
This discussion has been closed.
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