Changing scale of all entities in multiple .dxfs

Changing scale of all entities in multiple .dxfs

spencer.robertsU8DLN
Enthusiast Enthusiast
323 Views
4 Replies
Message 1 of 5

Changing scale of all entities in multiple .dxfs

spencer.robertsU8DLN
Enthusiast
Enthusiast

Due to some software limitations, I've been given a large number of .dxf files that were drawn in mm that need to be scaled to inches before being sent to fabrication.

 

I've gotten as far as iterating through a list of files, and being able to open, save and close each one, however I'm having a stumbling block as to how to change the scale for all entities. 

 

(defun ScaleFiles (files factor / acadApp acadDocs)
  (setq acadApp (vlax-get-acad-object))
  (setq acadDocs (vlax-get-property acadApp 'Documents))
  (mapcar
    '(lambda (fp / newDoc eMin eMax)
      (setq newDoc (vlax-invoke acadDocs 'open fp))
	 
      ;(command "_Scale" "_All" "" "0,0" factor) ;Doesn't work	
      (vlax-invoke newDoc 'close ':vlax-true)
    );lambda
    files
  );mapcar
);defun

 

I've done a bit of digging and found that ObjectDBX has a few limitations:

If the above is true, is it even possible to scale these drawings like this? or would I need to use an alternative solution (like script pro) instead?

 

Any suggestions would be appreciated.

0 Likes
324 Views
4 Replies
Replies (4)
Message 2 of 5

pendean
Community Legend
Community Legend
DWGUNITS command will reset "units" and rescale your file's content, just follow the prompts.
0 Likes
Message 3 of 5

paullimapa
Mentor
Mentor

Just so you know, any conversion whether from Imperial (Ft-Inch) to Metric (mm) or vise a versa will end up with strange dimensions. So a standard 900 wide mm door will end up becoming a non-standard 29.5 wide Ft-Inch door which would typically not be up to code standard.


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 4 of 5

ronjonp
Mentor
Mentor

@spencer.robertsU8DLN 

You could use vla-ScaleEntity with ODBX.

0 Likes
Message 5 of 5

Sea-Haven
Mentor
Mentor

Be careful using say -dwgunits its appears to be platform dependant it will run with the 5 questions or it can run with 6 as I have just found out, so have gone back to a setvar sequence to avoid this problem. Still checking. As need to work with a client having a mix of platform Acad, Archi, CIV3D etc.

 

_dwgunits help needed. - AutoCAD Bugs, Error Messages & Quirks - AutoCAD Forums (cadtutor.net)

 

 

0 Likes