Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Remove Hidden Data and Reduce File Size

38 REPLIES 38
Reply
Message 1 of 39
JC_BL
6564 Views, 38 Replies

Remove Hidden Data and Reduce File Size

I am trying to reduce the drawing file size.  This is for uploading the drawings to AutoCAD WS.  AutoCAD WS doesn't display or edit a drawing that is over 15MB.  Unfortunately some of our drawings are over 15MB even after I have removed the background and others and have purged.  I believe the reason why a drawing can be so big has to do with each object (grouped object) has a ton of information on it.  For example, the properties of a typical object is like this:

 

(
   (-1  . <Entity name: 7ffffbece60>)
   (0   . "PRCD_FITTING")
   (5   . "145B6")
   (102 . "{ACAD_XDICTIONARY")
   (360 . <Entity name: 7ffffbece70>)
   (102 . "}")
   (330 . <Entity name: 7ffffbf59f0>)
   (100 . "AcDbEntity")
   (67  . 0)
   (410 . "Model")
   (8   . "BON-SupplyMP-3.0-4.0 RECT")
   (62  . 1)
   (100 . "CPrcdEntity")
   (280 . 10)
   (90  . 601861454)
   (70  . 24058)
   (70  . 4567)
   (280 . -65)
   .
   . Skip 3000 lines here for clarity
   .
   (90  . 0)
   (90  . 0)
   (90  . 0)
)

You can see from above that the list of properties are huge.  All I really need are the visible parts of the object.  This means most of the info above are junk.

 

I try to reduce the size of object by exploding all the objects on the drawing.  This sort of work in the sense that the file size of a test drawing is reduced from something like 8MB down to 6MB.  But I am expecting far more reduction than this.  The reason why I expect far more reduction is that the total number of lines of the exploded items of the same object mentioned above is reduced from 3000+ lines to only 300 lines as shown below:

 

(
   (-1  . <Entity name: 7fffe8654f0>)
   (0   . "LINE")
   (330 . <Entity name: 7ffffa1b9f0>)
   (5   . "3B11F")
   (100 . "AcDbEntity")
   (67  . 0)
   (410 . "Model") 
   (8   . "BON-SupplyMP-3.0-4.0 RECT")
   (62  . 1)
   (100 . "AcDbLine") (10 4188.87 -423.095 156.0) (11 4188.87 -387.095 156.0) (210 0.0 0.0 1.0)
)
(
   (-1  . <Entity name: 7fffe8655f0>)
   (0   . "LINE")
   (330 . <Entity name: 7ffffa1b9f0>)
   (5   . "3B12F")
   (100 . "AcDbEntity")
   (67  . 0)
   (410 . "Model")
   (8   . "BON-SupplyMP-3.0-4.0 RECT")
   (62  . 1)
   (100 . "AcDbLine") (10 4248.87 -453.095 156.0) (11 4212.87 -453.095 156.0) (210 0.0 0.0 1.0)
)
.
. Skip 250 lines here for clarity
.
(
   (-1  . <Entity name: 7fffe865260>)
   (0   . "MTEXT")
   (330 . <Entity name: 7ffffa1b9f0>)
   (5   . "3B0F6")
   (100 . "AcDbEntity")
   (67  . 0)
   (410 . "Model")
   (8   . "BON-SupplyMP-3.0-4.0 RECT-ANNO")
   (62  . 1)
   (100 . "AcDbMText") (10 4193.39 -418.589 150.0)
   (40  . 3.0)
   (41  . 19.8)
   (46  . 0.0)
   (71  . 1)
   (72  . 1)
   (1   . "\\Fdim.shx;\\W0.7000000000;\\T1.0000000000;\\o\\l24X30THRT")
   (7   . "BonDuctTXT") (210 0.0 0.0 1.0) (11 1.0 1.46161e-017 0.0)
   (42  . 17.5)
   (43  . 3.0)
   (50  . 1.46161e-017)
   (73  . 1)
   (44  . 1.0)
)

Therefore, I am expecting a 10-to-1 reduction, not just a 1/4 reduction.

 

I am wondering there may be hidden data on the drawing that are left behind after I have exploded the objects.  Unfortunately, purging the drawing doesn't help because there is nothing to be purged.

 

Would you please tell me if there is a way to get rid of the hidden data?  If there is a better alternative, please also let me know.

 

Jay Chan

38 REPLIES 38
Message 2 of 39
Kent1Cooper
in reply to: JC_BL


@jchan wrote:

I am trying to reduce the drawing file size.  This is for uploading the drawings to AutoCAD WS.  ....  Unfortunately some of our drawings are over 15MB even after I have removed the background and others and have purged.  I believe the reason why a drawing can be so big has to do with each object (grouped object) has a ton of information on it.  .... 

.... 

I try to reduce the size of object by exploding all the objects on the drawing.  This sort of work ....  But I am expecting far more reduction than this.  .... 

Therefore, I am expecting a 10-to-1 reduction, not just a 1/4 reduction.

 

I am wondering there may be hidden data on the drawing that are left behind after I have exploded the objects.  Unfortunately, purging the drawing doesn't help because there is nothing to be purged.

....


Not having AutoCAD WS [or even knowing what it is -- there doesn't seem to be a sub-forum devoted to it as there are for so many other AutoCAD variants and overlaid programs], nor knowing what a "PRCD_FITTING" object is, I can't say for sure.  But try Searching these Discussion Groups, or even the internet, for things like "purge hidden data", "purge dictionaries", "purge extended data", similar wordings with "remove" or "delete" or "eliminate" in place of "purge", and "Superpurge".  There are things out there, though you'll have to try some of them to see whether they'll work in your particular situation.

 

If not for the file size you describe, I might also suggest posting a drawing that others with the same software can experiment on.  But maybe such a drawing with only one of those overloaded objects in it would serve the purpose without being too much of a burden on the website.

Kent Cooper, AIA
Message 3 of 39
dgorsman
in reply to: Kent1Cooper

FYI - AutoCAD WS is an online/"software as a service" version of AutoCAD, accessible over the internet via both computers and some portable devices.  Naturally, the features are quite limited.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 4 of 39
aqdam1978
in reply to: JC_BL

the size of drawings depends on who or which software created the drawings!

 

if a human created drawings, so he/she should draw as a professional.

for example using blocks instead of group of same objects and so on.

 

if a software created a drawing (for example pdf 2 dwg) be sure about:

hatch objects may be exploded to tens or hundreds of line/plines.

many lines are overlapped

.....

 

so, it's better to use OVERKILL command.

 

as I said, the size of drawing defined by drawer/creator!

 

Abbas

 

Message 5 of 39
braudpat
in reply to: aqdam1978

 

Hello from France

 

You could have a lot of hidden Infos in a DWG !  For example :

 

--- Registered Applications

Command :  -PURGE  with option R

 

--- XDATA - You need a Lisp/VLisp routine to erase ALL XDatas

I join a fabulous Lisp Routine from Gilles which counts Entities with XDATAs

and propose to delete ALL XDATAs ...

Routine :  XD_CNT_DEL

I have translated the minimum ...

 

--- Dictionnaries

You need a very special Lisp/VLisp routine to ERASE ALL Dictionnaries ...

Could be very dangerous !?

 

Don't forget that if you PURGE too much (Registered Applics, XDatas, Dictionnaries, etc)

yours vertical applicatiosn will not run / recognize special objets : AA, MEP, CIVIL, etc ...

 

So you have to Save the DWG with a NEW Filename !

 

Bye, Pat

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 6 of 39
Hallex
in reply to: JC_BL

Create copy of this drawing then load this routine

;; written by VK
(defun all_filters_del (/ doc ltb xdic fd f rec)
  (vl-load-com)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq ltb (vlax-vla-object->ename (vla-get-layers doc))) ; коллекция LAYERS
(if (and (setq xdic (cdadr (member '(102 . "{ACAD_XDICTIONARY") (entget ltb)))) ; расширенный словарь
(setq fd (cdadr (member '(3 . "ACAD_LAYERFILTERS") (entget xdic)))) ; словарь фильтров
(assoc 3 (setq f (entget fd))) ;_ имеются фильтры
) ;_ and
(progn
;; выделение списка записей
(while (/= 3 (caar f))
(setq f (cdr f))
) ;_ остался список (3 . имя_фильтра) (360 . ename_XRECORD)...
;; удаление записей словаря
(while (setq xrec (cdadr f))
(entdel xrec)
(setq f (cddr f))
) ;_ while
;; удаление словаря фильтров
(dictremove xdic "ACAD_LAYERFILTERS")
(princ "\nФильтры из рисунка удалены.")
) ;_ progn
(princ "\nФильтров в рисунке не обнаружено.")
) ;_ if
) ;_ defun
(vl-load-com)
(all_filters_del) ;_ autoload

 This will delete layer filters from there,

then see how the size is reduced

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
Message 7 of 39
JC_BL
in reply to: JC_BL

Thanks for the many helpful suggestions that I have received here.  Unfortunately, I still cannot reduce the file size.

 

Some background info:  I am using a third party software to help me to draw ductwork using AutoCAD.  Each object on the drawing represents a piece of pipe or fitting.  Visually they are shown as 2-D boxes with some descriptive texts inside them.  But the object contains more info than what is shown on the screen.  The object also has info about how it is supposed to be constructed, the kind of accessories that should be mounted on it, the number of stiffeners,...etc.  That's probably the reason why each object is so big.  Here, I want to generate a simplified drawing based on the master copy.  The simplified drawing only needs all the visible elements.  It doesn't need all those additional properties about the object.  I need to figure out where those additional properties are stored, and I want to know how to remove those properties in order to reduct the file size.

 

I have checked the drawing, and I am sure that it doesn't contain any XDATA because the objects don't have any -3 group code or 1000-or-above group code.

 

I have tried PURGE using the R option to remove registered applications.  It helps very little.

 

I indeed can find a long list of dictionaries related to the third party software.  Seem like the third party software may store their info as dictionaries.  I used (dictremove) command to remove all the dictionaries that are related to the third party software.  Unfortunately, the drawing file size actually INCREASED instead of reduced.  This is very puzzling.

 

I have also used the (all_filters_del) LISP program that a forum member has offered.  It can reduce the drawing file size in a tiny test drawing.  But running this on a large drawing actually increases the file size.

 

I have attached a small drawing that has only one piece of duct in it.  When you use (entget (car (entsel))) to check the properties of that single piece of duct, you will see that it has a very long list of properites.  The visual part of it should be only 1/10 of this size.  Please note that you need to use LOGFILEON / LOGFILEOFF to log the long list of properties.  Otherwise, you will only see a small subset in the command window.

 

I will greatly appreciate if people can tell me what I should do to shrink the object size and the file size.  Thanks in advance.

 

Jay Chan

Message 8 of 39
dgorsman
in reply to: JC_BL

Thats an AEC custom object.  It can be converted to "pure" AutoCAD objects via AECTOACAD but as noted it will make the file bigger.  Its one of the reasons for creating custom objects in the first place - they can do a lot, and be prevented from doing other things, while having a smaller file size than an AutoCAD-entity equivalent (data as opposed to entities).

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 9 of 39
JC_BL
in reply to: dgorsman

Thanks for pointing out that the objects are AEC Custom Objects.  I didn't know this name until today.

 

Is there a way to remove AEC info from the drawing and only keep the visual items?  If I explode the object and leave with the basic visual items, the total object size should be smaller, not bigger, right?  I would think that if the file size ends up bigger, this means AEC info are still in the drawing; but they are in broken links that no one can refer to them, and no one can clean them.  I tested this theory by copying and pasting only the visual items from the drawing to another drawing.  Unfortunately, the end result is even bigger than the original drawing.

 

If you know how to shrink the file size, please let me know.  Thanks.

 

Jay Chan

Message 10 of 39
braudpat
in reply to: dgorsman

 

Hello from France

 

I have used a very special Routine to "wipe out" unnecessary things ...

I lost some colors ...  I was to "strict" maybe !?

 

What do you think of the result ?

 

Is it possible to get a DWG with more special objects ?

 

Bye, Pat

 

Patrice ( Supporting Troops ) - Autodesk Expert Elite
If you are happy with my answer please mark "Accept as Solution" and if very happy please give me a Kudos (Felicitations) - Thanks

Patrice BRAUD

EESignature


Message 11 of 39
JC_BL
in reply to: JC_BL

Yes, attached please find a test drawing that has a small number of pieces on it.

 

I appreciate your help in looking into the drawing.

 

Jay Chan

Message 12 of 39
hmsilva
in reply to: JC_BL

jchan,

just one more option,

the dwg that you attached had 322 KB, after,

 

wblock -> Source -> Entire drawing

 

the new dwg size, 93 KB

I's an option to consider...

 

Henrique

EESignature

Message 13 of 39
JC_BL
in reply to: hmsilva

Thanks for your suggestion.  Unfortunately that wblock command only shrinks the test drawing that has only one piece of duct.  When I use the wblock on a drawing that has 10+ pieces of duct, the reduction on file size is minimum.  When I use the wblock on a drawing that has a lot more pieces, the file size actually has increased.  Sorry about that.

 

Jay Chan

Message 14 of 39
JC_BL
in reply to: JC_BL

I may need to abandon the effort to reduce the file size because I find that I may have over-estimated the potential saving of turning each AEC object into individual lines and arcs.  I thought I may be able to cut down the size of each AEC object to 1/10 the original size if I can turn AEC object into individual parts.  But I found that when I calculate the size of the individual parts, I only include the parts that are facing up.  I forgot that the object is in 3-D: It also has the bottom, the 4 sides and the in-between graphics.  At most that I can cut down its size is like by 40%, not 90% as what I thought.  On top of this, the combined size of individual parts actually will be more than each single AEC object.  This means the possible saving is not even 40% - more like 20% to 30%.  Doing all this for this little gain is not very rewarding to me.  Therefore, I will have to abandon this project, and look for a different way to get around with the 15MB size limit in AutoCAD WS.

 

Sorry about this.  And thanks for people who have tried to help me.

 

Jay Chan

Message 15 of 39
hmsilva
in reply to: JC_BL

Just trying to help...


One more attempt,
the dwg you posted, the "Test_SomePieces.dwg" with 713 KB,
1- start a new dwg with a generic template eg "acad.dwt"
2- insert your "Test_SomePieces.dwg"
3- explode, purge, save... 625 KB
4- wblock -> Source -> Entire drawing

the new dwg 570 KB

 

Henrique

EESignature

Message 16 of 39
JC_BL
in reply to: hmsilva

I tried that.  But the only case when I see a significantly size reduction is with the drawing that only has one single piece.  The drawing that has 10+ pieces only shows a minimum size reduction.  The drawing that has a lot of pieces actually shows a size increase instead of reduction.

 

Seem like by and large, exploding a AEC object into individual parts is likely to increase file size instead of reducing the size.

 

Sorry to find out.  Thanks anyway.

 

Jay Chan

Message 17 of 39
hmsilva
in reply to: JC_BL

if only need lines and arcs, like you said before, export to dgn, re-import
explode and overkill, will substantially reduce the file size...

 

Henrique

EESignature

Message 18 of 39
JC_BL
in reply to: hmsilva

Thanks for the good tip.  Seem like the explode/export/import can remove hidden data from the drawing.  I use a similar method as what you have suggested and I can reduce the drawing file size down to 70% of the original size.  The only differences of what you have suggested and what I actually need to do are: (1) I need to unload the third party software first before I can explode the object; otherwise, the third party software seems to prevent me from exploding iits objects.  (2) I need to explode the objects first before export/import; otherwise, I don't see any reduction on file size.

 

The steps that I actually do are:

1.  Open the drawing.

2.  Unload the third party app.

3.  Explode the objects on the drawnig.

4.  Export the drawing into a DNG file.

5.  Open a new drawing based on acad.dwt template.

6.  Import the DNG file into the new drawing.

7.  Overkill / Purge / Save.

 

Yes, this works.  Unfortunately 30% improvement is not quite enough for me.  As mentioned in my previous email, I over-estimated the possible saving and ended up misleading myself to this direction.  Therefore, I likely need to find a different way to get around with the file size problem.

 

Thanks for the good tip though.  This tip will come in handy for other uses.

 

Jay Chan

 

 

Message 19 of 39
hmsilva
in reply to: JC_BL

You're welcome, Jay Chan

Henrique

EESignature

Message 20 of 39
JamesMaeding
in reply to: JC_BL

generally custom objects need their arx loaded so you can explode them, not the opposite.

 

The problem here is you need to decide the best way to get rid of the custom objects, and decide what you want them exploded to. The end result must be native entities to have any hope of working on WS.

 

You will want to explode the aec objects, then wblock all to a new drawing.

wblocking destroys grouping and all the invisible stuff, except xdata and xrecords.

There are lisps to remove those easily.

Then look at what you do not like, and we can help you clean that up.

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost