Plotting is the last stage in presenting map data.
The following sample outlines the steps required to set up and plot a map set.
To plot a map
- Set the Plotter name for Layout1 using the AutoCAD� ActiveX� interface.
- Add a drive alias to the list so that AutoCAD Map can find the drawings used to execute the plot.
- Define a boundary drawing or use an existing one. This example uses an existing drawing named System-Grid.dwg.
- Attach the drawings for this plot set and the boundary drawing.
- Define a "Draw" mode query which selects "ALL" objects in the attached drawings.
- Save the query internal to the project.
- Define a layout block, (title block) or use an existing one. The layout block must contain at least one viewport and optionally a reference viewport. If the layout block contains an attribute which represents a mapname or some other type of area naming convention, that name can be mapped from the boundary drawing to this attribute, in fact any object data associated to a boundary can be mapped to an attribute on the layout block. This sample does not contain code for creating or defining this layout block.
- Create a new plot set.
- Define Plot Set variables
- Append the current plot set definition to the plot set list.
- Write the current plot set definition to the plot definition dictionary within the currrent project.
- Perform a cursory check to see if the required attributes have been set, this is optional.
- Perform a more extensive check that makes sure that no errors occur when plotting takes place, this is optional.
- Initialize the plotting environment. See (map_pltInit) for more detail on this function.
- Display a single sheet within the plot set based on a boundary value, then plot if successful. Note, you must always call map_pltdisplay() before calling map_pltPlot().
- Restore the display environment to its state before the last execution of the map_pltDisplay().
- Restore the data extension options and AutoCAD settings altered by map_pltInit().
(vl-load-com) (setq acadObject (vlax-get-Acad-object)) (setq acadDocument (vla-get-ActiveDocument acadObject)) (setq activeLayoutObject (vla-Get-ActiveLayout acadDocument)) (setq pSpace (vla-get-PaperSpace acadDocument)) (setq layout (vla-get-layout pSpace)) (vla-put-configname layout "\\\\PlotServer\\Hp Laserjet 4100 Series Pcl")
(ade_aliasadd "LISP_SAMPLE" "C:\\Lisp\\Drawings\\PlotMapSet")
The boundary drawing must contain at least one closed polyline with object data. Each closed polyline is a division of the map, and the sheet name is attached to it as object data.
(ade_dsattach "LISP_SAMPLE:\\Landbase-Shared.dwg") (ade_dsattach "LISP_SAMPLE:\\Water-Facilities.dwg") (ade_dsattach "LISP_SAMPLE:\\System-Grid.dwg")
(ade_qryclear) (ade_qrydefine '("" "" "" "Location" ("All") "" )) (ade_qrysettype "draw")
(ade_qrysave "PlotQueries" '(("name" "TruckBook-100") ("saveoption" 2)))
Define the drawing set:
(setq dwgs_list (list "LISP_SAMPLE:\\Landbase-Shared.dwg" "LISP_SAMPLE:\\Water-Facilities.dwg")) (map_pltCurrSet "dwgs" dwgs_list)
Define the plotter name via the layout:
(map_pltCurrSet "pnam" "Layout1")
Define the layout block name:
(map_pltCurrSet "block" "TITLE-A")
Define the layout blocks viewport layer:
(map_pltCurrSet "vlayer" "TB-BORDER")
Define the object data table containing boundary information:
(map_pltCurrSet "bnamt" "MAPSYS-MAP")
Define the boundary field name:
(map_pltCurrSet "bnamf" "MAPNAME")
Define the boundary object data field to block attribute in layout mapping:
(map_pltCurrSet "atts" "MAPNAME")
Define the layout blocks reference viewport flag:
(map_pltCurrSet "kflg" nil)
Define the layout blocks key viewport layer:
(map_pltCurrSet "klayer" "")
Define the display layers in the reference viewport:
(map_pltCurrSet "kdispl" "")
Define the layers to freeze in main viewport:
(map_pltCurrSet "vdispl" "0")
Define the query category:
(map_pltCurrSet "qcat" "PlotQueries")
Define the query name:
(map_pltCurrSet "qnam" "TruckBook-100")
Define the boundary drawing:
(map_pltCurrSet "bdwg" "LISP_SAMPLE:\\System-Grid.dwg")
Define the boundary layer:
(map_pltCurrSet "blyr" "MAPEDGE")
Define the boundary field name:
(map_pltCurrSet "bodfs" "MAPNAME")
Specify the boundaries:
(setq bndry_list (list "101" "102")) (map_pltCurrSet "bnds" bndry_list)
Define the plot to specified scale flag:
(map_pltCurrSet "sflg" nil)
Define the plot scale:
(map_pltCurrSet "scale" "1:750")
Define the clip objects against boundary flag:
(map_pltCurrSet "clip" T)
Define the plot the boundary flag:
(map_pltCurrSet "pbnd" T)
(if (not (map_pltDefValid "TruckBook-100")) (prompt "\nERROR: Plot set invalid.") )
(map_pltDisplay "101") ;Visually check the plot set display. If it is correct, plot it. (initget "Yes No") (setq answer (getkword "\nDisplay is correct Yes/No
?")) (if (or (null answer) (equal answer "Yes")) (map_pltPlot))