Wall Set Top Constraint Parameter.

Wall Set Top Constraint Parameter.

Anonymous
Not applicable
2,392 Views
3 Replies
Message 1 of 4

Wall Set Top Constraint Parameter.

Anonymous
Not applicable

Hi API Community, 

 

I've created a wall through the API it set the Top Constraint to Unconnected.  I'd like to set the Top Constraint parameter to a level and remove the Unconnected Height.  Is this possible?   I haven't had any luck with my method.

 

public void CreateWall(Document doc, ObjWalls LinkedWall)
        {
            MyLibrary lib = new MyLibrary();
            LocationCurve locationCurve = LinkedWall.WallCurve;
            List<Level> levels = lib.GetLevels(doc);
            Level BaseLevel = levels.Find(l => l.Name == LinkedWall.BaseConstraint);
            Level TopLevel = levels.Find(l => l.Name == LinkedWall.TopConstranit);

            XYZ startPoint = LinkedWall.startPoint;
            XYZ endPoint = LinkedWall.EndPoint;

            Line line = Line.CreateBound(startPoint, endPoint);
            Transaction t = new Transaction(doc);
            t.Start("Create Wall");
            try 
            {
                Wall wall = Wall.Create(doc, line, BaseLevel.Id, true);
                Parameter parm = wall.LookupParameter("Top Constraint");
                parm.Set(TopLevel.Name);
            }
            catch { }
            t.Commit();
        }

 

Accepted solutions (1)
2,393 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
Accepted solution

Hey Danny,

 

you can set the top of the wall to a level you want, with

 

Parameter p = wall.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE);
if (null != p)
{
    p .Set(level.Id);
}

Hope this helps.

Christian

Message 3 of 4

Anonymous
Not applicable

Thank you.  I've been looking for some time and trying all sorts of things that didn't work.  This is perfect.  

 

0 Likes
Message 4 of 4

Anonymous
Not applicable

You are welcome and I hope you enjoy your coffee.

0 Likes