I want to import some solids created by an external library into Revit with TessellatedShapeBuilder. All solids are correctly tessellated and closed. But I got sometimes the following error on calling TessellatedShapeBuilder.Build()
Could not Crate consistent vertext list
As far as I know there are some restriction about triangle. e.g. the distance between two vertex. I could merge two vertex in this case. But I dont know other restriction and how could I adjust my vertex list and triangle list to avoid the above error?
Thanks
Erik
Dear Erik,
The problem might indeed be due to vertices lying too close together.
They need to be at least about 2 mm apart:
http://thebuildingcoder.typepad.com/blog/2014/05/directshape-performance-and-minimum-size.html
What I always do in these kind of cases:
While reading the input vertices one by one, I put them into a dictionary equipped with an XYZ comparison operator.
If a new vertex is very close to an existing one, my comparison operator considers the two vertices to be equal, so I ignore it and use the existing one instead.
I think the OBJ to direct shape converter add-in implements something like this:
http://thebuildingcoder.typepad.com/blog/2016/10/directobjloader-for-revit-2017.html
Oops, no, sorry, it does not.
However, the GetVertices method in The Building Coder samples CmdNestedInstanceGeo.cs does something similar using an XyzEqualityComparer.
You would simply have to replace the face vertex index of any ignored vertex by the index of its replacement.
I hope this helps.
Cheers,
Jeremy
Hi Jeremy,
thanks for your quick response. Exactly I had made it as you suggested. It could solve the problem when two vertex too close are. But I got still the same error on some solids after the adjustment. It is actually about soil layer. The first in the attachment could be built as Solid by TessellatedShapeBuilder after the above adjustment, the second not, only built as Mesh. Therefore I asked if there is any other restriction.
By the way after my testing the minimal distance between two vertex is much more than 2mm, at least 20mm.
Regards
Erik
Hi,
there is an Appliation.MinimumThickness property. It says in the RevitAPI.chm:
"The minimum thickness allowed in Revit for a variety of geometric constructs. These include blends, extrusions, and wall layers."
May it be that your second sample is very flat in some areas, resulting in the local thickness falling below this value?
Revitalizer
Thanks, I have also thought of it. The thickness in my soil layer is actually controlled by the distance between top grid point and bottom grid point. So after the adjustment as said should it always be higher than a certain value ( I tried 20mm - 100mm ) Therefore the first example works, but the second not.
Maybe I must conside the angle between two triangles at the solid edge. It could not be too small ???
Erik
Whatever problem you run into, try reproducing the same issue manually through the user interface.
That will probably provide more information on what the problem is than the Revit API does.
Yes you can 🙂
For instance, you can extract vertices from the external data and create points in Revit representing them, then manipulate those in the UI.
oh, I am newbie with modelling 🙂 How to create a point in Revit? As a reference point? Could I try to build a solid or mesh from points?
Hi,
have a look at TessellatedShapeBuilderResult.GetIssuesForFaceSet.
In fact, you may localize exactly the face(s) respectively the vertices causing the problem.
Each TesselatedBuildIssue provides a GetDescription() method.
Revitalizer
I got a following exception when calling TessellatedShapeBuilder.Build(). After catching the exception GetBuildResult() returned nothing.
ex2 {"Could not create consistent vertex list."}
DirectCast(ex2,Autodesk.Revit.Exceptions.InvalidOperationException).FunctionId.File "TessellatedShapeBuilder.cpp"
DirectCast(ex2,Autodesk.Revit.Exceptions.InvalidOperationException).FunctionId.Function "void __cdecl TessellatedShapeBuilder::build_(void)"
DirectCast(ex2,Autodesk.Revit.Exceptions.InvalidOperationException).FunctionId.Line 558
Hi,
before invoking the Build method, you could check the input:
TessellatedShapeBuilder.DoesFaceHaveEnoughLoopsAndVertices(TessellatedFace)
Revitalizer
I did, actually all faces were just triangles, so I got no error during check.
Dear Erik,
Jochen of bimm raised an ADN case and pointed out this thread, so I will take the liberty of answering you both here for all to partake. Jochen also shared some sample code and data sets. I logged the issue REVIT-130028 [TessellatedShapeBuilder solid creation throws Could not create consistent vertex list has] with our development team for this on your behalf. Please make a note of this number for future reference.
I also noticed a similar older development issue that still remained open, REVIT-122687 [TessellatedShapeBuilder cannot build from triangle from circle face].
Prompted by my submission of your new issue, the development team took a look at the latter, older one and respond to that:
Here's a quick guess based on a glance at the add-in code and TessellatedShapeBuilder code:
The shape that is picked is not a closed solid.
Note that the add-in code in only accepts a valid solid:
Target = TessellatedShapeBuilderTarget.Solid, Fallback = TessellatedShapeBuilderFallback.Abort
Therefore, if the selected shape is not a solid, TessellatedShapeBuilder will throw an InvalidOperationException with the odd message "Could not create consistent vertex list." That message should presumably be much more generic.
In summary: that sample data does not describe a closed solid, and the add-in code is explicitly rejecting all results that are not closed solids.
In that case, one could either fix the sample data to create a closed solid, or change the shape builder target and fall-back to something more lenient.
I see that in your sample, you implemented your own fall-back mechanism by initially trying to use
builder.Target = TessellatedShapeBuilderTarget.Solid builder.Fallback = TessellatedShapeBuilderFallback.Abort
If the call to builder.Build fails, you launch a second attempt using
builder.Target = TessellatedShapeBuilderTarget.Mesh builder.Fallback = TessellatedShapeBuilderFallback.Salvage
Have you checked whether this exception handling works, and the second attempt is launched as you expect?
I expect the development team will provide more feedback as soon as they have analysed your code in more depth as well.
Best regards,
Jeremy
Dear Jeremy,
thank you for your effort. Some solids come directly from the external library and should be always closed. And the other solids after merging points with small difference are also closed. For that I have inserted a part code to check it.
The second attempt is only to show the problematic geometry in Revit.
Now it is a big problem, because it occurs so randomly. We could not find out what cause this problem. Thanks for any further feedback.
Regards
Erik
Dear Jochen and Erik,
Thank you for your update, appreciation and further details.
The developer team took a first look and says:
We see the failure in TessShapeUtils.cpp. An optional warning is not dispalyed in the relerase version, saying "OriginalLoopGeomAcuteAngle - Too acute angle between adjacent segments for the face in the original face loop - dropping it". This condition is checked only for solids
(mode != TessShapeFactory::Polymesh)
The process bails out if
(mode == TessShapeFactory::ClosedSolidOrAbort)
Therefore, construction of polymesh instead of the solid does succeed.
More research is required.
Thank you for your patience.
Best regards,
Jeremy
Dear Jeremy,
thanks for the useful information. I have actually thought of it. What is the minimal angle between adjacent segments? I am glad that the problem is in process and expect the further feedback.
Best Regards
Erik
Dear Erik,
Thank you for your update and appreciation.
I asked the development team...
Thank you for your patience.
Best regards,
Jeremy
Dear Erik,
Thank you for your patience.
I heard back from the development team, who say:
If the angle is greater than 1 degree, this problem will not occur.
They verified that this limitation is honoured and behaves as expected and therefore now closed the issue REVIT-130028 [TessellatedShapeBuilder solid creation throws Could not create consistent vertex list -- 14029415] as 'By Design'.
I hope this helps.
Best regards,
Jeremy
Dear Jeremy,
thanks for your further feedback. Now I know the limitation, but unfortunately the tiny angle is unavoidable in my application . The calculation gives often thin layer with such angle. What could I do then?
Best Regards
Erik