Insert blocks via automation - best method?
I want to automate the insert of blocks into a dwg file from a list (Excel or DB) that contains: block name, x & y coordinates, text attributes. Ideally, the drawing could be updated again when the list changes.
First, is there a compatible AutoCAD plugin that already exists for this?
If not, what is the best API interface?
First, is there a compatible AutoCAD plugin that already exists for this?
If not, what is the best API interface?
- .NET
- Lisp
- BRX
- COM
0
Comments
-
Any of the APIs will work for that
Store something like [PATH, X , Y, Z ,SCALE_X, SCALE_Y, ROTATION]
Send the results to the insert command
You can use something like SQLite for AutoLisp to store your data locally
https://www.theswamp.org/index.php?topic=28286.0
If you plan on storing the actual blocks on a server database, then I would choose .NET or BRX.
0 -
Why not just excel itself you can make a column of the correct insert sequence and copy it to the autocad command line. -insert blkname x,y 1.0 1.0 0.0 look at concatenate command.
The other is that excel can control Autocad and like wise Autocad control Excel. I have attached a very simple example.
Using lisp simplest is read a csv file that is an export of the excel file. For me I read the excel file then would insert.
Just Google insert blocks with attributes excel autocad lisp
DB Access ? Can be opened by Autocad.
0 -
Thanks both. Are any of the options better than others for making updates when the list changes?
For example:
Step 1: User insert blocks with text attributes
Step 2: User needs to make a change that could:
- change attribute text or
- add a new block or
- delete a block completely or replace it
Thanks!0 -
Hi all,
Just for completeness, I'd like to mention that we now allow adding Block references from within Grasshopper. (see here for the Grasshopper connector)
Based on your question, probably not the best route, and more fit for BIM workflows, but you never know...0 -
If you choose .NET, you can setup an Application.Idle event to check if the source file is changed.ryatkins said:Thanks both. Are any of the options better than others for making updates when the list changes?
For example:
Step 1: User insert blocks with text attributes
Step 2: User needs to make a change that could:
- change attribute text or
- add a new block or
- delete a block completely or replace it
Thanks!
one option is to show a balloon notification, with a command button to re define the blocks, or import attributes
0 -
Given you have XY for the block could do a check does it exist and redo the attribute values. It would also have to do this block is missing want to add ?0
-
I’ve been playing with XL2CAD and the bulk property import and export utility and it has been promising so far for my task.
https://www.dotsoft.com/xl2cad.htm0