Author Topic: wblock become 4MB no matter the content  (Read 2300 times)

0 Members and 1 Guest are viewing this topic.

Amsterdammed

  • Guest
wblock become 4MB no matter the content
« on: May 01, 2016, 07:46:51 AM »
I generate shopdrawings out of a drawing for my technical equipment rooms. work great 9 times here and now at the 10 building in this project it doesn't.

i create for each shop drawing a wblock that later will be inserted in a m"mother" shop drawing and layout are created in there. this all worked. but now it stops working after the 5th (no matter what 5 i select wblocks inserted in the mother drawing . block does load in the drawing but not show, so all lisp that works further with that block comes to an halt.

no matter what i do  a wblock out of that particular drawing becomes 4mb, even for a single line. also with copy/paste in to template. if i draw the line in the template it is 68kb. even a wblock out of the wblock is 4mb.

 i know that wblock are using the source drawing as a template, so there's clearly 4mb on BS getting past on . What could that be????


i purges everything including regapps.

i need to generate 160 shop drawings and time is running out fast.

What can i try to repair that ???


Thanks folks

Bernd




MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: wblock become 4MB no matter the content
« Reply #1 on: May 01, 2016, 01:46:07 PM »
Challenging narrative. Odds are it's dictionary pollution, likely from a vertical (Civil 3D, Prosteel, yada), AEC pollution etc.

Run AnalyzeThis on the sickly drawings and share the reports:

Code: [Select]
(progn

    ;;  Trivial code but nonetheless ... Copyright © 2007-2016 Michael Puckett
    ;;
    ;;  Do note that the count values are not absolute. They reflect what is
    ;;  found by sweeping thru all collections without applying instancing.
    ;;
    ;;  For example, if Block "A" hosts 4 lines, and there are 10 instances of
    ;;  said block the reported count will NOT be 40 — it will be 4. A future
    ;;  version may address this issue.

    (defun _AnalyzeThis ( this / _IndexThisEx _IndexThis _ImNotDead _LSet _RSet _GetChildrenAux _GetChildren _MakeReport _ExportReport _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 _ImNotDead ( )

            ;;  Admittedly takes longer to execute but operator
            ;;  knows AutoCAD is alive; doing something.
            ;;
            ;;  Note: Variable count is a lexical global (int).
           
            (if (zerop (rem (setq count (1+ count)) 100 ))
                (progn
                    (command ".delay" 0)
                    (princ (strcat "\rIndexed [" (itoa count) "] objects."))
                    (princ)
                )
            )

        )

        (defun _LSet ( text len )

            (while (< (strlen text) len)
                (setq text (strcat text "        "))
            )

            (substr text 1 len)

        )

        (defun _RSet ( text len )

            (while (< (strlen text) len)
                (setq text (strcat "        " text))
            )

            (substr text (- (strlen text) len -1))

        )

        (defun _IndexThis ( this )

            ;;  _IndexThis is a wrapper for IndexEx.
            ;;  don't get it? Too bad, so sad.

            ;;  let 'em know we haven't died
           
            (_ImNotDead)

            (_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
                (function
                    (lambda ( )
                        ;;  force an error if the 'this'
                        ;;  object is not a collection
                        (vlax-get this 'Count)
                        ;;  'kay, let's roll
                        (vlax-for object this
                            (_IndexThis object)
                        )
                    )
                )
            )

            (if (eq :vlax-true (vla-get-hasextensiondictionary this))
                (_IndexThis (vla-getextensiondictionary this))
            )

            (foreach brat (_GetChildren this)
                (_IndexThis brat)
            )

        )

        (defun _GetChildrenAux ( ename / result )
            (while (and ename (/= "SEQEND" (cdr (assoc 0 (entget ename)))))
                (setq
                    result (cons ename result)
                    ename  (entnext ename)
                )
            )
            (mapcar 'vlax-ename->vla-object (reverse result))
        )

        (defun _GetChildren ( object / foo )
            (   (lambda ( ename )
                    (if (eq 1 (cdr (assoc 66 (entget ename))))
                        (_GetChildrenAux (entnext ename))
                    )
                )
                (vlax-vla-object->ename object)
            )
        )

        (defun _MakeReport ( data / sum len1 len2 len3 val div val )

            (setq
                data (vl-sort data '(lambda (a b) (> (cadr a) (cadr b))))
                data (cons (list "TOTAL COUNT:" (setq sum (apply '+ (mapcar 'cadr data)))) data)
                len1 (1+ (apply 'max (mapcar 'strlen (mapcar 'car data))))
                len2 (strlen (itoa sum))
                len3 (1+ (strlen "[100.0%]"))
                div  (/ sum 100.0)
            )

            (cons
                (list
                    (strcat
                        (apply 'strcat (mapcar 'getvar '(dwgprefix dwgname)))
                        "\n"
                    )
                )
                (mapcar
                    (function
                        (lambda ( pair )
                            (list
                                (_LSet (car pair) len1)
                                (_RSet (itoa (setq val (cadr pair))) len2)
                                (_Rset (strcat " [" (rtos (/ val div) 2 1) "%]") len3)
                            )
                        )
                    )
                    data
                )
            )
        )

        (defun _ExportReport ( report / name handle )

            (setq
                name    (vl-filename-mktemp "analyzethis.txt")
                handle  (open name "w")
            )

            (foreach lst report
                (foreach x lst (princ x handle))
                (princ "\n" handle)
            )

            (close handle)

            (startapp "notepad.exe" name)

        )

        (defun _Main ( this / count index report handle )

            ;;  Variables 'index' and 'count' are lexical globals
            ;;  accessed by lexical global function _IndexEx,
            ;;  _IndexThis and _ImOk.
           
            (setq count 0)

            (_IndexThis (vlax-get this 'Blocks))
            (_IndexThis (vlax-get this 'Dictionaries))
            (_IndexThis (vlax-get this 'DimStyles))
            ;;  (_IndexThis (vlax-get this 'FileDependencies))
            (_IndexThis (vlax-get this 'Groups))
            (_IndexThis (vlax-get this 'Layers))
            (_IndexThis (vlax-get this 'Layouts))
            (_IndexThis (vlax-get this 'Linetypes))
            (_IndexThis (vlax-get this 'Materials))
            (_IndexThis (vlax-get this 'PlotConfigurations))
            (_IndexThis (vlax-get this 'RegisteredApplications))
            (_IndexThis (vlax-get this 'TextStyles))
            (_IndexThis (vlax-get this 'UserCoordinateSystems))
            (_IndexThis (vlax-get this 'Viewports))

            (foreach lst (setq report (_MakeReport index))
                (foreach x lst (princ x))
                (princ "\n")
            )

            (_ExportReport report)

            (princ)

        )

        (_Main this)

    )

    (defun C:AnalyzeThis ( / dimzin cmdecho )

        (setq
            cmdecho (getvar 'cmdecho)
            dimzin  (getvar 'dimzin)
        )
        (setvar 'cmdecho 0)
        (setvar 'dimzin 0)

        (_AnalyzeThis (vla-get-activedocument (vlax-get-acad-object)))

        (setvar 'dimzin dimzin)
        (setvar 'cmdecho cmdecho)
        (princ)

    )

    (c:AnalyzeThis)

)

Edit: Revised program to show what percentage an individual tally represents.
Edit: Revised program to indicate it's busy (for larger drawings).
Edit: Revised ImNotDead function.
« Last Edit: May 02, 2016, 06:06:36 PM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Amsterdammed

  • Guest
Re: wblock become 4MB no matter the content
« Reply #2 on: May 01, 2016, 08:57:32 PM »
Michael,

thanks, i am running the code, but it is a pretty big drawing, so i seems to take a while. I have some detail in the drawing from the architect, so that might be the source. but just deleting and purge isn't doing it, i tried that in one of the wblocks and then made a wblock out of that and it still was 4mb.

 I will share the result when available.

Thanks Bernd

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: wblock become 4MB no matter the content
« Reply #3 on: May 01, 2016, 09:06:55 PM »
Hope you grabbed the latest version of the utility. An interim version had a bug. Apologies if the one you grabbed crashes.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Amsterdammed

  • Guest
Re: wblock become 4MB no matter the content
« Reply #4 on: May 01, 2016, 10:39:09 PM »
("AcDbLine" 166374)
("AcDbBlockTableRecord" 18974)
("AcDbEllipse" 14668)
("AcDbLSStrokePatternComponent" 11710)
("AcDb2dVertex" 11149)
("AcDbLSSymbolComponent" 7440)
("AcDbPolyline" 5397)
("AcDbPoint" 4922)
("AcDbLSPointComponent" 4257)
("AcDbLSCompoundComponent" 4255)
("AcDbBlockReference" 4192)
("AcDbLinetypeTableRecord" 3195)
("AcDbHatch" 3190)
("AcDbDictionary" 3060)
("AcDb3dSolid" 3054)
("AcDbSpline" 2480)
("AcDbMText" 2390)
("AcDbLayerTableRecord" 2336)
("AcDbLSDefinition" 2266)
("AcDbText" 1314)
("AcDbLSInternalComponent" 1082)
("AcDbAttribute" 753)
("AcDbArc" 599)
("AcDbXrecord" 595)
("AcDb2dPolyline" 272)
("AcDbAttributeDefinition" 173)
("AcDbRegion" 144)
("AcDbBody" 124)
("AcDbCircle" 115)
("AcDbViewport" 110)
("AcDbScale" 83)
("AcDbTextStyleTableRecord" 66)
("AcDbRegAppTableRecord" 59)
("AcDbSortentsTable" 59)
("AcDbSection" 56)
("AcDbField" 45)
("AcDbLayout" 44)
("AcDbVisualStyle" 26)
("AcDbSolid" 19)
("AcDbMaterial" 14)
("AcDbDictionaryVar" 12)
("AcDbZombieObject" 12)
("vlo_VL" 11)
("AcDbDimStyleTableRecord" 10)
("AcDbRotatedDimension" 8)
("AcDbWipeout" 6)
("AcDbMLeaderStyle" 4)
("AcDbAssocNetwork" 2)
("AcDbViewportTableRecord" 1)
("AcDbViewportTable" 1)
("AcDbUCSTable" 1)
("AcDbTextStyleTable" 1)
("AcDbRegAppTable" 1)
("AcDbLinetypeTable" 1)
("AcDbLayerTable" 1)
("AcDbDimStyleTable" 1)
("AcDbWipeoutVariables" 1)
("AcDbTableStyle" 1)
("AcDbSectionManager" 1)
("AcDbPlaceHolder" 1)
("AcDbDictionaryWithDefault" 1)
("AcDbMlineStyle" 1)
("AcDbFieldList" 1)
("AcDbSolidBackground" 1)
("AcDbDimAssoc" 1)
("AcDbDynamicBlockPurgePreventer" 1)
("AcDbEvalGraph" 1)
("AcDbMLeader" 1)
("AcDbBlockTable" 1)

Total object count: 281147


what now?

Amsterdammed

  • Guest
Re: wblock become 4MB no matter the content
« Reply #5 on: May 01, 2016, 10:39:52 PM »
missed that in my post:
RG-07-50-00-250.dwg

Object tally:

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: wblock become 4MB no matter the content
« Reply #6 on: May 01, 2016, 10:42:26 PM »
Perform the analysis on a drawing from the same series that isn't bloated.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: wblock become 4MB no matter the content
« Reply #7 on: May 02, 2016, 02:37:25 AM »
AcDbLSStrokePatternComponent ... Ergo: 'Classic' DGN linetypes problem?
See:
https://www.theswamp.org/index.php?topic=48574.msg536490#msg536490

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: wblock become 4MB no matter the content
« Reply #8 on: May 02, 2016, 04:44:42 AM »
are you using the standard "wblock" command, or "-wblock"? I've had better results when using the -w command.

I generate shopdrawings out of a drawing for my technical equipment rooms. work great 9 times here and now at the 10 building in this project it doesn't.

i create for each shop drawing a wblock that later will be inserted in a m"mother" shop drawing and layout are created in there. this all worked. but now it stops working after the 5th (no matter what 5 i select wblocks inserted in the mother drawing . block does load in the drawing but not show, so all lisp that works further with that block comes to an halt.

no matter what i do  a wblock out of that particular drawing becomes 4mb, even for a single line. also with copy/paste in to template. if i draw the line in the template it is 68kb. even a wblock out of the wblock is 4mb.

 i know that wblock are using the source drawing as a template, so there's clearly 4mb on BS getting past on . What could that be????


i purges everything including regapps.

i need to generate 160 shop drawings and time is running out fast.

What can i try to repair that ???


Thanks folks

Bernd

Amsterdammed

  • Guest
Re: wblock become 4MB no matter the content
« Reply #9 on: May 02, 2016, 05:17:30 AM »
Michael,

you are great!! Thank you. took the dgnfix lsp and changed the alert to princ so i could run it as a script, and repaired my 160 dwgs.
now i insert them in my "mother shop drawing and it seems to work, no more hick-ups.

You saved my butt(again)!!

Thanks,

Bernd

Amsterdammed

  • Guest
Re: wblock become 4MB no matter the content
« Reply #10 on: May 02, 2016, 05:19:49 AM »
Roy,

forgot to thank you too for your help!

It was the dgn linetype problem!

all fixed with swamp posts!

Thanks

Bernd

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: wblock become 4MB no matter the content
« Reply #11 on: May 02, 2016, 06:34:56 AM »
... Let's not forget alanjt (Alan J. Thompson) the author of DGNFix.

Amsterdammed

  • Guest
Re: wblock become 4MB no matter the content
« Reply #12 on: May 02, 2016, 08:11:03 AM »
Iindeed!

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: wblock become 4MB no matter the content
« Reply #13 on: May 02, 2016, 08:44:10 AM »
AcDbLSStrokePatternComponent ... Ergo: 'Classic' DGN linetypes problem?
See:
https://www.theswamp.org/index.php?topic=48574.msg536490#msg536490

Thanks for stepping in with this info Roy. I should have recognized same -- our company was hit with this rather massively a couple years ago with drawings from another consulting firm. The result was rather traumatic -- it crippled our system for a couple days as scores of drawings infected other drawings ad infinitum. To this day our fix is named after the other company. In my defense I was on my phone and hadn't read the analysis dump, I figured the culprit(s) would be plain enough comparing the report from a diseased file and non diseased file.

Michael,

you are great!! Thank you. took the dgnfix lsp and changed the alert to princ so i could run it as a script, and repaired my 160 dwgs.
now i insert them in my "mother shop drawing and it seems to work, no more hick-ups.

You saved my butt(again)!!

Thanks,

Bernd

My pleasure, thanks for the thanks.

... Let's not forget alanjt (Alan J. Thompson) the author of DGNFix.

This x 2.
« Last Edit: May 02, 2016, 08:51:24 AM by MP »
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: wblock become 4MB no matter the content
« Reply #14 on: May 02, 2016, 06:06:42 PM »
Note: AnalyzeThis proggy updated.
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst