public void ExportComplexEntity( IEnumerable<IOccComplexEntity> entities, string path )
Parameters
- entities
- Occurrences of type complex entity that will be exported.
- path
- Path to .hxce file.
public void ExportComplexEntity( IEnumerable<IOccComplexEntity> entities, string path )
Exception | Description |
---|---|
EPLAN.Harness.API.Exceptions.HpdApiNotInitializedException | Api is not in an initialized state. You can get current state from EPLAN.Harness.API.HpdApi.Status property. If API is uninitialized, you can initialize it by calling EPLAN.Harness.API.HpdApi.Init method. If API is in failed state, you can not resurrect it. |
EPLAN.Harness.API.Exceptions.ObjectInvalidException | The object is in invalid state. Obtain a new one. |
EPLAN.Harness.API.Exceptions.ArgumentNullException | Argument is null. |
EPLAN.Harness.API.Exceptions.FileClosedException | This file is not opened. |
// Init API HpdApi api = HpdApi.GetInstance(); api.Init(); // Open project and select variant Project project = api.OpenProject(@"c:\Projects\Demo\Demo.hxproj"); Variant variant = project.GetVariants()[0]; // Open workspace or workdesk existing one: Designer designer = variant.GetWorkspaces().FirstOrDefault(d => d.Name == "Workspace_1"); // Designer designer = variant.GetWorkdesks().FirstOrDefault(d => d.Name == "Workdesk_1"); designer.Open(false, false); // Select complex entities (or all) IEnumerable<IOccComplexEntity> ces = designer.GetAllOccurrences().OfType<IOccComplexEntity>(); // Export complex entities to file designer.ExportComplexEntity(ces, @"c:\Users\xyz\Documents\exportCE.hxce"); // Close documents. designer.Close(); variant.Close(); project.Close(); // Close the API. api.Close();