public override bool acceptsListOfLists(FScheme.Value value) { if (Utils.IsListOfListsOfLists(value)) { return(false); } FSharpList <Value> vals = ((Value.List)value).Item; if (!vals.Any() || !(vals[0] is Value.List)) { return(true); } FSharpList <Value> firstListInList = ((Value.List)vals[0]).Item; if (!firstListInList.Any() || !(firstListInList[0] is Value.Container)) { return(true); } var var1 = ((Value.Container)firstListInList[0]).Item; if (var1 is ModelCurveArray) { return(false); } return(true); }
/// <summary> /// A utility function to obtain the CSharp number type from a Value /// </summary> /// <param name="value">A Value object that returns true for IsNumber</param> /// <param name="convertedValue">The holder for the obtained value</param> /// <returns>False if the first param returns false for IsNumber</returns> public static bool Convert(FScheme.Value value, ref double convertedValue) { if (!value.IsNumber) { return(false); } convertedValue = (value as Value.Number).Item; return(true); }
/// <summary> /// A utility function to obtain the CSharp number type from a Value /// </summary> /// <param name="value">A Value object that returns true for IsNumber</param> /// <param name="convertedValue">The holder for the obtained value</param> /// <returns>False if the first param returns false for IsNumber</returns> public static bool Convert(FScheme.Value value, ref FSharpList <Value> convertedValue) { if (!value.IsList) { return(false); } convertedValue = ((FScheme.Value.List)value).Item; return(true); }
/// <summary> /// A utility function to obtain the Geometry from a Value /// </summary> /// <param name="value">A Value object that returns Container</param> /// <param name="convertedValue">The holder for the obtained value</param> /// <returns>False if the first param returns false for IsContainer</returns> public static bool Convert(FScheme.Value value, ref Autodesk.LibG.Geometry convertedValue) { convertedValue = null; if (!value.IsContainer) { return(false); } object itemValue = (value as Value.Container).Item; convertedValue = itemValue as Autodesk.LibG.Geometry; return(convertedValue != null); }
/// <summary> /// A utility function to obtain the CSharp number type from a Value /// </summary> /// <param name="value">A Value object that returns true for IsNumber</param> /// <param name="convertedValue">The holder for the obtained value</param> /// <returns>False if the first param returns false for IsNumber</returns> public static bool Convert(FScheme.Value value, ref string convertedValue) { if (value.IsString) { convertedValue = ((FScheme.Value.String)value).Item; return(true); } if (value.IsSymbol) { convertedValue = ((FScheme.Value.Symbol)value).Item; return(true); } return(false); }
/// <summary> /// Determine whether the given list is a list of lists. /// </summary> /// <param name="value"></param> /// <returns></returns> public static bool IsListOfLists(FScheme.Value value) { if (value.IsList) { FSharpList <Value> vals = ((Value.List)value).Item; if (!vals.Any()) { return(false); } if (vals[0].IsList) { return(true); } } return(false); }
public virtual bool acceptsListOfLists(FScheme.Value value) { return(false); }
/// <summary> /// Utility method to get the Revit geometry associated with nodes. /// </summary> /// <param name="value"></param> /// <returns></returns> private static List <GeometryObject> RevitGeometryFromNodes(FScheme.Value value) { var geoms = new List <GeometryObject>(); if (value == null) { return(geoms); } if (value.IsList) { foreach (var val_inner in ((FScheme.Value.List)value).Item) { geoms.AddRange(RevitGeometryFromNodes(val_inner)); } return(geoms); } var container = value as Value.Container; if (container == null) { return(geoms); } var geom = ((FScheme.Value.Container)value).Item as GeometryObject; if (geom != null && !(geom is Face)) { geoms.Add(geom); } var ps = ((FScheme.Value.Container)value).Item as ParticleSystem; if (ps != null) { geoms.AddRange(ps.Springs.Select(spring => Line.CreateBound(spring.getOneEnd().getPosition(), spring.getTheOtherEnd().getPosition())).Cast <GeometryObject>()); } var cl = ((FScheme.Value.Container)value).Item as Autodesk.Revit.DB.CurveLoop; if (cl != null) { geoms.AddRange(cl); } //draw xyzs as Point objects var pt = ((FScheme.Value.Container)value).Item as XYZ; if (pt != null) { Type pointType = typeof(Point); MethodInfo[] pointTypeMethods = pointType.GetMethods(BindingFlags.Static | BindingFlags.Public); var method = pointTypeMethods.FirstOrDefault(x => x.Name == "CreatePoint"); if (method != null) { var args = new object[3]; args[0] = pt.X; args[1] = pt.Y; args[2] = pt.Z; geoms.Add((Point)method.Invoke(null, args)); } } return(geoms); }