Exemple #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);
                }
            }
        }
Exemple #2
0
        public void Main_Create(Document revitDoc, UIDocument uidoc)
        {
            /// 建立CAD處理物件
            GetCADImformation GetCADImformation = new GetCADImformation(true, true, true);

            GetCADImformation.CADProcessing(uidoc);

            Dictionary <string, List <LINE> > CADGeometry = GetCADImformation.LayersAndGeometries;

            if (CADGeometry == null)
            {
                return;
            }


            /// 取得Revit指定的FamilyTypes
            Dictionary <string, List <Dictionary <string, List <FamilySymbol> > > > LightFamilyTypes = CatchLightFamilyType(RevFind.GetDocLightTypes(revitDoc));
            /// 取得Revit所有樓層資訊
            List <Level> levels = RevFind.GetLevels(revitDoc);
            /// 建立Form物件
            Form_CreateLight Form = new Form_CreateLight(LightFamilyTypes, levels, CADGeometry);

            Form.ShowDialog();

            /// 確認是要用圓形或者是多邊形心中來建立物件
            string RadioCase = Form.radCircle.Checked == true ? "Circle" : (Form.radPloyline.Checked == true ? "Ployline" : "Square");

            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);

                /// 激活FamilyType
                StartFamilyType(Form.returnType[0], revitDoc);

                /// 開始建立物件
                CreateLight(Form.returnType[0], Form.returnBaseLevel[0], revitDoc, centerPoint, SHIFT);
            }

            Form.Dispose();
        }