triangulated mullion vertices not correct

Anonymous

triangulated mullion vertices not correct

Anonymous
Not applicable

Hello,

 

After the triangulation of the mullions in my project, it seems that the vertices Z isn't right. It gives me an value to high ( like 60 meters to high ) or to low ( like 150 meters below 0 ). I am using this code to get the vertices, can someone help me getting the right values? Walls and floors are going correctly by the code, but mullions aren't.

 

triangle.get_Vertex(x) gives us an very odd Z value.

 

 

if(wall.Walltype.Kind == WallKind.Curtain)
{
 // Loop mullions
 foreach (ElementId mullionId in this.curtainWall.CurtainGrid.GetMullionIds())
 {
  // Get mullion
  Element mullion = document.GetElement(mullionId);

  // Get element geometry
  Options options = new Options();
  GeometryElement geometryElement = element.get_Geometry(options);

  // Loop geometry objects
         foreach (GeometryObject geometryObject in geometryElement)
         {
   // Cast as solid
   Solid solid = geometryObject as Solid;
   
   // Loops solids
              foreach (Solid solid in solids)
              {
                  // Loop faces
                  foreach (Face geomFace in solid.Faces)
                  {
                       if(geomFace.Triangulate().Vertices.Count < 3)
                       {
                           continue;
                       }

                       Mesh mesh = geomFace.Triangulate();

                       for (int t = 0; t < mesh.NumTriangles; t++)
                       {
                           //Create new face
                           PartFace face = new PartFace();

                           MeshTriangle triangle = mesh.get_Triangle(t);

                           // Add coordinate to face
                           face.Coordinates.Add(triangle.get_Vertex(0) / feet);
                           face.Coordinates.Add(triangle.get_Vertex(1) / feet);
                           face.Coordinates.Add(triangle.get_Vertex(2) / feet);

                           // Add face to list
                           polygon.Faces.Add(face);
                       }
                  }
              }
  	   }
        }
}

 

With kind regards,

 

 

Guus

 

0 Likes
Reply
497 Views
3 Replies
Replies (3)

matthew_taylor
Advisor
Advisor

Hi @Anonymous,

There was a recent discussion on this that may explain a lot:

https://forums.autodesk.com/t5/revit-api-forum/how-to-get-a-solids-location-in-the-project/m-p/6860193#U6860193

 

Cheers,

 

-Matt


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes

Anonymous
Not applicable

Hello Matt,

 

We tried to use the same approach, however our bounding box seems to be really far away. As you can see in the figure below ( exported the coordinates to matlab) this "doorframe made out of mullions" isn't axactly right. the strange thing is that the bounding box is actually the same coordinates as the element.get_geometry(). visible in the 3D view is that it is 2m high, 900 mm width and 114 mm thick. and positioned on the first floor ( 0 - 2800 mm )

matlab.PNG 

is there another method for obtaining the geometry of mullions?

 

 

with kind regards,

 

Guus

0 Likes

matthew_taylor
Advisor
Advisor

Hi @Anonymous,

I'm no expert in this, but I'm going to throw you a few ideas:

  • The Revit API uses decimal feet for Length. You divide by 'feet'. Consider testing everything in decimal feet, then working out any conversions afterwards.
  • Your geometry options don't specify much. Have you adjusted these to if it affects your results? (I'm particularly thinking of the detail level OR view here.)
  • .Triangulate has an overload that accepts a levelOfDetail value.
  • Triangulate notes results as 'approximate'. I'm guessing that this is expected, but unlikely to cause such a large issue.

While this is vastly out of date, it may help:

http://thebuildingcoder.typepad.com/blog/2009/03/transform-instance-coordinates.html

(As noted in that blog post, have you looked at the ElementViewer SDK example?)

 

Cheers,

 

-Matt

 


Cheers,

-Matt
_______________________________________________________________________________
Marking a post as a 'solution' helps the community. Giving a post 'Kudos' is as good as saying thanks. Why not do both?
0 Likes