Author Topic: How to reduce the file size.  (Read 28983 times)

0 Members and 1 Guest are viewing this topic.

jitupnair

  • Guest
How to reduce the file size.
« on: June 27, 2012, 02:36:48 AM »
I have a drawing file with a single line (line copied from a huge file) . But the file size is 14.MB. I have noticed nearly 2173 line types in the file but none is used. Line type are still there after purging. While auditing it shows 464900 entities. Can someone help me to reduce the file size?.

If there is any nongraphical entities how to remove that ?. I cannot upload the file becouse of the

Thanks & Regards

Jithesh

MeasureUp

  • Bull Frog
  • Posts: 462
Re: How to reduce the file size.
« Reply #1 on: June 27, 2012, 02:54:13 AM »
[Joke]
Don't do too much at work.
[Serious]
Open the purge dialog by typing "purge" and  you'll see what you can do.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #2 on: June 27, 2012, 03:01:36 AM »
Also try the command-line version by prefixing the purge command with a minus sign. Then purge RegApps, Empty Text & Zero Length objects. Then do a regular purge again (including blocks, layers, styles, ltypes, dimstyles, etc.) - do this at least 3 times as there may be nested stuff. Also check if there's a huge amount of layer-filters / and/or states.

Check if there's any blocks left in the drawing (use the Insert command). If there are, then they must be inserted somewhere on something like an Off/Frozen layer or on a different layout. Zoom Extents after turning on all layers on each layout to make sure there's not something hiding several miles off to a side.

If still there's a problem, start the MOVE command and then type ALL when asked to select objects. See what's displayed on the command-line.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Faster

  • Guest
Re: How to reduce the file size.
« Reply #3 on: June 27, 2012, 03:04:12 AM »
I have a drawing file with a single line (line copied from a huge file) . But the file size is 14.MB. I have noticed nearly 2173 line types in the file but none is used. Line type are still there after purging. While auditing it shows 464900 entities. Can someone help me to reduce the file size?.

If there is any nongraphical entities how to remove that ?. I cannot upload the file becouse of the

Thanks & Regards

Jithesh
Trying this code:
Code - Auto/Visual Lisp: [Select]
  1. (dictremove (namedobjdict) "ACAD_SCALELIST")

jitupnair

  • Guest
Re: How to reduce the file size.
« Reply #4 on: June 27, 2012, 03:33:05 AM »
I tried all the options in purge, audit, wblock, move etc still the file size is same. While moving its showing only one object, but in audit it shows 464900 objects.
 I cant remove 2173 line types loaded in the file using purge. I believe its from some nongraphical entities.

The file size is 13.5MB after compressing so I cant upload it.


Jithesh

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: How to reduce the file size.
« Reply #5 on: June 27, 2012, 03:38:48 AM »
first turn all layers on then Select all (using Cntrl+A) then check properties. I think that there are OLE objects.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #6 on: June 27, 2012, 04:19:08 AM »
Trying this code:
Code - Auto/Visual Lisp: [Select]
  1. (dictremove (namedobjdict) "ACAD_SCALELIST")
That's extremely dangerous! If anything in that DWG file is annotative, then the DWG would crash ACad as soon as you select it. And I don't think it would make much difference in the filesize - not to the point of removing several MB.

Edit: On the same lines, there might be other dictionaries from stuff like AEC objects. To see what's going on there you could try my code from here: http://forums.augi.com/showthread.php?78139-remove-data-link-from-drawing&p=1145303&viewfull=1#post1145303

The file size is 13.5MB after compressing so I cant upload it.
What about using something like YouSendit / DropBox / 4Shared / etc. Then you could simply post a link to it here.

Something you could also try is saving it as an older version DWG to see if the anomalous objects either becomes visible / removed.
« Last Edit: June 27, 2012, 04:25:06 AM by irneb »
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

pBe

  • Bull Frog
  • Posts: 402
Re: How to reduce the file size.
« Reply #7 on: June 27, 2012, 04:27:54 AM »
I have a drawing file with a single line (line copied from a huge file) . But the file size is 14.MB. I have noticed nearly 2173 line types in the file but none is used. Line type are still there after purging. While auditing it shows 464900 entities. Can someone help me to reduce the file size?.

If there is any nongraphical entities how to remove that ?. I cannot upload the file becouse of the

Thanks & Regards

Jithesh

Look into Annotaive Entities.  If a file has a large number of annotive scale AND  ALL scales on that list are assigned to each of the annotiative objects , the file will baloon 10 folds (exag  :-D)
 
EDIT: @ Irné
I encountered a file such as the one i described above. I actually used your OBJECTSCALECURONLY [Modified a bit] to "fix" the file, sure enough. 20MB ended up as 6MB.
« Last Edit: June 27, 2012, 06:41:49 AM by pBe »

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #8 on: June 27, 2012, 05:51:03 AM »
Yep, size might increase drastically if multiple objects are attached to multiple scales. It's because each object would have a dictionary containing an XRecord to link it to each Scale (i.e. if there's 1000 objects and 100 scales there's 100000 XRecords). The best way to avoid this scenario happening is to never turn the AnnoAutoScale on - only turn it on when you really need it (like when creating a new viewport at a new scale), then immediately turn it off again! Otherwise it tends to attach all scales in the current drawing to all annotative objects in that drawing.

But what Faster's code does is simply delete the 100 scales themselves. The links would still be attached to the 1000 objects - i.e. there's still the 100000 XRecords. And these are what's going to crash acad, since if you select (or even hover the cursor over an entity) acad reads these XRecords attached to the object to find out if it needs to add the AnnoScale pop-up menu / that icon at the cursor. But seeing as they now point to something which doesn't exist acad crashes.

That ObjetcScaleCurOnly idea is a quick-fix. Just be warned it could still cause issues. Say you've got the same anno object displayed in 2 viewports at different scales. At least one of those viewports would no longer display that object after running my code. And you can imagine that this would cause lots of extra work if there's 100's of such objects and 10's of such viewports! A better solution would be to modify that code to a ObjectScaleUsedOnly version, but that is an extremely complex code to write since it would require some sort of "knowledge" as to which objects are displayed in all viewports (including viewports in DWGs which xref the current file into itself).
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

jitupnair

  • Guest
Re: How to reduce the file size.
« Reply #9 on: June 27, 2012, 06:08:51 AM »
Thanks for the Idea Irneb,

I have uploaded the file to Dropbox.
Please follow the link

https://www.dropbox.com/sh/2q29z13b4v7fenq/j7PlrFcP7B/test-file-size.dwg

Thanks & Regards

Jithesh.

kruuger

  • Swamp Rat
  • Posts: 625
Re: How to reduce the file size.
« Reply #10 on: June 27, 2012, 06:26:57 AM »
Thanks for the Idea Irneb,

I have uploaded the file to Dropbox.
Please follow the link

https://www.dropbox.com/sh/2q29z13b4v7fenq/j7PlrFcP7B/test-file-size.dwg

Thanks & Regards

Jithesh.
huge number of linetypes. why they can't be deleted  :?
kruuger

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: How to reduce the file size.
« Reply #11 on: June 27, 2012, 06:30:22 AM »
Run this fantastic utility by MP and you will discover that the drawing contains 2,173 Linetypes and 4,539 Blocks (with names "*A####") indicating that these are no doubt used by the linetypes. The drawing also contains a dictionary: ACAD_DGNLINESTYLECOMP with 21,135 entries - this dictionary is probably preventing you from purging those blocks and linetypes.

kruuger

  • Swamp Rat
  • Posts: 625
Re: How to reduce the file size.
« Reply #12 on: June 27, 2012, 06:38:29 AM »
type this:
Code - Auto/Visual Lisp: [Select]
  1. (dictremove (namedobjdict) "ACAD_DGNLINESTYLECOMP")
then purge and dwg is clean.

thanks Lee for link. nice tool :)
kruuger

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: How to reduce the file size.
« Reply #13 on: June 27, 2012, 06:40:38 AM »
You're welcome Kruuger  :-)

I wonder what caused that dictionary and so many linetypes to be created in the first place?

Drawing size is reduced from 14.4MB to 55.1KB!  :-o

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #14 on: June 27, 2012, 06:47:20 AM »
I wonder what caused that dictionary and so many linetypes to be created in the first place?
Well, from the dictionary name I'm guessing the DGN refers to a MicroStation file. Perhaps the drawing was originally imported from MS and this dictionary stayed inside even after everything was erased & purged.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

jitupnair

  • Guest
Re: How to reduce the file size.
« Reply #15 on: June 27, 2012, 06:51:29 AM »
Greate help. Thanks to all of you for your help.

My original file size was more than 100MB. Now it become 2MB.


Thanks & Regards

Jithesh P. Nair

pBe

  • Bull Frog
  • Posts: 402
Re: How to reduce the file size.
« Reply #16 on: June 27, 2012, 06:53:51 AM »
Run this fantastic utility by MP and you will discover that the drawing contains 2,173 Linetypes and 4,539 Blocks (with names "*A####") indicating that these are no doubt used by the linetypes. The drawing also contains a dictionary: ACAD_DGNLINESTYLECOMP with 21,135 entries - this dictionary is probably preventing you from purging those blocks and linetypes.

Fantastic indeed.   :wink:


mammajamma

  • Guest
Re: How to reduce the file size.
« Reply #17 on: June 27, 2012, 09:13:37 AM »
WBLOCK
select "Entire drawing"
navigate to location and give it a name. (you can delete the old and rename the new later)
Poof, Bang, Voila.
Clean as a whistle drawing (or should be).

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #18 on: June 27, 2012, 09:44:47 AM »
WBLOCK...
Unfortunately not in this case:
I tried all the options in purge, audit, wblock, move etc still the file size is same...
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: How to reduce the file size.
« Reply #19 on: June 27, 2012, 07:32:20 PM »
In the simplest way, I think, is to copying what you want to a blank new drawing.
I have tried and the drawing size reduced from 14.727mb to about 120kb.

Faster

  • Guest
Re: How to reduce the file size.
« Reply #20 on: June 27, 2012, 11:19:37 PM »
Why do you to reduce the file size.?If you reduce the file size,a lot of usefull information will be lost!

mammajamma

  • Guest
Re: How to reduce the file size.
« Reply #21 on: June 28, 2012, 11:13:18 AM »
WBLOCK...
Unfortunately not in this case:
I tried all the options in purge, audit, wblock, move etc still the file size is same...

Yes, but was it done by checking the box next to "Entire drawing"? This is more effective than doing a regular wblock and actually choosing the objects, with the added plus of doing both layout and model at once.
Another big help is deleting layer filters and annotative scales, which can both accumulate like a virus.
Also, using the command line "-pu" (dash purge), and "R" for regapps can get rid of some memory hogging junk.

mammajamma

  • Guest
Re: How to reduce the file size.
« Reply #22 on: June 28, 2012, 11:13:58 AM »
Why do you to reduce the file size.?If you reduce the file size,a lot of usefull information will be lost!

You're not serious, are you?
 :-o

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #23 on: June 28, 2012, 12:31:08 PM »
Yes, but was it done by checking the box next to "Entire drawing"? This is more effective than doing a regular wblock and actually choosing the objects, with the added plus of doing both layout and model at once.
Another big help is deleting layer filters and annotative scales, which can both accumulate like a virus.
Also, using the command line "-pu" (dash purge), and "R" for regapps can get rid of some memory hogging junk.
I think those were mentioned previously, though you've clarified a good use of WBlock for anyone who'd come into such a situation.

The issue with the OP's drawing is unfortunately not cleared by any of those options. I think only a WBlock of selected entities removes the DGN dictionary (unless you've selected something which is tied to that dictionary). The issue seems to be that the dict, keeps all sorts of info about the entities imported from MicroStation and doesn't release this if those entities are erased. A WBlock of Entire Drawing includes all those dictionaries under the named object dictionary if they're not empty. Otherwise the -PU RegApps should've cleared it already.

As for why you'd want the file smaller. It depends on what data is actually in that dict and if you can ever really use it for something you'd want to. Generally though, this looks like useless data - seeing as it's something to do with MS, obviously nothing which ACad can do anything with. I might be wrong, but it doesn't appear so. Anyhow, the OP wanted the file smaller. He got it smaller, and now seems happy about it - so obviously that data was useless to him. Perhaps later he'd come across a scenario where it might make sense to keep the hidden dictionary full of who-knows-what, but at present there's no reason to. It simply uses up hard-drive space, RAM, makes the DWG run slower and causes issues when he wants to send it to someone (email would have similar limits as he's found when trying to attach the file to this thread - not to mention bandwidth is used up for no apparent reason).
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: How to reduce the file size.
« Reply #24 on: June 28, 2012, 06:52:25 PM »
Technically, most of your comments are fine, but by looking at the OP's first post, he just want to keep the single line on the drawing regardless anything else.
Therefore, copying the line to a new drawing is the answer.
Hope I haven't misunderstood the OP's point.

VVA

  • Newt
  • Posts: 166
Re: How to reduce the file size.
« Reply #25 on: June 30, 2012, 05:08:15 AM »
I use Alexander Rivilis utility  _EXPLODEALLPROXY and _REMOVEALLPROXY and file size reduce to 86368 bites

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #26 on: July 02, 2012, 02:14:41 AM »
Technically, most of your comments are fine, but by looking at the OP's first post, he just want to keep the single line on the drawing regardless anything else.
Therefore, copying the line to a new drawing is the answer.
Hope I haven't misunderstood the OP's point.
Yep it sounds that way, though it doesn't "work" that way in this case. Go open the offending drawing the OP added onto DropBox on post #10 (it's 16MB in size). Then do the copy-n-paste only line to a new blank DWG. Go save that DWG ... it becomes 14MB in size on my Vanilla 2012 (blank DWG started from ACAD.DWT file 64KB original). That's the same principle as I've noted about the WBlock only working if the selected items are not linked to that enormous dictionary.

BTW, Copy-n-Paste does much the same as a WBlock ... only less controllable.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

mammajamma

  • Guest
Re: How to reduce the file size.
« Reply #27 on: July 02, 2012, 01:27:11 PM »
When I used my method of "Wblock", "Entire Drawing" it went from 14,727 kb to 68 kb, without doing anything else to the file.
Pretty reduced, I'd say.
So what's the problem?

KewlToyZ

  • Guest
Re: How to reduce the file size.
« Reply #28 on: July 02, 2012, 01:42:13 PM »
The objects were not directly linked to that DGN dictionary so it worked.
Otherwise WBlock would have failed the reduction.

MeasureUp

  • Bull Frog
  • Posts: 462
Re: How to reduce the file size.
« Reply #29 on: July 02, 2012, 06:49:16 PM »
Yep it sounds that way, though it doesn't "work" that way in this case. Go open the offending drawing the OP added onto DropBox on post #10 (it's 16MB in size). Then do the copy-n-paste only line to a new blank DWG. Go save that DWG ... it becomes 14MB in size on my Vanilla 2012 (blank DWG started from ACAD.DWT file 64KB original). That's the same principle as I've noted about the WBlock only working if the selected items are not linked to that enormous dictionary.

BTW, Copy-n-Paste does much the same as a WBlock ... only less controllable.
By doing copy-n-paste, the drawing size reduced from 14.727mb to about 120kb as I mentioned on post #19.

kruuger

  • Swamp Rat
  • Posts: 625
Re: How to reduce the file size.
« Reply #30 on: July 02, 2012, 07:19:53 PM »
MeasureUp, mammajamma what software are you using to wblock, copy, paste method ?
i doesn't work for me like irneb mentioned earlier.

kruuger

MeasureUp

  • Bull Frog
  • Posts: 462
Re: How to reduce the file size.
« Reply #31 on: July 03, 2012, 12:09:31 AM »
MeasureUp, mammajamma what software are you using to wblock, copy, paste method ?
i doesn't work for me like irneb mentioned earlier.

kruuger
AutoCAD 2011.
It is version regardless for copy-n-paste.
Simply copy the line then paste to another drawing.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #32 on: July 03, 2012, 02:42:18 AM »
Exactly. Here's a screen capture to show that neither the Copy-n-Paste nor the WBlock reduces the filesize at all.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: How to reduce the file size.
« Reply #33 on: July 03, 2012, 03:55:48 AM »
...
I have the same problem the files comes huge.
I used your tool Dictionary Editing tools. it taking long time but not working with file around 5MB. and working with small file around 0.5 MB

kruuger

  • Swamp Rat
  • Posts: 625
Re: How to reduce the file size.
« Reply #34 on: July 03, 2012, 04:40:43 AM »
...
I have the same problem the files comes huge.
I used your tool Dictionary Editing tools. it taking long time but not working with file around 5MB. and working with small file around 0.5 MB
Code - Auto/Visual Lisp: [Select]
  1. (dictremove (namedobjdict) "AEC_DISP_REPS")
  2. (dictremove (namedobjdict) "AEC_DISPLAY_PROPS_DEFAULTS")
kruuger

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: How to reduce the file size.
« Reply #35 on: July 03, 2012, 05:02:16 AM »
...
kruuger
The file almost the same

kruuger

  • Swamp Rat
  • Posts: 625
Re: How to reduce the file size.
« Reply #36 on: July 03, 2012, 05:25:39 AM »
...
kruuger
The file almost the same
after deleting these dictionary file is around 100kb, but save is still "heavy"
kruuger

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #37 on: July 03, 2012, 05:55:48 AM »
Yes the DictEdit might fail if the list it's trying to display is huge - it's trying to display all items in that listbox on the dialog.

To find out which thing has a lot of items, I'd go with MP's routine (as Lee's linked to in post #12). From that you should be able to pick up what the dictionary name is, then use Kruuger's idea to remove the dictionary - you should then be able to purge normally.

E.g. running the Counts command from MP's routine:
Code: [Select]
...
Dictionaries.Count = 14
    ACAD_CIP_PREVIOUS_PRODUCT_INFO has no <Count> property.
    ACAD_COLOR.Count = 0
    ACAD_DGNLINESTYLECOMP.Count = 21135
    Groups.Count = 0
    Layouts.Count = 3
    Nameless, Handle=72.Count = 3
    ACAD_MLEADERSTYLE.Count = 2
    ACAD_MLINESTYLE.Count = 1
    PlotConfigurations.Count = 0
    ACAD_PLOTSTYLENAME.Count = 1
    ACAD_SCALELIST.Count = 33
    ACAD_TABLESTYLE.Count = 1
    ACAD_VISUALSTYLE.Count = 24
    AcDbVariableDictionary.Count = 7
DimStyles.Count = 3
Groups.Count = 0
Layers.Count = 1
Layouts.Count = 3
Linetypes.Count = 2173
RegisteredApplications.Count = 8
Modelspace.Count = 1
Paperspace.Count = 0
Again, as Kruuger's mentioned earlier ... simply remove the offending dictionary:
Code: [Select]
(dictremove (namedobjdict) "ACAD_DGNLINESTYLECOMP")And for the 2nd version:
Code: [Select]
Command: COUNTS
Blocks.Count = 4
    *Model_Space.Count = 0
    *Paper_Space.Count = 2
    EC_TICK.Count = 3
    EC-Arrow.Count = 1
Dictionaries.Count = 29
    ACAD_BACKGROUND.Count = 0
    ACAD_CIP_PREVIOUS_PRODUCT_INFO has no <Count> property.
    ACAD_COLOR.Count = 1
    Nameless, Handle=24D6DA has no <Count> property.
    Groups.Count = 0
    ACAD_IMAGE_DICT.Count = 1
    Nameless, Handle=29399 has no <Count> property.
    Layouts.Count = 2
    Nameless, Handle=10.Count = 3
    ACAD_MLEADERSTYLE.Count = 1
    ACAD_MLINESTYLE.Count = 1
    PlotConfigurations.Count = 26
    ACAD_PLOTSTYLENAME.Count = 1
    ACAD_SCALELIST.Count = 86
    ACAD_TABLESTYLE.Count = 1
    ACAD_VISUALSTYLE.Count = 26
    AcadDim has no <Count> property.
    AcDbVariableDictionary.Count = 11
    ADS_HISTORY.Count = 1
    AEC_CLASSIFICATION_SYSTEM_DEFS.Count = 0
    AEC_DISP_REP_CONFIGURATIONS.Count = 5
    AEC_DISP_REP_SETS.Count = 10
    AEC_DISP_REPS.Count = 151
    AEC_DISPLAY_PROPS_DEFAULTS.Count = 142
    AEC_LAYERKEY_STYLES.Count = 3
    AEC_PROPERTY_SET_DEFS.Count = 0
    AEC_VARS.Count = 3
    ASE_INDEX_DICTIONARY.Count = 1
    BNS_VARIABLES.Count = 1
DimStyles.Count = 2
Groups.Count = 0
Layers.Count = 3
Layouts.Count = 2
Linetypes.Count = 3
RegisteredApplications.Count = 10
Modelspace.Count = 0
Paperspace.Count = 2
However, a straight open and save reduces that particular file from 5.5MB to 206kB. Those AEC dictionaries are usually from some vertical product like ACA - thus ACad generally fixes issues on these with a simple open & save.

If I further use my DictEdit or follow Kruuger's idea to remove all AEC (and such), then do a purge regapps and all that, the file furthe4r reduces in size to 132kB.

It might be that those entities (e.g. the purge RegApps show some others removed) are using custom ARX objects. You might need to download the object enablers from ADesk:
Code: [Select]
Command: -PU
-PURGE
Enter type of unused objects to purge
[Blocks/Dimstyles/Groups/LAyers/LTypes/MAterials/MUltileaderstyles/Plotstyles/SH
apes/textSTyles/Mlinestyles/Tablestyles/Visualstyles/Regapps/Zero-length
geometry/Empty text objects/All]: r
Enter name(s) to purge <*>:
Verify each name to be purged? [Yes/No] <Y>: n
Deleting registered application "ACAD_MLEADERVER".
Deleting registered application "AcAecLayerStandard".
Deleting registered application "AECBASE".
Deleting registered application "DCO15".
Deleting registered application "REVIT".
5 registered applications deleted.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #38 on: July 03, 2012, 06:20:07 AM »
BTW, here's a much more simplistic method of getting hold of all the dictionaries attached to the document (note-not attached direct to entities - which is a different matter).
Code - Auto/Visual Lisp: [Select]
  1. (defun dt:dxf-dictlst  (dxf /)
  2.          (mapcar '(lambda (a b) (cond ((and (= (car a) 3) (= (car b) 350)) (list (cons (cdr a) (cdr b))))))
  3.                  dxf
  4.                  (cdr dxf))))
  5.  
  6. (defun dt:countitems (ename /) (length (dt:dxf-dictlst (entget ename))))
  7.  
  8. (defun dt:getdicts (/) (mapcar '(lambda (a) (list (car a) (cdr a) (dt:countitems (cdr a)))) (dt:dxf-dictlst (entget (namedobjdict)))))
  9.  
  10. (defun c:CountDicts ()
  11.   (foreach d (dt:getdicts) (print d))
  12.   (princ))
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: How to reduce the file size.
« Reply #39 on: July 03, 2012, 09:04:30 AM »
using MP tool gives this data
Code: [Select]
Command: COUNTS
Blocks.Count = 4
    *Model_Space.Count = 0
    *Paper_Space.Count = 2
    EC_TICK.Count = 3
    EC-Arrow.Count = 1
Dictionaries.Count = 28
    ACAD_ASSOCNETWORK.Count = 1
    ACAD_BACKGROUND.Count = 0
    ACAD_COLOR.Count = 1
    Nameless, Handle=24D6DA has no <Count> property.
    Groups.Count = 238571
    ACAD_IMAGE_DICT.Count = 1
    Nameless, Handle=29399 has no <Count> property.
    Layouts.Count = 2
    Nameless, Handle=10.Count = 3
    ACAD_MLEADERSTYLE.Count = 1
    ACAD_MLINESTYLE.Count = 1
    PlotConfigurations.Count = 26
    ACAD_PLOTSTYLENAME.Count = 1
    ACAD_SCALELIST.Count = 86
    ACAD_TABLESTYLE.Count = 1
    ACAD_VISUALSTYLE.Count = 26
    AcadDim has no <Count> property.
    ACDB_RECOMPOSE_DATA has no <Count> property.
    AcDbVariableDictionary.Count = 11
    ADS_HISTORY.Count = 1
    AEC_CLASSIFICATION_SYSTEM_DEFS.Count = 0
    AEC_DISP_REP_CONFIGURATIONS.Count = 5
    AEC_DISP_REP_SETS.Count = 10
    AEC_LAYERKEY_STYLES.Count = 3
    AEC_PROPERTY_SET_DEFS.Count = 0
    AEC_VARS.Count = 3
    ASE_INDEX_DICTIONARY.Count = 1
    BNS_VARIABLES.Count = 1
DimStyles.Count = 1
Groups.Count = 238571
Layers.Count = 2
Layouts.Count = 2
Linetypes.Count = 3
RegisteredApplications.Count = 8
Modelspace.Count = 0
Paperspace.Count = 2

the Dic Groups.Count = 238571 is huge

as Kruuger
Code: [Select]
(dictremove (namedobjdict) "Groups")but not working, and the file size still as it is.

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: How to reduce the file size.
« Reply #40 on: July 03, 2012, 09:08:47 AM »
Groups is not a Dictionary, but a Collection.

To remove all Groups, use this:

Code - Auto/Visual Lisp: [Select]

kruuger

  • Swamp Rat
  • Posts: 625
Re: How to reduce the file size.
« Reply #41 on: July 03, 2012, 09:17:00 AM »
using MP tool gives this data
Code: [Select]
Command: COUNTS
Blocks.Count = 4
    *Model_Space.Count = 0
    *Paper_Space.Count = 2
    EC_TICK.Count = 3
    EC-Arrow.Count = 1
Dictionaries.Count = 28
    ACAD_ASSOCNETWORK.Count = 1
    ACAD_BACKGROUND.Count = 0
    ACAD_COLOR.Count = 1
    Nameless, Handle=24D6DA has no <Count> property.
    Groups.Count = 238571
    ACAD_IMAGE_DICT.Count = 1
    Nameless, Handle=29399 has no <Count> property.
    Layouts.Count = 2
    Nameless, Handle=10.Count = 3
    ACAD_MLEADERSTYLE.Count = 1
    ACAD_MLINESTYLE.Count = 1
    PlotConfigurations.Count = 26
    ACAD_PLOTSTYLENAME.Count = 1
    ACAD_SCALELIST.Count = 86
    ACAD_TABLESTYLE.Count = 1
    ACAD_VISUALSTYLE.Count = 26
    AcadDim has no <Count> property.
    ACDB_RECOMPOSE_DATA has no <Count> property.
    AcDbVariableDictionary.Count = 11
    ADS_HISTORY.Count = 1
    AEC_CLASSIFICATION_SYSTEM_DEFS.Count = 0
    AEC_DISP_REP_CONFIGURATIONS.Count = 5
    AEC_DISP_REP_SETS.Count = 10
    AEC_LAYERKEY_STYLES.Count = 3
    AEC_PROPERTY_SET_DEFS.Count = 0
    AEC_VARS.Count = 3
    ASE_INDEX_DICTIONARY.Count = 1
    BNS_VARIABLES.Count = 1
DimStyles.Count = 1
Groups.Count = 238571
Layers.Count = 2
Layouts.Count = 2
Linetypes.Count = 3
RegisteredApplications.Count = 8
Modelspace.Count = 0
Paperspace.Count = 2

the Dic Groups.Count = 238571 is huge

as Kruuger
Code: [Select]
(dictremove (namedobjdict) "Groups")but not working, and the file size still as it is.
there was no Group in your file. what file are you checking  :-o
k.

mammajamma

  • Guest
Re: How to reduce the file size.
« Reply #42 on: July 03, 2012, 09:31:02 AM »
MeasureUp, mammajamma what software are you using to wblock, copy, paste method ?
i doesn't work for me like irneb mentioned earlier.

kruuger

AutoCAD 2012. Plain old WBLOCK, then the pickbox that says "Entire drawing" next to Source at the top. (instead of "Block" or "Objects"). Then saved it with a different file name. Nothing fancy.

kruuger

  • Swamp Rat
  • Posts: 625
Re: How to reduce the file size.
« Reply #43 on: July 03, 2012, 09:45:37 AM »
MeasureUp, mammajamma what software are you using to wblock, copy, paste method ?
i doesn't work for me like irneb mentioned earlier.

kruuger

AutoCAD 2012. Plain old WBLOCK, then the pickbox that says "Entire drawing" next to Source at the top. (instead of "Block" or "Objects"). Then saved it with a different file name. Nothing fancy.
yes, but it doesn't work on my side - 2012 also.
even copy-paste. when ctrl+c autocad freeze so i know that dictionary is also copied.
kruuger

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #44 on: July 03, 2012, 09:49:55 AM »
AutoCAD 2012. Plain old WBLOCK, then the pickbox that says "Entire drawing" next to Source at the top. (instead of "Block" or "Objects"). Then saved it with a different file name. Nothing fancy.
AutoCAD 2011.
It is version regardless for copy-n-paste.
Simply copy the line then paste to another drawing.
There must be something else going on. With HasanCad's drawing your methods work fine - though I don't need them for the tst.dwg file in post #34.

It's the dwg in post #10 that does not reduce in size with the WBlock or the Copy-n-Paste idea. See my video screen capture in post #33.

There must be something different between yours and mine (including Kruuger's) ACad setups. Perhaps something to do with object enablers?
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

mammajamma

  • Guest
Re: How to reduce the file size.
« Reply #45 on: July 03, 2012, 09:57:53 AM »
I have mine set to "check web for live enablers" and "object detect and command invoke". And I was using the file from post #10.
I use the wblock method all the time on stubborn drawings, when there's crap that won't purge. Works better than copy/paste which tends to drag junk along with the objects selected.
I don't even know why it works, since "entire drawing" would imply that all the crap would also be included, but that's not the case.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #46 on: July 03, 2012, 10:16:03 AM »
I also use it for stubborn DWGs. And my settings are also set to check web & detect & invoke. Though I've manually installed some previously.

Usually the WBlock cleans up much better than anything else (without raw programming). And the nicest thing about it (in relation to copy-n-paste or wblock selected - which is exactly the same thing) is that your Layout tabs also goes with. The only hiccup I've found previously is that named page setups not assigned to Layouts aren't included, but that's as I'd have expected.

The only other place I've run into this same scenario is with Data Links. If you copy an Excel sheet and paste as linked AutoCAD entities (i.e. a linked table) a Data Link dictionary item is created each time. If you delete / explode / unlink the table that dictionary isn't also deleted. If there's no linked table then WBlock Entire DWG clears the issue, but if you've got say 10 of these links and only one still linked table it copies all 10 links to the new DWG. In this case copy-n-paste / wblock selected works better in that if you don't select the table none of the links are also copied. That was one of the original reasons I created the DictEdit routine.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: How to reduce the file size.
« Reply #47 on: July 04, 2012, 05:25:52 AM »
Groups is not a Dictionary, but a Collection.
...
What is deference between a collection and a dictionary?
and are there another types than these 2 in dag file?

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: How to reduce the file size.
« Reply #48 on: July 04, 2012, 05:58:59 AM »
Every dictionary is a collection, but not every collection is a dictionary.

Actually the reason Groups is not filed under the NamedObjDict collection is because it was something older (more like a table). A table is also a "collection", but it was implemented way back in the 80's ... just not removed & replaced by dictionaries since that would cause problems. If you look at the ActiveX object of the DWG file you can see most of these "tables" as collections of that object. Open the text screen (F2) and type the following at the command prompt:
Code: [Select]
(vl-load-com)
(vlax-dump-object (vla-get-ActiveDocument (vlax-get-acad-object)))
You'll see all sorts of "Properties" of the document. Some of them are other objects, and some of those are collections of other objects. E.g. the Blocks property links to the Blocks collection (which is actually the Blocks table. The Dictionaries property likewise links to the NamedObjDict collection. The Groups property links to the Groups collection. Etc. etc. etc.

The issue with some things in one place and others in another place is due to the long history of changes in acad. AutoDesk periodically added not just new features, but also new structures inside the DWG file to hold those features. E.g. the old table structures could not be tied onto other objects. For that XData was allowed, but this had some serious restrictions like a maximum amount of data and only some data types allowed in some codes. E.g. the description of a Layer is attached to that layer's table entry as xdata.

Thus the dictionaries were implemented, which allows data to be stored not just for the DWG file as a whole, but also tied onto any other object. E.g. the AnnoScales are stored as a dictionary under the NamedObjDict collection. But the links for each annotative object to the scales attached to that object are stored as Dictionaries attached to that object itself. Also a dictionary / its XRecord items do not have such restrictions as XData does. Thus a dictionary (or even just one entry inside it) may contain anything between 0 bytes and the maximum your PC would handle before crashing. Unfortunately some programmers didn't think about their use of dictionaries enough, thus you end up with these dictionaries cluttering the DWG file and having difficulty purging them out when not needed anymore.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.