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

0 Members and 1 Guest are viewing this topic.

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