public object Parse(string value, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.UnitType unitType, Autodesk.Revit.DB.DisplayUnitType outputDisplayUnitType) { if (!value.StartsWith("(")) { return(null); } if (!value.EndsWith(")")) { return(null); } value = value.TrimStart('('); value = value.TrimEnd(')'); string[] uv = value.Split(','); if (uv.Length != 2) { return(null); } double tempu; double tempv; if (!double.TryParse(uv[0], out tempu)) { return(null); } if (!double.TryParse(uv[1], out tempv)) { return(null); } return(new UV(tempu, tempv)); }
public object Parse(string value, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.UnitType unitType, Autodesk.Revit.DB.DisplayUnitType outputDisplayUnitType) { Guid tempguid; if (!Guid.TryParse(value, out tempguid)) { return(null); } return(new Guid(value)); }
public string Format(object value, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.UnitType unitType, Autodesk.Revit.DB.DisplayUnitType inputDisplayUnitType, bool edit) { List <ElementId> elementids = value as List <ElementId>; string tempstring = ""; for (int i = 0; i < elementids.Count; i++) { tempstring += elementids[i].ToString(); tempstring += ";"; } if (tempstring.EndsWith(";")) { tempstring = tempstring.TrimEnd(';'); } return(tempstring); }
public object Parse(string value, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.UnitType unitType, Autodesk.Revit.DB.DisplayUnitType outputDisplayUnitType) { string[] guidmain = value.Split(';'); List <Guid> guids = new List <Guid>(); for (int i = 0; i < guidmain.Length; i++) { Guid tempguid; if (!Guid.TryParse(guidmain[i].ToString(), out tempguid)) { return(null); } guids.Add(tempguid); } return(guids); }
public object Parse(string value, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.UnitType unitType, Autodesk.Revit.DB.DisplayUnitType outputDisplayUnitType) { int tempid; if (!int.TryParse(value, out tempid)) { return(null); } ElementId eid = new ElementId(tempid); Element e = document.GetElement(eid); if (e == null) { return(null); } return(eid); }
public object Parse(string value, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.UnitType unitType, Autodesk.Revit.DB.DisplayUnitType outputDisplayUnitType) { string[] xyzmain = value.Split(';'); List <XYZ> xyzs = new List <XYZ>(); for (int i = 0; i < xyzmain.Length; i++) { if (!xyzmain[i].StartsWith("(")) { return(null); } if (!xyzmain[i].EndsWith(")")) { return(null); } xyzmain[i] = xyzmain[i].TrimStart('('); xyzmain[i] = xyzmain[i].TrimEnd(')'); string[] xyz = xyzmain[i].Split(','); if (xyz.Length != 3) { return(null); } double tempx; double tempy; double tempz; if (!double.TryParse(xyz[0], out tempx)) { return(null); } if (!double.TryParse(xyz[1], out tempy)) { return(null); } if (!double.TryParse(xyz[2], out tempz)) { return(null); } xyzs.Add(new XYZ(tempx, tempy, tempz)); } return(xyzs); }
public object Parse(string value, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.UnitType unitType, Autodesk.Revit.DB.DisplayUnitType outputDisplayUnitType) { string[] elementidmain = value.Split(';'); List <ElementId> elementids = new List <ElementId>(); for (int i = 0; i < elementidmain.Length; i++) { int tempid; if (!int.TryParse(elementidmain[i].ToString(), out tempid)) { return(null); } ElementId eid = new ElementId(tempid); Element e = document.GetElement(eid); if (e == null) { return(null); } elementids.Add(eid); } return(elementids); }
public object Parse(string value, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.UnitType unitType, Autodesk.Revit.DB.DisplayUnitType outputDisplayUnitType) { if (!value.StartsWith("(")) { return(null); } if (!value.EndsWith(")")) { return(null); } value = value.TrimStart('('); value = value.TrimEnd(')'); string[] xyz = value.Split(','); if (xyz.Length != 3) { return(null); } double tempx; double tempy; double tempz; if (!double.TryParse(xyz[0], out tempx)) { return(null); } if (!double.TryParse(xyz[1], out tempy)) { return(null); } if (!double.TryParse(xyz[2], out tempz)) { return(null); } return(new XYZ(tempx, tempy, tempz)); }
public object Parse(string value, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.UnitType unitType, Autodesk.Revit.DB.DisplayUnitType outputDisplayUnitType) { string[] uvmain = value.Split(';'); List <UV> uvs = new List <UV>(); for (int i = 0; i < uvmain.Length; i++) { if (!uvmain[i].StartsWith("(")) { return(null); } if (!uvmain[i].EndsWith(")")) { return(null); } uvmain[i] = uvmain[i].TrimStart('('); uvmain[i] = uvmain[i].TrimEnd(')'); string[] uv = uvmain[i].Split(','); if (uv.Length != 2) { return(null); } double tempu; double tempv; if (!double.TryParse(uv[0], out tempu)) { return(null); } if (!double.TryParse(uv[1], out tempv)) { return(null); } uvs.Add(new UV(tempu, tempv)); } return(uvs); }
/// <summary> /// set the format options for special unit type. /// </summary> public void SetFormatOptions(Autodesk.Revit.DB.UnitType unitType, Autodesk.Revit.DB.FormatOptions options) { m_units.SetFormatOptions(unitType, options); m_unitType_formatOptions[unitType] = options; }
public string Format(object value, Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.UnitType unitType, Autodesk.Revit.DB.DisplayUnitType inputDisplayUnitType, bool edit) { return(value.ToString()); }
public object Convert(object value, Autodesk.Revit.DB.UnitType unitType, Autodesk.Revit.DB.DisplayUnitType inputUnitType, Autodesk.Revit.DB.DisplayUnitType outputUnitType) { return(value); }