EaBIM一直以来积极响应国家“十二五”推进建筑业信息化的号召,对建筑领域的信息技术开展深入技术交流和探讨!致力于打造“BIM-建筑师-生态技术”三位一体综合资源交流共享平台,希望为BIM与可持续设计理念及技术的普及做出微小的贡献!!!

萧闫子 发表于 2014-1-9 12:41:40

创建系统族System Family Creation

Here is a frequent query that came in once again today:Question: I would like to create new system families in the Revit project, specifically wall families, to represent my stored database values including data such as material, thickness and other required properties.I would like to use the API to create a new wall and assign the structural layers their function and material. I would appreciate some advice how to achieve the creation of these system family types.Answer: System families are built into Revit itself and cannot be modified, so the short answer to your question is simply 'No, you cannot create new system families'.On the other hand, just like standard families, the purpose of system families is to provide types or symbols for use in the building model. The types are represented by the ElementType base class, and it provides a Duplicate method which allows you to create new types of the same family.Some system families are exposed as classes to the API, such as Wall. In that case, the Wall class and its properties and methods define what you can do with it, and the wall types are represented by the WallType derived from ElementType.Here is some VB code taken from the discussion on creating a new type which creates a new wall type using the Duplicate method, modifies it, and then assigns it to an existing wall:Dim wallType As WallType = wall.WallType   Dim newWallType As WallType _    = TryCast(wallType.Duplicate( _      newWallTypeName), WallType)   Dim layers As CompoundStructureLayerArray _    = newWallType.CompoundStructure.Layers   For Each layer As CompoundStructureLayer _    In layers   ' double each layer thickness:   layer.Thickness *= 2.0RNext   ' assign the new wall type back to the wall:   wall.WallType = newWallTypeFor completeness sake, here is the same code in C#:WallType wallType = wall.WallType;   WallType newWallType = wallType.Duplicate(   newWallTypeName ) as WallType;   CompoundStructureLayerArray layers   = newWallType.CompoundStructure.Layers;   foreach( CompoundStructureLayer layer in layers ){    // double each layer thickness:   layer.Thickness *= 2.0;}// assign the new wall type back to the wall:   wall.WallType = newWallType;In the current Revit API, you cannot create new layers in a wall type's compound layer structure.The work-around for this is to create the required number of layers manually and save separate wall types for each number of layers in the template file used to create your project. Then, when your application needs a new wall type with a specific number of layers, it can use a suitable one of the manually created predefined wall types and duplicate and modify that.

悠悠筱荷 发表于 2014-2-20 14:42:50

(*^__^*) 嘻嘻……

页: [1]
查看完整版本: 创建系统族System Family Creation