コード例 #1
0
        public void Draw()
        {
            if (this.RenderDescription == null)
            {
                this.RenderDescription = new RenderDescription();
            }
            else
            {
                this.RenderDescription.ClearAll();
            }

            foreach (Curve crv in curves)
            {
                //convert the tessellated curve to a render description
                IList <XYZ> curvePts = crv.Tessellate();
                for (int i = 1; i < curvePts.Count; i++)
                {
                    var a = curvePts[i - 1];
                    var b = curvePts[i];

                    RenderDescription.lines.Add(new Point3D(a.X, a.Y, a.Z));
                    RenderDescription.lines.Add(new Point3D(b.X, b.Y, b.Z));
                }
            }
        }
コード例 #2
0
ファイル: dynIntersection.cs プロジェクト: kyoisi/Dynamo
        public void Draw()
        {
            if (this.RenderDescription == null)
                this.RenderDescription = new RenderDescription();
            else
                this.RenderDescription.ClearAll();

            foreach (XYZ pt in pts)
                this.RenderDescription.points.Add(new Point3D(pt.X, pt.Y, pt.Z));
        }
コード例 #3
0
        public void Draw()
        {
            if (this.RenderDescription == null)
            {
                this.RenderDescription = new Nodes.RenderDescription();
            }

            if (particleSystem == null)
            {
                return;
            }

            for (int i = 0; i < particleSystem.numberOfParticles(); i++)
            {
                Particle p   = particleSystem.getParticle(i);
                XYZ      pos = p.getPosition();
                if (i < this.RenderDescription.points.Count())
                {
                    this.RenderDescription.points[i] = new Point3D(pos.X, pos.Y, pos.Z);
                }
                else
                {
                    Point3D pt = new System.Windows.Media.Media3D.Point3D(pos.X, pos.Y, pos.Z);
                    this.RenderDescription.points.Add(pt);
                }
            }

            for (int i = 0; i < particleSystem.numberOfSprings(); i++)
            {
                ParticleSpring ps   = particleSystem.getSpring(i);
                XYZ            pos1 = ps.getOneEnd().getPosition();
                XYZ            pos2 = ps.getTheOtherEnd().getPosition();

                if (i * 2 + 1 < this.RenderDescription.lines.Count())
                {
                    this.RenderDescription.lines[i * 2]     = new Point3D(pos1.X, pos1.Y, pos1.Z);
                    this.RenderDescription.lines[i * 2 + 1] = new Point3D(pos2.X, pos2.Y, pos2.Z);
                }
                else
                {
                    Point3D pt1 = new System.Windows.Media.Media3D.Point3D(pos1.X, pos1.Y, pos1.Z);
                    Point3D pt2 = new System.Windows.Media.Media3D.Point3D(pos2.X, pos2.Y, pos2.Z);

                    this.RenderDescription.lines.Add(pt1);
                    this.RenderDescription.lines.Add(pt2);
                }
            }
        }
コード例 #4
0
        public void Draw()
        {
            if (RenderDescription == null)
            {
                RenderDescription = new RenderDescription();
            }

            if (ParticleSystem == null)
            {
                return;
            }

            for (int i = 0; i < ParticleSystem.numberOfParticles(); i++)
            {
                Particle p   = ParticleSystem.getParticle(i);
                XYZ      pos = p.getPosition();
                if (i < RenderDescription.points.Count())
                {
                    RenderDescription.points[i] = new Point3D(pos.X, pos.Y, pos.Z);
                }
                else
                {
                    var pt = new Point3D(pos.X, pos.Y, pos.Z);
                    RenderDescription.points.Add(pt);
                }
            }

            for (int i = 0; i < ParticleSystem.numberOfSprings(); i++)
            {
                ParticleSpring ps   = ParticleSystem.getSpring(i);
                XYZ            pos1 = ps.getOneEnd().getPosition();
                XYZ            pos2 = ps.getTheOtherEnd().getPosition();

                if (i * 2 + 1 < RenderDescription.lines.Count())
                {
                    RenderDescription.lines[i * 2]     = new Point3D(pos1.X, pos1.Y, pos1.Z);
                    RenderDescription.lines[i * 2 + 1] = new Point3D(pos2.X, pos2.Y, pos2.Z);
                }
                else
                {
                    var pt1 = new Point3D(pos1.X, pos1.Y, pos1.Z);
                    var pt2 = new Point3D(pos2.X, pos2.Y, pos2.Z);

                    RenderDescription.lines.Add(pt1);
                    RenderDescription.lines.Add(pt2);
                }
            }
        }
コード例 #5
0
ファイル: dynIntersection.cs プロジェクト: CSharpDev/Dynamo
        public void Draw()
        {
            if (this.RenderDescription == null)
            {
                this.RenderDescription = new RenderDescription();
            }
            else
            {
                this.RenderDescription.ClearAll();
            }

            foreach (XYZ pt in pts)
            {
                this.RenderDescription.points.Add(new Point3D(pt.X, pt.Y, pt.Z));
            }
        }
コード例 #6
0
        public static void DrawCurve(RenderDescription description, object obj)
        {
            Autodesk.Revit.DB.Curve curve = obj as Autodesk.Revit.DB.Curve;

            IList<XYZ> points = curve.Tessellate();

            for (int i = 0; i < points.Count; ++i)
            {
                XYZ xyz = points[i];

                description.lines.Add(new Point3D(xyz.X, xyz.Y, xyz.Z));

                if (i == 0 || i == (points.Count - 1))
                    continue;

                description.lines.Add(new Point3D(xyz.X, xyz.Y, xyz.Z));
            }
        }
コード例 #7
0
ファイル: dynGeometry.cs プロジェクト: epeter61/Dynamo
        public void Draw()
        {
            if (this.RenderDescription == null)
                this.RenderDescription = new RenderDescription();
            else
                this.RenderDescription.ClearAll();

            foreach (Curve c in crvs)
            {
                if (c == null)
                    continue;

                DrawCurve(this.RenderDescription, c);
            }
        }
コード例 #8
0
ファイル: dynSelection.cs プロジェクト: romeo08437/Dynamo
        public RenderDescription Draw()
        {
            RenderDescription rd = new RenderDescription();

            Face face = (Face)dynRevitSettings.Doc.Document.GetElement(f).GetGeometryObjectFromReference(f);

            dynRevitTransactionNode.DrawFace(rd, face);

            return rd;
        }
コード例 #9
0
ファイル: dynGeometry.cs プロジェクト: epeter61/Dynamo
        public void Draw()
        {
            if (this.RenderDescription == null)
                this.RenderDescription = new RenderDescription();
            else
                this.RenderDescription.ClearAll();

            foreach (Solid s in solids)
            {
                if (s == null)
                    continue;

                dynRevitTransactionNode.DrawSolid(this.RenderDescription, s);
            }
        }
コード例 #10
0
ファイル: dynGeometry.cs プロジェクト: romeo08437/Dynamo
        private void DrawCurve(ref RenderDescription description, Curve curve)
        {
            IList<XYZ> points = curve.Tessellate();

            for (int i = 0; i < points.Count; ++i)
            {
                XYZ xyz = points[i];

                description.lines.Add(new Point3D(xyz.X, xyz.Y, xyz.Z));

                if (i == 0 || i == (points.Count - 1))
                    continue;

                description.lines.Add(new Point3D(xyz.X, xyz.Y, xyz.Z));
            }
        }
コード例 #11
0
ファイル: dynGeometry.cs プロジェクト: romeo08437/Dynamo
 public RenderDescription Draw()
 {
     RenderDescription rd = new RenderDescription();
     foreach (XYZ pt in pts)
         rd.points.Add(new Point3D(pt.X, pt.Y, pt.Z));
     return rd;
 }
コード例 #12
0
        RenderDescription DrawPython(Value val)
        {
            RenderDescription rd = new RenderDescription();

            DrawContainers(val, rd);

            return rd;
        }
コード例 #13
0
ファイル: dynDynamicRelaxation.cs プロジェクト: kyoisi/Dynamo
        public void Draw()
        {
            if (this.RenderDescription == null)
                this.RenderDescription = new Nodes.RenderDescription();

            if (particleSystem == null)
                return;

            for (int i = 0; i < particleSystem.numberOfParticles(); i++)
            {
                Particle p = particleSystem.getParticle(i);
                XYZ pos = p.getPosition();
                if (i < this.RenderDescription.points.Count())
                {
                    this.RenderDescription.points[i] = new Point3D(pos.X, pos.Y, pos.Z);
                }
                else
                {
                    Point3D pt = new System.Windows.Media.Media3D.Point3D(pos.X, pos.Y, pos.Z);
                    this.RenderDescription.points.Add(pt);
                }
            }

            for (int i = 0; i < particleSystem.numberOfSprings(); i++)
            {
                ParticleSpring ps = particleSystem.getSpring(i);
                XYZ pos1 = ps.getOneEnd().getPosition();
                XYZ pos2 = ps.getTheOtherEnd().getPosition();

                if (i * 2 + 1 < this.RenderDescription.lines.Count())
                {
                    this.RenderDescription.lines[i * 2] = new Point3D(pos1.X, pos1.Y, pos1.Z);
                    this.RenderDescription.lines[i * 2 + 1] = new Point3D(pos2.X, pos2.Y, pos2.Z);
                }
                else
                {
                    Point3D pt1 = new System.Windows.Media.Media3D.Point3D(pos1.X, pos1.Y, pos1.Z);
                    Point3D pt2 = new System.Windows.Media.Media3D.Point3D(pos2.X, pos2.Y, pos2.Z);

                    this.RenderDescription.lines.Add(pt1);
                    this.RenderDescription.lines.Add(pt2);
                }
            }
        }
コード例 #14
0
        // Elements can cantain many Geometry
        public static void DrawElement(RenderDescription description, object obj)
        {
            if (obj == null)
                return;

            if (typeof(Autodesk.Revit.DB.CurveElement).IsAssignableFrom(obj.GetType()))
            {
                DrawCurveElement(description, obj);
            }
            else if (typeof(Autodesk.Revit.DB.ReferencePoint).IsAssignableFrom(obj.GetType()))
            {
                DrawReferencePoint(description, obj);
            }
            else if (typeof(Autodesk.Revit.DB.Form).IsAssignableFrom(obj.GetType()))
            {
                DrawForm(description, obj);
            }
            else if (typeof(Autodesk.Revit.DB.GeometryElement).IsAssignableFrom(obj.GetType()))
            {
                DrawGeometryElement(description, obj);
            }
            else if (typeof (Autodesk.Revit.DB.GeometryObject).IsAssignableFrom(obj.GetType()))
            {
                DrawGeometryObject(description, obj);
            }
            else
            {
                Element elem = obj as Element;
                if (elem != null)
                {
                    Options o = new Options();
                    o.DetailLevel = ViewDetailLevel.Medium;
                    GeometryElement geom = elem.get_Geometry(o);

                    if (geom != null)
                    {
                        DrawGeometryObject(description, geom);
                    }
                }
            }
        }
コード例 #15
0
        public static void DrawCurveElement(RenderDescription description, object obj)
        {
            Autodesk.Revit.DB.CurveElement elem = obj as Autodesk.Revit.DB.CurveElement;

            DrawCurve(description, elem.GeometryCurve);
        }
コード例 #16
0
        /// <summary>
        /// Log visualization update timing and geometry data.
        /// </summary>
        /// <param name="rd">The aggregated render description for the model.</param>
        /// <param name="ellapsedTime">The ellapsed time of visualization as a string.</param>
        protected void LogVisualizationUpdateData(RenderDescription rd, string ellapsedTime)
        {
            var renderDict = new Dictionary<string, object>();
            renderDict["points"] = rd.Points.Count;
            renderDict["line_segments"] = rd.Lines.Count / 2;
            renderDict["mesh_facets"] = rd.Meshes.Any()
                                            ? rd.Meshes.Select(x => x.TriangleIndices.Count / 3).Aggregate((a, b) => a + b)
                                            : 0;
            renderDict["time"] = ellapsedTime;
            renderDict["manager_type"] = this.GetType().ToString();

            var renderData = JsonConvert.SerializeObject(renderDict);

            InstrumentationLogger.LogInfo("Perf-Latency-RenderGeometryGeneration", renderData);

            //Debug.WriteLine(renderData);
        }
コード例 #17
0
        internal void VisualizeGeometry(NodeModel node, object geom, string tag, RenderDescription rd)
        {
            var t = geom.GetType();

            var viz = Visualizers.FirstOrDefault(x => x.Key == t || x.Key.IsAssignableFrom(t));

            //draw what's in the container
            if (viz.Value != null)
            {
                viz.Value.Invoke(node, geom, tag, rd, octree);
            }
        }
コード例 #18
0
        /// <summary>
        /// Aggregates all upstream geometry for the given node then sends
        /// a message that a visualization is ready
        /// </summary>
        /// <param name="node">The node whose upstream geometry you need.</param>
        /// <returns>A render description containing all upstream geometry.</returns>
        public void RenderUpstream(NodeModel node)
        {
            var rd = new RenderDescription();

            //send back just what the node needs
            var watch = new Stopwatch();
            watch.Start();

            if (node == null)
            {
                //send back everything
                rd = AggregateRenderDescriptions();

                //StripDuplicates(rd);

                OnResultsReadyToVisualize(this, new VisualizationEventArgs(rd, string.Empty));
            }
            else
            {
                //send back renderables for the branch
                var drawables = GetUpstreamDrawableIds(node.Inputs);

                var ids = from viz in dynSettings.Controller.VisualizationManager.Visualizations
                          where drawables.Contains(viz.Key)
                          select viz;

                var keyValuePairs = ids as KeyValuePair<string, RenderDescription>[] ?? ids.ToArray();

                var pts = keyValuePairs.SelectMany(x => x.Value.Points);
                var lines = keyValuePairs.SelectMany(x => x.Value.Lines);
                var meshes = keyValuePairs.SelectMany(x => x.Value.Meshes);
                var xs = keyValuePairs.SelectMany(x => x.Value.XAxisPoints);
                var ys = keyValuePairs.SelectMany(x => x.Value.YAxisPoints);
                var zs = keyValuePairs.SelectMany(x => x.Value.ZAxisPoints);
                var pts_sel = keyValuePairs.SelectMany(x => x.Value.SelectedPoints);
                var lines_sel = keyValuePairs.SelectMany(x => x.Value.SelectedLines);
                var mesh_sel = keyValuePairs.SelectMany(x => x.Value.SelectedMeshes);
                var text = keyValuePairs.SelectMany(x => x.Value.Text);

                rd.Points.AddRange(pts);
                rd.Lines.AddRange(lines);
                rd.Meshes.AddRange(meshes);
                rd.XAxisPoints.AddRange(xs);
                rd.YAxisPoints.AddRange(ys);
                rd.ZAxisPoints.AddRange(zs);
                rd.SelectedPoints.AddRange(pts_sel);
                rd.SelectedLines.AddRange(lines_sel);
                rd.SelectedMeshes.AddRange(mesh_sel);
                rd.Text.AddRange(text);

                //StripDuplicates(rd);

                OnResultsReadyToVisualize(this, new VisualizationEventArgs(rd, node.GUID.ToString()));
            }

            watch.Stop();
            Debug.WriteLine(String.Format("{0} ellapsed for aggregating geometry for watch.", watch.Elapsed));

            //LogVisualizationUpdateData(rd, watch.Elapsed.ToString());
        }
コード例 #19
0
 public VisualizationEventArgs(RenderDescription description, string viewId)
 {
     Description = description;
     Id = viewId;
 }
コード例 #20
0
        public RenderDescription AggregateRenderDescriptions()
        {
            var descriptions = Visualizations.Values;

            var rd = new RenderDescription
                {
                    Points = descriptions.SelectMany(x => x.Points).ToThreadSafeList(),
                    Lines = descriptions.SelectMany(x => x.Lines).ToThreadSafeList(),
                    SelectedPoints = descriptions.SelectMany(x => x.SelectedPoints).ToThreadSafeList(),
                    SelectedLines = descriptions.SelectMany(x => x.SelectedLines).ToThreadSafeList(),
                    XAxisPoints = descriptions.SelectMany(x => x.XAxisPoints).ToThreadSafeList(),
                    YAxisPoints = descriptions.SelectMany(x => x.YAxisPoints).ToThreadSafeList(),
                    ZAxisPoints = descriptions.SelectMany(x => x.ZAxisPoints).ToThreadSafeList(),
                    Meshes = descriptions.SelectMany(x => x.Meshes).ToThreadSafeList(),
                    SelectedMeshes = descriptions.SelectMany(x => x.SelectedMeshes).ToThreadSafeList(),
                    Text = descriptions.SelectMany(x=>x.Text).ToThreadSafeList()
                };

            return rd;
        }
コード例 #21
0
 public static void DrawXYZ(RenderDescription description, object obj)
 {
     XYZ point = obj as XYZ;
     description.points.Add(new Point3D(point.X, point.Y, point.Z));
 }
コード例 #22
0
        public void Draw(RenderDescription description, object obj)
        {
            //string path = @"C:\Temp\" + System.Guid.NewGuid().ToString() + ".txt";
            //System.IO.File.WriteAllText(path, obj.GetType().Name);

            DrawElement(description, obj);
        }
コード例 #23
0
        public static void DrawFace(RenderDescription description, object obj)
        {
            Autodesk.Revit.DB.Face face = obj as Autodesk.Revit.DB.Face;

            Mesh3D[] meshes = RevitMeshToHelixMesh(face.Triangulate(0.2));

            foreach (Mesh3D mesh in meshes)
            {
                description.meshes.Add(mesh);
            }
        }
コード例 #24
0
 private void DrawContainers(Value val, RenderDescription rd)
 {
     if (val.IsList)
     {
         foreach (Value v in ((Value.List)val).Item)
         {
             DrawContainers(v, rd);
         }
     }
     if (val.IsContainer)
     {
         var drawable = ((Value.Container)val).Item;
         if(drawable is XYZ)
         {
             dynRevitTransactionNode.DrawXYZ(rd, (XYZ)drawable);
         }
         else
         {
             dynRevitTransactionNode.DrawGeometryObject(rd, (GeometryObject)drawable);
         }
     }
 }
コード例 #25
0
        public static void DrawForm(RenderDescription description, object obj)
        {
            Autodesk.Revit.DB.Form form = obj as Autodesk.Revit.DB.Form;

            DrawGeometryElement(description, form.get_Geometry(new Options()));
        }
コード例 #26
0
ファイル: dynGeometry.cs プロジェクト: romeo08437/Dynamo
 public RenderDescription Draw()
 {
     RenderDescription rd = new RenderDescription();
     foreach (Solid s in solids)
         dynRevitTransactionNode.DrawSolid(rd, s);
     return rd;
 }
コード例 #27
0
        public static void DrawGeometryElement(RenderDescription description, object obj)
        {
            try
            {
                GeometryElement gelem = obj as GeometryElement;

                foreach (GeometryObject go in gelem)
                {
                    DrawGeometryObject(description, go);
                }
            }
            catch (Exception ex)
            {
                dynSettings.Controller.DynamoViewModel.Log(ex.Message);
                dynSettings.Controller.DynamoViewModel.Log(ex.StackTrace);
            }
        }
コード例 #28
0
ファイル: dynGeometry.cs プロジェクト: romeo08437/Dynamo
 public RenderDescription Draw()
 {
     RenderDescription rd = new RenderDescription();
     foreach (Curve c in crvs)
         DrawCurve(ref rd, c);
     return rd;
 }
コード例 #29
0
 public static void DrawReferencePoint(RenderDescription description, object obj)
 {
     ReferencePoint point = obj as ReferencePoint;
     description.points.Add(new Point3D(point.GetCoordinateSystem().Origin.X,
         point.GetCoordinateSystem().Origin.Y,
         point.GetCoordinateSystem().Origin.Z));
 }
コード例 #30
0
        public RenderDescription Draw()
        {
            RenderDescription rd = new RenderDescription();

            if (particleSystem == null)
                return rd;

            for(int i=0; i<particleSystem.numberOfParticles(); i++)
            {
                Particle p = particleSystem.getParticle(i);
                XYZ pos = p.getPosition();
                rd.points.Add(new System.Windows.Media.Media3D.Point3D(pos.X, pos.Y, pos.Z));
            }

            for (int i = 0; i < particleSystem.numberOfSprings(); i++)
            {
                ParticleSpring ps = particleSystem.getSpring(i);
                XYZ pos1 = ps.getOneEnd().getPosition();
                XYZ pos2 = ps.getTheOtherEnd().getPosition();

                rd.lines.Add(new System.Windows.Media.Media3D.Point3D(pos1.X, pos1.Y, pos1.Z));
                rd.lines.Add(new System.Windows.Media.Media3D.Point3D(pos2.X, pos2.Y, pos2.Z));
            }
            return rd;
        }
コード例 #31
0
        public static void DrawSolid(RenderDescription description, object obj)
        {
            Autodesk.Revit.DB.Solid solid = obj as Autodesk.Revit.DB.Solid;

            foreach (Face f in solid.Faces)
            {
                DrawFace(description, f);
            }

            foreach (Edge edge in solid.Edges)
            {
                DrawCurve(description, edge.AsCurve());
            }
        }
コード例 #32
0
        public void Draw()
        {
            if (DynamoAsm.HasShutdown)
            {
                return;
            }

            if (this.RenderDescription == null)
            {
                this.RenderDescription = new RenderDescription();
            }
            else
            {
                this.RenderDescription.ClearAll();
            }

            foreach (GraphicItem g in _graphicItems)
            {
                FloatList point_vertices = g.point_vertices_threadsafe();

                for (int i = 0; i < point_vertices.Count; i += 3)
                {
                    this.RenderDescription.points.Add(new Point3D(point_vertices[i],
                                                                  point_vertices[i + 1], point_vertices[i + 2]));
                }

                SizeTList num_line_strip_vertices = g.num_line_strip_vertices_threadsafe();
                FloatList line_strip_vertices     = g.line_strip_vertices_threadsafe();

                int counter = 0;

                foreach (uint num_verts in num_line_strip_vertices)
                {
                    for (int i = 0; i < num_verts; ++i)
                    {
                        Point3D p = new Point3D(
                            line_strip_vertices[counter],
                            line_strip_vertices[counter + 1],
                            line_strip_vertices[counter + 2]);

                        this.RenderDescription.lines.Add(p);

                        counter += 3;

                        if (i == 0 || i == num_verts - 1)
                        {
                            continue;
                        }

                        this.RenderDescription.lines.Add(p);
                    }
                }

                FloatList triangle_vertices = g.triangle_vertices_threadsafe();

                List <int>     indices_front = new List <int>();
                List <int>     indices_back  = new List <int>();
                List <Point3D> vertices      = new List <Point3D>();

                for (int i = 0; i < triangle_vertices.Count / 9; ++i)
                {
                    for (int k = 0; k < 3; ++k)
                    {
                        int index = i * 9 + k * 3;

                        Point3D new_point = new Point3D(triangle_vertices[index],
                                                        triangle_vertices[index + 1],
                                                        triangle_vertices[index + 2]);

                        bool new_point_exists = false;
                        for (int l = 0; l < vertices.Count; ++l)
                        {
                            Point3D p = vertices[l];
                            if ((p.X == new_point.X) && (p.Y == new_point.Y) && (p.Z == new_point.Z))
                            {
                                indices_front.Add(l);
                                new_point_exists = true;
                                break;
                            }
                        }

                        if (new_point_exists)
                        {
                            continue;
                        }

                        indices_front.Add(vertices.Count);
                        vertices.Add(new_point);
                    }

                    int a = indices_front[indices_front.Count - 3];
                    int b = indices_front[indices_front.Count - 2];
                    int c = indices_front[indices_front.Count - 1];

                    indices_back.Add(c);
                    indices_back.Add(b);
                    indices_back.Add(a);
                }

                this.RenderDescription.meshes.Add(new Mesh3D(vertices, indices_front));
                this.RenderDescription.meshes.Add(new Mesh3D(vertices, indices_back));
            }
        }
コード例 #33
0
 public static void DrawUndrawable(RenderDescription description, object obj)
 {
     //TODO: write a message, throw an exception, draw a question mark
 }
コード例 #34
0
        // Why the if/else statements? Most dynRevitTransactionNode are created
        // via a Python script. This keeps logic in the main C# code base.
        public static void DrawGeometryObject(RenderDescription description, object obj)
        {
            if (obj == null)
                return;

            // Debugging code
            //string path = @"C:\Temp\" + System.Guid.NewGuid().ToString() + ".txt";
            //System.IO.File.WriteAllText(path, obj.GetType().Name);

            if (typeof(Autodesk.Revit.DB.XYZ).IsAssignableFrom(obj.GetType()))
            {
                DrawXYZ(description, obj);
            }
            if (typeof(Autodesk.Revit.DB.Curve).IsAssignableFrom(obj.GetType()))
            {
                DrawCurve(description, obj);
            }
            else if (typeof(Autodesk.Revit.DB.Solid).IsAssignableFrom(obj.GetType()))
            {
                DrawSolid(description, obj);
            }
            else if (typeof(Autodesk.Revit.DB.Face).IsAssignableFrom(obj.GetType()))
            {
                DrawFace(description, obj);
            }
            else
            {
                DrawUndrawable(description, obj);
            }
        }
コード例 #35
0
ファイル: dynGeometry.cs プロジェクト: epeter61/Dynamo
        public void Draw()
        {
            if(this.RenderDescription == null)
                this.RenderDescription = new RenderDescription();
            else
                this.RenderDescription.ClearAll();

            foreach (Transform t in transforms)
            {
                Point3D origin = new Point3D(t.Origin.X, t.Origin.Y, t.Origin.Z);
                XYZ x1 = t.Origin + t.BasisX.Multiply(3);
                XYZ y1 = t.Origin + t.BasisY.Multiply(3);
                XYZ z1 = t.Origin + t.BasisZ.Multiply(3);
                Point3D xEnd = new Point3D(x1.X, x1.Y, x1.Z);
                Point3D yEnd = new Point3D(y1.X, y1.Y, y1.Z);
                Point3D zEnd = new Point3D(z1.X, z1.Y, z1.Z);

                this.RenderDescription.xAxisPoints.Add(origin);
                this.RenderDescription.xAxisPoints.Add(xEnd);

                this.RenderDescription.yAxisPoints.Add(origin);
                this.RenderDescription.yAxisPoints.Add(yEnd);

                this.RenderDescription.zAxisPoints.Add(origin);
                this.RenderDescription.zAxisPoints.Add(zEnd);
            }
        }