Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Detecting problem DGN linetype-related objects in a DWG

5 REPLIES 5
Reply
Message 1 of 6
dmfrazier
360 Views, 5 Replies

Detecting problem DGN linetype-related objects in a DWG

Is there any way, using AutoLISP, to simply detect the presence of DGN linetype-related objects in a DWG?  (The purpose would be to automatically alert R2013 users when they open a DWG so that they may take corrective action.)

 

Thanks.

5 REPLIES 5
Message 2 of 6
hmsilva
in reply to: dmfrazier


@dmfrazier wrote:

Is there any way, using AutoLISP, to simply detect the presence of DGN linetype-related objects in a DWG?  (The purpose would be to automatically alert R2013 users when they open a DWG so that they may take corrective action.)


Perhaps adding something like this in accadoc.lsp

 

(setq *flag nil)
(while (setq TblName (tblnext "LType" (null TblName)))
  (if (wcmatch (strcase (cdr (assoc 2 TblName))) "DGN*7,DGN*4");; add the correct names in uppercase
    (setq *flag T)
  )
)
(if *flag
  (alert "take corrective action")
  )
(princ)

 

Hope that helps

Henrique

EESignature

Message 3 of 6
dmfrazier
in reply to: hmsilva

Not a bad start (thank you), but the problem with this approach is that I have no way of knowing beforehand what linetype names to check for.  For instance, I have a set of DWGs causing me headaches right now that have roughly 1200 unwanted (and unpurgeable) linetypes and none of them include "DGN" in their names (and it doesn't appear that there's anything else in the names that I would be able to always count on).

 

I wonder if maybe I should look for something other than the linetypes.  One thing I've noticed is that when I use the DGNPurge utility on one of these DWGs, it makes purgeable a bunch of blocks whose names start with "*A".  I wonder if that would be a reliable clue.

Message 4 of 6
hmsilva
in reply to: dmfrazier

I can't offer much help, I don't deal with DGN's, only have two sample dgn's posted by users trying to purge those linetypes...

 

Just a thought

instead of testing for DGN linetypes, test for non standard linetypes (your's .lin)...


Henrique

EESignature

Message 5 of 6
artc2
in reply to: dmfrazier

If there is DGN linestyle data in the drawing, then the Named Objects Dictionary will have a dictionary in it named "ACAD_DGNLINESTYLECOMP" which contains most of the data objects (some others are in the extension dictionaries of the LinetTypeTableRecords).

Message 6 of 6
dmfrazier
in reply to: artc2

Thank you.  That looks promising....

 

I borrowed some code for something similar, and came up with this:

 

(dictsearch (namedobjdict) "ACAD_DGNLINESTYLECOMP")

 

In a new blank DWG based on my template, this returns nil.

In a DWG known to have "issues", this code hangs AutoCAD.

(So, I think I'm getting somewhere... but very slowly!)

 

Can you think of another strategy?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost