Jump to content

Recommended Posts

Posted

As part of my day to day work on my current project I need to export dwg files to dxf for site engineers to set out from. I'm having difficulty with a lot of the files because they are being produced in various softwares and seem to contain a lot of unrecognised (for want of a better phrase!) information within AutoCAD.

 

I have wrote a LISP that will do the following;

- unlock all layers

- select and delete all hatches

- select and explode all blocks

- change all linetypes to continuous

- change all lineweights to 0

- purge

 

This reduces the dwg file size slightly but when exported to dxf it increases dramatically. I have also tried BREP, OVERKILL. I have taken into account DGN linetypes and used the -PURGE command to purge 'orphaned data'. The only thing that I can think of that I haven't addressed are 3D faces.

 

I have CAD Tools that will convert 3D faces to 3D polylines though I'd be interested in getting a hold of a LISP that will do this so I can build it into my own.

 

Also any other suggestions on how to reduce the file size would be greatly appreciated!

Posted

I work with dxf files as well for construction layout as that is the format that my data collector uses. Just as a suggestion, maybe create several different dxf for each item that they need to layout. ie Building.dxf, Sidewalk.dxf, Storm Sewer.dxf etc... Rather than dxf the entire drawing. This way the file sizes stay small and organized. Keep the objects that you place in these dxfs simple as possible. It makes it easier to work with while out in the field.

Posted
As part of my day to day work on my current project I need to export dwg files to dxf for site engineers to set out from. I'm having difficulty with a lot of the files because they are being produced in various softwares and seem to contain a lot of unrecognised (for want of a better phrase!) information within AutoCAD.

 

I have wrote a LISP that will do the following;

- unlock all layers

- select and delete all hatches

- select and explode all blocks

- change all linetypes to continuous

- change all lineweights to 0

- purge

 

This reduces the dwg file size slightly but when exported to dxf it increases dramatically. I have also tried BREP, OVERKILL. I have taken into account DGN linetypes and used the -PURGE command to purge 'orphaned data'. The only thing that I can think of that I haven't addressed are 3D faces.

 

I have CAD Tools that will convert 3D faces to 3D polylines though I'd be interested in getting a hold of a LISP that will do this so I can build it into my own.

 

Also any other suggestions on how to reduce the file size would be greatly appreciated!

The only other suggestions are wblocking the drawing, purge all the styles, then purge all. I don't know of any other ways to make it any smaller.
Posted

Dxf will always be bigger than a dwg as its a assci txt file not compressed binary format, not sure exploding blocks will help with size.

 

Purge regapps ?

 

Something like

(setq ss (ssget (list (cons 0 "3dface"))))
(setq x (sslength ss)
y x)
(repeat y
(setq 3df (vlax-ename->vla-object(ssname ss (setq x (- x 1)))))
(setq coords (vlax-safearray->list (vlax-variant-value (vla-get-coordinates 3df))) )
; do your pline thing here
)

Posted

Purge regapps and materials. I've also heard layer filters and layer states enlarge files so delete those. I would also delete any unnecessary layout tabs.

Posted

One of the DXF options is to Select Objects. Not sure how you would do that in a lisp, but it would cut down the file size.

Posted

Sometimes there are things that are not visible within a DWG file and are way out in space. In order to delete those objects as well, I use the erase command. When prompted for a selection, I use this bit of code to select everything in the active space (model/paper space).

 

(ssget "x")

 

Then before you finalize the command, type R in the command line. This will allow you to remove objects from your current selection (the things you want to keep). Once you make a selection of things you want to keep, then you can finish the erase command.

Posted

Overkill

-Purge > Regapps

-Purge > All

Audit

Save

Repeat

Save

WBlock to new drawing file.

That should do it.

Not sure that exploding blocks, changing linetypes or lineweights gains you anything.

Posted

Not sure that exploding blocks, changing linetypes or lineweights gains you anything.

 

It makes it a lot easier when importing the dxf to a number of survey packages though.

Posted

Finally figured out a process of reducing it down, it only took a two hour workshop with 3 of us sitting around a table!

 

All the usual processes of audits, explode blocks, etc. though a big difference was noticed when 3D faces were converted to lines and then also a big jump down in size for purging orphaned data (purging regapps is the major part of this).

 

In the process of building the LISP to contain the 7/8 processes, I'll post it here for anyone who may find themselves in a similar situation in the future.

 

Thanks for all the help as usual folks!

Posted

A little while ago I also had an issue with filesize. For whatever reason, while the file was a dwg it wouldn't purge things properly. A heeeeeeap of stuff which should have been removed during purge wasn't being removed. Certain layers for example which had nothing on them, say they can't be deleted.

The solution was, to save the file as a dxf, close it, re-open the dxf, purge all (this time it actually works..), then save as dwg again. This process is quite annoying but seems to be the only I can get it to work.

Ended up being able to reduce our standard template file at work that everyone uses from 8800kb down to 850kb

Posted

Having a bit of hassle trying to steal a bit of LISP and fit it into my overall LISP routine. Can anyone help me out with changing the code below to enable it to run automatically within a bigger routine? I've tried various bits and pieces though I can't seem to get it sorted.

 

(defun dxf (e code)
(cdr (assoc code e))
)

(defun dxfPt2D (e code / x)
(setq x (dxf e code))
(if (= d "3d")
 (list (car x)(cadr x)(caddr x))
 (list (car x)(cadr x))
)
)

(defun cvt1face (e)
(command "_LINE" (dxfPt2D e 10) (dxfPt2D e 11) (dxfPt2D e 12) )
(if (equal (dxf e 12)(dxf e 13))
 (command "_CL")
 (command (dxfPt2D e 13) "_CL")
)
)

(defun C:3DF2L (/ ss ssl i e d)
(setvar "CMDECHO" 0)
; (prompt "\nVyberte objekty 3DFACE pro prevod na cary: ")
(prompt "\nSelect 3DFACE objects to convert to lines: ")
(command "_SELECT" "_AU" pause)
(setq ss (ssget "_P" '((0 . "3DFACE")))) ; jen 3DFACE
(if (or (not ss) (zerop (setq ssl (sslength ss)))) (progn (prompt "*None*")(exit)) )
(initget "2d 3d")
(setq d (getkword "\nConvert to [2d/3d] <3d>: "))
(if (not d)(setq d "3d"))
(setq i 0)
(command "_UNDO" "_BE")
(command "_LAYER" "_M" "3DF2L" "") ; do zvl.hladiny
(setvar "OSMODE" (boole 7 (getvar "OSMODE") 16384))
(while (< i ssl)
 (setq e (ssname ss i))
 (cvt1face (entget e)) ; prevod
 (setq i (1+ i))
);while
(setvar "OSMODE" (boole 2 (getvar "OSMODE") 16384))
(command "_UNDO" "_EN")
(prompt "\nLines created to the layer 3DF2L")
; (if (= d "2d")(prompt "\nNyni vymazte usecky krome obrysovych (_ERASE _CP)\na pak dejte _PEDIT _Yes _Join"))
(if (= d "2d")(prompt "\nFor outline curve erase all lines except outline (_ERASE _CP)\nand type _PEDIT _Yes _Join"))

(princ)
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...