- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have been tasked with updating and bringing to current standards, hundreds of drawings; each with hundreds of block references (attributed text).
The block references are text objects (not MTEXT) and each block reference has, or should have, 7 attributes.
I have recently discovered block references with the 4th attribute missing. These were made long ago with a modified routine. After fiddling for a bit, I set up an example for the attached DWG.
I have lisp programs that will append a Tag, Prompt and Value to the end of the list in a block reference, but have found none that can wedge these into the middle of an existing list, where this needs to be for follow-on processing, and where the order of things is important.
Complicating things is the fact that each block reference must have a different block number for export to a database. All block references are supposed to have the same 7 attributes each with a set of values unique to that particular block reference. I can't just fix one and sync others to it (?).
After a week of remaking these block reference to replace the missing attribute, because that's the only way I see it now, I have come here seeking assistance/advice. My searches for a suitable fix are coming up empty, and remaking all these is starting to draw a mean vacuum.
Ideally, the program would start checking block references and if the certain tag does not exist, insert the Tag, Prompt and Value into the correct position and then go find the next occurance.
Is this even possible?
The missing Tag is MRIN, The missing Prompt is "Enter MRIN" and the Value is blank by default; filled in later in processing.
Attached is a DWG with examples. It's saved in 2010 format so should open for most folks.
And just in case it's of help, below is an exerpt from the ancient program that makes these block references. The program was written over 30 years ago and, amazingly, still works in Autocad 2022.
;; dscord is the insertion point, established earlier in the program
(progn
(command "attdef" "" "NAME" "Enter NAME." textdat dscord "")
(setq nameattr1 (entlast))
(command "attdef" "" "RIN" "Enter OBJ ID." RIN dscord "")
(setq nameattr2 (entlast))
(command "attdef" "" "BOXSIZE" "Box Coordinates. " bsize dscord "")
(setq nameattr3 (entlast))
;
(command "attdef" "" "MRIN" "Enter MRIN." mrin dscord "") ; <--- The missing one
(setq nameattr4 (entlast))
;
(command "attdef" "" "CURRENTLAYER" "Enter CurrentLayer." "NOPLOT" dscord "")
(setq nameattr5 (entlast))
(command "attdef" "" "SHAPE" "Enter Object ShapeType." "R" dscord "")
(setq nameattr6 (entlast))
(command "attdef" "" "OBJTYPE" "Enter ObjectType." "EQ" dscord "")
(setq nameattr7 (entlast))
(setq bname (itoa atblk))
(while (tblsearch "BLOCK" (strcat drawname "$ECC$" bname))
(progn
(setq atblk (+ atblk 1)
bname (itoa atblk)
)
)
)
(setq bname (strcat drawname "$ECC$" bname))
(progn
(command "block" bname dscord nameattr1 nameattr2 nameattr3 nameattr4 nameattr5 nameattr6 nameattr7)
(setq count 0
emax (sslength ss2)
)
(while (< count emax)
(command (ssname ss2 count))
(setq count (1+ count))
)
(command "" "insert" bname dscord "1" "1" "0")
)
)
Thanks for any help,
Steve
Solved! Go to Solution.