Beispiel #1
0
        public void Main_Create(Document revitDoc, UIDocument uidoc)
        {
            CreateObjects RevCreate = new CreateObjects(revitDoc);
            //Dictionary<string, List<LINE>> res_ = GeneralCAD(uidoc);
            //Dictionary<string, List<LINE>> res = GetPolylineAndLineClosedRegion(res_);



            Dictionary <string, List <LINE> > CADGeometry = null;

            CADGeometry = GeneralCAD(uidoc);


            Dictionary <string, List <FamilySymbol> > LightFamilyTypes = CatchLightFamilyType(RevFind.GetDocLightTypes(revitDoc));
            List <Level>     levels = RevFind.GetLevels(revitDoc);
            Form_CreateLight Form   = new Form_CreateLight(LightFamilyTypes, levels, CADGeometry);

            Form.ShowDialog();

            string RadioCase = Form.radCircle.Checked == true ? "Circle" : "Ployline";

            if (Form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                double      SHIFT       = Convert.ToDouble(Form.txtShift.Text) / 304.8;
                List <LINE> LINES_      = CADGeometry[Form.cmbColCADLayers.Text];
                List <LINE> LINES       = GetPolylineAndLineClosedRegion(LINES_, RadioCase);
                List <XYZ>  centerPoint = TakeOffSameLightPoint(LINES);

                foreach (XYZ pp in centerPoint)
                {
                    XYZ newPP = new XYZ(pp.X, pp.Y, SHIFT);
                    RevCreate.CreateLight(Form.returnType[0], Form.returnBaseLevel[0], newPP);
                }
            }
        }
        public void Main_Create(Document revitDoc, UIDocument uidoc)
        {
            CreateObjects RevCreate = new CreateObjects(revitDoc);
            Dictionary <string, List <LINE> > res = GeneralCAD(uidoc);

            Dictionary <string, List <LINE> > CADGeometry = null;

            CADGeometry = GeneralCAD(uidoc);
            if (CADGeometry == null)
            {
                return;
            }

            Dictionary <string, List <FamilySymbol> > colFamilyTypes  = RevFind.GetDocColumnsTypes(revitDoc);
            Dictionary <string, List <FamilySymbol> > beamFamilyTypes = RevFind.GetDocBeamTypes(revitDoc);
            List <Level> levels = RevFind.GetLevels(revitDoc);
            Form1        Form   = new Form1(colFamilyTypes, beamFamilyTypes, levels, CADGeometry);

            Form.ShowDialog();
            if (Form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                if (Form.chCol.Checked)
                {
                    int         CaseIndex = 0;
                    List <LINE> LINES     = CADGeometry[Form.cmbColCADLayers.Text];
                    PreProcessing.ClassifyLines(LINES, out List <List <LINE> > Collect,
                                                out List <LINE> H_Direction_Lines,
                                                out List <LINE> V_Direction_Lines,
                                                out List <LINE> Else_Direction_Lines);
                    List <LINE> RES_COLUMN = PreProcessing.GetColumnDrawCenterPoints(Collect);
                    foreach (LINE pp in RES_COLUMN)
                    {
                        RevCreate.CreateColumn(Form.returnType[CaseIndex], Form.returnBaseLevel[CaseIndex], Form.returnTopLevel[CaseIndex], pp);
                    }
                }

                if (Form.chBeam.Checked)
                {
                    int         CaseIndex = 1;
                    List <LINE> LINES     = CADGeometry[Form.cmbBeamCADLayers.Text];
                    PreProcessing.ClassifyLines(LINES, out List <List <LINE> > Collect,
                                                out List <LINE> H_Direction_Lines,
                                                out List <LINE> V_Direction_Lines,
                                                out List <LINE> Else_Direction_Lines);
                    List <LINE> RES_BEAM = PreProcessing.GetBeamDrawLines(Collect, H_Direction_Lines, V_Direction_Lines);

                    foreach (LINE pp in RES_BEAM)
                    {
                        RevCreate.CreateBeam(Form.returnType[CaseIndex], Form.returnBaseLevel[CaseIndex], pp);
                    }
                }
            }
        }
        public void Create_Version_2(Document revitDoc, UIDocument uidoc)
        {
            CreateObjects RevCreate = new CreateObjects(revitDoc);
            Dictionary <string, List <LINE> > res = GeneralCAD(uidoc);

            Dictionary <string, List <LINE> > BeforeSortedCADGeometry = null;

            /// 讀取CAD所有圖層幾何資訊
            BeforeSortedCADGeometry = GeneralCAD(uidoc);
            /// 若沒選擇CAD 則回傳
            if (BeforeSortedCADGeometry == null)
            {
                return;
            }



            Dictionary <string, List <LINE> > CADGeometry = new Dictionary <string, List <LINE> >();
            var Layers = BeforeSortedCADGeometry.OrderBy(t => t.Key).ToList();

            foreach (var item in Layers)
            {
                CADGeometry[item.Key] = BeforeSortedCADGeometry[item.Key];
            }

            Dictionary <string, List <FamilySymbol> > colFamilyTypes  = RevFind.GetDocColumnsTypes(revitDoc);
            Dictionary <string, List <FamilySymbol> > beamFamilyTypes = RevFind.GetDocBeamTypes(revitDoc);
            List <Level> levels = RevFind.GetLevels(revitDoc);
            Form1        Form   = new Form1(colFamilyTypes, beamFamilyTypes, levels, CADGeometry);

            Form.ShowDialog();
            if (Form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                if (Form.chCol.Checked)
                {
                    int         CaseIndex = 0;
                    List <LINE> LINES     = CADGeometry[Form.cmbColCADLayers.Text];
                    PreProcessing.ClassifyLines(LINES, out List <List <LINE> > Collect,
                                                out List <LINE> H_Direction_Lines,
                                                out List <LINE> V_Direction_Lines,
                                                out List <LINE> Else_Direction_Lines);
                    List <LINE> RES_COLUMN = PreProcessing.GetColumnDrawCenterPoints(Collect);
                    foreach (LINE pp in RES_COLUMN)
                    {
                        RevCreate.CreateColumn(Form.returnType[CaseIndex], Form.returnBaseLevel[CaseIndex], Form.returnTopLevel[CaseIndex], pp);
                    }
                }

                if (Form.chBeam.Checked)
                {
                    List <LINE> LINES = CADGeometry[Form.cmbBeamCADLayers.Text];
                    List <BEAM> Beams = BeamCenterLineProcessing(LINES);

                    int CaseIndex = 1;
                    StartFamilyType(Form.returnType[CaseIndex], revitDoc);
                    CreateBeam(Form.returnType[CaseIndex], Form.returnBaseLevel[CaseIndex], Beams, revitDoc);
                    //foreach (BEAM pp in Beams)
                    //{
                    //    RevCreate.CreateBeam(Form.returnType[CaseIndex], Form.returnBaseLevel[CaseIndex], pp.GetEdgeLine(3));
                    //}
                }
            }
        }