Author Topic: dwg file 42MB, but nothing in dwg!  (Read 14593 times)

0 Members and 1 Guest are viewing this topic.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: dwg file 42MB, but nothing in dwg!
« Reply #30 on: December 03, 2007, 02:43:16 PM »
Afterthought, 42MB is going to be too big to email, even if zipped me thinks. Do you have winzip? You could partition it into 10MB chucks and send each separately.

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

jonesy

  • SuperMod
  • Seagull
  • Posts: 15568
Re: dwg file 42MB, but nothing in dwg!
« Reply #31 on: December 03, 2007, 02:45:24 PM »
Are there any zero length lines or text in there? (sorry if this has already been asked)

I don't know. How would I check for that?
Theres a lisp at the swamp.... I'll try to find it.
Thanks for explaining the word "many" to me, it means a lot.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: dwg file 42MB, but nothing in dwg!
« Reply #32 on: December 03, 2007, 02:50:18 PM »
What is the size of the newly created drawing when using this?

Code: [Select]
(command ".-wblock"
(strcat (getvar "dwgprefix") (getvar "dwgname")"-NEW")
"*"
)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

T.Willey

  • Needs a day job
  • Posts: 5251
Re: dwg file 42MB, but nothing in dwg!
« Reply #33 on: December 03, 2007, 02:50:34 PM »
What does this return
Code: [Select]
(defun c:LoItemCount (/ ObjType ObjList tempList)
(vlax-for lo (vla-get-Layouts (vla-get-Activedocument (vlax-get-Acad-Object)))
(setq ObjList nil)
(vlax-for obj (vla-get-Block lo)
(setq ObjType (vla-get-ObjectName obj))
(if (setq tempList (assoc ObjType ObjList))
(setq ObjList (subst (cons (car tempList) (1+ (cdr tempList))) tempList ObjList))
(setq ObjList (cons (cons ObjType 1) ObjList))
)
)
(prompt (strcat "\n Count for layout: " (vla-get-Name lo)))
(foreach lst ObjList
(prompt (strcat "\n    Object type [Amount]: " (car lst) " [ " (itoa (cdr lst)) " ]"))
)
)
(princ)
)

I'm very intrigued as well.

<snip> ..
(Tim, to be truly effective you need to perform same on every entity in every block definition to absolutely ensure / force visibility)
.. <snip>
True.


Edit:  Update code to run correctly.
« Last Edit: December 03, 2007, 02:54:28 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.

architecture68-raff

  • Swamp Rat
  • Posts: 599
  • Strange things are afoot at the Circle-K.
Re: dwg file 42MB, but nothing in dwg!
« Reply #34 on: December 03, 2007, 02:52:16 PM »
I've found this posting to be helpful in similar situations...(courtesy of rkmcswain)

http://rkmcswain.blogspot.com/2007/11/drawings-larger-than-they-should-be.html
Chicago, Illinois
ADT 2005, Revit Architecture 2009, Sketchup 7

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: dwg file 42MB, but nothing in dwg!
« Reply #35 on: December 03, 2007, 02:53:38 PM »
What's the report if you paste this to the command line in the afflicted drawing (forgive me it's a bit crude)?

Code: [Select]
(progn

    (defun _AnalyzeThis ( this / _IndexThisEx _IndexThis _Main )
   
        (defun _IndexThisEx ( this / objectname pair )
   
            ;;  index is a lexical global declared in _Main
   
            (setq index
                (if
                    (setq pair
                        (assoc
                            (setq objectname
                                (vlax-get this 'Objectname)
                            )
                            index
                        )
                    )
                    (subst
                        (list
                            (car pair)
                            (1+ (cadr pair))
                        )
                        pair
                        index
                    )
                    (cons
                        (list objectname 1)
                        index
                    )
                )
            )
           
            ;;  not strictly needed but
            ;;  return the index to the caller           
   
        )
   
        (defun _IndexThis ( this )
       
            ;;  _IndexThis is a wrapper for IndexEx.
            ;;  don't get it? Too bad, so sad.
           
            (_IndexThisEx this)
           
            ;;  this is not a robust example of programming,
            ;;  but in the interests of time and ascii economy
            ;;  I'm using a simplistic recursive sledge hammer
            ;;  technique
           
            (vl-catch-all-apply   
           
               '(lambda ( )
               
                    ;;  force an error if the 'this'
                    ;;  object is not a collection
               
                    (vlax-get this 'Count)
               
                    ;;  let 'em know we haven't died
               
                    (princ
                        (strcat
                            "Indexing "
                            (vl-prin1-to-string this)
                            "\n"
                        )
                    )
               
                    ;;  'kay, let's roll
               
                    (vlax-for object this
                        (_IndexThis object)                   
                    )
                )
            )           
        )
   
        (defun _Main ( this / index )
       
            ;;  variable 'index' is a lexical global accessed
            ;;  by lexical global function _IndexEx.
       
            ;(_IndexThis (vlax-get this 'Blocks))
            (_IndexThis (vlax-get this 'ModelSpace))
           
            (princ "\nOrdered by object type:\n")
           
            (mapcar 'print       
                (vl-sort
                    index
                   '(lambda ( a b ) (< (car a) (car b)))
                )
            )                 
   
            (princ "\n\nOrdered by object count (descending):\n")
           
            (mapcar 'print       
                (vl-sort
                    index
                   '(lambda ( a b ) (> (cadr a) (cadr b)))
                )
            )                 
   
            (princ "\n\nTotal object count: ")
           
            (princ (apply '+ (mapcar 'cadr index)))
           
            (princ)       
       
        )
   
        (_Main this)
   
    )
   
    (defun C:AnalyzeThis ( )
   
        (_AnalyzeThis (vla-get-activedocument (vlax-get-acad-object)))
       
        (princ)
   
    )
   
    (c:AnalyzeThis)
   
)
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: dwg file 42MB, but nothing in dwg!
« Reply #36 on: December 03, 2007, 02:55:12 PM »
I've found this posting to be helpful in similar situations...(courtesy of rkmcswain)

http://rkmcswain.blogspot.com/2007/11/drawings-larger-than-they-should-be.html

Good tip but I can can tell you with certainty it's not a layer filters or registered applications problem.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Notsober

  • Guest
Re: dwg file 42MB, but nothing in dwg!
« Reply #37 on: December 03, 2007, 02:58:48 PM »

Try qtext [enter] on [enter] regenall [enter] zoom [enter] extents [enter].

Poof, "OMG, it's full of stars!"


Michael, you're a genius!

The dwg turned out to be a UNIVERSE!!!

T.Willey

  • Needs a day job
  • Posts: 5251
Re: dwg file 42MB, but nothing in dwg!
« Reply #38 on: December 03, 2007, 03:02:38 PM »
If they are empty text strings, you can use this to select them
Code: [Select]
(setq ss (ssget "x" '((0 . "MTEXT,TEXT") (1 . ", ")))); Jason Piercey
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: dwg file 42MB, but nothing in dwg!
« Reply #39 on: December 03, 2007, 03:06:27 PM »
Be mindful there's also the potential for other "hidden" gems, like wipeouts, 3dfaces etc. That "AnalyzeThis" code should be very revealing me thinks.

Also, keep in mind qtext will reveal blank text, attdefs and attributes (the latter hosted in blocks).
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Notsober

  • Guest
Re: dwg file 42MB, but nothing in dwg!
« Reply #40 on: December 03, 2007, 03:18:06 PM »
so far we've got it down to 13MB, it's still large. But it's better than 42MB!

so how do I find other "hidden" gems to rid them?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: dwg file 42MB, but nothing in dwg!
« Reply #41 on: December 03, 2007, 03:18:38 PM »
Did you run the AnalyzeThis code snip?

Edit: Would be interesting to see the results generated from the 42MB version, rather than the 13MB version.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Notsober

  • Guest
Re: dwg file 42MB, but nothing in dwg!
« Reply #42 on: December 03, 2007, 03:19:32 PM »
What's the report if you paste this to the command line in the afflicted drawing (forgive me it's a bit crude)?

Code: [Select]
(progn

    (defun _AnalyzeThis ( this / _IndexThisEx _IndexThis _Main )
   
        (defun _IndexThisEx ( this / objectname pair )
   
            ;;  index is a lexical global declared in _Main
   
            (setq index
                (if
                    (setq pair
                        (assoc
                            (setq objectname
                                (vlax-get this 'Objectname)
                            )
                            index
                        )
                    )
                    (subst
                        (list
                            (car pair)
                            (1+ (cadr pair))
                        )
                        pair
                        index
                    )
                    (cons
                        (list objectname 1)
                        index
                    )
                )
            )
           
            ;;  not strictly needed but
            ;;  return the index to the caller           
   
        )
   
        (defun _IndexThis ( this )
       
            ;;  _IndexThis is a wrapper for IndexEx.
            ;;  don't get it? Too bad, so sad.
           
            (_IndexThisEx this)
           
            ;;  this is not a robust example of programming,
            ;;  but in the interests of time and ascii economy
            ;;  I'm using a simplistic recursive sledge hammer
            ;;  technique
           
            (vl-catch-all-apply   
           
               '(lambda ( )
               
                    ;;  force an error if the 'this'
                    ;;  object is not a collection
               
                    (vlax-get this 'Count)
               
                    ;;  let 'em know we haven't died
               
                    (princ
                        (strcat
                            "Indexing "
                            (vl-prin1-to-string this)
                            "\n"
                        )
                    )
               
                    ;;  'kay, let's roll
               
                    (vlax-for object this
                        (_IndexThis object)                   
                    )
                )
            )           
        )
   
        (defun _Main ( this / index )
       
            ;;  variable 'index' is a lexical global accessed
            ;;  by lexical global function _IndexEx.
       
            ;(_IndexThis (vlax-get this 'Blocks))
            (_IndexThis (vlax-get this 'ModelSpace))
           
            (princ "\nOrdered by object type:\n")
           
            (mapcar 'print       
                (vl-sort
                    index
                   '(lambda ( a b ) (< (car a) (car b)))
                )
            )                 
   
            (princ "\n\nOrdered by object count (descending):\n")
           
            (mapcar 'print       
                (vl-sort
                    index
                   '(lambda ( a b ) (> (cadr a) (cadr b)))
                )
            )                 
   
            (princ "\n\nTotal object count: ")
           
            (princ (apply '+ (mapcar 'cadr index)))
           
            (princ)       
       
        )
   
        (_Main this)
   
    )
   
    (defun C:AnalyzeThis ( )
   
        (_AnalyzeThis (vla-get-activedocument (vlax-get-acad-object)))
       
        (princ)
   
    )
   
    (c:AnalyzeThis)
   
)

the report:

Indexing #<VLA-OBJECT IAcadModelSpace 010d5e04>

Ordered by object type:

("AcDbArc" 20)
("AcDbBlockReference" 1)
("AcDbBlockTableRecord" 1)
("AcDbCircle" 4)
("AcDbHatch" 1)
("AcDbLine" 172)
("AcDbMText" 4)
("AcDbPolyline" 8)
("AcDbSolid" 7)
("AcDbText" 1)

Ordered by object count (descending):

("AcDbLine" 172)
("AcDbArc" 20)
("AcDbPolyline" 8)
("AcDbSolid" 7)
("AcDbCircle" 4)
("AcDbMText" 4)
("AcDbBlockReference" 1)
("AcDbText" 1)
("AcDbHatch" 1)
("AcDbBlockTableRecord" 1)

Total object count: 219

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: dwg file 42MB, but nothing in dwg!
« Reply #43 on: December 03, 2007, 03:21:08 PM »
Hmmm, that looks wrong, and by magnitudes. Revisiting code ...
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

deegeecees

  • Guest
Re: dwg file 42MB, but nothing in dwg!
« Reply #44 on: December 03, 2007, 03:22:06 PM »
Code: [Select]
(defun _AnalyzeThis...
Got a giggle from that. I would have never thought of qtext. Nice MP!