I am trying to create a process that includes:
* exporting data from a database to a file (csv, text, or dwx)
* using the exported data to overwrite the Block Properties Table in an existing block definition.
* There is no need to change the fields, only the values. But there may be more or fewer values listed.
* This can be done quite easily manually. But the purposes include reliable consistency of wording and ease of use. So there is no point to doing this manually. I have been trying to learn enough lisp to do this. I am by no means a programmer, just someone hard headed enough to not give up.
I have used property dumps to find that the Block Properties Table has an autocad ID, a parent ID (the block definition I believe), a handle, and a type (AcdbBlockPropertiesTable i think). But I cannot identify what specifically it is, where it resides, or how to view or replace values.
The name and behavior of the BPT make it pretty clear that it is a tiny database (object?) nested somewhere (in/as a block property?). It would seem that one database object could easily replace another, either as a blanket overwrite or by tediously measuring, re-sizing, and replacing each value. Any help would be appreciated. Thank you all for your help.
@Anonymous
Solved! Go to Solution.
Solved by arievanbrakel6314. Go to Solution.
Solved by arievanbrakel6314. Go to Solution.
BTW, my initial attempt was to simply mimic the manual overwrite:
(command "bedit" "block")
(command "btable")
(princ "\t \t \t \t") ; 4 tabs to move into the first data cell
This worked to open the table, but once inside the "btable" command, it was impossible(?) to mimic input from the keyboard (to tab over, input the data and press the ok/save button). I tried adding items as an argument to the btable command, nesting the btable command within write, write-char, and princ. Unfortunately I am a novice with lisp, and as I said before, too hard headed to quit. (also, I don't know if I executed those commands properly).
I understand this method would be inferior to replacing the table by code but it would be good enough for me.
Are you talking about Attributes? If not, what are some examples of the "properties" you mean and the "values" you would replace in a Block from some data source?
Read about these AutoLisp functions:
(tblsearch)
(tblnext)
(tblobjname)
Do they get you started, or do you mean something else?
[EDIT: I replied to Message 1 before seeing Message 2. If your reference to BTABLE means you're talking about Dynamic Blocks, I'm not well versed in those, so I hope others who are can help better than I can.]
After researching deeper, it posible to read the block property table from lisp.
It imposible to verwrite the block property table from lisp as there is a bug in DXF group 1010 and 1071 and can't be overwritten.
To overcome this flaw, i did create an ARX that can be loaded in AutoCAD that expose an interface
(UpdateBlockPropertyTable <block name> <list with table values>)
from lisp.
I build a utility which works in ac2017, ac2020, ac2022.
https://github.com/avbrakel/AutoCAD-UpdateBlockPropertyTable-Arx
I appreciate this work tremendously, and also the license that allows me to use it. However, I have questions about it. I have many questions about this but I will study it a little more.
Do you know if this is functional for Autocad 2023 or forward? Are lookup tables easier to work with than Block Property Tables? Thank you very much.
@Kent1Cooper wrote:Are you talking about Attributes? If not, what are some examples of the "properties" you mean and the "values" you would replace in a Block from some data source?
This is a good question. I am indeed talking about dynamic block properties. However, the terminology is not crystal clear. I believe "properties" include attributes and can also include dimensions and quantities. Attributes are text fields that can show/reference other properties, but I think they are also considered properties of the block.
A Block Properties Table (as I understand it) is a type of constraint that connects block properties to other block properties. It is similar to a lookup table... but I don't really understand the differences, or what type of entities they actually are. This is part of my problem. I need to know the names of the items to assign them values.
So looking through this folder, I see several file types and readme files. It appears the process is:
1. Download the 2020 .arx file and place it in a trusted, accessible folder. Download the "DynamicBlock.lsp" file... or is it the "DynamicBlock_v1.lsp"? and place it in the same location. Download the readme & license files and place them with the files.
2. write my lisp program to:
a. read input data and arrange it into a single list (?)
b. Load and run the .arx file
c. load the DynamicBlock file
d. use the line you showed
(UpdateBlockPropertyTable <block name> <list with table values>)
This seems very accessible. Regarding the UpdateBPT function:
* Is it operational as is, or is it still in process?
* Does it have limitations or expectations of the number of fields/columns in the BPT?
Thank you very much for this resource.
You are correct
1. Download the
UpdateBlockPropertyTable.arx for autocad 2022
UpdateBlockPropertyTableAc2020.arx for autocad 2020
and place it in a trusted, accessible folder.
2. Download and open testDrawing.dwg
3. Download and run testScript.LSP it will:
- it loads the .arx
- modify the lockPropertyTable of block cable2
4. write my lisp program to your needs:
a. read input data and arrange it into a single list (?)
b. Load and run the .arx file
c. use the line you showed
(UpdateBlockPropertyTable <block name> <list with table values>)
The other files like dynamicBlock_v1.lsp are used to investigate and not real for production
The I use the application UpdateBlockPropertyTable.arx in my company for several years.
Till now i didn't find a flaw, but can not guaranty in all situations.
I have tested this on AutoCAD (Civil3D ) 2023 and found it to work on the test file. Thank you very much for this work.
I did need to look at the test script to see the format of the input list. The function accepts a list of lists, each line of the block table being a list. I will set up my read file function to build my data into this form.
Thank you again, this is amazing.
Sincerely,
Michael Bickel
Can't find what you're looking for? Ask the community or share your knowledge.