Eplan Platform API
Eplan.EplApi.HEServices Namespace / DeviceService Class / InsertAccessory3D Method
Placement which will be the parent of the new object. Can't be null.
Accessory part number. Can't be null.
Accessory part variant. Can't be null.
Accessory placement name. First one found will be used. Can't be null.
Accessory installation name which will used for placing. Can't be null.
Determins if created object will be transient.
Collection which will be filled with created objects. Can be null.
Example

In This Topic
    InsertAccessory3D Method
    In This Topic
    Creates and inserts accessories of a placement.
    Syntax

    Parameters

    pMainPlacement
    Placement which will be the parent of the new object. Can't be null.
    strPartNumber
    Accessory part number. Can't be null.
    strPartVariant
    Accessory part variant. Can't be null.
    strAccessoryPlacement
    Accessory placement name. First one found will be used. Can't be null.
    strInstallationVariant
    Accessory installation name which will used for placing. Can't be null.
    bTransient
    Determins if created object will be transient.
    colCreatePlacements
    Collection which will be filled with created objects. Can be null.

    Return Value

    True if accessory has been placed automatically.
    Exceptions
    ExceptionDescription
    NULL was passed as a needed parameter.
    Invalid or empty parameter passed.
    The internal interface could not be created.
    Creation of accessory failed. Please check if accessory placement is assigned to the article or the installation variant is valid.
    An error occurred while performing the action. Please refer to the exception message.
    Remarks
    Accessories are placed automatically, which means that their transformation have been calculated and set, only if it results from the information contained in the accessory placement. In other case accessories transformation must be calculated and set manually.
    Example
    The following examples shows how to insert a 3d accessory.
    //get 3d function from selection
    SelectionSet oSelectionSet = new SelectionSet();
    Function3D oMainFunction = oSelectionSet.Selection[0] as Function3D;
    
    //set accessory data
    String strPartNumber = "SE.GV3A01";
    String strPartVariant = "1";
    
    //set accessory placement data
    String strAccessoryPlacement = "SE.GV";
    String strInstallationVariant = "Top";
    
    //insert accessory
    List<Placement3D> listCreatedPlacements = new List<Placement3D>();
    bool bPlacedAutomatically = new DeviceService().InsertAccessory3D(
            oMainFunction, 
            strPartNumber, 
            strPartVariant, 
            strAccessoryPlacement, 
            strInstallationVariant, 
            false, 
            listCreatedPlacements);
    
    //if accessory not placed automatically then location needs to be set manually
    if (bPlacedAutomatically == false)
    {
        foreach (Placement3D oPlacement in listCreatedPlacements)
        {
            //set parent for accessory
            oPlacement.SetParent(oMainFunction, false);
    
            //calculate transformation
            Matrix3D oTransformation = new Matrix3D();
            // TODO
    
            //set location is 3d space relatively to parent function
            oPlacement.RelativeTransformation = oTransformation;
        }
    }
    
    
    See Also