Revit中坐标系类型多而复杂,下面是获取项目基点坐标系的方法,
ElementCategoryFilter siteCategoryfilter = new ElementCategoryFilter(BuiltInCategory.OST_ProjectBasePoint);
FilteredElementCollector collector = new FilteredElementCollector(doc);
IList<Element> siteElements = collector.WherePasses(siteCategoryfilter).ToElements();
Transform totalTransform = null;
foreach (Element ele in siteElements)
{
//Parameter paramX = ele.ParametersMap.get_Item("E/W");
Parameter paramX = ele.get_Parameter(BuiltInParameter.BASEPOINT_EASTWEST_PARAM);
double X = paramX.AsDouble();
//Parameter paramY = ele.ParametersMap.get_Item("N/S");
Parameter paramY = ele.get_Parameter(BuiltInParameter.BASEPOINT_NORTHSOUTH_PARAM);
double Y = paramY.AsDouble();
Parameter paramElev = ele.get_Parameter(BuiltInParameter.BASEPOINT_ELEVATION_PARAM);
double Elev = paramElev.AsDouble();
//Parameter paramAngle = ele.ParametersMap.get_Item("Angle to True North");
Parameter paramAngle = ele.get_Parameter(BuiltInParameter.BASEPOINT_ANGLETON_PARAM);
double Angle = paramAngle.AsDouble();
XYZ projectBasePoint = new XYZ(X, Y, Elev);
totalTransform = Transform.CreateTranslation(projectBasePoint).Multiply(Transform.CreateRotation(XYZ.BasisZ, Angle));
}