예제 #1
0
        Stream(ArrayList data, Face face)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(Face)));

            data.Add(new Snoop.Data.Double("Area", face.Area));
            ///TODO: Restore: data.Add(new Snoop.Data.Object("Material element", face.MaterialElement));
            data.Add(new Snoop.Data.Bool("Is two-sided", face.IsTwoSided));
            data.Add(new Snoop.Data.Enumerable("Edge loops", face.EdgeLoops));
            data.Add(new Snoop.Data.Object("Triangulate", face.Triangulate()));
            data.Add(new Snoop.Data.Object("Reference", face.Reference));

            ConicalFace conicalFace = face as ConicalFace;

            if (conicalFace != null)
            {
                Stream(data, conicalFace);
                return;
            }

            CylindricalFace cylFace = face as CylindricalFace;

            if (cylFace != null)
            {
                Stream(data, cylFace);
                return;
            }

            HermiteFace hermiteFace = face as HermiteFace;

            if (hermiteFace != null)
            {
                Stream(data, hermiteFace);
                return;
            }

            PlanarFace planarFace = face as PlanarFace;

            if (planarFace != null)
            {
                Stream(data, planarFace);
                return;
            }

            RevolvedFace revlFace = face as RevolvedFace;

            if (revlFace != null)
            {
                Stream(data, revlFace);
                return;
            }

            RuledFace ruledFace = face as RuledFace;

            if (ruledFace != null)
            {
                Stream(data, ruledFace);
                return;
            }
        }
예제 #2
0
        Stream(ArrayList data, ConicalFace face)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(ConicalFace)));

            data.Add(new Snoop.Data.Xyz("Origin", face.Origin));
            data.Add(new Snoop.Data.Xyz("Axis", face.Axis));
            data.Add(new Snoop.Data.Angle("Half angle", face.HalfAngle));
        }
예제 #3
0
        private void SolidProcess(Solid geomSolid, UIDocument doc, Material materialElement)
        {
            try
            {
                int icount = 0;
                fr_Progress.SetProBarFace(geomSolid.Faces.Size);
                foreach (Face geomFace in geomSolid.Faces)
                {
                    fr_Progress.AddValueProBarFace(++icount);
                    RevolvedFace revolvedFace = geomFace as RevolvedFace;
                    if (null != revolvedFace)
                    {
                    }
                    ConicalFace conicalFace = geomFace as ConicalFace;
                    if (null != conicalFace)
                    {
                    }
                    CylindricalFace cylindricalFace = geomFace as CylindricalFace;
                    if (null != cylindricalFace)
                    {
                    }
                    HermiteFace hermiteFace = geomFace as HermiteFace;
                    if (null != hermiteFace)
                    {
                    }
                    RuledFace ruledFace = geomFace as RuledFace;
                    if (null != ruledFace)
                    {
                    }
                    if (null != geomFace.Reference)
                    {
                    }
                    Material materialElementNew = materialElement;
                    if (null != geomFace.MaterialElement)
                    {
                        materialElementNew = geomFace.MaterialElement as Material;
                    }
                    Mesh geomMesh = geomFace.Triangulate();
                    AddFaceMaterial(materialElementNew, doc);
                    MeshProcess(geomMesh);

                    TextureCoord(geomFace);
                }
            }
            catch (Exception e)
            {
                string message;
                // Exception rised, report it by revit error reporting mechanism.
                message = "SolidProcess fails for Reason:" + Environment.NewLine;
                File.AppendAllText(@"C:\CadFaster\Revit\ExeWriter_log.txt", message);
                message = e.ToString();
                //File.AppendAllText(@"C:\CadFaster\Revit\ExeWriter_log.txt", message);
                //return Autodesk.Revit.UI.Result.Failed;
            }
            //End of SolidProcess
        }
예제 #4
0
 Stream(ConicalFace face)
 {
     StreamFaceGeoometry(face);
 }
예제 #5
0
        private void Stream(ArrayList data, ConicalFace face)
        {
            data.Add(new Snoop.Data.ClassSeparator(typeof(ConicalFace)));

            data.Add(new Snoop.Data.Xyz("Origin", face.Origin));
            data.Add(new Snoop.Data.Xyz("Axis", face.Axis));
            data.Add(new Snoop.Data.Angle("Half angle", face.HalfAngle));
        }
예제 #6
0
        private void DataProcess(Solid geomSolid, GeometryInstance instance)
        {
            try
            {
                uint ufaces    = 0;
                uint uVertices = 0;
                uint uPoints   = 0;
                uint iStartId  = (uint)d_VerticesList.Count;
                foreach (Face geomFace in geomSolid.Faces)
                {
                    iStartId = (uint)d_VerticesList.Count;
                    bool bNewFace = true;
                    ufaces++;
                    Mesh mesh = geomFace.Triangulate();
                    foreach (XYZ ii in mesh.Vertices)
                    {
                        uVertices++;

                        XYZ point = ii;
                        if (null != instance)
                        {
                            Transform instTransform    = instance.Transform;
                            XYZ       transformedPoint = instTransform.OfPoint(point);
                        }
                    }
                    uint iNextId = 0;
                    for (int i = 0; i < mesh.NumTriangles; i++)
                    {
                        MeshTriangle triangle = mesh.get_Triangle(i);
                        XYZ          vertex   = triangle.get_Vertex(0);
                        if (bNewFace)
                        {
                            iNextId  = iStartId / 3;
                            bNewFace = false;
                        }

                        u_IndicesList.Add(3);
                        AddVertex(iStartId, vertex, iNextId++);
                        vertex = triangle.get_Vertex(1);
                        AddVertex(iStartId, vertex, iNextId++);
                        vertex = triangle.get_Vertex(2);
                        AddVertex(iStartId, vertex, iNextId++);
                    }
                    XYZ        origin     = new XYZ(0, 0, 0);
                    XYZ        normal     = new XYZ(0, 0, 0);
                    XYZ        vector     = new XYZ(0, 0, 0);
                    PlanarFace planarFace = geomFace as PlanarFace;
                    if (null != planarFace)
                    {
                        origin = planarFace.Origin;
                        normal = planarFace.Normal;
                        vector = planarFace.get_Vector(0);
                    }
                    ConicalFace ConFace = geomFace as ConicalFace;
                    if (null != ConFace)
                    {
                        origin = ConFace.Origin;
                        normal = ConFace.Axis;
                        vector = ConFace.get_Radius(0);
                    }

                    HermiteFace HermiteFace = geomFace as HermiteFace;
                    if (null != HermiteFace)
                    {
                        origin = new XYZ(0, 0, 0); //HermiteFace.Points;
                        normal = new XYZ(0, 0, 0); //HermiteFace.TaAxis;
                        vector = new XYZ(0, 0, 0); //HermiteFace.get_Tangents(0);
                    }
                    RevolvedFace RevolFace = geomFace as RevolvedFace;
                    if (null != RevolFace)
                    {
                        origin = RevolFace.Origin;
                        normal = RevolFace.Axis;
                        vector = RevolFace.get_Radius(0);
                    }
                    RuledFace RulFace = geomFace as RuledFace;
                    if (null != RulFace)
                    {
                        origin = new XYZ(0, 0, 0);  // RulFace.get_Point;
                        normal = new XYZ(0, 0, 0);  ///RulFace.Axis;
                        vector = RulFace.get_Point(0);
                    }
                    CylindricalFace CylinFace = geomFace as CylindricalFace;
                    if (null != CylinFace)
                    {
                        origin = CylinFace.Origin;
                        normal = CylinFace.Axis;
                        vector = CylinFace.get_Radius(0);
                    }
                    uint featuresCount = 0;
                    for (int s = d_NormalsList.Count; s < d_VerticesList.Count; s += 3)
                    {
                        d_NormalsList.Add(normal.X);
                        d_NormalsList.Add(normal.Y);
                        d_NormalsList.Add(normal.Z);
                        d_TextureCoordsList.Add(normal.X);
                        d_TextureCoordsList.Add(normal.Y);
                        d_TextureCoordsList.Add(normal.Z);
                        featuresCount++;
                    }
                    u_FeaturesIndList.Add(featuresCount);
                }

                foreach (Edge edge in geomSolid.Edges)
                {
                    foreach (XYZ ii in edge.Tessellate())
                    {
                        uPoints++;
                        XYZ point = ii;
                        if (null != instance)
                        {
                            Transform instTransform    = instance.Transform;
                            XYZ       transformedPoint = instTransform.OfPoint(point);
                        }
                    }
                }//foreach (Face geomFace in geomSolid.Faces)
                 //string Osa = element.Name.ToString() + element.Id.ToString();
            }
            catch (Exception e)
            {
                string message;
                // Exception rised, report it by revit error reporting mechanism.
                message = e.ToString();
                File.AppendAllText(@"C:\CadFaster\Revit\ExeWriter_log.txt", message);
                //return Autodesk.Revit.UI.Result.Failed;
            }
            //End of DataProcess
        }
예제 #7
0
 public virtual void Stream(ConicalFace face)
 {
     StreamFaceGeoometry(face);
 }
예제 #8
0
 Stream(ConicalFace face)
 {
     StreamFaceGeoometry(face);
 }
예제 #9
0
 public Surface FaceToSpeckle(ConicalFace conicalFace, double tolerance)
 {
     throw new NotImplementedException();
 }
예제 #10
0
 public virtual void Stream(ConicalFace face)
 {
     StreamFaceGeometry(face);
 }