×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

LISP to Remove Bind Prefixes and Merge Resulting Layers

LISP to Remove Bind Prefixes and Merge Resulting Layers

LISP to Remove Bind Prefixes and Merge Resulting Layers

(OP)
I am looking for a LISP file that will remove the X-Ref Prefixes from layers bound to a file then merge duplicate layers to the original layer already included in the file.  I found this "Remove Bind Prefixes" lisp in an autodesk forum.  It seems, no matter how much searching I do, I can't find an automated solution to the merging the results.  Obviously there is laymrg, but it takes way too long to merge 40 or 50 layers one-at-a-time.  Needless to say, I am not an expert at lisp but I, like a whole bunch of other folks on these forums, am trying to learn.  Any help would be oh-so greatly appreciated.

Thanks

Remove Bind Prefixes:

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close