Need help matching individual attributes

Need help matching individual attributes

1Moonlight
Participant Participant
640 Views
13 Replies
Message 1 of 14

Need help matching individual attributes

1Moonlight
Participant
Participant

Hello - I have a tittle sheet with what is essentially a BOM made up of attributes. I would like to tie the information in one row of my part list to a block on a separate sheet where I have a drawing of the specific part.  I would like to be able to edit the information in either location and have it update the other. I've tried using the "field" options but that has two major issues. First, it does not work bidirectionally. Second, it's tedious to create the layout for every instance / part. I've tried using a spreadsheet instead of our parts list with attributes, but it doesn't quite work either. It does not work bidirectionally and seems to take up a lot of resources and increase the file size. Any ideas to help with this process would be appreciated. Thanks.

0 Likes
641 Views
13 Replies
Replies (13)
Message 2 of 14

MrJSmith
Advocate
Advocate

I've not attempted to do something you are describing, so someone else might have a better response. But the way I'd attempt to solve your issue would be to have an intermediate file (text file, csv, or excel) that exports/imports the information based on several reactors (if you wanted it completely automatic) or when the user runs a command.

 

Another method might be to use the objectDB method to push changes whenever one gets updated, via a reactor or command, but due to AutoCAD bugs the formatting might get off.

 

Either option would require extensive work to implement. 

0 Likes
Message 3 of 14

1Moonlight
Participant
Participant

I think an attribute table extraction gets the closes to what I'm looking for. However, there are still two issues. The first, I can do without if need. The information can't be updated bidirectionally. The second issue, and perhaps someone can help me out with this; I have a template setup in the attached drawing with the information and layout I need. I can't get the table to work if I copy it to another drawing without recreating it. Is there a way to use the table in this drawing as a template, so that when I insert it in another drawing I don't need to go through the entire process of creating the table, extracted information, and formatting it again? Sorry, the website will not let me attached the dxe file.

0 Likes
Message 4 of 14

MrJSmith
Advocate
Advocate

I am not very familiar with ACAD tables. I hate modifying them as a user (so slow and cumbersome) so I typically stay away from them. I do know you can extract all their information though via LISP, including formatting and values. So it should be relatively simple to write a script that allows you copy paste it.

 

Very strange you can't copy by default between drawings. I attempted to entmake via LISP and it worked, but when you save the tables values to blackboard, it throws an error saying "error: Visual LISP: Illegal inter-doc import/export object". Next I tried creating a blank table and then ent modding it with the entity information of the previous table. This works and here is the code I used to attempt it. Note: The code needs some refinement, like copying over the layer information (if you want to match that) and also might need to include codes "(41 . 1.0) (42 . 1.0) (43 . 1.0) (50 . 0.0) (70 . 0) (71 . 0) (44 . 0.0) (45 . 0.0)" for whatever they do. 

 

(defun c:tableCopy ( / lst ent f)
	(print "Select table to copy")
	(setq ent (entget (ssname (ssget '((0 . "ACAD_TABLE"))) 0)))
	(foreach it ent
		(if f 
			(setq lst (append lst (list it)))
			(if (= 343 (car it)) (setq f 1))
		)
		
	)
	(vl-bb-set 'table lst)
	(print "Table Copied")
	(princ)
)

(defun c:tablePaste ( / lst ent pt f)
	(setq pt (getpoint "Pick where you want to insert the copy table"))
	(command "-table" "2" "2" pt)
	(setq ent (entget (entlast)))
	(foreach it ent
		(if (not f) (setq lst (append lst (list it) )))
		(if (= 343 (car it)) (setq f 1))
	)
	(setq table (append lst (vl-bb-ref 'table)))
	(entmod table)
	(princ)
)

 

I am not sure if any of this is helpful. Personally, I'd use attribute blocks with excel, but that's because I have more experience with manipulating those objects.

0 Likes
Message 5 of 14

1Moonlight
Participant
Participant

Hi - Thanks for your efforts. I implemented the table copy lisp but I didn't see an insert table statement. Where does the table go? 

Thanks.

0 Likes
Message 6 of 14

MrJSmith
Advocate
Advocate

If you type in tablePaste, it should prompt you to pick a point location and put the table there.

0 Likes
Message 7 of 14

1Moonlight
Participant
Participant

Thanks again. If I use the LISP it does copy and paste a table, but the table becomes static and does not update from the new information in the new drawing. Thanks again for trying. 

0 Likes
Message 8 of 14

Sea-Haven
Mentor
Mentor

Ok the answer to maybe one problem when you insert the table if it has Fields as the cell result it will fail, in a field is an ID it is only relevant to say one dwg. The same problem exits with block attributes using fields you may copy a block and object but the second block only shows the value of the 1st object as that is what the field ID refers to.

 

So quick answer I don't think can have a bidirectional without deleting one or the other source ID. For me can read all layouts and make a table based on all the attributes in the title block, the table can exist anywhere in model or in a single layout. I have done this for dwg index, but it just reads attribute values, you could amend and make all the cells a field. BUT single direction only.

 

Here is dwg index example it would need modifying to suit your dwg, attribute tagnames. The table rows produced are equal to number of layouts, as it takes like 2 seconds to make I would just update a new one and delete old.

 

0 Likes
Message 9 of 14

1Moonlight
Participant
Participant

Hello Sea-Haven - When I run the lisp I get the following error: Pick point for top left hand of table: ; error: bad argument type: lselsetp nil. Please help.

 

0 Likes
Message 10 of 14

1Moonlight
Participant
Participant

It looks like the closest I can come to what I need is using the table data extraction. I'm able to create the tables I need and sync the data if anything in a block changes. However, if I have a new drawing with the same blocks (names and attributes), I need to start from scratch. I can't seem to use the first table .dxe file for a template. Anyone know of a way to have a true template I can insert and have it gather the information from the new drawing automatically? I want to keep the exact same layout of the table and draw from the same blocks each time. 

0 Likes
Message 11 of 14

MrJSmith
Advocate
Advocate

@1Moonlight Sorry, I was just attempting to copy the same exact table between drawings (same formatting and all that) not have the table's cells automatically update/sync. 

 

If I understand the problem correctly, I don't know a way to do via simple/already implemented CAD techniques. AutoCAD seems to REALLY hate the notion of copying tables between drawings. However, I do think you could accomplish what you want with custom LISP. The problem and solution would need to be really well defined and it would take a decent amount of effort to create.

0 Likes
Message 12 of 14

1Moonlight
Participant
Participant

Thanks for your feedback / input. I hate when something seems like it should be easy but isn't. I would almost think you could copy a table from one drawing and paste it into another drawing and have it update with the data from the new drawing. That would be a really big timesaver. 

0 Likes
Message 13 of 14

MrJSmith
Advocate
Advocate

How are you making it update currently? Or are they currently not linked? I tried changing something in the sample file you provided most recently (TESTTABLE) and it didn't seem to update the table on the first sheet.

 

As I mentioned, you most certainly could write a LISP to gather the data in the new drawing and update the pasted table (from my previous script). Everything in a table is editable via LISP. It would just be a matter of:

  1. Determine which information is important
  2. Gathering up that information.
  3. Sorting that information in whatever fashion you want
  4. Updating the table with the information. 

 

0 Likes
Message 14 of 14

1Moonlight
Participant
Participant

If you update the block, go back to the table and select "update data links" when the .dxe file is in the same folder then the information in the table is update. You will need to rename the attached testtable.txt file with the .dxe extension. 

0 Likes