Message 1 of 8

Not applicable
08-31-2017
12:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey guys I am running a test to see if the geometry element I have, is an 'Arc'.
The code I have at the moment is below:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; using System.IO; using System.Reflection; using Autodesk.Revit.Attributes; using Autodesk.Revit.DB; using Autodesk.Revit.UI; using Autodesk.Revit.DB.Architecture; using Autodesk.Revit.UI.Selection; using Autodesk.Revit.ApplicationServices; using DoorTag; namespace DoorTag { internal static class DoorArcExtensions { // get list of doorSwingarcs public static List<GeometryElement> GetListOfDoorArcs(this IndependentTag tag) { FamilyInstance door = IndependentTagExtensions.GetTaggedLocalElement(tag); // have some options Autodesk.Revit.DB.Options opt = new Options(); // Create a new empty list of arcs List<GeometryElement> ListOfDoorArcs = new List<GeometryElement>(); // Get the list of the geometry objects Autodesk.Revit.DB.GeometryElement geomElem = door.get_Geometry(opt); // for each geometry element that is an arc, add that to the list of door arcs foreach (GeometryElement geomObj in geomElem) { if (geomElem == Arc) { ListOfDoorArcs.Add(geomElem); } List<GeometryElement> tempList = ListOfDoorArcs; GeometryElement doorArc = tempList[0]; } return ListOfDoorArcs; } // get list of doorSwingarcs public static GeometryElement GetDoorArc(this IndependentTag tag) { FamilyInstance door = IndependentTagExtensions.GetTaggedLocalElement(tag); List<GeometryElement> tempList = DoorArcExtensions.GetListOfDoorArcs(tag); GeometryElement doorArc = tempList[0]; // count the number of items in the list int countOfDoorArcs = tempList.Count; if (countOfDoorArcs <= 1) { if (countOfDoorArcs == 0) // it must be a sliding door or panel { doorArc = tempList[0]; // do nothing } else // it must be a single door { doorArc = tempList[0]; } return doorArc; } // Test for double or leaf and a half else { doorArc = tempList[0]; } return doorArc; } } }
How ever I am getting the following error message: "'Arc' is a type which is not valid in the current context"
How should I change my code to make sure the it recognises 'Arc' as a type for a geometry element and can test for it?
Kind regards
Solved! Go to Solution.