Skip To Content

WebFeatureLayer.Set (.NET)

The WebFeatureLayer.Set method updates the properties of the specified web feature layer.

Declaration

public bool Esri.ArcGISForAutoCAD.WebFeatureLayer.Set(Document doc, string flName, Dictionary<string, object> serviceProperties, string sublayerName = null)

Parameters

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

Required

string

flName

An existing web feature layer name in the drawing.

Required

string

serviceProperties

A dictionary of optional web feature layer properties that can be set. The keys and values are described in the table below.

Required

string

sublayerName

An existing feature layer sublayer name in the drawing.

Optional

The keys and values for the serviceProperties dictionary are as follows:

KeyTypeValue DescriptionRequired

"BRANCH"

string

The name of the affected editing branch.

Optional

"EDITMODE"

bool

Specifies the editing option. true = edit, false = read-only.

Optional

"CADLAYER"

string

The name of the AutoCAD layer that will be used to override the web feature layer's default layer.

Optional

"DEFINITIONEXPRESSION"

string

A WHERE clause expression that limits features from the layer by attribute values. The syntax of the WHERE clause is determined by the source data. Use Discard Edits or Synchronize on the web feature layer after setting a definition expression to see the remaining features.

Optional

"TYPE"

string

The default element type. The options are "Point", "Block Reference", and "AECC_COGO_POINT" for point and multipoint web feature layers, and "Hatch" and "Automatic" for polygon web feature layers. Redraw the web feature layer to see the newly set default element type.

Optional

"DESCRIPTION"

string

The block name if the type is "Block Reference", a description if the type is "AECC_COGO_POINT", or the hatch pattern if the type is "Hatch". Redraw the web feature layer to see the newly set default element description.

Optional

"SAVEASTEMPLATE"

bool

Specifies whether the corresponding AutoCAD layer, query expression, type, or description properties will be saved in a web feature layer property template, which is locally stored in the drawing. true = save as template, false = do not save as template (default).

Optional

"SUBLAYER_FIELD"

string

A field name used to define sublayers. Enter an empty string, "", to clear all sublayers, which will delete existing sublayers and move all features to the parent layer. Sublayers must be cleared before setting a sublayer field. Customizing sublayers is not supported on layers that have a service-defined subtype field.

Optional

Returns

TypeDescription

bool

true if the web feature layer properties were set successfully

Remarks on error conditions

This method may throw an exception or return false or null if a parameter is invalid. If any property fails to set, the method will return false.

Example 1

Print the success of setting the web feature layer editing properties for the editor01.sampleBranch branch of the Damage_to_Commercial_Buildings web feature layer to read-only.

// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
var flName = "Damage_to_Commercial_Buildings";
var serviceProperties = new Dictionary<string, object>()
{
  { "BRANCH", "editor01.sampleBranch" }, 
  { "EDITMODE", false }
};

// Set the properties
var success = Esri.ArcGISForAutoCAD.WebFeatureLayer.Set(doc, flName, serviceProperties);

// Print the success
doc.Editor.WriteMessage(success.ToString());

/* Example output
True
*/

Example 2

Print the success of setting the default AutoCAD layer for the Commercial subtype of the Olympia_Meters web feature layer to the AutoCAD layer AB-METERS-EX and saving this property to a web feature layer template.

 // Initialize
 var doc = Application.DocumentManager.MdiActiveDocument;
 var flName = "Olympia_Meters";
 var serviceProperties = new Dictionary<string, object>()
 {
   { "CADLAYER", "AB-METERS-EX" },
   { "SAVEASTEMPLATE", true }
 };

 // Set the properties
 var success = Esri.ArcGISForAutoCAD.WebFeatureLayer.Set(doc, flName, serviceProperties, "Commercial");

 // Print the success
 doc.Editor.WriteMessage(success.ToString());

 /* Example output
 True
 */

See also

esri_webfeaturelayer_set—An AutoLISP function that updates the properties of the specified web feature layer in the drawing.