using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MapFIED
{
class Program
{
public List<int[]> Brange(int n,int m,int k,int N,int M,int K,String filename)
{
Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
xlApp.Visible = false;
TaskDialog.Show("revit", "0");
Workbooks wbs = xlApp.Workbooks;
_Workbook wb = wbs.Add(filename);//excel表格
_Worksheet wb1 = wb.Sheets[1];
TaskDialog.Show("revit", "000");
int row = wb1.Rows.Count; int col = wb1.Columns.Count;//cells
List < int[] > brange= null;
int[] range = new int[5];
for (int i = 0; i < row; i++)
{
if ((wb1.Cells[i,1]>=n-5&&wb1.Cells[i,1]<=n+5)&&(wb1.Cells[i, 2] >= m - 5 && wb1.Cells[i, 2] <= m + 5)&&(wb1.Cells[i, 3] >= k - 5 && wb1.Cells[i, 3] <= k + 5))
{
range[0] = n;range[1] = m;range[2] = k;
brange.Add(range);
}
}
return brange;
}
public int[] Dcal(double X1,double X2,double Y1,double Y2,double Z1,double Z2,double X,double Y,double Z,int N,int M,int K)//NMK代表3个方向的次数
{
int[] Deg = new int[3];
double xg = Math.Ceiling((X - X1)/N);
Deg[0] = (int)xg;
double yg = Math.Ceiling((Y - Y1) / M);
Deg[1] = (int)yg;
double zg = Math.Ceiling((Z-Z1)/Z);
Deg[2] = (int)zg;
return Deg;
}
public void changeXYZ(double x,double y,double z, String filename)//Sheet是表示不可以用的表格,两个XYZ是起点和重点
{
Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
xlApp.Visible = false;
TaskDialog.Show("revit", "0");
Workbooks wbs = xlApp.Workbooks;
_Workbook wb = wbs.Add(filename);//excel表格
_Worksheet wb1 = wb.Sheets[1];
TaskDialog.Show("revit","000");
int row = wb1.Rows.Count; int col = wb1.Columns.Count;//cells
int n = 1;int m = 1;int k = 1;//这是格子的坐标
int N = 10;int M = 10;int K = 10;//这是所有的格子的最大坐标
List<int[]> range = Brange(n,m,k,150,150,150,filename);//nmk代表三个数xyz
//for循环
for (int h = 0; h < 5; h++)
{
for (int j = 0; j < 5; j++)
{
for (int i = 0; i < 5; i++)
{
int ni1 = n + i;int ni2 = n - i;
int mi1 = m + j;int mi2 = m - j;
int ki1 = k + h;int ki2 = k - h;
int[] v0 = new int[3];int[] v1 = new int[3];int[] v2 = new int[3]; int[] v3 = new int[3]; int[] v4 = new int[3]; int[] v5 = new int[3];int[] v6 = new int[3]; int[] v7 = new int[3]; int[] v8 = new int[3];
v0[0] = ni1;v0[1] = mi1;v0[2] = ki1;
v1[0] = ni1;v1[1] = mi1;v1[2] = ki2;
v2[0] = ni1;v2[1] = mi2;v2[2] = ki1;
v3[0] = ni1;v3[1] = mi2;v3[2] = ki2;
v4[0] = ni2; v4[1] = mi1; v4[2] = ki1;
v5[0] = ni2; v5[1] = mi1; v5[2] = ki2;
v6[0] = ni2; v6[1] = mi2; v6[2] = ki1;
v7[0] = ni2; v7[1] = mi2; v7[2] = ki2;
int r0 = 0;int r1 = 0;int r2 = 0;int r3 = 0;int r4 = 0;int r5 = 0;int r6 = 0;int r7 = 0;
foreach (var r in range)
{
if (r.Equals(v0))
{
r0 = 1;
}
}
if (r0 == 0)
{
int[] Point = v0; break;
}
foreach (var r in range)
{
if (r.Equals(v1))
{
r1 = 1; break;
}
}
if (r1 == 0)
{
int[] Point = v1; break;
}
foreach (var r in range)
{
if (r.Equals(v2))
{
r2 = 1; break;
}
}
if (r2 == 0)
{
int[] Point = v2; break;
}
foreach (var r in range)
{
if (r.Equals(v3))
{
r3 = 1; break;
}
}
if (r3 == 0)
{
int[] Point = v3; break;
}
foreach (var r in range)
{
if (r.Equals(v4))
{
r4 = 1; break;
}
}
if (r4 == 0)
{
int[] Point = v4; break;
}
foreach (var r in range)
{
if (r.Equals(v5))
{
r5 = 1; break;
}
}
if (r5 == 0)
{
int[] Point = v5; break;
}
foreach (var r in range)
{
if (r.Equals(v6))
{
r6 = 1; break;
}
}
if (r6 == 0)
{
int[] Point = v6; break;
}
foreach (var r in range)
{
if (r.Equals(v7))
{
r7 = 1;break;
}
}
if (r7 == 0)
{
int[] Point = v7; break;
}
}
}
}
}
static void Main(string[] args)
{
Console.WriteLine(0);
}
}
}