+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Senior Member
    Using
    AutoCAD 2010
    Join Date
    Aug 2010
    Posts
    211

    Default Need help with some codes please

    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
             )
    ))))

  2. #2
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,737

    Default

    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

  3. #3
    Senior Member
    Using
    AutoCAD 2010
    Join Date
    Aug 2010
    Posts
    211

    Default

    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

  4. #4
    Senior Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2012
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    331

    Default

    Quote Originally Posted by Sweety View Post
    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).

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  5. #5
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows XP
    Discipline
    Construction
    pBe's Discipline Details
    Discipline
    Construction
    Details
    Camp Construction planning and details
    Using
    AutoCAD 2009
    Join Date
    Apr 2010
    Posts
    2,106

    Default

    Quote Originally Posted by Lee Mac View Post
    Code:
    (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

  6. #6
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,737

    Default

    Quote Originally Posted by Sweety View Post
    Thank you LEE .
    You're welcome!

    Quote Originally Posted by Sweety View Post
    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:

    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

  7. #7
    Quantum Mechanic Lee Mac's Avatar
    Computer Details
    Lee Mac's Computer Details
    Operating System:
    Windows 7 Ultimate (32-bit)
    Discipline
    Multi-disciplinary
    Lee Mac's Discipline Details
    Discipline
    Multi-disciplinary
    Details
    Custom Programming / Software Customisation
    Using
    AutoCAD 2013
    Join Date
    Aug 2008
    Location
    London, England
    Posts
    15,737

    Default

    Quote Originally Posted by pBe View Post
    Wow, I didn't know that

    That is so cool
    Cheers dude
    Lee Mac Programming

    With Mathematics there is the possibility of perfect rigour, so why settle for less?

    Just another Swamper

  8. #8
    Senior Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2012
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    331

    Default

    I did some research :

    blocks

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

    "0" layer can't be renamed, but color can be set to it (changed to "red" - color 1)
    Code:
      (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"
    Code:
      (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"
    Code:
      (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")
    Code:
      (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"
    Code:
      (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"
    Code:
      (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"
    Code:
      (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
    Code:
    
      (if (setq ent (tblobjname "APPID" "ACAD"))
          (entmod (subst '(2 . "MR") '(2 . "ACAD") (entget ent)))
      )
    M.R.

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

  9. #9
    Senior Member
    Using
    AutoCAD 2010
    Join Date
    Aug 2010
    Posts
    211

    Default

    Registered forum members do not see this ad.

    Thank you LEE for the nice explanations

    Also thank you Marko for that nice examples .

Similar Threads

  1. 4 dxf codes for 10
    By Michaels in forum AutoLISP, Visual LISP & DCL
    Replies: 22
    Last Post: 14th Aug 2010, 05:31 pm
  2. New codes of ssget to me
    By Michaels in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 14th Aug 2010, 02:38 pm
  3. Help with Autocad codes like %%d
    By Lithium in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 11th Feb 2009, 08:51 am
  4. codes
    By chloe18 in forum AutoCAD Beginners' Area
    Replies: 7
    Last Post: 27th Sep 2007, 01:05 pm
  5. DXF Codes
    By Spageddie in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 18th Sep 2005, 11:36 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts