protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         txt_BaySpacing.Attributes.Add("readonly", "readonly");
         if (Request.Cookies.Get("Project") != null)
         {
             string absolutePath = Request.Cookies.Get("Project").Value;
             using (XmlReader xmlReader = XmlReader.Create(absolutePath))
             {
                 DataContractSerializer deserializer = new DataContractSerializer(typeof(HndzProject));
                 project = deserializer.ReadObject(xmlReader) as HndzProject;
             }
             AdjustDefaultValuesAndUnits();
         }
     }
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            HndzProject  project  = new HndzProject();
            HndzBuilding building = new HndzBuilding(project);
            HndzStorey   storey   = new HndzStorey(building);

            HndzFrameSingleBay3D frame3D = new HndzFrameSingleBay3D(/*length*/ 24000, /*baySpacing*/ 6000, /*Width*/ 20000,
                                                                    5000, 2000, HndzLocationEnum.Cairo, HndzRoofSlopeEnum.From1To5, HndzRoofAccessibilityEnum.Inaccessible,
                                                                    HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II, null, null, null, null, null, storey);
            bool isGenerated = ConvertToIFC.GenerateIFCProject(project, "E:\\test13June");

            if (isGenerated)
            {
                Console.WriteLine("      Succeed       ");
            }
            else
            {
                Console.WriteLine("      Failed        ");
            }
            Console.ReadKey();
        }
Ejemplo n.º 3
0
        static private XbimModel CreateandInitModel(HndzProject hndzProject)
        {
            //IfcRelAggregates
            //Crashes here.....Fixed in this update :D

            XbimModel model = XbimModel.CreateModel(hndzProject.Name + "No." + hndzProject.GlobalId + ".xBIM", Xbim.XbimExtensions.XbimDBAccess.ReadWrite); //create an empty model

            if (model != null)
            {
                //Begin a transaction as all changes to a model are transacted
                using (XbimReadWriteTransaction txn = model.BeginTransaction("Initialize Model"))
                {
                    //do once only initialization of model application and editor values
                    model.DefaultOwningUser.ThePerson.GivenName              = hndzProject.Owner.Name;
                    model.DefaultOwningUser.ThePerson.FamilyName             = hndzProject.Owner.LastName;
                    model.DefaultOwningUser.TheOrganization.Name             = hndzProject.Owner.Organization;
                    model.DefaultOwningApplication.ApplicationIdentifier     = IFCFileResources.ApplicationIdentifier;
                    model.DefaultOwningApplication.ApplicationDeveloper.Name = IFCFileResources.ApplicationDevelopers;
                    model.DefaultOwningApplication.ApplicationFullName       = IFCFileResources.ApplicationFullName;
                    model.DefaultOwningApplication.Version = IFCFileResources.CurrentApplicationVersion;

                    //set up a project and initialize the defaults

                    var project = model.Instances.New <IfcProject>();
                    project.Initialize(ProjectUnits.SIUnitsUK);
                    project.Name = hndzProject.Name;
                    project.OwnerHistory.OwningUser        = model.DefaultOwningUser;
                    project.OwnerHistory.OwningApplication = model.DefaultOwningApplication;

                    //validate and commit changes
                    if (model.Validate(txn.Modified(), Console.Out) == 0)
                    {
                        txn.Commit();
                        return(model);
                    }
                }
            }
            return(null); //failed so return nothing
        }
Ejemplo n.º 4
0
        protected void btn_Finish_Click(object sender, EventArgs e)
        {
            //ToDo Validate all then create new object of HndzProject to be assigned to frame3D

            HndzProject project = new HndzProject();

            project.LengthUnit             = (LengthUnit)ddl_LengthUnit.SelectedIndex;
            project.ForceUnit              = (ForceUnit)ddl_ForceUnit.SelectedIndex;
            project.TemperatureUnit        = (TemperatureUnit)ddl_TempUnit.SelectedIndex;
            project.GlobalCoordinateSystem = (HndzWCS)ddl_CoordinatesSystem.SelectedIndex;
            project.Owner      = new Person();
            project.Designer   = new Person();
            project.Consultant = new Person();
            project.Contractor = new Person();

            if (!string.IsNullOrWhiteSpace(txt_ProjectName.Text))
            {
                project.Name = txt_ProjectName.Text;
            }
            if (!string.IsNullOrWhiteSpace(txt_Description.Text))
            {
                project.Description = txt_Description.Text;
            }
            if (!string.IsNullOrWhiteSpace(txt_Owner_FName.Text))
            {
                project.Owner.SetName(txt_Owner_FName.Text);
            }
            if (!string.IsNullOrWhiteSpace(txt_Owner_LName.Text))
            {
                project.Owner.SetLastName(txt_Owner_LName.Text);
            }
            if (!string.IsNullOrWhiteSpace(txt_Designer_FName.Text))
            {
                project.Owner.SetName(txt_Designer_FName.Text);
            }
            if (!string.IsNullOrWhiteSpace(txt_Consultant_FName.Text))
            {
                project.Owner.SetName(txt_Consultant_FName.Text);
            }
            if (!string.IsNullOrWhiteSpace(txt_Contractor_FName.Text))
            {
                project.Owner.SetName(txt_Contractor_FName.Text);
            }
            if (!string.IsNullOrWhiteSpace(txt_Designer_LName.Text))
            {
                project.Owner.SetLastName(txt_Designer_LName.Text);
            }
            if (!string.IsNullOrWhiteSpace(txt_Consultant_LName.Text))
            {
                project.Owner.SetLastName(txt_Consultant_LName.Text);
            }
            if (!string.IsNullOrWhiteSpace(txt_Contractor_LName.Text))
            {
                project.Owner.SetLastName(txt_Contractor_LName.Text);
            }
            if (!string.IsNullOrWhiteSpace(txt_Designer_OrganizationName.Text))
            {
                project.Owner.SetLastName(txt_Designer_OrganizationName.Text);
            }
            if (!string.IsNullOrWhiteSpace(txt_Consultant_OrganizationName.Text))
            {
                project.Owner.SetLastName(txt_Consultant_OrganizationName.Text);
            }
            if (!string.IsNullOrWhiteSpace(txt_Contractor_OrganizationName.Text))
            {
                project.Owner.SetLastName(txt_Contractor_OrganizationName.Text);
            }


            //ToDo: complete assigning all values....................


            DataContractSerializer xmlser = new DataContractSerializer(project.GetType());
            string relativePath           = Resources.WebResources.XMLPath + "Project.xml";
            string absolutePath           = Server.MapPath(relativePath);

            using (XmlWriter xw = XmlWriter.Create(absolutePath))
            {
                xmlser.WriteObject(xw, project);
            }
            HttpCookie cookName = new HttpCookie("Project");

            cookName.Value = absolutePath;
            Response.Cookies.Add(cookName);

            Response.Redirect("/Pages/Designer/FrameTemplate.aspx");
        }
Ejemplo n.º 5
0
        public static string GenerateIFC(HndzFrameSingleBay3D frame3D)
        {
            // create project
            HndzProject project = new HndzProject();

            project.Name                   = "Handaz Building";
            project.Description            = "Handaz Building Description";
            project.GlobalCoordinateSystem = HndzWCS.Egypt_Red_Belt;
            project.Owner                  = new Person("HANDAZ", "HANDAZ", "HANDAZ", "HANDAZ", "HANDAZ", "HANDAZ", "HANDAZ");

            //test stories
            HndzBuilding bui    = new HndzBuilding(project);
            HndzStorey   storey = new HndzStorey(bui, 0);


            if (frame3D == null)
            {
                frame3D = new HndzFrameSingleBay3D(24000, 6000, 20000, 6000, 2000, HndzLocationEnum.Cairo,
                                                   HndzRoofSlopeEnum.From1To10, HndzRoofAccessibilityEnum.Inaccessible, HndzBuildingEnclosingEnum.PartiallyEnclosed, HndzImportanceFactorEnum.II);
            }
            if (frame3D.BuildingStorey == null)
            {
                frame3D.BuildingStorey = storey;
            }
            XbimModel   model    = CreateandInitModel(frame3D.BuildingStorey.Building.Project);
            IfcBuilding building = CreateBuilding(model, frame3D.BuildingStorey.Building);

            List <IfcProduct> tt = new List <IfcProduct>();

            foreach (HndzFrameSingleBay2D frame2D in frame3D.Frames2D)
            {
                tt.Add(CreateColumn(model, frame2D.RightColumn));
                tt.Add(CreateColumn(model, frame2D.LeftColumn));
                tt.Add(CreateBeam(model, frame2D.RightBeam));
                tt.Add(CreateBeam(model, frame2D.LeftBeam));
            }
            foreach (HndzPurlin purlin in frame3D.Purlins)
            {
                tt.Add(CreateBeam(model, purlin));
            }

            List <List <IfcProduct> > temp = new List <List <IfcProduct> >();

            temp.Add(tt);

            CreateStorey(model, building, 4000, temp);
            string fileName = "Project" + frame3D.BuildingStorey.Building.Project.GlobalId;

            string filePath = IFCFileResources.wexbimPath + fileName;

            try
            {
                model.SaveAs(filePath, XbimStorageType.IFC);
                //model.SaveAs(filePath, XbimStorageType.XBIM);
                CreateWexBimFromIfc(model, filePath);
            }
            catch (Exception ex)
            {
            }
            return(fileName);
        }