Author Topic: Can't purge linetype  (Read 4897 times)

0 Members and 1 Guest are viewing this topic.

Rabbit

  • Guest
Can't purge linetype
« on: October 04, 2013, 10:17:07 AM »
My template drawing has linetypes within it that have come from an xref, but there is no ref attached to the drawing.  The linetypes have names like "XREF-LAYOUT*********" (asterisks being different letters/numbers).  I'm fairly sure that these are located within a block somewhere.  What I need to do is find out which blocks have the erroneous linetypes so that I can inspect them closer and remove these linetypes.

I've started a routine which will find the blocks okay, but I can't figure out how to cycle through all the entities to find said linetypes.  Also, some of these blocks may have nested blocks which may have these linetypes.

Code - Auto/Visual Lisp: [Select]
  1. (defun c:FLT (/ s i sn name blocks)
  2.  
  3.   (if (not acdoc)
  4.   )
  5.   (setq s (ssget "_:L"))
  6.     (repeat (setq i (sslength s))
  7.       (setq sn (ssname s (setq i (1- i))))
  8.       (if (eq (cdr (assoc 0 (entget sn))) "INSERT")
  9.         (if
  10.           (not (member (setq name (cdr (assoc 2 (entget sn)))) blocks)
  11.           )
  12.            (progn
  13.              (setq blocks (cons name blocks))
  14.              (vlax-for each (vla-item (vla-get-blocks acdoc) name)
  15.                (if (wcmatch (vla-get-linetype each) "X*") (setq BList (cons name BList)))
  16.              )
  17.            )
  18.         )
  19.       )
  20.     )
  21.  
  22.       (setq BList (reverse BList)
  23.             AlertList "")
  24.       (while BList
  25.         (setq AlertList (strcat AlertList "\n" (nth 0 BList))
  26.               BList (vl-remove (car BList) BList))
  27.       );while
  28.  
  29.     (alert (strcat "These blocks have xref linetypes:" AlertList))
  30.   (princ)
  31. )
  32.  

And this is another shot at it:

Code - Auto/Visual Lisp: [Select]
  1. (defun C:FLT    ()
  2.                   (vla-get-activedocument (vlax-get-acad-object))
  3.                   ) ;_ end of vla-get-Blocks
  4.     (if (= (vla-get-IsXref Blk) :vlax-false)
  5.       (vlax-for Obj Blk
  6.         (if (eq (cdr (assoc 0 (entget (vlax-vla-object->ename Obj)))) "INSERT")
  7.           (progn
  8.             (setq name (cdr (assoc 2 (entget (vlax-vla-object->ename Obj)))))
  9.             (foreach item Obj
  10.               (if (wcmatch (vla-get-linetype item) "X*") (setq BList (cons name BList)))
  11.             );foreach
  12.           );progn
  13.         );if
  14.       ) ;vlax-for
  15.     ) ;if
  16.   ) ;vlax-for
  17.   (setq BList (reverse BList)
  18.             AlertList "")
  19.       (while BList
  20.         (setq AlertList (strcat AlertList "\n" (nth 0 BList))
  21.               BList (vl-remove (car BList) BList))
  22.       );while
  23.  
  24.     (alert (strcat "These blocks have xref linetypes:" AlertList))
  25.   (princ)
  26. );defun
  27.  

I've attached a block, for testing, with one of the offending linetypes in it.

Thanks,
Rabbit

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Can't purge linetype
« Reply #1 on: October 04, 2013, 11:04:17 AM »
Maybe this will help.

Code: [Select]
(defun c:flt (/ blist name)
  (vlax-for blk (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
    (if (and (= (vla-get-isxref blk) :vlax-false) (= (vla-get-islayout blk) :vlax-false))
      (progn (setq name (vlax-get blk
  (if (vlax-property-available-p blk 'effectivename)
    'effectivename
    'name
  )
)
     )
     (vlax-for obj blk
       (if (and (not (vl-position name blist)) (wcmatch (vla-get-linetype obj) "X*"))
(setq blist (cons name blist))
       )
     )
      )
    )
  )
  (mapcar 'print (vl-sort blist '<))
)


Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Rabbit

  • Guest
Re: Can't purge linetype
« Reply #2 on: October 04, 2013, 02:12:04 PM »
I see what I was doing wrong.  I was going about it the wrong way.  Thanks for the help.

On a side note, I've gotten ride of EVERYTHING in my drawing and the linetypes and textstyles are still there.  I've even used SuperPurge on it.

Anybody want a challenge?


EDIT:
Sorry for the long time to reply.  Been having to do the *ork thing.  And now I can't reply to the original thread.
But, the DGNPURGE stuff did the trick.  Thanks guys.
« Last Edit: October 14, 2013, 02:50:24 PM by Rabbit »

BlackBox

  • King Gator
  • Posts: 3770
Re: Can't purge linetype
« Reply #3 on: October 04, 2013, 02:48:47 PM »
I see what I was doing wrong.  I was going about it the wrong way.  Thanks for the help.

On a side note, I've gotten ride of EVERYTHING in my drawing and the linetypes and textstyles are still there.  I've even used SuperPurge on it.

Anybody want a challenge?

... And what happens when you WBLOCK the desired entities, that do not have the problem 'linetypes and textstyles' assigned?
"How we think determines what we do, and what we do determines what we get."

steve.carson

  • Newt
  • Posts: 108
Re: Can't purge linetype
« Reply #4 on: October 04, 2013, 03:35:38 PM »
http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&id=22174522&linkID=22152744

This is a link to a hotfix by autodesk that adds a new command called "dgnpurge" that fixes this issue. We just went through this in our office. When i get into the office I'll post more info that we've found.


Steve

BlackBox

  • King Gator
  • Posts: 3770
Re: Can't purge linetype
« Reply #5 on: October 04, 2013, 03:38:04 PM »
http://usa.autodesk.com/adsk/servlet/ps/dl/item?siteID=123112&id=22174522&linkID=22152744

This is a link to a hotfix by autodesk that adds a new command called "dgnpurge" that fixes this issue. We just went through this in our office. When i get into the office I'll post more info that we've found.


Steve

You'll find an Autoloader .bundle for this here. :thumbsup:

Cheers
"How we think determines what we do, and what we do determines what we get."

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: Can't purge linetype
« Reply #6 on: October 04, 2013, 03:39:57 PM »
The drawing is full of anonymous block definitions which are holding those references.  I'm no lisper but I used the following to rename all the anonymous block definitions.  For anybody interested I've attached the modified drawing and the visual studio project directory.  There is a .dll in the bin folder that works on 2013
Code - C#: [Select]
  1. [CommandMethod("Anonymous")]
  2.         public void ExposeAnonymousBlocks()
  3.         {
  4.             Document doc = Application.DocumentManager.MdiActiveDocument;
  5.             Editor ed = doc.Editor;
  6.             Database db = doc.Database;
  7.             using (Transaction tr = doc.TransactionManager.StartTransaction())
  8.             {
  9.                 BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
  10.                 foreach (ObjectId id in bt)
  11.                 {
  12.  
  13.                     BlockTableRecord btr = (BlockTableRecord)tr.GetObject(id, OpenMode.ForWrite);
  14.                     try
  15.                     {
  16.                         if (btr.IsAnonymous && !btr.IsLayout)
  17.                         {
  18.                             ed.WriteMessage("\n{0}", btr.Name);
  19.                             btr.Name = btr.Name.Substring(1);
  20.                         }
  21.                     }
  22.                     catch
  23.                     { ed.WriteMessage("\nCouldn't rename {0}", btr.Name); }
  24.  
  25.                 }
  26.                 tr.Commit();
  27.             }
  28.  
  29.         }

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Can't purge linetype
« Reply #7 on: October 04, 2013, 04:10:53 PM »
Hi,

The anonymous blocks Will Watch noticed came from custom objects created by AutoCAD Architecture (AEC objects) and the line types which are referenced by these blocks too.

If you open this drawing in an AutoCAD (vanilla) version which does not have the Achitecture Object Enabler installed, all these custom objects are converted into proxy objects (zombie objects).
Doing so, you can erase these proxy objects using the ZombieKiller app (on Exchange Apps) and deeply purge the drawing with RadicaPurge (on Exchange Apps too).

Attached the drawing after this cleanup (2081 proxy objects erased, 919 objects purged).
« Last Edit: October 04, 2013, 04:17:42 PM by gile »
Speaking English as a French Frog

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Can't purge linetype
« Reply #8 on: October 04, 2013, 04:20:36 PM »
And using the old school wblock :).

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

owenwengerd

  • Bull Frog
  • Posts: 451
Re: Can't purge linetype
« Reply #9 on: October 04, 2013, 05:00:19 PM »
I've even used SuperPurge on it.

If you use SuperPurge, try first hard purging the ACAD_DGNLINESTYLECOMP dictionary entry. Once that is gone, you can normal purge all those anonymous blocks and the linetypes.