+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Senior Member harilalmn's Avatar
    Computer Details
    harilalmn's Computer Details
    Operating System:
    Win XP
    Discipline
    Architectural
    harilalmn's Discipline Details
    Occupation
    CAD Manager
    Discipline
    Architectural
    Using
    AutoCAD 2010
    Join Date
    Aug 2010
    Location
    Bangalore, India
    Posts
    115

    Default Cleaning up $0$ Layers in Binded Drawings

    Registered forum members do not see this ad.

    Hi All,
    I have so many drawings in which the xrefs were 'bind'ed instead of 'insert'ing.
    Seeking a solution I got a Lisp routine from net (Thanks to the person posted it. But I don't remember his name or the wesite I got it from), which is as given below. The problem is that $0$ layers are not getting renamed because I have another layer in the same name. Suppose;
    I have a layer, Ground Floor Plan$0$A-ANNO-DIMS which has to be renamed to A-ANNO-DIMS
    Since the drawing has a layer A-ANNO-DIMS, it doesn't allow the lisp to rename it. I have the logic now but I am a zero in lisp.

    It has to check if the layer exists before renaming.
    If existing it should merge down the $0$ layer to the standard one. (This part is missing in the lisp routine)

    Can anyone please change the code to do so? It would be a great help...
    Here is the code;



    (defun c:RBP(/ ActDoc Name NewName)
    ; RemoveBindPrefixes
    ; Renames layers, blocks, dimension styles, text styles, user coordinate systems, and views
    ; by taking out the bind as bind prefix
    ; Example Drawing1$0$Layer1 -> Layer1

    (vl-load-com)
    (defun RemoveBindPrefix (String / Pos LastPos)

    (if (setq Pos (vl-string-search "$" String))
    (progn
    (setq LastPos Pos)
    (while (setq Pos (vl-string-search "$" String (1+ Pos)))
    (setq LastPos Pos)
    )
    (substr String (+ 2 LastPos))
    )
    String
    )
    )
    ;---------------------------------------------------------
    (setq ActDoc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
    (vlax-for Obj (vla-get-Layers ActDoc)
    (setq Name (vla-get-Name Obj))
    (if (/= (setq NewName (RemoveBindPrefix Name)) Name)
    (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-Name (list Obj NewName)))
    (prompt (strcat "\n Layer: " Name " was not renamed."))
    )
    )
    )
    (vlax-for Obj (vla-get-Blocks ActDoc)
    (setq Name (vla-get-Name Obj))
    (if (/= (setq NewName (RemoveBindPrefix Name)) Name)
    (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-Name (list Obj NewName)))
    (prompt (strcat "\n Block: " Name " was not renamed."))
    )
    )
    )
    (vlax-for Obj (vla-get-TextStyles ActDoc)
    (setq Name (vla-get-Name Obj))
    (if (/= (setq NewName (RemoveBindPrefix Name)) Name)
    (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-Name (list Obj NewName)))
    (prompt (strcat "\n Text style: " Name " was not renamed."))
    )
    )
    )
    (vlax-for Obj (vla-get-Views ActDoc)
    (setq Name (vla-get-Name Obj))
    (if (/= (setq NewName (RemoveBindPrefix Name)) Name)
    (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-Name (list Obj NewName)))
    (prompt (strcat "\n View: " Name " was not renamed."))
    )
    )
    )
    (vlax-for Obj (vla-get-UserCoordinateSystems ActDoc)
    (setq Name (vla-get-Name Obj))
    (if (/= (setq NewName (RemoveBindPrefix Name)) Name)
    (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-Name (list Obj NewName)))
    (prompt (strcat "\n UCS: " Name " was not renamed."))
    )
    )
    )
    (vlax-for Obj (vla-get-DimStyles ActDoc)
    (setq Name (vla-get-Name Obj))
    (if (/= (setq NewName (RemoveBindPrefix Name)) Name)
    (if (vl-catch-all-error-p (vl-catch-all-apply 'vla-put-Name (list Obj NewName)))
    (prompt (strcat "\n Dimension style: " Name " was not renamed."))
    )
    )
    )
    (princ)
    )

  2. #2
    Quantum Mechanic ReMark's Avatar
    Computer Details
    ReMark's Computer Details
    Operating System:
    Windows 7 Pro 64-bit
    Computer:
    Thinkmate
    Motherboard:
    Intel DX58SO2 LGA1366 X58
    CPU:
    Intel i7-960 Quad-core 3.20GHz 8MB cache
    RAM:
    12GB (3x4GB) PC3-106000 DDR3
    Graphics:
    nVidia Quadro 4000, 2GB GDDR5
    Primary Storage:
    150GB Velocipraptor 10,000 rpm
    Secondary Storage:
    none
    Monitor:
    Dell P24LLH - 24" wide screen LCD
    Discipline
    See details...
    ReMark's Discipline Details
    Occupation
    CAD Draftsman/Designer...chemical manufacturing.
    Discipline
    See details below.
    Details
    I work for a specialty chemical manufacturer. I do a little bit of everything from P&IDs to civil to architectural and structural.
    Using
    AutoCAD 2015
    Join Date
    Nov 2005
    Location
    Norwalk, CT USofA
    Posts
    40,481

    Default

    Perhaps you are referring to the lisp routine written by CAB2k that was included as part of post #10 in this thread at the AUGI website.

    http://forums.augi.com/showthread.php?t=31759
    "I have only come here seeking knowledge. Things they wouldn't teach me of in college." The Police

    Eat brains...gain more knowledge!

    I'm now a full member of the Society for the Promotion of Mediocrity in CAD. Standards? We don't need no stinkin' standards! Take whatever advice I offer and do the opposite.

  3. #3
    Senior Member harilalmn's Avatar
    Computer Details
    harilalmn's Computer Details
    Operating System:
    Win XP
    Discipline
    Architectural
    harilalmn's Discipline Details
    Occupation
    CAD Manager
    Discipline
    Architectural
    Using
    AutoCAD 2010
    Join Date
    Aug 2010
    Location
    Bangalore, India
    Posts
    115

    Default

    Yeah I have gone through that.
    But that was not what I exactly wanted....!!
    That routine first adds prefix to all XRef Layers like X1, X2, X3 etc....
    It does not merge down the layers.
    In the code I posted here, it does the job perfectly, but I just wanted it to merge down the Layers, Text Styles, Dimension Styles Etc... to the standard ones.
    Could someone please edit the code to achieve it?

  4. #4
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,149

    Default

    Registered forum members do not see this ad.

    DropBox | finding the light...
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

Similar Threads

  1. Cleaning Drawings
    By herb6874 in forum AutoCAD General
    Replies: 1
    Last Post: 15th Jun 2010, 03:40 pm
  2. Cleaning Drawings Lisp?
    By Brian_MMC in forum AutoLISP, Visual LISP & DCL
    Replies: 5
    Last Post: 14th Feb 2010, 08:25 pm
  3. Cleaning layers, changing texts
    By donbosco in forum AutoCAD Beginners' Area
    Replies: 4
    Last Post: 25th Nov 2009, 11:47 pm
  4. External References Disappear when Binded
    By jrobpong in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 7th Jan 2008, 10:28 am
  5. copy layers to new drawings
    By quasifun in forum AutoCAD General
    Replies: 5
    Last Post: 27th Sep 2007, 05:32 pm

Tags for this Thread

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