Dimensions is an additional source of input for macro feature. Dimensions can be defined in the following way:

public class DimensionMacroFeatureParams
{
    [ParameterDimension(swDimensionType_e.swLinearDimension)]
    public double FirstDimension { get; set; } = 0.01;

    [ParameterDimension(swDimensionType_e.swLinearDimension)]
    public double SecondDimension { get; set; }
}

It is required to arrange the dimensions after rebuild by overriding the OnSetDimensions method. Use DimensionData::SetOrientation helper method to align the dimension.

protected override void OnSetDimensions(ISldWorks app, IModelDoc2 model, IFeature feature, MacroFeatureRebuildResult rebuildResult, DimensionDataCollection dims, BoundingCylinderMacroFeatureParams parameters)
{
    dims[0].SetOrientation(new Point(0, 0, 0), new Vector(0, 1, 0));

    dims[1].SetOrientation(new Point(0, 0, 0), new Vector(0, 0, 1));
}

Origin is a starting point of the dimension.

For linear dimensions orientation represents the vector along the direction of the dimension (i.e. the direction of measured entity) For radial dimensions orientation represents the normal of the dimension (i.e. the vector of rotation of the dimension)

Orientation of dimensions
Orientation of dimensions

Passing data from regeneration

In some cases it might be required to pass the data from OnRebuild method to be used within the OnSetDimensions. For example when the geometry is required to calculate the dimension position.

This could be possible by creating custom rebuild result and returning from the regeneration function.

private class CustomRebuildResult : MacroFeatureRebuildBodyResult
{
    internal MyData CustomData { get; private set; }

    internal BodiesFilletMacroFeatureRebuildResult(IMacroFeatureData featData,
        IBody2[] bodies, MyData customData) : base(featData, true, bodies)
    {
        CustomData = customData;
    }
}

protected override MacroFeatureRebuildResult OnRebuild(ISldWorks app, IModelDoc2 model, IFeature feature, TParams parameters)
{
    var featData = feature.GetDefinition() as IMacroFeatureData;

    var resBodies = GetBodies(); //generating bodies
    var customData = new MyData(); //creating custom data and assigning required values

    return new CustomRebuildResult(featData, resBodies, customData); //returning custom rebuild result
}

protected override void OnSetDimensions(ISldWorks app, IModelDoc2 model, IFeature feature, MacroFeatureRebuildResult rebuildResult,
    DimensionDataCollection dims, BodiesFilletFeatureDataModel parameters)
{
    var rebuildRes = rebuildResult as CustomRebuildResult;

    var customData = rebuildRes.CustomData;
    
    //TODO: use custom data to arrange dimensions
}