简体   繁体   English

如何使用 Revit API 创建结构墙?

[英]How to use Revit API to create a structural wall?

I already know how to create a Architectural wall using Revit API.我已经知道如何使用 Revit API 创建建筑墙。

The code is something like this.代码是这样的。 Notice, I am also use Revit Python Wrapper in my code.请注意,我还在代码中使用了 Revit Python Wrapper。

def create_wall(a, b, c, d, e, f, g, h): doc = revit.doc def create_wall(a,b,c,d,e,f,g,h):doc = revit.doc

with rpw.db.Transaction('Test Is Instance') as t:
    start_point = XYZ(a, b, c)

    # convert millimeter to feet, internal, it uses feet
    end_point = XYZ(d, e, f)

    # Wrapper Line
    line = Line.new(start_point, end_point)

    levels = db.Collector(of_class='Level')
    level_0 = levels.get_first()
    wall = DB.Wall.Create(doc, line.unwrap(), level_0.Id, False)
    w = db.Wall(wall)

    # convert the mm to feet.
    w.parameters['Base Offset'].value = g
    w.parameters['Unconnected Height'].value = h

After I did this, I found it is working well.完成此操作后,我发现它运行良好。 But there is one thing, the wall I created using this function, when it comes across a wall in the intersection, if there is a small gap, for example 45 mm, it will automatically stick to the wall in the intersection and the gap disappears.但是有一点,我用这个function做的墙,在路口碰到一堵墙,如果有小缝隙,比如45mm,会自动贴在路口的墙上,缝隙就消失了.

Say, I created a wall 1.5 meters long, but there is anothter wall in the intersection and there is a 45 mm distance between this created wall and the existing wall in the intersection.比如说,我创建了一堵 1.5 米长的墙,但在交叉路口还有另一堵墙,这堵墙与交叉路口的现有墙之间有 45 毫米的距离。 The 45 mm gap disappears and the length of the created new wall actually 1.5 meters plus 45 mm long. 45 毫米的间隙消失了,创建的新墙的长度实际上是 1.5 米加上 45 毫米长。 And this is not what I want.这不是我想要的。

Someone told me I can use structural wall instead Architectural wall.有人告诉我我可以用结构墙代替建筑墙。 The way to do that is to follow this step, In menu - Structure, choose the Component in the ribbon of structure menu, then click the model-in-place, after that, there will be a window pop up, Then choose the Family Category - Walls with filter list is Structure, Then in Project Brower tree, Families - walls there will be new type of wall, and this wall doesn't have the issue I mentioned above, that is it won't automatically strectch and change the length when I create the wall.方法就是按照这个步骤,在菜单-结构中,在结构菜单的ribbon中选择Component,然后点击model-in-place,之后会弹出一个window,然后选择Family Category - Walls with filter list 是 Structure,然后在 Project Brower tree 中,Families - walls 会有新类型的墙,而这面墙没有我上面提到的问题,即不会自动拉伸和改变我创建墙时的长度。

First topic is that is this true?第一个话题是真的吗? What are their differences for these two types of wall creation?这两种类型的墙创作有什么区别? And if this is true, how can I use revit API to create the second type of wall?如果这是真的,我该如何使用 revit API 创建第二种类型的墙?

PS. PS。 I also use Revit Python Shell to inspect two different kinds of walls.我还使用 Revit Python Shell 来检查两种不同类型的墙壁。 The first type of wall - Architectural wall type is Wall class in Revit API.第一种墙——建筑墙类型是 Revit API 中的墙 class。 I also have the second type of wall handy, but it's created manually, it's created by someone else and not created by Revit API.我也有第二种类型的墙,但它是手动创建的,它是由其他人创建的,而不是由 Revit API 创建的。 I inspected the revit file containing the second type of wall, when I select this second type of wall in his Revit file, the return type of selected Revit wall in Revit python shell is FamilyInstance.我检查了包含第二种墙的revit文件,当我在他的Revit文件中select这第二种墙时,Revit python Z2591C98B70119FE624898B1E424B5中选择的Revit墙的返回类型是Family

Secondly, I have this question, why the first type of the wall is Wall Class but the type of the second wall - structural wall is FamilyInstance.其次,我有这个问题,为什么第一种墙是Wall Class 而第二种墙-结构墙的类型是FamilyInstance。

I think what the wall you create through the revit-api does, is that it is joining the wall end to another wall.我认为您通过 revit-api 创建的墙的作用是将墙端连接到另一面墙。 What you need is WallUtils.DisallowWallJoinAtEnd() .您需要的是WallUtils.DisallowWallJoinAtEnd() As stated in the revit-api documentation.如 revit-api 文档中所述。 revitapidocs.com - WallUtils revitapidocs.com - WallUtils

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM