Exemple #1
0
        //bool HSFaddComponent(cl_DataStore SaveData, String str_FileName)
        public void Test_HSFaddComponent()
        {
            bool bRetValue;

            Outwriter target       = new Outwriter();
            String    str_FileName = String.Empty;

            bRetValue = target.HSFaddComponent(null, str_FileName);
            Assert.IsFalse(bRetValue);
            cl_DataStore TargetData = new cl_DataStore();

            bRetValue = target.Init("Test_HSFaddComponent");
            Assert.IsTrue(bRetValue);
            bRetValue = target.HSFaddComponent(TargetData, str_FileName);
            Assert.IsTrue(bRetValue);
            TargetData.PartName = "PartName";
            double[] dData = { 0.2 };
            TargetData.transformation    = dData;
            TargetData.componentMaterial = dData;
            TargetData.featureMaterials  = dData;
            TargetData.textureMatrix     = dData;

            str_FileName = "Test_HSFaddComponent";
            bRetValue    = target.HSFaddComponent(TargetData, str_FileName);
            Assert.IsTrue(bRetValue);
        }
Exemple #2
0
        //bool WriteData(string str_FileName)
        public void Test_WriteData()
        {
            bool bRetValue;

            Outwriter target      = new Outwriter();
            String    strPartName = String.Empty;
            uint      uFace       = 0;

            float[] Vert    = { 0.1f };
            float[] Nor     = { 0.1f };
            float[] TC      = { 0.2f };
            uint[]  Ind     = { 3 };
            uint[]  FeaC    = { 4 };
            String  ComName = "Test_addComponent 1";

            double[]     trans    = { 0.1 };
            double[]     ComMat   = { 0.2 };
            double[]     FeaMat   = { 0.3 };
            double[]     TexMat   = { 0.4 };
            cl_DataStore SaveData = new cl_DataStore();

            bRetValue = target.Init("Test_WriteData");
            bRetValue = target.addpart(strPartName, uFace);
            bRetValue = target.addFaceRegion(strPartName, Vert, Nor, TC, Ind, FeaC);
            bRetValue = target.addComponent(strPartName, ComName, trans, ComMat, FeaMat, TexMat);
            Assert.IsTrue(bRetValue);
            bRetValue = target.WriteData(strPartName);
            Assert.IsTrue(bRetValue);
        }
Exemple #3
0
        public void addComponent(String PartName, String ComName, double[] trans, double[] ComMat, double[] FeaMat, double[] TexMat)
        {
            bool bkatki = false;
            int  i      = 0;

            while (i < ArLi_RevitData.Count && false == bkatki)
            {
                cl_DataStore temp = ArLi_RevitData[i] as cl_DataStore;
                if (temp.PartName == PartName)
                {
                    bkatki = true;
                }
                else
                {
                    i++;
                }
            }
            if (bkatki == true)
            {
                cl_DataStore temp = ArLi_RevitData[i] as cl_DataStore;
                temp.componentId            = ComName;
                temp.transformation         = trans;
                temp.componentMaterial      = ComMat;
                temp.featureMaterials       = FeaMat;
                temp.u_featureMaterialCount = (uint)FeaMat.Length;
                temp.imageId       = "";
                temp.textureMatrix = TexMat;
                temp.UdoubleSided  = 0;
            }
        }
Exemple #4
0
        //bool HSFaddFaceRegion(cl_DataStore SaveData, String str_FileName)
        public void Test_HSFaddFaceRegion()
        {
            bool bRetValue;

            Outwriter target       = new Outwriter();
            String    str_FileName = String.Empty;

            bRetValue = target.HSFaddFaceRegion(null, str_FileName);
            Assert.IsFalse(bRetValue);
            cl_DataStore TargetData = new cl_DataStore();

            bRetValue = target.Init("Test_HSFaddFaceRegion");
            Assert.IsTrue(bRetValue);
            bRetValue = target.HSFaddFaceRegion(TargetData, str_FileName);
            Assert.IsTrue(bRetValue);
            TargetData.PartName = "PartName";
            float[] fData = { 0.1f };
            TargetData.Vertices      = fData;
            TargetData.Normals       = fData;
            TargetData.TextureCoords = fData;
            uint[] uData = { 1 };
            TargetData.Indices  = uData;
            TargetData.Features = uData;
            str_FileName        = "Test_HSFaddFaceRegion";
            bRetValue           = target.HSFaddFaceRegion(TargetData, str_FileName);
            Assert.IsTrue(bRetValue);
        }
Exemple #5
0
        public void addFaceRegion(String PartName, float[] Vert, float[] Nor, float[] TC, uint[] Ind, uint[] FeaC)
        {
            bool bkatki = false;
            int  i      = 0;

            while (i < ArLi_RevitData.Count && false == bkatki)
            {
                cl_DataStore temp = ArLi_RevitData[i] as cl_DataStore;
                if (temp.PartName == PartName)
                {
                    bkatki = true;
                }
                else
                {
                    i++;
                }
            }
            if (bkatki == true)
            {
                cl_DataStore temp = ArLi_RevitData[i] as cl_DataStore;
                temp.Vertices      = Vert;
                temp.Normals       = Nor;
                temp.TextureCoords = TC;
                temp.Indices       = Ind;
                temp.Features      = FeaC;
                temp.UVertexCount  = (uint)Vert.Length / 3;
                temp.UIndexCount   = (uint)Ind.Length;
                temp.UFeatureCount = (uint)FeaC.Length;
            }
        }
Exemple #6
0
        public void addpart(String PartName, UInt32 U_FaceCount)
        {
            //writer.addPart(PartName, U_FaceCount);
            bool bkatki = false;
            int  i      = 0;

            while (i < ArLi_RevitData.Count && false == bkatki)
            {
                cl_DataStore temp = ArLi_RevitData[i] as cl_DataStore;
                if (temp.PartName == PartName)
                {
                    bkatki = true;
                }
                else
                {
                    i++;
                }
            }
            if (bkatki == false)
            {
                cl_DataStore OsaVarasto = new cl_DataStore();
                OsaVarasto.PartName       = PartName;
                OsaVarasto.uPartFaceCount = U_FaceCount;
                ArLi_RevitData.Add(OsaVarasto);
            }
        }
Exemple #7
0
        //bool addpart(String PartName, UInt32 U_FaceCount)
        public void Test_addpart()
        {
            bool   bRetValue;
            string strPartName = String.Empty;
            uint   uFace       = 0;

            Outwriter    target     = new Outwriter();
            cl_DataStore TargetData = new cl_DataStore();

            bRetValue = target.Init("Test_addpart");
            Assert.IsTrue(bRetValue);
            strPartName = "Test_addpart";
            bRetValue   = target.addpart(strPartName, uFace);
            Assert.IsTrue(bRetValue);
        }
Exemple #8
0
        //bool HSFaddpart(cl_DataStore SaveData)
        public void Test_HSFaddpart()
        {
            bool bRetValue;

            Outwriter target = new Outwriter();

            bRetValue = target.HSFaddpart(null);
            Assert.IsFalse(bRetValue);
            cl_DataStore TargetData = new cl_DataStore();

            bRetValue = target.Init("Test_HSFaddpart");
            Assert.IsTrue(bRetValue);
            bRetValue = target.HSFaddpart(TargetData);
            Assert.IsTrue(bRetValue);
            TargetData.PartName = "PartName";
            bRetValue           = target.HSFaddpart(TargetData);
            Assert.IsTrue(bRetValue);
            TargetData.uPartFaceCount = 1;
            bRetValue = target.HSFaddpart(TargetData);
            Assert.IsTrue(bRetValue);
        }
Exemple #9
0
        public void HSFaddComponent(cl_DataStore SaveData, String str_FileName)
        {
            string message;

            try
            {
                if (koponettimaara == 82)
                {
                    koponettimaara = 82;
                }
                // Create a component (geometry instance) for SamplePart
                //System.Threading.Thread.Sleep(200);
                writer.addComponent(SaveData.PartName, SaveData.componentId,
                                    SaveData.transformation, SaveData.componentMaterial,
                                    SaveData.featureMaterials, SaveData.u_featureMaterialCount, "", SaveData.textureMatrix, 0);
                writer.addComponent("CloseSubAssembly", SaveData.componentId, null, null, null, 0, null, null, 0);
                //message = "       AddComponent  :" + SaveData.PartName +
                //    " trans: " + SaveData.transformation.Length.ToString() +
                //    " ComMat: " + SaveData.componentMaterial.Length.ToString() +
                //    " FeaMat: " + SaveData.featureMaterials.Length.ToString() +
                //    " TexMat: " + SaveData.textureMatrix.Length.ToString() +
                //    " nro: " + koponettimaara + Environment.NewLine;
                //File.AppendAllText(@"C:\CadFaster\Revit\" + str_FileName + ".txt", message);
            }
            catch (Exception e)
            {
                //string message;
                // Exception rised, report it by revit error reporting mechanism.
                message = "ERROR: AddComponent  :" + SaveData.PartName +
                          " trans: " + SaveData.transformation.Length.ToString() +
                          " ComMat: " + SaveData.componentMaterial.Length.ToString() +
                          " FeaMat: " + SaveData.featureMaterials.Length.ToString() +
                          " TexMat: " + SaveData.textureMatrix.Length.ToString() +
                          " nro: " + koponettimaara + Environment.NewLine;
                File.AppendAllText(@"C:\CadFaster\Revit\" + str_FileName + ".txt", message);
                message = e.ToString();
                //File.AppendAllText(@"C:\CadFaster\Revit\ExeWriter_log.txt", message);
                //return Autodesk.Revit.UI.Result.Failed;
            }
        }
Exemple #10
0
        //bool addFaceRegion(String PartName, float[] Vert, float[] Nor, float[] TC, uint[] Ind, uint[] FeaC)
        public void Test_addFaceRegion()
        {
            bool   bRetValue;
            string strPartName = "Test_addFaceRegion";

            float[]      Vert       = { 0.1f };
            float[]      Nor        = { 0.1f };
            float[]      TC         = { 0.2f };
            uint[]       Ind        = { 3 };
            uint[]       FeaC       = { 4 };
            Outwriter    target     = new Outwriter();
            cl_DataStore TargetData = new cl_DataStore();

            bRetValue = target.Init("Test_addFaceRegion");
            uint uFace = 0;

            bRetValue = target.addpart(strPartName, uFace);
            Assert.IsTrue(bRetValue);

            bRetValue = target.addFaceRegion(strPartName, Vert, Nor, TC, Ind, FeaC);
            Assert.IsTrue(bRetValue);
        }
Exemple #11
0
        //bool addComponent(String PartName, String ComName, double[] trans, double[] ComMat, double[] FeaMat, double[] TexMat)
        public void Test_addComponent()
        {
            bool   bRetValue;
            string strPartName = "Test_addComponent";;
            String ComName     = "Test_addComponent 1";

            double[] trans  = { 0.1 };
            double[] ComMat = { 0.2 };
            double[] FeaMat = { 0.3 };
            double[] TexMat = { 0.4 };


            Outwriter    target     = new Outwriter();
            cl_DataStore TargetData = new cl_DataStore();

            bRetValue = target.Init("Test_addComponent");
            uint uFace = 0;

            bRetValue = target.addpart(strPartName, uFace);
            Assert.IsTrue(bRetValue);
            bRetValue = target.addComponent(strPartName, ComName, trans, ComMat, FeaMat, TexMat);
            Assert.IsTrue(bRetValue);
        }
Exemple #12
0
        public void HSFaddFaceRegion(cl_DataStore SaveData, String str_FileName)
        {
            string message;

            try
            {
                koponettimaara++;
                if (koponettimaara == 82)
                {
                    koponettimaara = 82;
                }
                writer.addFaceRegion(SaveData.PartName, SaveData.Vertices, SaveData.Normals, SaveData.TextureCoords,
                                     SaveData.Indices, SaveData.UVertexCount, SaveData.UIndexCount, SaveData.Features, SaveData.UFeatureCount);
                //message = "       AddFaceRegion :" + SaveData.PartName +
                //    " VER: " + SaveData.Vertices.Length.ToString() +
                //    " Nor: " + SaveData.Normals.Length.ToString() +
                //    "  TC: " + SaveData.TextureCoords.Length.ToString() +
                //    " Ind: " + SaveData.Indices.Length.ToString() +
                //    " FeaC: " + SaveData.Features.Length.ToString() +
                //    " nro: " + koponettimaara + Environment.NewLine;
                //File.AppendAllText(@"C:\CadFaster\Revit\" + str_FileName + ".txt", message);
            }
            catch (Exception e)
            {
                // Exception rised, report it by revit error reporting mechanism.
                message = "ERROR: AddFaceRegion " + SaveData.PartName +
                          " VER: " + SaveData.Vertices.Length.ToString() +
                          " Nor: " + SaveData.Normals.Length.ToString() +
                          "  TC: " + SaveData.TextureCoords.Length.ToString() +
                          " Ind: " + SaveData.Indices.Length.ToString() +
                          " FeaC: " + SaveData.Features.Length.ToString() +
                          " nro: " + koponettimaara + Environment.NewLine;
                File.AppendAllText(@"C:\CadFaster\Revit\" + str_FileName + ".txt", message);
                message = e.ToString();
            }
        }
Exemple #13
0
 public void HSFaddpart(cl_DataStore SaveData)
 {
     writer.addPart(SaveData.PartName, SaveData.uPartFaceCount);
 }