Ejemplo n.º 1
0
        public void GetInfo()
        {
            try
            {
                docName    = m_doc.Title;
                uniqueId   = m_view.UniqueId;
                viewId     = m_view.Id.IntegerValue;
                viewName   = m_view.Name;
                viewTypeID = m_view.GetTypeId().IntegerValue;
                ViewFamilyType viewType = m_doc.GetElement(m_view.GetTypeId()) as ViewFamilyType;
                if (null != viewType)
                {
                    viewTypeName = viewType.Name;
                }

                Parameter sheetNumberParam = m_view.get_Parameter(BuiltInParameter.VIEWPORT_SHEET_NUMBER);
                Parameter sheetNameParam   = m_view.get_Parameter(BuiltInParameter.VIEWPORT_SHEET_NAME);
                if (null != sheetNumberParam && null != sheetNameParam)
                {
                    if (!string.IsNullOrEmpty(sheetNumberParam.AsString()) && !string.IsNullOrEmpty(sheetNameParam.AsString()))
                    {
                        sheetNumber  = sheetNumberParam.AsString();
                        sheetName    = sheetNameParam.AsString();
                        isOnSheet    = true;
                        sheetObj     = FindSheet(sheetNumber, sheetName);
                        viewLocation = FindViewLocation(sheetObj);
                    }
                }

                ICollection <ElementId> referenceCalloutIds = m_view.GetReferenceCallouts();
                if (referenceCalloutIds.Count > 0)
                {
                    foreach (ElementId eId in referenceCalloutIds)
                    {
                        Element callout = m_doc.GetElement(eId);
                        if (null != callout)
                        {
                            Parameter param = callout.get_Parameter(BuiltInParameter.ID_PARAM);
                            if (null != param)
                            {
                                ElementId    referenceViewId = param.AsElementId();
                                ViewDrafting referenceView   = m_doc.GetElement(referenceViewId) as ViewDrafting;
                                if (null != referenceView)
                                {
                                    ViewProperties vp = new ViewProperties(m_doc, referenceView);
                                    if (!dependantViews.ContainsKey(vp.ViewId))
                                    {
                                        dependantViews.Add(vp.ViewId, vp);
                                    }
                                }
                            }
                        }
                    }
                }

                ICollection <ElementId> referenceSectionIds = m_view.GetReferenceSections();
                if (referenceSectionIds.Count > 0)
                {
                    foreach (ElementId eId in referenceSectionIds)
                    {
                        Element marker = m_doc.GetElement(eId);
                        if (null != marker)
                        {
                            Parameter param = marker.get_Parameter(BuiltInParameter.ID_PARAM);
                            if (null != param)
                            {
                                ElementId    referenceViewId = param.AsElementId();
                                ViewDrafting referenceView   = m_doc.GetElement(referenceViewId) as ViewDrafting;
                                if (null != referenceView)
                                {
                                    ViewProperties vp = new ViewProperties(m_doc, referenceView);
                                    if (!dependantViews.ContainsKey(vp.ViewId))
                                    {
                                        dependantViews.Add(vp.ViewId, vp);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string message = ex.Message;
            }
        }