简体   繁体   中英

How to use Revit API to create a structural wall?

I already know how to create a Architectural wall using Revit API.

The code is something like this. Notice, I am also use Revit Python Wrapper in my code.

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.

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. The 45 mm gap disappears and the length of the created new wall actually 1.5 meters plus 45 mm long. 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.

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?

PS. I also use Revit Python Shell to inspect two different kinds of walls. The first type of wall - Architectural wall type is Wall class in Revit API. 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. 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.

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.

I think what the wall you create through the revit-api does, is that it is joining the wall end to another wall. What you need is WallUtils.DisallowWallJoinAtEnd() . As stated in the revit-api documentation. revitapidocs.com - WallUtils

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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