Esempio n. 1
0
        static private void ExportParameters(Element element, ref Va3cContainer.Va3cObject elementObject)
        {
            string      propertyName = string.Empty;
            ElementType elementType  = element.Document.GetElement(element.GetTypeId()) as ElementType;

            if (elementType != null && string.IsNullOrEmpty(elementType.FamilyName))
            {
                propertyName += (elementType.FamilyName + " " + element.Name);
            }
            else
            {
                propertyName = element.Name;
            }

            string propertyFileName;

            if (PropertyExporter.ExportParameters(propertyName, elementObject.uuid, element.ParametersMap, out propertyFileName))
            {
                elementObject.propertyfile = propertyFileName;
            }
        }
Esempio n. 2
0
    static private bool ExportLevel(KeyValuePair <ElementId, List <Element> > levelElements, ref Va3cContainer.Va3cObject rootObject, Document activeDocument)
    {
        Va3cContainer.Va3cObject levelObject = new Va3cContainer.Va3cObject();
        levelObject.uuid = StringConverter.NewGuid();
        levelObject.type = "Level";
        Level level = activeDocument.GetElement(levelElements.Key) as Level;

        if (level != null)
        {
            levelObject.name = level.Name;
        }
        else
        {
            levelObject.name = "无标高";
        }

        Dictionary <ElementId, List <Element> > CategoryElementsDic = new Dictionary <ElementId, List <Element> >();

        foreach (Element element in levelElements.Value)
        {
            Category  category   = element.Category;
            ElementId categoryId = new ElementId(-1);
            if (category != null)
            {
                categoryId = category.Id;
            }
            else
            {
                categoryId = new ElementId(-1);
            }

            if (CategoryElementsDic.ContainsKey(categoryId))
            {
                CategoryElementsDic[categoryId].Add(element);
            }
            else
            {
                CategoryElementsDic.Add(categoryId, new List <Element> {
                        element
                    });
            }
        }

        if (!CategoryExporter.ExportCategories(CategoryElementsDic, ref levelObject, activeDocument))
        {
            return(false);
        }

        if (level != null)
        {
            string propertyFileName;
            if (PropertyExporter.ExportParameters(levelObject.name, levelObject.uuid, level.ParametersMap, out propertyFileName))
            {
                levelObject.propertyfile = propertyFileName;
            }
        }

        if (levelObject.children.Count > 0)
        {
            rootObject.children.Add(levelObject);
        }

        return(true);
    }