Esempio n. 1
0
        void setupParticleSystem(Autodesk.Revit.DB.Face f, int uDiv, int vDiv, double springDampening, double springRestLength, double springConstant, double mass)
        {
            BoundingBoxUV bbox  = f.GetBoundingBox();
            double        uStep = (bbox.Max.U - bbox.Min.U) / uDiv;
            double        vStep = (bbox.Max.V - bbox.Min.V) / vDiv;

            for (int j = 0; j <= uDiv; j++) // Y axis is outer loop
            {
                double u = bbox.Min.U + uStep * j;

                for (int i = 0; i <= vDiv; i++) // X axis is inner loop
                {
                    double v = bbox.Min.V + vStep * i;

                    Particle a = particleSystem.makeParticle(mass, f.Evaluate(new UV(u, v)), false);
                    if (i > 0)
                    {
                        particleSystem.makeSpring(particleSystem.getParticle((i - 1) + (j * (vDiv + 1))), a, springRestLength, springConstant, springDampening);
                    }

                    if (j > 0)
                    {
                        Particle b = particleSystem.getParticle(i + ((j - 1) * (vDiv + 1)));
                        particleSystem.makeSpring(a, b, springRestLength, springConstant, springDampening);
                    }

                    if (i == 0 || i == vDiv || j == 0 || j == uDiv)
                    {
                        a.makeFixed();
                    }
                }
            }
        }
Esempio n. 2
0
        public override Value Evaluate(FSharpList <Value> args)
        {
            Reference faceRef = (args[1] as Value.Container).Item as Reference;

            Autodesk.Revit.DB.Face f = (faceRef == null) ?
                                       ((args[1] as Value.Container).Item as Autodesk.Revit.DB.Face) :
                                       dynRevitSettings.Doc.Document.GetElement(faceRef).GetGeometryObjectFromReference(faceRef) as Autodesk.Revit.DB.Face;


            XYZ face_point = null;

            if (f != null)
            {
                //each item in the list will be a reference point
                UV param = (UV)(args[0] as Value.Container).Item;
                face_point = f.Evaluate(param);
            }

            return(Value.NewContainer(face_point));
        }