Face Reference

Face Reference

Tripler123
Advocate Advocate
950 Views
2 Replies
Message 1 of 3

Face Reference

Tripler123
Advocate
Advocate

Hi all,

I have tried to create a wall by the face of a column, but at the moment of obtaining the reference of the selected face I get it as null. Any advice to get that reference? Show the code.

 

Reference pickedObj;
            pickedObj = uiDoc.Selection.PickObject(ObjectType.Face, "Select Face");
            GeometryObject geometryObject = doc.GetElement(pickedObj).GetGeometryObjectFromReference(pickedObj);
            PlanarFace face = geometryObject as PlanarFace;

            WallType wType = new FilteredElementCollector(doc)
                            .OfClass(typeof(WallType))
                            .Cast<WallType>().FirstOrDefault(q
                             => q.Name == "Parapeto e=0.20 m (350 kgm/cm2)");



            using (Transaction t = new Transaction(doc))
            {
                t.Start("Face by Wall");
                try
                {
                    FaceWall.Create(doc, wType.Id, WallLocationLine.CoreExterior, face.Reference);
                }
                catch (Exception ex)
                {

                    TaskDialog.Show("Error", ex.Message);
                }

                t.Commit();
            }
            return Result.Succeeded;
0 Likes
Accepted solutions (1)
951 Views
2 Replies
Replies (2)
Message 2 of 3

joshua.lumley
Advocate
Advocate

Is the column in a linked model?

0 Likes
Message 3 of 3

RPTHOMAS108
Mentor
Mentor
Accepted solution

Not sure why you are getting null.

 

You can only create a FaceWall from a face that belongs to a Mass or Element of GenericModel category (not a column). As in the UI Face walls are typically created from the results of massing studies i.e. a skin to the face of the mass.

 

You should check:

FaceWall.IsValidFaceReferenceForFaceWall

FaceWall.IsWallTypeValidForFaceWall

0 Likes