Message 1 of 11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi everyone,
I was trying to edit the shape of a Part using the method SetFaceOffset. I get the sample from https://thebuildingcoder.typepad.com/blog/2012/09/parts-assemblies-partutils-and-divideparts.html
However I'm always having an error saying "face doesn't belong to the part". Which I think is impossible. My code so far :
UIDocument uidoc = uiapp.ActiveUIDocument;
Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
Document doc = uidoc.Document;
Reference refS = uidoc.Selection.PickObject(ObjectType.Element);
Part p = doc.GetElement(refS.ElementId) as Part;
Options opt = new Options();
opt.View = doc.ActiveView;
GeometryElement geomElem = p.get_Geometry(opt);
foreach (GeometryObject geomObject in geomElem)
{
if (geomObject is Solid)
{
Solid solid = geomObject as Solid;
FaceArray faceArray = solid.Faces;
foreach (Face face in faceArray)
{
if (p.CanOffsetFace(face))
{
p.SetFaceOffset(face, 0.078740157480311268);
}
}
}
}
Have you got any ideas why I get this error ? Is it a bug of the Revit API ?
Thanks !
Solved! Go to Solution.