Set the Layout property to MinimumSpacing. 
   Namespace:   Autodesk.Revit.DB  
  Assembly:   RevitAPI  (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0) 
Syntax
| C# | 
|---|
|  | 
| Visual Basic | 
|---|
|  | 
| Visual C++ | 
|---|
|  | 
Parameters
- distance
-  Type:  System Double  
 
- just
-  Type:  Autodesk.Revit.DB SpacingRuleJustification  
 
- gridlinesRotation
-  Type:  System Double  
 
- offset
-  Type:  System Double  
 
Remarks
 When changing the Layout to MinimumSpacing, you must also simultaneously set the Distance, Justification, GridlinesRotation, and Offset properties.