Exemple #1
0
        /// <summary>
        /// obtain all the properties of the curtain grid
        /// </summary>
        public void ReloadGridProperties()
        {
            if (null == m_activeGrid)
            {
                if (true == m_myDocument.WallCreated)
                {
                    m_activeGrid = m_myDocument.CurtainWall.CurtainGrid;
                }
                else
                {
                    return;
                }
            }

            // horizontal grid pattern
            Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());

            act.Start();
            switch (m_activeGrid.Grid2Justification)
            {
            case CurtainGridAlignType.Beginning:
                m_gridProperties.HorizontalJustification = CurtainGridAlign.Beginning;
                break;

            case CurtainGridAlignType.Center:
                m_gridProperties.HorizontalJustification = CurtainGridAlign.Center;
                break;

            case CurtainGridAlignType.End:
                m_gridProperties.HorizontalJustification = CurtainGridAlign.End;
                break;

            default:
                break;
            }
            m_gridProperties.HorizontalAngle       = m_activeGrid.Grid2Angle * 180.0 / Math.PI;
            m_gridProperties.HorizontalOffset      = m_activeGrid.Grid2Offset;
            m_gridProperties.HorizontalLinesNumber = m_activeGrid.NumULines;
            // vertical grid pattern
            switch (m_activeGrid.Grid1Justification)
            {
            case CurtainGridAlignType.Beginning:
                m_gridProperties.VerticalJustification = CurtainGridAlign.Beginning;
                break;

            case CurtainGridAlignType.Center:
                m_gridProperties.VerticalJustification = CurtainGridAlign.Center;
                break;

            case CurtainGridAlignType.End:
                m_gridProperties.VerticalJustification = CurtainGridAlign.End;
                break;

            default:
                break;
            }
            m_gridProperties.VerticalAngle       = m_activeGrid.Grid1Angle * 180.0 / Math.PI;
            m_gridProperties.VerticalOffset      = m_activeGrid.Grid1Offset;
            m_gridProperties.VerticalLinesNumber = m_activeGrid.NumVLines;
            // other data
            m_gridProperties.PanelNumber          = m_activeGrid.NumPanels;
            m_gridProperties.UnlockedPanelsNumber = m_activeGrid.GetUnlockedPanelIds().Count;
            m_gridProperties.CellNumber           = m_activeGrid.GetCurtainCells().Count;
            if (0 != m_activeGrid.GetMullionIds().Count)
            {
                m_gridProperties.MullionsNumber         = m_activeGrid.GetMullionIds().Count;
                m_gridProperties.UnlockedmullionsNumber = m_activeGrid.GetUnlockedMullionIds().Count;
            }
            act.Commit();
        }
        /// <summary>
        /// Returns all of the curtain panels for a CurtainGrid.
        /// </summary>
        /// <param name="curtainGrid">The CurtainGrid element.</param>
        /// <returns>The element ids of the active curtain panels.</returns>
        public static ICollection <ElementId> GetVisiblePanelsForGrid(CurtainGrid curtainGrid)
        {
            ICollection <ElementId> panelIdsIn = curtainGrid.GetPanelIds();

            return(panelIdsIn);
        }
Exemple #3
0
        CollectEvent(object sender, CollectorEventArgs e)
        {
            // cast the sender object to the SnoopCollector we are expecting
            Collector snoopCollector = sender as Collector;

            if (snoopCollector == null)
            {
                Debug.Assert(false); // why did someone else send us the message?
                return;
            }

            // see if it is a type we are responsible for
            Color color = e.ObjToSnoop as Color;

            if (color != null)
            {
                Stream(snoopCollector.Data(), color);
                return;
            }

            LayoutRule layoutRule = e.ObjToSnoop as LayoutRule;

            if (layoutRule != null)
            {
                Stream(snoopCollector.Data(), layoutRule);
                return;
            }

            FormatOptions formatOptions = e.ObjToSnoop as FormatOptions;

            if (formatOptions != null)
            {
                Stream(snoopCollector.Data(), formatOptions);
                return;
            }

            CurtainGrid curtainGrid = e.ObjToSnoop as CurtainGrid;

            if (curtainGrid != null)
            {
                Stream(snoopCollector.Data(), curtainGrid);
                return;
            }

            CurtainCell curtainCell = e.ObjToSnoop as CurtainCell;

            if (curtainCell != null)
            {
                Stream(snoopCollector.Data(), curtainCell);
                return;
            }

            RebarHostData rebarHostData = e.ObjToSnoop as RebarHostData;

            if (rebarHostData != null)
            {
                Stream(snoopCollector.Data(), rebarHostData);
                return;
            }

            Leader leader = e.ObjToSnoop as Leader;

            if (leader != null)
            {
                Stream(snoopCollector.Data(), leader);
                return;
            }

            VolumeCalculationSetting volCalc = e.ObjToSnoop as VolumeCalculationSetting;

            if (volCalc != null)
            {
                Stream(snoopCollector.Data(), volCalc);
                return;
            }

            VolumeCalculationOptions volCalcOpts = e.ObjToSnoop as VolumeCalculationOptions;

            if (volCalcOpts != null)
            {
                Stream(snoopCollector.Data(), volCalcOpts);
                return;
            }

            ViewSheetSetting viewSheetSetting = e.ObjToSnoop as ViewSheetSetting;

            if (viewSheetSetting != null)
            {
                Stream(snoopCollector.Data(), viewSheetSetting);
                return;
            }

            Autodesk.Revit.UI.Events.DialogBoxData dlgBoxData = e.ObjToSnoop as Autodesk.Revit.UI.Events.DialogBoxData;
            if (dlgBoxData != null)
            {
                Stream(snoopCollector.Data(), dlgBoxData);
                return;
            }

            Construction construct = e.ObjToSnoop as Construction;

            if (construct != null)
            {
                Stream(snoopCollector.Data(), construct);
                return;
            }

            FamilyElementVisibility famElemVisib = e.ObjToSnoop as FamilyElementVisibility;

            if (famElemVisib != null)
            {
                Stream(snoopCollector.Data(), famElemVisib);
                return;
            }

            FamilyManager famManager = e.ObjToSnoop as FamilyManager;

            if (famManager != null)
            {
                Stream(snoopCollector.Data(), famManager);
                return;
            }

            FamilyParameter famParam = e.ObjToSnoop as FamilyParameter;

            if (famParam != null)
            {
                Stream(snoopCollector.Data(), famParam);
                return;
            }

            FamilyType famType = e.ObjToSnoop as FamilyType;

            if (famType != null)
            {
                Stream(snoopCollector.Data(), famType);
                return;
            }

            MEPSpaceConstruction mepSpaceConstuct = e.ObjToSnoop as MEPSpaceConstruction;

            if (mepSpaceConstuct != null)
            {
                Stream(snoopCollector.Data(), mepSpaceConstuct);
                return;
            }

            BuildingSiteExportOptions bldSiteExpOptions = e.ObjToSnoop as BuildingSiteExportOptions;

            if (bldSiteExpOptions != null)
            {
                Stream(snoopCollector.Data(), bldSiteExpOptions);
                return;
            }

            DGNExportOptions dgnExpOptions = e.ObjToSnoop as DGNExportOptions;

            if (dgnExpOptions != null)
            {
                Stream(snoopCollector.Data(), dgnExpOptions);
                return;
            }

            DWFExportOptions dwfExpOptions = e.ObjToSnoop as DWFExportOptions;

            if (dwfExpOptions != null)
            {
                Stream(snoopCollector.Data(), dwfExpOptions);
                return;
            }

            DWGExportOptions dwgExpOptions = e.ObjToSnoop as DWGExportOptions;

            if (dwgExpOptions != null)
            {
                Stream(snoopCollector.Data(), dwgExpOptions);
                return;
            }

            DWGImportOptions dwgImpOptions = e.ObjToSnoop as DWGImportOptions;

            if (dwgImpOptions != null)
            {
                Stream(snoopCollector.Data(), dwgImpOptions);
                return;
            }

            FBXExportOptions fbxExpOptions = e.ObjToSnoop as FBXExportOptions;

            if (fbxExpOptions != null)
            {
                Stream(snoopCollector.Data(), fbxExpOptions);
                return;
            }

            TrussMemberInfo trussInfo = e.ObjToSnoop as TrussMemberInfo;

            if (trussInfo != null)
            {
                Stream(snoopCollector.Data(), trussInfo);
                return;
            }

            VertexIndexPair vertIndPair = e.ObjToSnoop as VertexIndexPair;

            if (vertIndPair != null)
            {
                Stream(snoopCollector.Data(), vertIndPair);
                return;
            }

            PointElementReference ptElemRef = e.ObjToSnoop as PointElementReference;

            if (ptElemRef != null)
            {
                Stream(snoopCollector.Data(), ptElemRef);
                return;
            }

            Autodesk.Revit.DB.Architecture.BoundarySegment boundSeg = e.ObjToSnoop as Autodesk.Revit.DB.Architecture.BoundarySegment;
            if (boundSeg != null)
            {
                Stream(snoopCollector.Data(), boundSeg);
                return;
            }

            PointLocationOnCurve ptLocOnCurve = e.ObjToSnoop as PointLocationOnCurve;

            if (ptLocOnCurve != null)
            {
                Stream(snoopCollector.Data(), ptLocOnCurve);
                return;
            }

            Entity entity = e.ObjToSnoop as Entity;

            if (entity != null)
            {
                Stream(snoopCollector.Data(), entity);
                return;
            }

            Field field = e.ObjToSnoop as Field;

            if (field != null)
            {
                Stream(snoopCollector.Data(), field);
                return;
            }

            ExtensibleStorageField storeagefield = e.ObjToSnoop as ExtensibleStorageField;

            if (storeagefield != null)
            {
                Stream(snoopCollector.Data(), storeagefield);
                return;
            }

            IList <Autodesk.Revit.DB.BoundarySegment> boundSegs = e.ObjToSnoop as
                                                                  IList <Autodesk.Revit.DB.BoundarySegment>;

            if (boundSegs != null)
            {
                Stream(snoopCollector.Data(), boundSegs);
                return;
            }

            if (e.ObjToSnoop is KeyValuePair <String, String> )
            {
                KeyValuePair <String, String> stringspair = (KeyValuePair <String, String>)e.ObjToSnoop;
                Stream(snoopCollector.Data(), stringspair);
                return;
            }

            Schema schema = e.ObjToSnoop as Schema;

            if (schema != null)
            {
                Stream(snoopCollector.Data(), schema);
                return;
            }

            ElementId elemId = e.ObjToSnoop as ElementId;

            if (elemId != null)
            {
                Stream(snoopCollector.Data(), elemId);
                return;
            }

            if (Utils.IsSupportedType(e.ObjToSnoop) && e.ObjToSnoop != null)
            {
                Utils.StreamWithReflection(snoopCollector.Data(), e.ObjToSnoop.GetType(), e.ObjToSnoop);
            }
        }
      Stream(ArrayList data, CurtainGrid grid)
      {
         data.Add(new Snoop.Data.ClassSeparator(typeof(CurtainGrid)));

         data.Add(new Snoop.Data.Enumerable("Curtain Cells", grid.GetCurtainCells()));
         data.Add(new Snoop.Data.Enumerable("Mullions", grid.GetMullionIds(), m_activeDoc));
         data.Add(new Snoop.Data.Enumerable("Unlocked mullions", grid.GetUnlockedMullionIds(), m_activeDoc));
         data.Add(new Snoop.Data.Angle("Grid 1 angle", grid.Grid1Angle));
         data.Add(new Snoop.Data.String("Grid 1 justification", grid.Grid1Justification.ToString()));
         data.Add(new Snoop.Data.Double("Grid 1 offset", grid.Grid1Offset));
         data.Add(new Snoop.Data.Angle("Grid 2 angle", grid.Grid2Angle));
         data.Add(new Snoop.Data.String("Grid 2 justification", grid.Grid2Justification.ToString()));
         data.Add(new Snoop.Data.Double("Grid 2 offset", grid.Grid2Offset));
         data.Add(new Snoop.Data.Int("Number of panels", grid.NumPanels));
         data.Add(new Snoop.Data.Enumerable("Panels", grid.GetPanelIds(), m_activeDoc));
         data.Add(new Snoop.Data.Enumerable("Unlocked panels", grid.GetUnlockedPanelIds(), m_activeDoc));
         data.Add(new Snoop.Data.Int("Number of U lines", grid.NumULines));
         data.Add(new Snoop.Data.Enumerable("U grid lines", grid.GetUGridLineIds(), m_activeDoc));
         data.Add(new Snoop.Data.Int("Number of V lines", grid.NumVLines));
         data.Add(new Snoop.Data.Enumerable("V grid lines", grid.GetVGridLineIds(), m_activeDoc));
      }
 /// <summary>
 /// Returns all of the curtain panels for a CurtainGrid.
 /// </summary>
 /// <param name="curtainGrid">The CurtainGrid element.</param>
 /// <returns>The element ids of the active curtain panels.</returns>
 public static ICollection <ElementId> GetVisiblePanelsForGrid(CurtainGrid curtainGrid)
 {
     return(curtainGrid.GetPanelIds());
 }
 private void WriteCurtainCells(CurtainGrid grid, GraphicsStream grStream)
 {
     foreach (CurtainCell cell in grid.GetCurtainCells()) {
         foreach (CurveArray crvArray in cell.CurveLoops) {
             foreach (Curve crv in crvArray) {
                 grStream.Stream(crv);
             }
         }
     }
 }
        /// <summary>
        /// Returns all of the active curtain panels for a CurtainGrid.
        /// </summary>
        /// <param name="curtainGrid">The CurtainGrid element.</param>
        /// <returns>The element ids of the active curtain panels.</returns>
        /// <remarks>CurtainGrid.GetPanelIds() returns the element ids of the curtain panels that are directly contained in the CurtainGrid.
        /// Some of these panels however, are placeholders for "host" panels.  From a user point of view, the host panels are the real panels,
        /// and should replace these internal panels for export purposes.</remarks>
        public static HashSet<ElementId> GetVisiblePanelsForGrid(CurtainGrid curtainGrid)
        {
            ICollection<ElementId> panelIdsIn = curtainGrid.GetPanelIds();
            if (panelIdsIn == null)
                return null;

            HashSet<ElementId> visiblePanelIds = new HashSet<ElementId>();
            foreach (ElementId panelId in panelIdsIn)
            {
                Element element = ExporterCacheManager.Document.GetElement(panelId);
                if (element == null)
                    continue;

                ElementId hostPanelId = ElementId.InvalidElementId;
                if (element is Panel)
                    hostPanelId = (element as Panel).FindHostPanel();

                if (hostPanelId != ElementId.InvalidElementId)
                    visiblePanelIds.Add(hostPanelId);
                else
                    visiblePanelIds.Add(panelId);
            }

            return visiblePanelIds;
        }
 /// <summary>
 /// Returns all of the curtain panels for a CurtainGrid.
 /// </summary>
 /// <param name="curtainGrid">The CurtainGrid element.</param>
 /// <returns>The element ids of the active curtain panels.</returns>
 public static ICollection<ElementId> GetVisiblePanelsForGrid(CurtainGrid curtainGrid)
 {
     return curtainGrid.GetPanelIds();
 }
Exemple #9
0
        /// <summary>
        /// obtain all the properties of the curtain grid
        /// </summary>
        public void ReloadGridProperties()
        {
            if (null == m_activeGrid)
             {
            if (true == m_myDocument.WallCreated)
            {
               m_activeGrid = m_myDocument.CurtainWall.CurtainGrid;
            }
            else
            {
               return;
            }
             }

             // horizontal grid pattern
             Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());
             act.Start();
             switch (m_activeGrid.Grid2Justification)
             {
            case CurtainGridAlignType.Beginning:
               m_gridProperties.HorizontalJustification = CurtainGridAlign.Beginning;
               break;
            case CurtainGridAlignType.Center:
               m_gridProperties.HorizontalJustification = CurtainGridAlign.Center;
               break;
            case CurtainGridAlignType.End:
               m_gridProperties.HorizontalJustification = CurtainGridAlign.End;
               break;
            default:
               break;
             }
             m_gridProperties.HorizontalAngle = m_activeGrid.Grid2Angle * 180.0 / Math.PI;
             m_gridProperties.HorizontalOffset = m_activeGrid.Grid2Offset;
             m_gridProperties.HorizontalLinesNumber = m_activeGrid.NumULines;
             // vertical grid pattern
             switch (m_activeGrid.Grid1Justification)
             {
            case CurtainGridAlignType.Beginning:
               m_gridProperties.VerticalJustification = CurtainGridAlign.Beginning;
               break;
            case CurtainGridAlignType.Center:
               m_gridProperties.VerticalJustification = CurtainGridAlign.Center;
               break;
            case CurtainGridAlignType.End:
               m_gridProperties.VerticalJustification = CurtainGridAlign.End;
               break;
            default:
               break;
             }
             m_gridProperties.VerticalAngle = m_activeGrid.Grid1Angle * 180.0 / Math.PI;
             m_gridProperties.VerticalOffset = m_activeGrid.Grid1Offset;
             m_gridProperties.VerticalLinesNumber = m_activeGrid.NumVLines;
             // other data
             m_gridProperties.PanelNumber = m_activeGrid.NumPanels;
             m_gridProperties.UnlockedPanelsNumber = m_activeGrid.UnlockedPanels.Size;
             m_gridProperties.CellNumber = m_activeGrid.Cells.Size;
             if (null != m_activeGrid.Mullions)
             {
            m_gridProperties.MullionsNumber = m_activeGrid.Mullions.Size;
            m_gridProperties.UnlockedmullionsNumber = m_activeGrid.UnlockedMullions.Size;
             }
             act.Commit();
        }
Exemple #10
0
        /// <summary>
        /// reload all the geometry data of the curtain grid (grid lines, vertexes, and convert them to 2D format)
        /// </summary>
        public void ReloadGeometryData()
        {
            if (null == m_activeGrid)
             {
            if (true == m_myDocument.WallCreated)
            {
               m_activeGrid = m_myDocument.CurtainWall.CurtainGrid;
            }
            else
            {
               return;
            }
             }

             Transaction act = new Transaction(m_activeDocument, Guid.NewGuid().GetHashCode().ToString());
             act.Start();
             ElementSet mullions = m_activeGrid.Mullions;
             act.Commit();
             if (null != mullions && false == mullions.IsEmpty)
             {
            foreach (Mullion mullion in mullions)
            {
               if (null != mullion)
               {
                  m_mullionType = mullion.MullionType;
                  break;
               }
            }
             }

             GetULines();
             GetVLines();
             GetCurtainGridVertexes();
             // covert those lines to 2D format
             m_drawing.GetLines2D();
        }