Пример #1
0
        public void Execute(UpdaterData data)
        {
            Document doc = data.GetDocument();

            if (doc.IsFamilyDocument)
            {
                try
                {
                    //Get document Name
                    string name = doc.Title;
                    string n2   = "null";
                    if (String.IsNullOrEmpty(name))
                    {
                        name = "null";
                    }
                    //Get form location info (Varies by type?)
                    foreach (ElementId e in data.GetModifiedElementIds())
                    {
                        GenericForm ele = doc.GetElement(e) as GenericForm;
                        if (ele != null)
                        {
                            Sweep sweep = doc.GetElement(e) as Sweep;
                            if (sweep != null)
                            {
                                if (sweep.ProfileSymbol != null)
                                {
                                    n2 = sweep.ProfileSymbol.Profile.Name;
                                }
                            }
                            var bbox = ele.get_BoundingBox(null);
                            if (bbox != null)
                            {
                                var dims = GetDims(bbox);
                                if (Enum.GetNames(typeof(ObjectCategory)).ToList().Any(x => ele.Subcategory.Name.Contains(x)))
                                {
                                    int Correct = Enum.GetNames(typeof(ObjectCategory)).ToList().IndexOf(Enum.GetNames(typeof(ObjectCategory)).ToList().Where(x => ele.Subcategory.Name.Contains(x)).First());
                                    Datatype.ObjectStyle.PropogateSingle(Correct, new WriteToCMDLine(WriteNull), name, n2, dims);
                                }
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    e.OutputError();
                }
            }
        }
Пример #2
0
        public void Execute(UpdaterData data)
        {
            Document doc = data.GetDocument();

            if (doc.IsFamilyDocument)
            {
                try
                {
                    //Get document Name
                    string name = doc.Title;
                    if (String.IsNullOrEmpty(name))
                    {
                        name = "null";
                    }

                    //Get form location info (Varies by type?)
                    foreach (ElementId e in data.GetModifiedElementIds().Concat(data.GetAddedElementIds()))
                    {
                        GenericForm ele  = doc.GetElement(e) as GenericForm;
                        var         bbox = ele.get_BoundingBox(null);
                        if (bbox != null)
                        {
                            var dims       = GetDims(bbox);
                            int prediction = Datatype.ObjectStyle.PredictSingle(name, "null", dims);
                            var subcat     = doc.AddCategories(prediction);
                            ele.Subcategory = subcat;
                        }
                        //run info through neural network (slightly larger than mf network.
                        //update object style parameter
                    }
                    //profit
                }
                catch (Exception e)
                {
                    e.OutputError();
                }
            }
        }