Author Topic: How to find nested non-graphical data associated with blocks  (Read 11531 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
Say you have a block that only has layers, text styles and dimension styles.  How do you know what is associated with that block?

I had a drawing with some layers that I couldn't purge, and I couldn't find associated with anything in the drawing, so I assumed they were associated with a block some how, but I didn't know how to check for it.  Is there a way?

Thanks in advance.

Edit: This is the routine I'm using to find the layers.
Edit:  Maybe it's not in blocks, and if so, then where else could it be?  I check viewports, not froze within there either.  Not sub-entities of old fashion polylines, or 'endblk' or 'seqend' entities.
« Last Edit: July 12, 2007, 12:28:37 PM by T.Willey »
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: How to find nested non-graphical data associated with blocks
« Reply #1 on: July 12, 2007, 12:56:29 PM »
1. Blocks can only contain graphical objects.
2. Any vertical dictionaries?  AEC Walls etc.
3. APPID
4. Invisible graphical objects?
James Buzbee
Windows 8

Chuck Gabriel

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #2 on: July 12, 2007, 01:01:16 PM »
1. Blocks can only contain graphical objects.

You sure about that?  Build a drawing with some layers but no graphical entities.  Now insert that drawing into a new drawing.  You now have a block, that contains no graphical entities, in the host drawing, and all the layers from the drawing you inserted are contained in the host drawing.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #3 on: July 12, 2007, 01:14:56 PM »
2. Any vertical dictionaries?  AEC Walls etc.
Quote from: Acad drawing
AEC_CLASSIFICATION_SYSTEM_DEFS
AEC_DISP_REPS
AEC_DISPLAY_PROPS_DEFAULTS
AEC_MASS_ELEM_STYLES
AEC_MATERIAL_DEFS
AEC_PROFILE_DEFS
AEC_PROPERTY_FORMAT_DEFS
AEC_PROPERTY_SET_DEFS
AEC_SLAB_STYLES
AEC_SLABEDGE_STYLES
AEC_WINDOW_STYLES
AECB_CIRCUITS
AECB_VOLTAGEDEFINITIONS
ASE_INDEX_DICTIONARY
I noticed in your post, in the other thread about my chase layer routine, you said something about these.  I will see if I can find anything in them.

3. APPID
How to check these?  I don't think I have ever worked with them.

4. Invisible graphical objects?
Nope.  I have a routine that looks for these, and none were found.


Thanks James.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Cathy

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #4 on: July 12, 2007, 02:48:49 PM »
Did you purge the blocks -- is it perhaps in a block with no block reference to it in the drawing? 

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #5 on: July 12, 2007, 03:00:34 PM »
Did you purge the blocks -- is it perhaps in a block with no block reference to it in the drawing? 
I purged everything I could, and the layers were still there.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Cathy

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #6 on: July 12, 2007, 03:28:29 PM »
As a last resort, you can save it as a .dxf and then open the .dxf with a text editor and search for the layer name. 

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #7 on: July 12, 2007, 03:49:14 PM »
2. Any vertical dictionaries?  AEC Walls etc.
How can I check these dictionaries?  When I look at them, their entries they are all AcDbZombieObjects (proxy objects).
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to find nested non-graphical data associated with blocks
« Reply #8 on: July 12, 2007, 05:34:23 PM »
I'm intrigued Tim, any chance you send me the file?

Promise to keep the contents confidential.

Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to find nested non-graphical data associated with blocks
« Reply #9 on: July 14, 2007, 03:07:44 PM »
_FindRefs

Code: [Select]
(defun _FindRefs ( handles / _FileToList _IndexDxfData _SortHandles _Princ _Main )

    ;;==========================================================================
    ;;
    ;;  _FindRefs.lsp
    ;;
    ;;  Written by Michael Puckett (MP) for Tim Willey.
    ;;
    ;;--------------------------------------------------------------------------
    ;;
    ;;  Version 1.0  2007/07/14  Original code.  MP.
    ;;
    ;;--------------------------------------------------------------------------
    ;;
    ;;  Uses a sledge hammer technique to find all references to
    ;;  the handles passed to the function.
    ;;
    ;;  For every handle passed will return the handle plus any
    ;;  entities / objects that reference it as handles. If no
    ;;  references are found for a handle it will be listed solo.
    ;;
    ;;  For example --
    ;;
    ;;      (_FindRefs '( "BOGUS" "9409" "940B" "940A" "9408" ))
    ;;
    ;;  Might return this --
    ;;
    ;;      (
    ;;          ( "BOGUS" ) ;; no references found.
    ;;          ( "9409" "1E1B1" "1E01F" "1E023" ...)
    ;;          ( "940B" "1E1B5" "1E559" "1DFA5" ...)
    ;;          ( "940A" "1E1B3" "1E559" "1DFA5" ...)           
    ;;          ( "9408" "1E1AF" "1DFFA" "1DFFC" ... )
    ;;      )
    ;;
    ;;==========================================================================
                   
    (defun _FileToList ( fullName / handle result stream )

        (cond
            (   (setq handle (open fullName "r"))
                (while (setq stream (read-line handle))
                    (setq result
                        (cons
                            stream
                            result
                        )
                    )
                )
                (close handle)
            )
        )

        (reverse result)

    )

    (defun _IndexDxfData ( dxfData / i handle reference owner result )

        (setq i 0)

        (foreach entry dxfData

            (cond
                (   (eq "  5" entry)
                    (setq handle (nth (1+ i) dxfData))
                )
                (   (and
                        (member entry '( "320" "330" "340" "350" "360" "1005"))
                        (/= "0" (setq reference (nth (1+ i) dxfData)))
                    )
                    (setq result
                        (if (eq handle (car (setq owner (car result))))
                            (cons
                                (append owner (list reference))
                                (cdr result)
                            )
                            (cons
                                (list handle reference)
                                result
                            )
                        )
                    )
                )
            )

            (setq i (1+ i))

        )

        (reverse result)

    )
   
    (defun _SortHandles ( handles )
   
        ;;  Caller's responsibility to pass valid data. Normalizes
        ;;  handles to same string length by padding with leading
        ;;  zeros so sorts properly.
   
        (if (and handles (< 1 (length handles)))
       
            (   (lambda ( / len )
                   
                    (setq len
                        (apply 'max
                            (mapcar 'strlen handles)
                        )
                    )
                   
                    (acad_strlsort
                        (mapcar
                           '(lambda ( handle )
                                (while (< (strlen handle) len)
                                    (setq handle (strcat "0" handle))
                                )
                                handle
                            )                       
                            handles                       
                        )
                    )   
                )
            )   
       
            handles
       
        )   

    )

    (defun _Princ ( x )

        (princ x)

        (princ) ;; empties the print queue immediately as well as make quiet

    )

    (defun _Main ( handles / tempfile index result cmdecho )
   
        (cond

            ;;  Do sanity checks on the argument passed to the
            ;;  function (something I normally don't do but in
            ;;  the public's interest) ...
           
            (   (or
           
                    (null handles)                  ;;  duh
                   
                    (not (listp handles))           ;;  duh
                   
                    (null (vl-list-length handles)) ;;  catch dotted pair
                   
                    (not                            ;;  not a list of strings
                        (apply 'and
                            (mapcar
                               '(lambda ( handle ) (eq 'str (type handle)))
                                handles
                            )
                        )
                    )
                )   
               
                (princ
                    (strcat
                        "Invalid call: "
                        "(_FindRefs " (vl-prin1-to-string handles) ")\n"
                        "Syntax: (_FindRefs listOfHandles)\n"
                        "Example: (_FindRefs '(\"1\" \"2\" \"3\"))\n"
                    )
                )
               
                nil
                               
            )   
           
            ;;  Rock and roll ...

            (   t
           
                ;;  write out a dxf file offor the current drawing,
                ;;  consume it, index it, then nuke the bastard
       
                (_Princ "Creating dxf index ... ")
               
                (setq cmdecho (getvar "cmdecho"))
               
                (setvar "cmdecho" 0)
               
                (vl-cmdf
                    ".dxfout"
                    (setq tempfile (vl-filename-mktemp "myapp.dxf"))
                    ""
                )
               
                (setvar "cmdecho" cmdecho)
       
                (setq index (_IndexDxfData (_FileToList tempfile)))
               
                (vl-file-delete tempfile)
       
                (princ "[done].\n")
       
                (_Princ "Scanning dxf index ... ")
       
                (setq result
                    (mapcar
                       '(lambda ( handle )
                            (cons handle
                                (_SortHandles
                                    (mapcar 'car
                                        (vl-remove-if-not
                                           '(lambda ( entry )
                                                (member handle (cdr entry))
                                            )
                                            index
                                        )
                                    )
                                )                             
                            )
                        )
                        (mapcar 'strcase handles)
                    )
                )
       
                (_Princ "[done].\n")
               
                result
       
            )           
        )   

    )

    (_Main handles)

)

c:Test

Code: [Select]
(defun c:Test ( / _Type _MsgHasRefs _MsgRef _MsgNoRefs _Main )

    (defun _Type ( handle / ename )
        (if (setq ename (handent handle))
            (cdr (assoc 0 (entget ename)))
            "NUL"
        )
    )

    (defun _MsgHasRefs ( handle )
        (princ
            (strcat
                "Entity / Object ["
                handle
                "] <"
                (_Type handle)
                "> is referenced by these Entities/Objects:\n\n"
            )
        )       
    )

    (defun _MsgRef ( handle )
        (princ
            (strcat
                "\t\t\t"
                handle
                " <"
                (_Type handle)
                ">\n"
            )
        )
    )

    (defun _MsgNoRefs ( handle )
        (princ
            (strcat
                "Entity / Object ["
                handle
                "] <"
                (_Type handle)
                "> is not referenced by any Entities/Objects.\n\n"
            )
        )
    )

    (defun _Main ( / references )

        (foreach x

            (_FindRefs
                (vl-remove-if-not
                   '(lambda ( handle ) (eq 'str (type handle)))
                    (mapcar
                       '(lambda ( layer / ename )
                            (if (setq ename (tblobjname "layer" layer))
                                (cdr (assoc 5 (entget ename)))
                            )
                        )
                       '(
                            "UnwantedLayer1"
                            "UnwantedLayer2"
                            "UnwantedLayer3"
                            "UnwantedLayer4"
                        )
                    )
                )
            )

            (cond
                (   (setq references (cdr x))
                    (_MsgHasRefs (car x))
                    (mapcar '_MsgRef references)
                    (princ "\n")
                )
                (   (_MsgNoRefs (car x))
                )
            )
        )

        (princ)

    )

    (_Main)

)

Output might be ...

Entity / Object [A50A] <LAYER> is referenced by these Entities/Objects:

    2F06F <ACAD_PROXY_OBJECT>
    2F070 <ACAD_PROXY_OBJECT>
    ...

Entity / Object [A51C] <LAYER> is referenced by these Entities/Objects:

    2F069 <ACAD_PROXY_OBJECT>
    2F06A <ACAD_PROXY_OBJECT>
    ...

Entity / Object [A51B] <LAYER> is referenced by these Entities/Objects:

    2F069 <ACAD_PROXY_OBJECT>
    2F06A <ACAD_PROXY_OBJECT>
    ...

Entity / Object [A519] <LAYER> is referenced by these Entities/Objects:

    2F10B <ACAD_PROXY_OBJECT>
    2F10D <ACAD_PROXY_OBJECT>
    ...


Hope it helps / let me know of any problems.

:)



Edits:
Forced handles to uppercase before search.
Implemented _SortHandles function.
Added missing 360 code to _IndexDxfData.
Added sample output.
« Last Edit: July 16, 2007, 11:25:21 AM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: How to find nested non-graphical data associated with blocks
« Reply #10 on: July 15, 2007, 08:46:02 AM »
1. Blocks can only contain graphical objects.

You sure about that?  Build a drawing with some layers but no graphical entities.  Now insert that drawing into a new drawing.  You now have a block, that contains no graphical entities, in the host drawing, and all the layers from the drawing you inserted are contained in the host drawing.

The Layers aren't "in" the block - they would still be purgable.
James Buzbee
Windows 8

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: How to find nested non-graphical data associated with blocks
« Reply #11 on: July 15, 2007, 08:55:10 AM »
Tim,
Using ADT 2006 when a drawing is "exported to AutoCAD" all AEC objects are converted to simple AutoCAD entities, and all AEC dictionaries are deleted as well (just tried this).  This might be a drawing from an earlier release, or converted some other way, because it created the proxy objects.  I'm wondering if you could just delete the AEC dictionaries?  That would be my next step.

Hope this helps.

jb
James Buzbee
Windows 8

Chuck Gabriel

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #12 on: July 15, 2007, 09:29:40 AM »
1. Blocks can only contain graphical objects.

You sure about that?  Build a drawing with some layers but no graphical entities.  Now insert that drawing into a new drawing.  You now have a block, that contains no graphical entities, in the host drawing, and all the layers from the drawing you inserted are contained in the host drawing.

The Layers aren't "in" the block - they would still be purgable.

Interesting.  I never realized that, but I guess it makes sense, because the layers still are not referenced by any graphical entities.  Thanks.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #13 on: July 16, 2007, 11:29:23 AM »
Michael,

  Thanks for the code.  I will try and look at it today, but real work has been pushed on me, so not sure when I will get a minute to check it out.

James,

  I can try and erase the dictionaries and see what happens.  Thanks for the insight.  I'm not sure what version, or even what product our consultants are using, so I don't know if it's an older version than mine.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to find nested non-graphical data associated with blocks
« Reply #14 on: July 16, 2007, 12:11:28 PM »
Hi Tim.

I can almost guarantee that if you delete the references to the layers as found by the _FindRefs function that you will be able to purge said layers. Of course you should use some caution when performing said deletion and make sure candidate entities to be nuked meet your criteria, which at this point I'm not privy to.

If it's ok to delete proxies (i.e. you've considered the ramifications of doing so and are ok with it) then try the following minimalist code on a copy of the offending model and see what happens.

Make sure you edit the layer names embedded in the code below as applicable, noting that it does nominal sanity checking on said layer names.

Code: [Select]
(defun c:Test2 ( / _NukeIfMeetsCriteria )

    (defun _NukeIfMeetsCriteria ( handle / ename )
   
        (vl-catch-all-apply
       
           '(lambda ( )
   
                (if
                    (eq "ACAD_PROXY_OBJECT" ;; what else?
                        (cdr
                            (assoc 0
                                (entget
                                    (setq ename
                                        (handent handle)
                                    )
                                )
                            )
                        )
                    )
                   
                    (entdel ename)           
                )
               
                (if (null (entget ename))     
                    (princ
                        (strcat
                            handle
                            " nuked.\n"
                        )
                    )
                )
            )           
        )                       
    )

    (foreach x
   
        (_FindRefs
            (mapcar
               '(lambda ( layer / ename )
                    (if (setq ename (tblobjname "layer" layer))
                        (cdr (assoc 5 (entget ename)))
                    )
                )
               '(
                    "StubbornLayer1" ;; edit me and my friends below
                    "StubbornLayer2"
                    "StubbornLayer3"
                    "StubbornLayer4"
                )
            )
        )
       
        (foreach handle (cdr x)
       
            (_NukeIfMeetsCriteria handle)
           
        )   
   
    )
   
    (setvar "cmdecho" 0)
   
    (command ".purge" "_la" "*" "_No") ;; will echo names of layers purged
   
    (princ)
   
)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #15 on: July 18, 2007, 01:33:53 PM »
Michael,

  I just finished my work on the problem drawings.  I used your code examples, and see no adverse effects.  I put a front end dialog on the _FindRefs function, and printed to the command line what it found.  Here is one example.
Quote
Layer: G-ANNO-NPLT
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 28 ]
 Layer: A-WALL-PRES
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 50 ]
 Layer: A-Wall-Patt
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 109 ]
 Layer: A-WALL-FULL
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 9 ]
 Layer: A-Wall-Comp
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 173 ]
 Layer: A-Wall-Cent
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 126 ]
 Layer: A-Wall-Blow
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 168 ]
 Layer: A-Wall-Abov
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 168 ]
 Layer: A-Sect-Mcut
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 1 ]
 Layer: A-Roof-Fasc
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 4 ]
 Layer: A-Glaz-Blow
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 4 ]
 Layer: A-Glaz-Abov
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 4 ]
 Layer: A-Elev-Hlite
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 40 ]
 Layer: A-Elev-Dark
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 40 ]
 Layer: A-Anno-Scrn
 Object type [ count ]: DICTIONARY [ 1 ]
 Object type [ count ]: ACAD_PROXY_OBJECT [ 47 ]

I also made a global variable GlbVarEnameList that holds all the enames of the objects here.  Since I don't need any of them, because they don't show in my drawing, I deleted them like you show in your second code.  After that I was able to purge the unwanted layers.


Thanks everyone for the help.  I don't think I would have ever figured this out on my own.  Off to study the code in depth.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to find nested non-graphical data associated with blocks
« Reply #16 on: July 18, 2007, 02:50:07 PM »
Glad you got a { ermmm } handle on things Tim. Thanks for the update and for letting us pitch in. If you've any questions fire away (I'll try to answer 'em).

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #17 on: July 18, 2007, 02:56:47 PM »
My main hope is to be able to find this information without having to use dxfout.  I would love to be able to find it with plan lisp, vlisp or activex, so I can add it to my existing routine, but if not, then your way works just fine for me.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to find nested non-graphical data associated with blocks
« Reply #18 on: July 18, 2007, 03:17:04 PM »
My main hope is to be able to find this information without having to use dxfout.

IINM The only you'll able to do that Tim is with the proper object enabler loaded. Even then it depends if the bit heads who authored it properly exposed the dxf codes. Frequently not.

:/
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #19 on: July 18, 2007, 03:25:22 PM »
My main hope is to be able to find this information without having to use dxfout.

IINM The only you'll able to do that Tim is with the proper object enabler loaded. Even then it depends if the bit heads who authored it properly exposed the dxf codes. Frequently not.

:/
Well shoot!  Doesn't that just suck.

How does the dxfout know what to put in the file then?  Could a more powerful language find these things then?

I haven't the time right now to research this, more 'real' work has been given to me.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to find nested non-graphical data associated with blocks
« Reply #20 on: July 18, 2007, 03:29:50 PM »
How does the dxfout know what to put in the file then?

A good question that I can't adequately answer. Maybe if Tony drives by he can offer some insight.

Could a more powerful language find these things then?

Quite possibly, but I'm only guessing.

Sorry I'm not more helpful.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #21 on: July 18, 2007, 03:33:16 PM »
How does the dxfout know what to put in the file then?

A good question that I can't adequately answer. Maybe if Tony drives by he can offer some insight.
I don't think Tony checks the lisp forums here, but maybe.

Sorry I'm not more helpful.
You have been very helpful Michael.  Thank you.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #22 on: July 18, 2007, 03:34:33 PM »
Well shoot!  Doesn't that just suck.

How does the dxfout know what to put in the file then?  Could a more powerful language find these things then?

I haven't the time right now to research this, more 'real' work has been given to me.

Tim;

So, you just just want to kill the proxies and after that being able to purge your drawing?

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #23 on: July 18, 2007, 03:38:06 PM »
Well shoot!  Doesn't that just suck.

How does the dxfout know what to put in the file then?  Could a more powerful language find these things then?

I haven't the time right now to research this, more 'real' work has been given to me.

Tim;

So, you just just want to kill the proxies and after that being able to purge your drawing?
Not necessarily kill the proxy, but find out that the proxy exist.  If no way to edit them, or fix them, then delete the non-graphical entities that the proxy's represent.  If it is graphical, then I don't want to loose that information.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #24 on: July 18, 2007, 03:49:22 PM »
Not necessarily kill the proxy, but find out that the proxy exist.  If no way to edit them, or fix them, then delete the non-graphical entities that the proxy's represent.  If it is graphical, then I don't want to loose that information.

have not being able to read the whole topic enchilada.... let me do it...


the problem with proxies is that the developer set's the proxy flags and if they set a kNoOperation there won't be a way to use erase or wblock them AFAIK.


CottageCGirl

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #25 on: July 18, 2007, 04:07:06 PM »
I know it's late...and an EXTREEMLY SIMPLE approach, but if I have an idea what block might be lurking about.  if you draw a large circle (I use red) and hatch it solid. then redifine the block you are having trouble with...then zoom extents, sometimes it will show up off in never never land and you can undo back to pre-redefining the block and erase the extraneous block...sometimes it is just a duplicate that is invisable etc...
we use some blocks that are attributes only or just a dot..I found this is an effective/quick way to find if you have any stray blocks....

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to find nested non-graphical data associated with blocks
« Reply #26 on: July 18, 2007, 04:32:30 PM »
Not necessarily kill the proxy, but find out that the proxy exist.

Tim, if you simply want to find all proxies try this (ssget is unreliable with proxies) --

Code: [Select]
(if
    (setq proxies
        (vl-remove-if-not
           '(lambda ( ename )
                (eq "ACAD_PROXY_OBJECT"
                    (cdr (assoc 0 (entget ename)))
                )
            )
            (_GetDocEnames
                (vla-get-activedocument
                    (vlax-get-acad-object)
                )
            )
        )       
    )
   
    (progn
       
        (princ "\nHouston we have proxies ...\n")
       
        ;;  Do whatever ...
       
    )
   
)

Supporting cast (sorry, no time to uncouple it all) ...

Code: [Select]
(defun _Item ( collection name / item )

    ;;  If the named item exists in the collection return it to the
    ;;  caller, otherwise nil.

    (vl-catch-all-apply
       '(lambda ( )
            (setq item
                (vla-item collection name)
            )
        )
    )

    item

)

(defun _MakeCollectionName ( collection name )

    (if (_Item collection name)
        (   (lambda ( i )
                (while
                    (_Item
                        collection
                        (strcat name "_" (itoa (setq i (1+ i))))
                    )
                )
                (strcat name "_" (itoa i))
            )
            0
        )
        name
    )
)

(defun _ObjectIDtoObject ( document objectID / object )

    (vl-catch-all-apply
       '(lambda ( )
            (setq object
                (vla-objectidtoobject
                    document
                    objectID
                )
            )
        )
    )
    object
)

(defun _GetDocEnames ( doc / actdoc dict temp object objectID floorID result )

    ;;  An abused varient of my _GetDocObjects function.

    (if
        (equal doc
            (setq actdoc
                (vla-get-activedocument
                    (vlax-get-acad-object)
                )
            )
        )   
        (acad-push-dbmod)     
    )   

    (setq
        dict     (vla-get-dictionaries doc)
        temp     (vla-add dict (_MakeCollectionName dict "temp"))
        objectID (vla-get-objectid temp)
        floorID  (- (vla-get-objectID (vla-get-blocks doc)) 8)
    )

    (while (< floorID (setq objectID (- objectID 8)))
        (if (setq object (_ObjectIDtoObject doc objectID))
            (setq result
                (cons
                    (vlax-vla-object->ename object)
                    result                   
                )
            )
        )
    )

    (vla-delete temp)

    (if (equal doc actdoc)
        (acad-pop-dbmod)
    )   
   
    result

)



Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #27 on: July 18, 2007, 07:21:34 PM »
CCGirl,

  The problem isn't finding the block.  The problem doesn't seem to be block related, as I first thought it did.  It is a problem with custom objects, either by a vertical or a third party, that puts custom objects into the drawings.  It then stores information about these objects, and one of the items seems to be layers.  Since the layers are referencing the objects (or the objects are referencing the layers) I can't purge the layers out of the drawing.  Thanks for the idea though, I could use that one.

Michael,

  I will look at your code tomorrow, and see what I can understand about it.  Thanks for sharing.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CottageCGirl

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #28 on: July 18, 2007, 09:29:01 PM »
CCGirl,

  The problem isn't finding the block.  The problem doesn't seem to be block related, as I first thought it did.  It is a problem with custom objects, either by a vertical or a third party, that puts custom objects into the drawings.  It then stores information about these objects, and one of the items seems to be layers.  Since the layers are referencing the objects (or the objects are referencing the layers) I can't purge the layers out of the drawing.  Thanks for the idea though, I could use that one.

Michael,

  I will look at your code tomorrow, and see what I can understand about it.  Thanks for sharing.


ahhhh, we had a toilet block that someone had embedded wierd layers and, actually, attributes to, that  kept doing strange things...it took weeks to figure out..we call it the exploding toilet...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: How to find nested non-graphical data associated with blocks
« Reply #29 on: July 19, 2007, 12:55:24 PM »
Michael, I will look at your code tomorrow, and see what I can understand about it.  Thanks for sharing.

My pleasure, thanks for giving us the opportunity to pitch in.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #30 on: July 20, 2007, 02:53:49 PM »
Michael,

  I see what you are doing in your last code.  I guess there is no way with lisp (or C# that I found) to see what layers are associated with proxy objects.



Thanks all.  It was a good learning experience for me.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: How to find nested non-graphical data associated with blocks
« Reply #31 on: July 20, 2007, 03:09:09 PM »
ahhhh, we had a toilet block that someone had embedded wierd layers and, actually, attributes to, that  kept doing strange things...it took weeks to figure out..we call it the exploding toilet...
Couldn't you just flush the layers?  :-P
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

CottageCGirl

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #32 on: July 23, 2007, 08:55:55 AM »
ahhhh, we had a toilet block that someone had embedded wierd layers and, actually, attributes to, that  kept doing strange things...it took weeks to figure out..we call it the exploding toilet...
Couldn't you just flush the layers?  :-P

ha....
thats punny....

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #33 on: July 23, 2007, 02:43:31 PM »
Michael,

  I ran the program you gave me, and it found one item, a dictionary.  I erased the dictionary (entdel), but I still couldn't purge the layer.  I ran the command a second time and it doesn't find anything.

If I erase all objects in model space, then it can be purged.

The question:
Why?  Is there an item referencing the dictionary within model space?  If so, how can I find that item?

Thanks in advance.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

deegeecees

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #34 on: July 23, 2007, 02:46:35 PM »
If all you want to do is get rid of the Layer, then Express Tools has a Layer Delete function that will do this.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: How to find nested non-graphical data associated with blocks
« Reply #35 on: July 23, 2007, 02:57:19 PM »
If all you want to do is get rid of the Layer, then Express Tools has a Layer Delete function that will do this.
I like to know why/how things work, or not work, so I wouldn't want to use something that just deletes the layer without me understanding why I can't purge it regularly.

I will keep that in mind, as I don't use express that much, and forget what they have.  Thanks.  :-)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

deegeecees

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #36 on: July 23, 2007, 03:06:36 PM »
I like to know why/how things work, or not work, so I wouldn't want to use something that just deletes the layer without me understanding why I can't purge it regularly.
... Thanks.  :-)

 I hear ya loud n clear on that!

artisteroi

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #37 on: August 31, 2007, 11:22:55 AM »
1. Blocks can only contain graphical objects.

true only graphics but the graphics have properties and one of those properties is the host layer. Which means that the layer is occupied and un-purge-able. :mrgreen:

KewlToyZ

  • Guest
Re: How to find nested non-graphical data associated with blocks
« Reply #38 on: August 31, 2007, 02:13:06 PM »
AEC has so many bugs.... They have gotten really bad in 2008.

1.7 Billion objects in MEP and each discipline library is structured differently from the other.
Even 2 of the exact same ADT based AEC object types on the same layer in an XREF have given me separate bug effects with normal 2D block inserts to my own base drawing template. The complexity has exceeded the grasp of the interface. I hope that Autodesk starts to refine things without so many vertical developments for a few years.

From what is happening, my only guess is there could be custom tag/label text based objects containing data on those layers that cannot be viewed without their corresponding libraries. 9 out of 10 times I find the non graphical garbage hanging around is custom data.
« Last Edit: August 31, 2007, 04:20:04 PM by KewlToyZ »