- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
We are developing a tool which aims to align electrical elements (e.g. lighting fixtures) to the edge of the ceiling grid. I cannot make it work for rectangular elements, I was hoping to get the origin x and y values of the solid faces so I can calculate the correct length of the element, but the API is returning different values for the Origin. (Did not use the bounding box of the element because it includes other details of the element). I have tried different transforms also but no success yet. I would like to use the same value from the Face.Origin being returned by the Revit Lookup. Thank you.
My code is as follows:
Options gOptions = new Options();
gOptions.ComputeReferences = true;
gOptions.DetailLevel = ViewDetailLevel.Undefined;
gOptions.IncludeNonVisibleObjects = false;
GeometryElement geomElem = e.get_Geometry(gOptions);
GeometryObject geoObj = geomElem.FirstOrDefault();
GeometryInstance geomInst = geoObj as GeometryInstance;
if (geomInst != null)
{
GeometryElement gInstGeom = geomInst.GetInstanceGeometry();
foreach (GeometryObject gGeomObject in gInstGeom.Where(x => x is Solid))
{
Solid geoSolid = gGeomObject as Solid;
if(geoSolid.Volume > 0 && geoSolid.Visibility == Visibility.Visible && geoSolid.Faces.Size > 0)
{
foreach (Face f in geoSolid.Faces)
{
if (f is PlanarFace)
{
PlanarFace pf = f as PlanarFace;
XYZ origin = pf.Origin;
Solved! Go to Solution.