public CategoryProperties(Category category)
        {
            categoryName = category.Name;
            categoryId   = category.Id;
            var categoryFound = from cat in ComponentCategoryFilter.Categories where cat.CategoryId == categoryId select cat;

            if (categoryFound.Count() > 0)
            {
                CategoryProperties filteredCategory = categoryFound.First();
                selected = filteredCategory.Selected;
            }
        }
Esempio n. 2
0
        public RevitComponent(Schemas.Component component, Element element, RevitLinkProperties link)
        {
            try
            {
                Action            = component.Action;
                AuthoringToolId   = component.AuthoringToolId;
                Color             = component.Color;
                ElementName       = component.ElementName;
                Guid              = component.Guid;
                IfcGuid           = component.IfcGuid;
                OriginatingSystem = component.OriginatingSystem;
                Responsibility    = component.Responsibility;
                Selected          = component.Selected;
                ViewPointGuid     = component.ViewPointGuid;
                Visible           = component.Visible;

                RvtElement     = element;
                ElementId      = element.Id;
                IfcProjectGuid = link.IfcProjectGuid;
                TransformValue = link.TransformValue;
                IsLinked       = link.IsLinked;
                ElementName    = element.Name;
                Category       = new CategoryProperties(element.Category);

                var typeId      = element.GetTypeId();
                var elementType = link.LinkedDocument.GetElement(typeId) as ElementType;
                if (null != elementType)
                {
                    PreviewImage = elementType.GetPreviewImage(new Size(48, 48));
                }
            }
            catch (Exception)
            {
                // ignored
            }
        }