using (Transaction tan = new Transaction(revitDoc))
{
tan.Start("ccc");
Grid grid = Grid.Create(revitDoc, Line.CreateBound(new XYZ(0, 0, 0), new XYZ(10, 10, 0)));
grid.Name = "cc";
//通过实例获得类型id
ElementId elementId= grid.GetTypeId();
//通过类型ID获得元素
Element ss = revitDoc.GetElement(elementId);
//将元素转转为Grid。
GridType sss = ss as GridType;
if (sss!=null)
{ //获得类型参数。然后进行修改 就OK;
Parameter GridEnd=sss.get_Parameter(BuiltInParameter.GRID_BUBBLE_END_1);
GridEnd.Set(1);
Parameter GridStart = sss.get_Parameter(BuiltInParameter.GRID_BUBBLE_END_2);
GridStart.Set(1);
}
tan.Commit();
轴网对应的类是Grid,
Grid.curve 是可以拿到轴网的曲线,如果grid.Iscurved,返回是ture,那么curve,将是一个Arc对象,否则是line对象
注意:线必须是同一个平面立面的。