Surface area of Face is wrong.

Surface area of Face is wrong.

Anonymous
Not applicable
614 Views
4 Replies
Message 1 of 5

Surface area of Face is wrong.

Anonymous
Not applicable

I have written this fuzzy testcode, trying to extract the geometry of the glass in an Windowelement.

 

The dimensions of the Glass are 1170 x 1180, so the area i am looking for is around 1 m2. I get 12 m2. When i look at the family the dimensions are identical. Its in the basis sample project. I don't get it, can someone please enlighten me? 

 

Second question. Why isn't there just a collection extracted from the object model containing all the solids in the model, with their material and geometry? Everybody who want's  to do some analysis on the building needs that info. From what i'm reading i have to transform nested familyinstances???

 

 

		public void Testing()
		{
			Document doc = Document;
			String str = "";
			Options opts = Application.Application.Create.NewGeometryOptions();

			IList<Element> elems = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Windows).ToElements();
			
			foreach (Element e in elems)
			{
				if (e.Name =="1180 x 1170mm")
				{
				str += e.Name + "\n";
				
					GeometryElement geoElement = e.get_Geometry(opts); 
					
				   // Get geometry object van het element.
				   foreach (GeometryObject geoObject in geoElement)  
				   {  
				      // Get the geometry instance which contains the geometry information  
				      GeometryInstance instance = geoObject as GeometryInstance;  
				      if (null != instance)  
				      {  
				      	 
				      	GeometryElement i = instance.GetInstanceGeometry();
					
				         foreach (GeometryObject o in i)  
				         {  
				        
				            Solid s = o as Solid;  
    							if (null != s && 0 < s.Edges.Size)
					                {
					                		
					    				foreach(Face f in s.Faces)
					                	{
					    					
					                		Element m = doc.GetElement(f.MaterialElementId) as Element;
					                		
					                		if (null != m)
					                		{
						                		if (m.Name == "Glass")
						                		{
						                			

						                				str += f.Area + "\n";

						                		}
					                		}
					                	}
					                }
				         }  
				      }  
				   }
				}
				
				
			}
			
			TaskDialog.Show("test",str);
		}

 

0 Likes
615 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Revit's internal distance units are always in feet, so the area you're retrieving is in square feet.

Always be careful about units when you're using the API - distances are always in feet but I believe all other units are in SI.

Message 3 of 5

Anonymous
Not applicable

Many Thanks!

 

The Revit Api is clearly not written to be used by other people or to be practical.

The position of an element is a property, not an object from een instance, from an object form a nested transformed instance.

 

Sorry, i am a little frustrated. 😉

0 Likes
Message 4 of 5

Anonymous
Not applicable

I have an add-in that accepts coordinate points and are placed around the model. I (being in the US) have expeted results because distances between points are accurate and are measured in FT. However, any other country that uses my addin always gives negative feedback because the distances are incorrect between points when measured. I always have to explain to them that Revit does that on it's own; It is not overrideable.

0 Likes
Message 5 of 5

Anonymous
Not applicable

I am just a newby, but I would have my add-in ask the user the first time wich units he wants en let your add-in convert the results for metric. I would also build a command or button to change the various settings.

0 Likes