Code:(if (setq ent (tblobjname "BLOCK" "FT")) (entmod (subst '(2 . "CO") '(2 . "FT") (entget (cdr (assoc 330 (entget ent)))))) )


Registered forum members do not see this ad.
Hello guys .
Can someone help me with this code ? it doesn't rename the block "FT"
Code:(while (setq Myblk (tblnext "BLOCK" (null Myblk))) (if (eq (cdr (assoc 2 Myblk)) "FT") (progn (setq entlst (entget (tblobjname "BLOCK" (cdr (assoc 2 Myblk))))) (entmod (subst (cons 2 "CO") (assoc 2 entlst) entlst ) ))))
Code:(if (setq ent (tblobjname "BLOCK" "FT")) (entmod (subst '(2 . "CO") '(2 . "FT") (entget (cdr (assoc 330 (entget ent)))))) )
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper


Thank you LEE .
Why you used code 330 ? I see it is 330 Soft-pointer ID/handle to owner object and I can't understand what does it mean .
Thankxxxxx
You're welcome!
The 330 DXF Group code is always a pointer to the parent / owner entity, in this case the BLOCK_RECORD entity (AcDbBlockTableRecord object), which is the parent of the BLOCK entity (AcDbBlockBegin object). The AcDbBlockTableRecord object is the object found in the Visual LISP Block Collection and it is this entity / object that should be renamed to rename all references of the block in the drawing.
Every AutoCAD Block Definition uses the following entity hierarchy:
Code:+-- TABLE (AcDbBlockTable) | +--+-- BLOCK_RECORD (AcDbBlockTableRecord) | +--+-- BLOCK (AcDbBlockBegin) | +--+-- < Block Geometry Entity > | +-- < Block Geometry Entity > | ... | +-- < Block Geometry Entity > | +-- ENDBLK
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper
Lee Mac Programming
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Just another Swamper
I did some research :
blocks
alsoCode:(if (setq ent (tblobjname "BLOCK" "FT")) (entmod (subst '(2 . "CO") '(2 . "FT") (entget (cdr (assoc 330 (entget ent)))))) )
layersCode:(if (setq ent (cdr (assoc -2 (tblsearch "BLOCK" "FT")))) (entmod (subst '(2 . "CO") '(2 . "FT") (entget (cdr (assoc 330 (entget ent)))))) )
"0" layer can't be renamed, but color can be set to it (changed to "red" - color 1)
viewsCode:(if (setq ent (tblobjname "LAYER" "0")) (entmod (subst '(62 . 1) '(62 . 7) (entget ent))) )
Empty table view (tblnext "VIEW" T) => nil
Firstly create view "MR"
ltypesCode:(if (setq ent (tblobjname "VIEW" "MR")) (entmod (subst '(2 . "VR") '(2 . "MR") (entget ent))) )
"Continuous" ltype can't be modified so you have to load new ltype
Firstly load ltype "Dashed"
stylesCode:(if (setq ent (tblobjname "LTYPE" "Dashed")) (entmod (subst '(2 . "MR") '(2 . "Dashed") (entget ent))) )
"Standard" style can't be renamed, but font can be set to it (changed to "simplex.shx")
ucssCode:(if (setq ent (tblobjname "STYLE" "Standard")) (entmod (subst '(3 . "simplex.shx") '(3 . "arial.ttf") (entget ent))) )
Empty table ucs (tblnext "UCS" T) => nil
Firstly save ucs "MR"
dimstylesCode:(if (setq ent (tblobjname "UCS" "MR")) (entmod (subst '(2 . "VR") '(2 . "MR") (entget ent))) )
"Standard" dimstyle can't be renamed and modified
Firstly save dimstyle "MR"
vportsCode:(if (setq ent (tblobjname "DIMSTYLE" "MR")) (entmod (subst '(2 . "VR") '(2 . "MR") (entget ent))) )
Empty table vport (tblnext "VPORT" T) => nil
Firstly create vport "MR"
appidCode:(if (setq ent (tblobjname "VPORT" "MR")) (entmod (subst '(2 . "VR") '(2 . "MR") (entget ent))) )
"ACAD" appid can't be modified, so this won't work
M.R.Code:(if (setq ent (tblobjname "APPID" "ACAD")) (entmod (subst '(2 . "MR") '(2 . "ACAD") (entget ent))) )


Registered forum members do not see this ad.
Thank you LEE for the nice explanations
Also thank you Marko for that nice examples .![]()
Bookmarks