DataShortcutsDataShortcutManagerCreatePartialReferenceSurface Method

Creates a partial reference surface with a specified boundary in the host drawing according to the host database, source drawing file name, surface name, and boundary object ID.

Namespace: Autodesk.Civil.DataShortcuts
Assembly: AeccDataShortcutMgd (in AeccDataShortcutMgd.dll) Version: 13.8.0.292
Syntax
public ObjectId CreatePartialReferenceSurface(
	int index,
	Database hostDrawing,
	ObjectId dRefBoundaryId
)

Parameters

index  Int32
Data shortcut object index in current working project.
hostDrawing  Database
The host database. The partial reference surface will be created in this database.
dRefBoundaryId  ObjectId
 

Return Value

ObjectId
The object ID of the partial reference surface.
Exceptions
ExceptionCondition
[!:System.ArgumentException] Thrown when the reference boundary is not a simplified, non-self-intersecting polygon.
Example
API user can call this method to create parital reference surface in the hostDrawing by the index of the data shortcut in a working project.
C#
 1string hostDwgName = @"C:\Drawing1.dwg";
 2Database hostDb = new Database(false, true);
 3hostDb.ReadDwgFile(hostDwgName, FileOpenMode.OpenForReadAndAllShare, false, null);
 4
 5string sourceDwgName = @"C:\WorkingFolder\ProjectFolder\Surface.dwg";
 6string objectName = "EG";
 7DataShortcuts.SetWorkingFolder(@"C:\WorkingFolder");
 8DataShortcuts.SetCurrentProjectFolder("ProjectFolder");
 9DataShortcuts.Validate();
10bool isValidCreation = false;
11var dsManager = DataShortcuts.CreateDataShortcutManager(ref isValidCreation);
12int index = -1;
13for (int i = 0; i < dsManager.GetPublishedItemsCount(); ++i)
14{
15    var item = dsManager.GetPublishedItemAt(i);
16    if (sourceDwgName.Equals(Path.Combine(item.SourceLocation, item.SourceFileName))
17        && item.Name == objectName
18        && item.DSEntityType == DataShortcutEntityType::Surface)
19    {
20        index = i;
21        break;
22    }
23}
24
25ObjectId objectId = dsManager.CreatePartialReferenceSurface(index, hostDb, refBoundaryId);
See Also