コード例 #1
0
        public bool UpdateBuildingAnnotationFamily()
        {
            var result = false;

            try
            {
                var scheduleManager    = new ScheduleDataManager(m_app, CalculationTypes.BuildingArea);
                var category           = scheduleManager.GetLPDCategoryBAM();
                var allowableLPD       = scheduleManager.GetAllowableLPDBAM();
                var targetLPD          = scheduleManager.GetTargetLPDBAM();
                var actualLightingLoad = scheduleManager.GetActualLightingLoad();
                var area      = scheduleManager.GetArea();
                var actualLPD = actualLightingLoad / area;
                var reduction = 1 - (actualLPD / allowableLPD);

                using (var trans = new Transaction(m_doc))
                {
                    try
                    {
                        trans.Start("Update Annotation");

                        var annotation = new AnnotationProperties(annotationType, CalculationTypes.BuildingArea)
                        {
                            ASHRAELPDCategory  = category,
                            ASHRAEAllowableLPD = allowableLPD,
                            TargetLPD          = targetLPD,
                            ActualLightingLoad = actualLightingLoad,
                            Area            = area,
                            ActualLPD       = actualLPD,
                            Reduction       = reduction,
                            LPDCalculatedBy = Environment.UserName
                        };

                        trans.Commit();
                    }
                    catch
                    {
                        trans.RollBack();
                    }
                }

                result = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to update annotation family.\n" + ex.Message, "Update Annotation Family", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            return(result);
        }
コード例 #2
0
        public bool UpdateSpaceAnnotationFamily()
        {
            var result = false;

            try
            {
                var scheduleManager       = new ScheduleDataManager(m_app, CalculationTypes.SpaceBySpace);
                var allowableLightingLoad = scheduleManager.GetAllowableLightingLoad();
                var actualLightingLoad    = scheduleManager.GetActualLightingLoad();
                var savings   = scheduleManager.GetSavings();
                var area      = scheduleManager.GetArea();
                var actualLPD = actualLightingLoad / area;
                var reduction = savings / allowableLightingLoad;

                using (var trans = new Transaction(m_doc))
                {
                    try
                    {
                        trans.Start("Update Annotation");

                        var annotation = new AnnotationProperties(annotationType, CalculationTypes.SpaceBySpace)
                        {
                            TotalAllowableLightingLoad = allowableLightingLoad,
                            TotalActualLightingLoad    = actualLightingLoad,
                            TotalSavingsOverage        = savings,
                            Area            = area,
                            ActualLPD       = actualLPD,
                            Reduction       = reduction,
                            LPDCalculatedBy = Environment.UserName
                        };

                        trans.Commit();
                    }
                    catch
                    {
                        trans.RollBack();
                    }
                }
                result = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to update annotation family.\n" + ex.Message, "Update Annotation Family", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            return(result);
        }