| MGDwgDataSources.setDwg |
|
boolean setDwg(string DWG)
Sets the Autodesk DWG file or Autodesk Map project drawing for the Autodesk DWG layer.
If this method is successful, it automatically sets the layer's rebuild flag to True. See setRebuild for more information. If the DWG contains no path, then the first one found in the DWG search path will be used.
When changing the Autodesk DWG file, several other properties may also have to be updated, including KeyTable, KeyColumn, KeyColumnType, NameTable, NameType, NameColumn, UrlTable, UrlColumn, and LayerFilter.
Note that this method does not work during a busy state. For additional information about the busy state, refer to "Handling Busy State and Map Refresh" in the Autodesk MapGuide Developer's Guide.
DWG - The name of the Autodesk DWG file.
boolean - Returns True if successful.
NA
-1 (busy)
This code is designed to work with the 1stfloorplanEx6.mwf file used by the Filter DWG Layers example:
function setProperties()
{
// Get the map and selected features
var map = getMap();
var mapSel = map.getSelection();
// Use the single map layer Floor Plan
var mapLayer = map.getMapLayer("Floor Plan");
// Get DWG data source object for the layer
var mapLayerSetup = mapLayer.getLayerSetup();
var dwgMapLayerDataSource = mapLayerSetup.getDwgDataSources();
dwgMapLayerDataSource.setDwg("newDwgFile");
}