Parameters
- path
- Path of 3D part file. A file extension specifies its
format .
Return Value
Occurrence of imported 3D part.
Exception | Description |
---|---|
EPLAN.Harness.API.Exceptions.ArgumentNullException | Argument is null. |
EPLAN.Harness.API.Exceptions.FileNotFoundException | This file was not found. |
EPLAN.Harness.API.Exceptions.FileExtensionException | The exception that is thrown when the file has the wrong extension. |
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.FileClosedException | This file is not opened. |
// Initialize API. HpdApi api = HpdApi.GetInstance(); api.Init(); // Open a project. Project project = api.OpenProject(@"c:\Projects\MyProject.hxproj"); Variant variant = project.GetVariants()[0]; // Create or open an existing workspace or workdesk. Designer designer = variant.CreateWorkspace("Impor3D_test"); designer.Open(false, false); // Import a 3D file. IOccPart occ = designer.Import3DPart(@"c:\temp\FileToImport.stp"); // Work with the created occurrence. // Save changes. designer.Save(); project.Save(); // Close documents. designer.Close(); variant.Close(); project.Close(); api.Close();