Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with solid creation by TessellatedShapeBuilder

24 REPLIES 24
Reply
Message 1 of 25
Erik_Wu
1688 Views, 24 Replies

Problem with solid creation by TessellatedShapeBuilder

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 

24 REPLIES 24
Message 2 of 25
jeremytammik
in reply to: Erik_Wu

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



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 25
Erik_Wu
in reply to: jeremytammik

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

Message 4 of 25
Revitalizer
in reply to: Erik_Wu

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




Rudolf Honke
Software Developer
Mensch und Maschine





Message 5 of 25
Erik_Wu
in reply to: 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

Message 6 of 25
jeremytammik
in reply to: Erik_Wu

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.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 7 of 25
Erik_Wu
in reply to: jeremytammik

Unfortunately I
can not, because the solid to import is created by an external 3D library
not by Revit API.
Message 8 of 25
jeremytammik
in reply to: Erik_Wu

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.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 9 of 25
Erik_Wu
in reply to: jeremytammik

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?

Message 10 of 25
Revitalizer
in reply to: Erik_Wu

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




Rudolf Honke
Software Developer
Mensch und Maschine





Message 11 of 25
Erik_Wu
in reply to: 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

 

 

Message 12 of 25
Revitalizer
in reply to: Erik_Wu

Hi,

 

before invoking the Build method, you could check the input:

TessellatedShapeBuilder.DoesFaceHaveEnoughLoopsAndVertices(TessellatedFace)

 

 

Revitalizer

 

 




Rudolf Honke
Software Developer
Mensch und Maschine





Message 13 of 25
Erik_Wu
in reply to: Revitalizer

I did, actually all faces were just triangles, so I got no error during check.

Message 14 of 25
jeremytammik
in reply to: Erik_Wu

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



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 15 of 25
Erik_Wu
in reply to: jeremytammik

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

Message 16 of 25
jeremytammik
in reply to: Erik_Wu

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

 

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 17 of 25
Erik_Wu
in reply to: jeremytammik

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

Message 18 of 25
jeremytammik
in reply to: Erik_Wu

Dear Erik,

Thank you for your update and appreciation.

I asked the development team...

Thank you for your patience.

Best regards,

Jeremy

 

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 19 of 25
jeremytammik
in reply to: Erik_Wu

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
 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 20 of 25
Erik_Wu
in reply to: jeremytammik

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community