Sweety Posted October 13, 2012 Share Posted October 13, 2012 Hello guys . Can someone help me with this code ? it doesn't rename the block "FT" (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 ) )))) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 13, 2012 Share Posted October 13, 2012 (if (setq ent (tblobjname "BLOCK" "FT")) (entmod (subst '(2 . "CO") '(2 . "FT") (entget (cdr (assoc 330 (entget ent)))))) ) Quote Link to comment Share on other sites More sharing options...
Sweety Posted October 13, 2012 Author Share Posted October 13, 2012 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 Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted October 13, 2012 Share Posted October 13, 2012 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 . You can't rename just single block reference without redefining block definition (owner of all blocks with the same name). Quote Link to comment Share on other sites More sharing options...
pBe Posted October 13, 2012 Share Posted October 13, 2012 (if (setq ent (tblobjname "BLOCK" "FT")) (entmod (subst '(2 . "CO") '(2 . "FT") (entget (cdr (assoc 330 (entget ent)))))) ) Wow, I didn't know that That is so cool Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 14, 2012 Share Posted October 14, 2012 Thank you LEE . You're welcome! 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 . 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: +-- [color="darkred"]TABLE[/color] ([color="navy"]AcDbBlockTable[/color]) | +--+-- [color="darkred"]BLOCK_RECORD[/color] ([color="navy"]AcDbBlockTableRecord[/color]) | +--+-- [color="darkred"]BLOCK[/color] ([color="navy"]AcDbBlockBegin[/color]) | +--+-- [i][color="green"]< Block Geometry Entity >[/color][/i] | +-- [i][color="green"]< Block Geometry Entity >[/color][/i] | ... | +-- [i][color="green"]< Block Geometry Entity >[/color][/i] | +-- [color="darkred"]ENDBLK[/color] Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted October 14, 2012 Share Posted October 14, 2012 Wow, I didn't know that That is so cool Cheers dude Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted October 14, 2012 Share Posted October 14, 2012 I did some research : blocks [color=brown] (if (setq ent (tblobjname "BLOCK" "FT")) (entmod (subst '(2 . "CO") '(2 . "FT") (entget (cdr (assoc 330 (entget ent)))))) )[/color] also [color=brown] (if (setq ent (cdr (assoc -2 (tblsearch "BLOCK" "FT")))) (entmod (subst '(2 . "CO") '(2 . "FT") (entget (cdr (assoc 330 (entget ent)))))) )[/color] layers "0" layer can't be renamed, but color can be set to it (changed to "red" - color 1) (if (setq ent (tblobjname "LAYER" "0")) (entmod (subst '(62 . 1) '(62 . 7) (entget ent))) ) views Empty table view (tblnext "VIEW" T) => nil Firstly create view "MR" (if (setq ent (tblobjname "VIEW" "MR")) (entmod (subst '(2 . "VR") '(2 . "MR") (entget ent))) ) ltypes "Continuous" ltype can't be modified so you have to load new ltype Firstly load ltype "Dashed" (if (setq ent (tblobjname "LTYPE" "Dashed")) (entmod (subst '(2 . "MR") '(2 . "Dashed") (entget ent))) ) styles "Standard" style can't be renamed, but font can be set to it (changed to "simplex.shx") (if (setq ent (tblobjname "STYLE" "Standard")) (entmod (subst '(3 . "simplex.shx") '(3 . "arial.ttf") (entget ent))) ) ucss Empty table ucs (tblnext "UCS" T) => nil Firstly save ucs "MR" (if (setq ent (tblobjname "UCS" "MR")) (entmod (subst '(2 . "VR") '(2 . "MR") (entget ent))) ) dimstyles "Standard" dimstyle can't be renamed and modified Firstly save dimstyle "MR" (if (setq ent (tblobjname "DIMSTYLE" "MR")) (entmod (subst '(2 . "VR") '(2 . "MR") (entget ent))) ) vports Empty table vport (tblnext "VPORT" T) => nil Firstly create vport "MR" (if (setq ent (tblobjname "VPORT" "MR")) (entmod (subst '(2 . "VR") '(2 . "MR") (entget ent))) ) appid "ACAD" appid can't be modified, so this won't work [highlight] (if (setq ent (tblobjname "APPID" "ACAD")) (entmod (subst '(2 . "MR") '(2 . "ACAD") (entget ent))) )[/highlight] M.R. Quote Link to comment Share on other sites More sharing options...
Sweety Posted October 14, 2012 Author Share Posted October 14, 2012 Thank you LEE for the nice explanations Also thank you Marko for that nice examples . Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.