Пример #1
0
        public void Process(DataTreeBranch bIn, DataTreeBranch currentBranch)
        {
            DataTree       dt        = InPortData[1].Object as DataTree;
            ReferencePoint attractor = dt.Trunk.Leaves[0] as ReferencePoint;

            //use each XYZ leaf on the input
            //to define a new origin
            foreach (object o in bIn.Leaves)
            {
                ReferencePoint rp = o as ReferencePoint;

                if (rp != null)
                {
                    //get the distance betweent the points

                    double dist = rp.Position.DistanceTo(attractor.Position);
                    currentBranch.Leaves.Add(dist);
                }
            }

            foreach (DataTreeBranch b1 in bIn.Branches)
            {
                DataTreeBranch newBranch = new DataTreeBranch();
                currentBranch.Branches.Add(newBranch);

                Process(b1, newBranch);
            }
        }
Пример #2
0
        void Process(DataTreeBranch currBranch, DataTreeBranch a, DataTreeBranch b)
        {
            foreach (object o in a.Leaves)
            {
                if (b.Leaves.Count > a.Leaves.IndexOf(o))
                {
                    XYZ ptA = o as XYZ;
                    XYZ ptB = b.Leaves[a.Leaves.IndexOf(o)] as XYZ;

                    if (ptA != null && ptB != null)
                    {
                        Curve c = dynElementSettings.SharedInstance.Doc.Application.Application.Create.NewLineBound(ptA, ptB);
                        currBranch.Leaves.Add(c);
                    }
                }
            }

            foreach (DataTreeBranch aChild in a.Branches)
            {
                DataTreeBranch subBranch = new DataTreeBranch();
                currBranch.Branches.Add(subBranch);

                int idx = a.Branches.IndexOf(aChild);

                if (b.Branches.Count > idx)
                {
                    Process(subBranch, aChild, b.Branches[idx]);
                }
            }
        }
Пример #3
0
        public void ProcessState(DataTreeBranch bIn, Hashtable parameterMap)
        {
            foreach (object o in bIn.Leaves)
            {
                FamilyInstance fi = o as FamilyInstance;
                if (fi != null)
                {
                    foreach (DictionaryEntry de in parameterMap)
                    {
                        if (de.Value != null)
                        {
                            //find the parameter on the family instance
                            Parameter p = fi.get_Parameter(de.Key.ToString());
                            if (p != null)
                            {
                                if (de.Value != null)
                                {
                                    p.Set((double)de.Value);
                                }
                            }
                        }
                    }
                }
            }

            foreach (DataTreeBranch nextBranch in bIn.Branches)
            {
                ProcessState(nextBranch, parameterMap);
            }
        }
Пример #4
0
        public void Process(DataTreeBranch familyBranch, DataTreeBranch doubleBranch, string paramName)
        {
            int leafCount = 0;

            foreach (object o in familyBranch.Leaves)
            {
                FamilyInstance fi = o as FamilyInstance;
                if (fi != null)
                {
                    Parameter p = fi.get_Parameter(paramName);
                    if (p != null)
                    {
                        p.Set(Convert.ToDouble(doubleBranch.Leaves[leafCount]));
                    }
                }
                leafCount++;
            }

            int subBranchCount = 0;

            foreach (DataTreeBranch nextBranch in familyBranch.Branches)
            {
                //don't do this if the double tree doesn't
                //have a member in the same location
                if (doubleBranch.Branches.Count - 1 >= subBranchCount)
                {
                    Process(nextBranch, doubleBranch.Branches[subBranchCount], paramName);
                }
                subBranchCount++;
            }
        }
Пример #5
0
        public void Process(DataTreeBranch bIn, DataTreeBranch currentBranch)
        {
            foreach (object o in bIn.Leaves)
            {
                ReferencePoint rp = o as ReferencePoint;

                if (rp != null)
                {
                    //get the location of the point
                    XYZ            pos = rp.Position;
                    FamilySymbol   fs  = InPortData[1].Object as FamilySymbol;
                    FamilyInstance fi  = dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewFamilyInstance(pos, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);

                    Elements.Append(fi);
                    currentBranch.Leaves.Add(fi);
                }
            }

            foreach (DataTreeBranch b1 in bIn.Branches)
            {
                DataTreeBranch newBranch = new DataTreeBranch();
                this.Tree.Trunk.Branches.Add(newBranch);
                Process(b1, newBranch);
            }
        }
Пример #6
0
        public void Process(DataTreeBranch familyBranch, double d, string paramName)
        {
            int leafCount = 0;

            foreach (object o in familyBranch.Leaves)
            {
                FamilyInstance fi = o as FamilyInstance;
                if (fi != null)
                {
                    Parameter p = fi.get_Parameter(paramName);
                    if (p != null)
                    {
                        p.Set(d);
                        dynElementSettings.SharedInstance.Doc.RefreshActiveView();
                    }
                }
                leafCount++;
            }

            foreach (DataTreeBranch nextBranch in familyBranch.Branches)
            {
                //don't do this if the double tree doesn't
                //have a member in the same location

                Process(nextBranch, d, paramName);
            }
        }
Пример #7
0
        public void Process(DataTreeBranch bIn, DataTreeBranch currentBranch)
        {
            foreach (object o in bIn.Leaves)
            {
                // ReferencePoint rp = o as ReferencePoint; //MDJ 11-14-11
                XYZ pointXYZ = o as XYZ;

                if (pointXYZ != null)
                {
                    //get the location of the point
                    //XYZ pos = rp.Position;//MDJ 11-14-11

                    try //MDJ 11-14-11
                    {
                        //MDJ 11-14-11 FamilyCreate vs Create (family vs project newfamilyinstance)
                        FamilySymbol fs = InPortData[1].Object as FamilySymbol;
                        if (dynElementSettings.SharedInstance.Doc.Document.IsFamilyDocument == true)                                                                                                   //Autodesk.Revit.DB.Document.IsFamilyDocument
                        {
                            FamilyInstance fi = dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewFamilyInstance(pointXYZ, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural); //MDJ 11-14-11
                            Elements.Append(fi);
                            currentBranch.Leaves.Add(fi);
                        }
                        else
                        {
                            FamilyInstance fi = dynElementSettings.SharedInstance.Doc.Document.Create.NewFamilyInstance(pointXYZ, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);//MDJ 11-14-11
                            Elements.Append(fi);
                            currentBranch.Leaves.Add(fi);
                        }
                    }
                    catch (Exception e)
                    {
                        TaskDialog.Show("Error", e.ToString());
                    } //MDJ 11-14-11

                    //Hashtable parameterMap = StatePortData[0].Object as Hashtable;
                    //if (parameterMap != null)
                    //{
                    //    foreach (DictionaryEntry de in parameterMap)
                    //    {
                    //        //find the parameter on the family instance
                    //        Parameter p = fi.Symbol.get_Parameter(de.Key.ToString());
                    //        if (p != null)
                    //        {
                    //            p.Set((double)de.Value);
                    //        }
                    //    }
                    //}
                }
            }

            foreach (DataTreeBranch b1 in bIn.Branches)
            {
                DataTreeBranch newBranch = new DataTreeBranch();
                this.Tree.Trunk.Branches.Add(newBranch);
                Process(b1, newBranch);
            }
        }
Пример #8
0
 public void Clear()
 {
     //Debug.WriteLine("Item has " + this.branches.Count + " branches.");
     for (int i = this.branches.Count - 1; i >= 0; i--)
     {
         DataTreeBranch b = this.branches[i];
         b.Clear();
         this.branches.Remove(b);
     }
     this.branches.Clear();
     leaves.Clear();
 }
Пример #9
0
        public void Process(DataTreeBranch b, DataTreeBranch currentBranch)
        {
            List <XYZ>    ptArr   = new List <XYZ>();
            List <double> weights = new List <double>();

            foreach (object o in b.Leaves)
            {
                ReferencePoint pt = o as ReferencePoint;
                ptArr.Add(pt.Position);
                weights.Add(1);
            }

            //only make a curve if
            //there's enough points
            if (ptArr.Count > 1)
            {
                //make a curve
                NurbSpline ns       = dynElementSettings.SharedInstance.Doc.Application.Application.Create.NewNurbSpline(ptArr, weights);
                double     rawParam = ns.ComputeRawParameter(.5);
                Transform  t        = ns.ComputeDerivatives(rawParam, false);

                XYZ norm = t.BasisZ;

                if (norm.GetLength() == 0)
                {
                    norm = XYZ.BasisZ;
                }

                Plane       p  = new Plane(norm, t.Origin);
                SketchPlane sp = dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewSketchPlane(p);
                sps.Add(sp);

                ModelNurbSpline c = (ModelNurbSpline)dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewModelCurve(ns, sp);

                //add the element to the collection
                //so it can be deleted later
                Elements.Append(c);

                //create a leaf node on the local branch
                currentBranch.Leaves.Add(c);
            }

            foreach (DataTreeBranch b1 in b.Branches)
            {
                //every time you read a branch
                //create a branch
                DataTreeBranch newBranch = new DataTreeBranch();
                this.Tree.Trunk.Branches.Add(newBranch);

                Process(b1, newBranch);
            }
        }
Пример #10
0
        /// <summary>
        /// Process is an optional recursive method for dealing with this objects' DataTree
        /// In future versions, it will likely be required by the interface.
        /// </summary>
        /// <param name="branch"></param>
        public void Process(DataTreeBranch branch)
        {
            foreach (object o in branch.Leaves)
            {
                //do something
            }

            foreach (DataTreeBranch subBranch in branch.Branches)
            {
                //recurse through all sub branches
                //of the tree
                Process(subBranch);
            }
        }
Пример #11
0
        void Process(DataTreeBranch currBranch, DataTreeBranch a)
        {
            foreach (object o in a.Leaves)
            {
                Plane p = o as Plane;
                if (p != null)
                {
                    currBranch.Leaves.Add(dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewSketchPlane(p));
                }
            }

            foreach (DataTreeBranch aChild in a.Branches)
            {
                DataTreeBranch subBranch = new DataTreeBranch();
                currBranch.Branches.Add(subBranch);

                Process(subBranch, aChild);
            }
        }
Пример #12
0
        public void Process(DataTreeBranch bIn, DataTreeBranch currentBranch)
        {
            //use each XYZ leaf on the input
            //to define a new origin
            foreach (object o in bIn.Leaves)
            {
                ReferencePoint rp = o as ReferencePoint;

                if (rp != null)
                {
                    for (int i = 0; i < (int)InPortData[0].Object; i++)
                    {
                        //create a branch for the data tree for
                        //this row of points
                        DataTreeBranch b = new DataTreeBranch();
                        currentBranch.Branches.Add(b);

                        for (int j = 0; j < (int)InPortData[1].Object; j++)
                        {
                            XYZ pt = new XYZ(rp.Position.X + i * (double)InPortData[3].Object,
                                             rp.Position.Y + j * (double)InPortData[4].Object,
                                             rp.Position.Z);

                            ReferencePoint rpNew = dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewReferencePoint(pt);

                            //add the point as a leaf on the branch
                            b.Leaves.Add(rpNew);

                            //add the element to the collection
                            Elements.Append(rpNew);
                        }
                    }
                }
            }

            foreach (DataTreeBranch b1 in bIn.Branches)
            {
                DataTreeBranch newBranch = new DataTreeBranch();
                currentBranch.Branches.Add(newBranch);

                Process(b1, newBranch);
            }
        }
Пример #13
0
        public void Process(DataTreeBranch currBranch, DataTreeBranch a)
        {
            foreach (object o in a.Leaves)
            {
                XYZ pt = o as XYZ;
                if (pt != null)
                {
                    ReferencePoint rp = dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewReferencePoint(pt);
                    currBranch.Leaves.Add(rp);
                    Elements.Append(rp);
                }
            }

            foreach (DataTreeBranch aChild in a.Branches)
            {
                DataTreeBranch subBranch = new DataTreeBranch();
                currBranch.Branches.Add(subBranch);

                Process(subBranch, aChild);
            }
        }
Пример #14
0
        /// <summary>
        /// Process is an optional recursive method for dealing with this objects' DataTree
        /// In future versions, it will likely be required by the interface.
        /// </summary>
        /// <param name="branch"></param>
        public void Process(DataTreeBranch branch)
        {
            foreach (object o in branch.Leaves)
            {
                //do something
            }

            foreach (DataTreeBranch subBranch in branch.Branches)
            {
                //recurse through all sub branches
                //of the tree
                Process(subBranch);
            }
        }
Пример #15
0
        public void Process(DataTreeBranch bIn)
        {
            string line = "";
            double doubleSRValue = 0;

            // SR export schema:
            //Source,Date,Time,Model,Type,Study Date Range,Study Time Range,Longitude,Latitude,Unit
            //Vasari v1.0,11/19/2011,2:33 PM,insolationProjectMockUp.rvt,Cumulative,"1/1/2010,12/31/2010","10:00 AM,4:00 PM",-71.0329971313477,42.2130012512207,BTU/ft²
            //
            //Analysis point index,Insolation value,point x,point y,point z,normal x,normal y,normal z
            //1,153823.9528125,7.23744587802689,-32.6932900007427,70.7843137254902,0.2871833,-0.2871833,0.9138116
            //2,159066.52853125,4.74177488560379,-30.1976190083196,72.3529411764706,0.2871833,-0.2871833,0.9138116

            //DataTree treeIn = InPortData[0].Object as DataTree;
            //    if (treeIn != null)
            //    {

            foreach (object o in bIn.Leaves)
            {

                line = o.ToString();

                try // MDJ TODO - remove the try catch block
                {
                    string[] values = line.Split(',');
                    //index = int.Parse(values[0]); // seems a little hacky

                    //int i = 0;
                    int intTest = 0;// used in TryParse below. returns 0 if not an int and >0 if an int.

                    if (int.TryParse(values[0], out intTest)) // test the first value. if the first value is an int, then we know we are passed the header lines and into data
                    {

                       // string stringSRValue = values[1];

                        doubleSRValue = double.Parse(values[1]); // the 2nd value is the one we want

                        SumValue = SumValue + doubleSRValue; // compute the sum but adding current value with previous values

                    }

                    //i++;
                }

                catch (Exception e)
                {
                   // TaskDialog.Show("error", e.ToString());// index is out of range exception thrown from tryparse
                }
            }

            foreach (DataTreeBranch nextBranch in bIn.Branches)
            {
                Process(nextBranch);
            }
        }
Пример #16
0
 public DataTree()
 {
     trunk = new DataTreeBranch();
 }
Пример #17
0
 public DataTree()
 {
     trunk = new DataTreeBranch();
 }
Пример #18
0
        public void Process(DataTreeBranch b, DataTreeBranch currentBranch)
        {
            List<XYZ> ptArr = new List<XYZ>();
            List<double> weights = new List<double>();

            foreach (object o in b.Leaves)
            {
                ReferencePoint pt = o as ReferencePoint;
                ptArr.Add(pt.Position);
                weights.Add(1);
            }

            //only make a curve if
            //there's enough points
            if (ptArr.Count > 1)
            {
                //make a curve
                NurbSpline ns = dynElementSettings.SharedInstance.Doc.Application.Application.Create.NewNurbSpline(ptArr, weights);
                double rawParam = ns.ComputeRawParameter(.5);
                Transform t = ns.ComputeDerivatives(rawParam, false);

                XYZ norm = t.BasisZ;

                if(norm.GetLength()==0)
                {
                    norm = XYZ.BasisZ;
                }

                Plane p = new Plane(norm, t.Origin);
                SketchPlane sp = dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewSketchPlane(p);
                sps.Add(sp);

                ModelNurbSpline c = (ModelNurbSpline)dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewModelCurve(ns, sp);

                //add the element to the collection
                //so it can be deleted later
                Elements.Append(c);

                //create a leaf node on the local branch
                currentBranch.Leaves.Add(c);
            }

            foreach (DataTreeBranch b1 in b.Branches)
            {
                //every time you read a branch
                //create a branch
                DataTreeBranch newBranch = new DataTreeBranch();
                this.Tree.Trunk.Branches.Add(newBranch);

                Process(b1, newBranch);
            }
        }
Пример #19
0
        public void Process(DataTreeBranch bIn, DataTreeBranch currentBranch)
        {
            foreach (object o in bIn.Leaves)
            {
                ReferencePoint rp = o as ReferencePoint;

                if (rp != null)
                {
                    //get the location of the point
                    XYZ pos = rp.Position;
                    FamilySymbol fs = InPortData[1].Object as FamilySymbol;
                    FamilyInstance fi = dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewFamilyInstance(pos, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);

                    Elements.Append(fi);
                    currentBranch.Leaves.Add(fi);

                }
            }

            foreach (DataTreeBranch b1 in bIn.Branches)
            {
                DataTreeBranch newBranch = new DataTreeBranch();
                this.Tree.Trunk.Branches.Add(newBranch);
                Process(b1, newBranch);
            }
        }
Пример #20
0
        public void Process(DataTreeBranch bIn, DataTreeBranch currentBranch)
        {
            DataTree dt = InPortData[1].Object as DataTree;
            ReferencePoint attractor = dt.Trunk.Leaves[0] as ReferencePoint;

            //use each XYZ leaf on the input
            //to define a new origin
            foreach (object o in bIn.Leaves)
            {
                ReferencePoint rp = o as ReferencePoint;

                if (rp != null)
                {
                    //get the distance betweent the points

                    double dist = rp.Position.DistanceTo(attractor.Position);
                    currentBranch.Leaves.Add(dist);
                }
            }

            foreach (DataTreeBranch b1 in bIn.Branches)
            {
                DataTreeBranch newBranch = new DataTreeBranch();
                currentBranch.Branches.Add(newBranch);

                Process(b1, newBranch);
            }
        }
Пример #21
0
        private void ProcessState(DataTreeBranch bIn, Hashtable parameterMap)
        {
            foreach (object o in bIn.Leaves)
            {
                FamilyInstance fi = o as FamilyInstance;
                if (fi != null)
                {
                    foreach (DictionaryEntry de in parameterMap)
                    {
                        if (de.Value != null)
                        {
                            //find the parameter on the family instance
                            Parameter p = fi.get_Parameter(de.Key.ToString());
                            if (p != null)
                            {
                                if (de.Value != null)

                                    if (p.StorageType == StorageType.Double)
                                    {
                                        p.Set((double)de.Value);
                                    }
                                    else if (p.StorageType == StorageType.Integer)
                                    {
                                        p.Set((int)de.Value);
                                    }
                                    else if (p.StorageType == StorageType.String)
                                    {
                                        p.Set((string)de.Value);
                                    }
                            }
                        }
                    }
                }
            }

            foreach (DataTreeBranch nextBranch in bIn.Branches)
            {
                ProcessState(nextBranch, parameterMap);
            }
        }
Пример #22
0
        public void Process(DataTreeBranch familyBranch, DataTreeBranch doubleBranch, string paramName)
        {
            int leafCount = 0;
            foreach(object o in familyBranch.Leaves)
            {
                FamilyInstance fi = o as FamilyInstance;
                if (fi != null)
                {
                    Parameter p = fi.get_Parameter(paramName);
                    if(p!= null)
                    {
                        p.Set(Convert.ToDouble(doubleBranch.Leaves[leafCount]));
                    }
                }
                leafCount++;
            }

            int subBranchCount = 0;
            foreach (DataTreeBranch nextBranch in familyBranch.Branches)
            {
                //don't do this if the double tree doesn't
                //have a member in the same location
                if (doubleBranch.Branches.Count-1 >= subBranchCount)
                {
                    Process(nextBranch, doubleBranch.Branches[subBranchCount], paramName);
                }
                subBranchCount++;
            }
        }
Пример #23
0
        public void Process(DataTreeBranch bIn, DataTreeBranch currentBranch)
        {
            foreach (object o in bIn.Leaves)
            {
               // ReferencePoint rp = o as ReferencePoint; //MDJ 11-14-11
                XYZ pointXYZ = o as XYZ;

                if (pointXYZ != null)
                {
                    //get the location of the point
                    //XYZ pos = rp.Position;//MDJ 11-14-11

                    try //MDJ 11-14-11
                    {
                        //MDJ 11-14-11 FamilyCreate vs Create (family vs project newfamilyinstance)
                        FamilySymbol fs = InPortData[1].Object as FamilySymbol;
                        if (dynElementSettings.SharedInstance.Doc.Document.IsFamilyDocument == true)  //Autodesk.Revit.DB.Document.IsFamilyDocument
                        {
                            FamilyInstance fi = dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewFamilyInstance(pointXYZ, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);//MDJ 11-14-11
                            Elements.Append(fi);
                            currentBranch.Leaves.Add(fi);
                        }
                        else
                        {
                            FamilyInstance fi = dynElementSettings.SharedInstance.Doc.Document.Create.NewFamilyInstance(pointXYZ, fs, Autodesk.Revit.DB.Structure.StructuralType.NonStructural);//MDJ 11-14-11
                            Elements.Append(fi);
                            currentBranch.Leaves.Add(fi);
                        }

                    }
                    catch (Exception e)
                    {
                        TaskDialog.Show("Error", e.ToString());

                    } //MDJ 11-14-11

                    //Hashtable parameterMap = StatePortData[0].Object as Hashtable;
                    //if (parameterMap != null)
                    //{
                    //    foreach (DictionaryEntry de in parameterMap)
                    //    {
                    //        //find the parameter on the family instance
                    //        Parameter p = fi.Symbol.get_Parameter(de.Key.ToString());
                    //        if (p != null)
                    //        {
                    //            p.Set((double)de.Value);
                    //        }
                    //    }
                    //}
                }
            }

            foreach (DataTreeBranch b1 in bIn.Branches)
            {
                DataTreeBranch newBranch = new DataTreeBranch();
                this.Tree.Trunk.Branches.Add(newBranch);
                Process(b1, newBranch);
            }
        }
Пример #24
0
        public void ProcessState(DataTreeBranch bIn, Hashtable parameterMap)
        {
            foreach (object o in bIn.Leaves)
            {
                FamilyInstance fi = o as FamilyInstance;
                if (fi != null)
                {
                    foreach (DictionaryEntry de in parameterMap)
                    {
                        if (de.Value != null)
                        {
                            //find the parameter on the family instance
                            Parameter p = fi.get_Parameter(de.Key.ToString());
                            if (p != null)
                            {
                                if (de.Value != null)
                                    p.Set((double)de.Value);
                            }
                        }
                    }
                }
            }

            foreach (DataTreeBranch nextBranch in bIn.Branches)
            {
                ProcessState(nextBranch, parameterMap);
            }
        }
Пример #25
0
        void Process(DataTreeBranch currBranch, DataTreeBranch a, DataTreeBranch b)
        {
            foreach (object o in a.Leaves)
            {
                if (b.Leaves.Count > a.Leaves.IndexOf(o))
                {
                    XYZ ptA = o as XYZ;
                    XYZ ptB = b.Leaves[a.Leaves.IndexOf(o)] as XYZ;

                    if (ptA != null && ptB != null)
                    {
                        Curve c = dynElementSettings.SharedInstance.Doc.Application.Application.Create.NewLineBound(ptA, ptB);
                        currBranch.Leaves.Add(c);
                    }
                }
            }

            foreach (DataTreeBranch aChild in a.Branches)
            {
                DataTreeBranch subBranch = new DataTreeBranch();
                currBranch.Branches.Add(subBranch);

                int idx = a.Branches.IndexOf(aChild);

                if(b.Branches.Count > idx)
                {
                    Process(subBranch, aChild, b.Branches[idx]);
                }
            }
        }
Пример #26
0
        void Process(DataTreeBranch currBranch, DataTreeBranch a)
        {
            foreach (object o in a.Leaves)
            {
                Plane p = o as Plane;
                if (p != null)
                {
                    currBranch.Leaves.Add(dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewSketchPlane(p));
                }
            }

            foreach (DataTreeBranch aChild in a.Branches)
            {
                DataTreeBranch subBranch = new DataTreeBranch();
                currBranch.Branches.Add(subBranch);

                Process(subBranch, aChild);
            }
        }
Пример #27
0
        public void Process(DataTreeBranch currBranch, DataTreeBranch a)
        {
            foreach (object o in a.Leaves)
            {
                XYZ pt = o as XYZ;
                if (pt != null)
                {
                    ReferencePoint rp = dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewReferencePoint(pt);
                    currBranch.Leaves.Add(rp);
                    Elements.Append(rp);
                }
            }

            foreach (DataTreeBranch aChild in a.Branches)
            {
                DataTreeBranch subBranch = new DataTreeBranch();
                currBranch.Branches.Add(subBranch);

                Process(subBranch, aChild);
            }
        }
Пример #28
0
        public void Process(DataTreeBranch familyBranch, double d, string paramName)
        {
            int leafCount = 0;
            foreach (object o in familyBranch.Leaves)
            {
                FamilyInstance fi = o as FamilyInstance;
                if (fi != null)
                {
                    Parameter p = fi.get_Parameter(paramName);
                    if (p != null)
                    {
                        p.Set(d);
                        dynElementSettings.SharedInstance.Doc.RefreshActiveView();
                    }
                }
                leafCount++;
            }

            foreach (DataTreeBranch nextBranch in familyBranch.Branches)
            {
                //don't do this if the double tree doesn't
                //have a member in the same location

                Process(nextBranch, d, paramName);
            }
        }
Пример #29
0
        public void Process(DataTreeBranch bIn, DataTreeBranch currentBranch)
        {
            //use each XYZ leaf on the input
            //to define a new origin
            foreach (object o in bIn.Leaves)
            {
                ReferencePoint rp = o as ReferencePoint;

                if (rp != null)
                {
                    for (int i = 0; i < (int)InPortData[0].Object; i++)
                    {
                        //create a branch for the data tree for
                        //this row of points
                        DataTreeBranch b = new DataTreeBranch();
                        currentBranch.Branches.Add(b);

                        for (int j = 0; j < (int)InPortData[1].Object; j++)
                        {
                            XYZ pt = new XYZ(rp.Position.X + i * (double)InPortData[3].Object,
                                rp.Position.Y + j * (double)InPortData[4].Object,
                                rp.Position.Z);

                            ReferencePoint rpNew = dynElementSettings.SharedInstance.Doc.Document.FamilyCreate.NewReferencePoint(pt);

                            //add the point as a leaf on the branch
                            b.Leaves.Add(rpNew);

                            //add the element to the collection
                            Elements.Append(rpNew);
                        }
                    }
                }
            }

            foreach (DataTreeBranch b1 in bIn.Branches)
            {
                DataTreeBranch newBranch = new DataTreeBranch();
                currentBranch.Branches.Add(newBranch);

                Process(b1, newBranch);
            }
        }