Harness proD API Help
EPLAN.Harness.API.Projects.Documents Namespace / Designer Class / Import3DPart Method
Path of 3D part file. A file extension specifies its format.
Example
In This Topic
    Import3DPart Method
    In This Topic
    Import 3d part to designer.
    Syntax
    public IOccPart Import3DPart( 
       string path
    )

    Parameters

    path
    Path of 3D part file. A file extension specifies its format.

    Return Value

    Occurrence of imported 3D part.
    Exceptions
    ExceptionDescription
    Argument is null.
    This file was not found.
    The exception that is thrown when the file has the wrong extension.
    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.
    The object is in invalid state. Obtain a new one.
    This file is not opened.
    Example
    This example shows how to import 3D part.
    // 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();
    See Also