Get parcel fabric dataset controller from parcel layer
string errorMessage = await QueuedTask.Run(() =>
{
try
{
var myParcelFabricLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<ParcelLayer>().FirstOrDefault();
//if there is no fabric in the map then bail
if (myParcelFabricLayer == null)
return "There is no fabric in the map.";
var myParcelFabricDataset = myParcelFabricLayer.GetParcelFabric();
}
catch (Exception ex)
{
return ex.Message;
}
return "";
});
if (!string.IsNullOrEmpty(errorMessage))
MessageBox.Show(errorMessage, "Get Parcel Fabric Dataset from layer.");
Get parcel topology of parcel fabric dataset
string errorMessage = await QueuedTask.Run(() =>
{
try
{
var myParcelFabricLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<ParcelLayer>().FirstOrDefault();
//if there is no fabric in the map then bail
if (myParcelFabricLayer == null)
return "There is no fabric in the map.";
var myParcelFabricDataset = myParcelFabricLayer.GetParcelFabric();
var myTopology = myParcelFabricDataset.GetParcelTopology();
}
catch (Exception ex)
{
return ex.Message;
}
return "";
});
if (!string.IsNullOrEmpty(errorMessage))
MessageBox.Show(errorMessage, "Get Parcel Fabric Topology.");
Get parcel fabric from table
public static ParcelFabric GetParcelFabricFromTable(Table table)
{
ParcelFabric myParcelFabricDataset = null;
if (table.IsControllerDatasetSupported())
{
// Tables can belong to multiple controller datasets, but at most one of them will be a parcel fabric
IReadOnlyList<Dataset> controllerDatasets = table.GetControllerDatasets();
foreach (Dataset controllerDataset in controllerDatasets)
{
if (controllerDataset is ParcelFabric)
{
myParcelFabricDataset = controllerDataset as ParcelFabric;
}
else
{
controllerDataset.Dispose();
}
}
}
return myParcelFabricDataset;
}
Target Platforms: Windows 11, Windows 10
ArcGIS Pro version: 3 or higher.