Dwg to pcswmm
DWG TO PCSWMM WINDOWS
png, etc).Įxporting a Windows Metafile (vector) from Autocad (using Export or WMFOUT commands, or. The ESRI world file is a standard format (lookup using Wikipedia), only the filename extension changes to conform to the image format (.wmf. tiffs, though we can't use this in SWMM5 or EPANET (yet?)). Just copy and paste into a text file, appload within autocad, and type 'wmf_world' (no quotes) in the acad command line.
DWG TO PCSWMM CODE
Autolisp code is attached below, with copious display of variables and comments. It also draws a polyline around the viewport limits, which you can select and export along with your background map linework if you wish. I wrote a short Autolisp routine a while back to export a ESRI world coordinates file from the current Autocad viewport. (prompt "\nWMF_World - write ESRI world coordinates file for Windows Metafile export.")(princ)ĭo you mean this post which has some good non LIsp tips from 2010? Line 6: Y coordinate of centre of upper left pixel Line 5: X coordinate of centre of upper left pixel (screen x=0 y=0) Line 4: Pixel size in the y-direction (drawing units/pixel), almost always negative Line 3: Rotation about x-axis (not used) Line 2: Rotation about y-axis (not used) Line 1: Pixel size in the x-direction (drawing units/pixel) (setq Myfilename (getfiled "Save World File As" Myfilename "mfw" 1)) (setq MyDwgNameOnly (substr MyFullDwgName 1 (- (strlen MyFullDwgName) 4))) write ESRI world file (rename as needed later) (setq YUL_Ctr (+ Ymax (* 0.5 YPixelSize))) half a y-pixel down from Ymax (YPixelSize is negative) (setq XUL_Ctr (+ Xmin (* 0.5 XPixelSize))) half an x-pixel right of Xmin Centre of Upper Left X and Y pixel (*** not upper left edge edge of pixel) (prompt " Y pixel size = ")(princ YPixelSize)(princ) (prompt "\nX pixel size = ")(princ XPixelSize) (setq YPixelSize (/ (- Ymin Ymax) ScreenY)) typically negative (setq XPixelSize (/ (- Xmax Xmin) ScreenX)) positive draw a polyline boundary around the viewport limits (prompt "\nYmin = ")(princ Ymin)(prompt " Ymax = ")(princ Ymax)(princ) (prompt "\nXmin = ")(princ Xmin)(prompt " Xmax = ")(princ Xmax)(princ) Corner of viewport / screen (in drawing units) (setq OffsetX (* 0.5 ViewHeight MyAspectRatio)) Center of view in the current viewport (drawing units) Height of the view in the current viewport (drawing units) (prompt " Aspect Ratio = ")(princ MyAspectRatio)(princ) (prompt "\nAcad viewport width = ")(princ ScreenX) (setq ScreenY (float (cadr MyScreenSize))) (setq ScreenX (float (car MyScreenSize))) (setq MyScreenSize (getvar "screensize")) Write world file for use with Windows Meta File (or. (defun C:WMF_World ( / MyScreenSize ScreenX ScreenY MyAspectRatio ViewHeight HalfView) I couldn't find my original circa 2005 or 2008 post, so here is a re-upload of Autolisp code to write a Windows Meta File world coordinates fileĪlso, it is really easy using AutoLisp to write node (point) coordinates, link (polyline) vertices and catchment (closed polyline) boundaries to a text file (or excel spreadsheet) as SWMM 5 input format.