Landxml file into Revit issue


I am trying find a good workflow to bring our Civil 3D surfaces into Revit via Dynamo. I am exploring using a LandXML file of a Civil 3D surface and bringing that into Dynamo, then into Revit. I used Jostein Olsen’s graph to see if that would work for me (Thank You Jostein!!) The graph seems to run fine except for the Mesh.ByPointsFaceIndices node, which comes back with the error message of:

“Warning: Mesh.ByPointsFaceIndices operation failed.
One or more IndexGroups supplied contained an out of bounds vertex index! All IndexGroup indices are zero-based and must be less than the number of vertices supplied.”

after some investigation I think I have found the problem and the IndexGroup.ByIndices two nodes upstream is showing a “D” index with values other than zero. I don’t know how to get the “D” index values to go to zero. any help would be appreciated. Thank you all for your time. I have enclosed some screen shots of what I am getting with my graph and revit model.


Hi @Mike_Tuter

Your connection a “null” value to “DirectShape.ByMesh”. Please provide the files and complete screenshots with list previews and error messages expanded. If you want others to understand your problem. Thanks :slight_smile:


I’d suggest either:

  1. The ‘site designer’ addin to Revit. Although it is a bit roughs around the edges, one of the Autodesk developers has done the hard work for you- can import a LandXML file as a Revit topo

  2. Export the points from the C3D surface, and import using standard Revit points import

  3. If you want to do it in Dynamo, use Topography.ByPoints node rather than directshape

Refer above- I haven’t got the scale right- but the one on the left is option 1.
Note that a quirk of Revit is that the edges are not correct- needs a quick ‘split surface’ to tidy up


1 Like

Do you really need it to be done via Dynamo?
To add to Andrew_Hannell’s Site designer suggestion I can suggest using Civil Structures. It is a very good plug in for importing XML from Civil 3D for both topography and roads.

I don’t quite agree with you Andrew. I, for one, think the way Revit handles construction of topographies is at best poor and although I’m sure the Site designer devs do their best, it really doesn’t work for me at all. Part of the reason is that the boundary of the topo get all messed up. secondary because Revit topos can’t have two points with the same X,Y although the Z-value is different. All in all I think a directshape isn’t that bad. Not for my usecases anyway, which is to provide some sort of reference of the landscape (often not done in Revit or by me at all.) See the same LandXML below imported as a direct shape and as a constructed Revit topography by Site designer. Which one do you think provide me with the best insight in design intent? :slight_smile:

@Mike_Tuter I’ve got no answer for you unfortunately without seeing more of your script.

1 Like

Hi @jostein_olsen

Yes, I agree Revit handling of topographies is ‘poor’- I don’t believe it has changed (improved) for several releases.
Autodesk need to address this and data exchange between applications such as C3D & Revit if they are serious about ‘BIM for Infrastructure

But the methods I outlined are an option, built in to Revit/C3D albeit with limitations.


1 Like

@Andrew_Hannell Thank you for your reply and suggestions.

I have tried site designer in the past for my topos, but never got it to work properly. I’m sure it is a mistake on my part, but every time I would bring in a landXML topo it would not be a the correct elevation and I would have to move it up a large distance. So large in fact I had to write a little Dynamo script to circumvent Revit’s maximum move limit of 30,000 feet.

I tried importing the surface points into the Revit topography directly, but my result was similar to the site designer topo. I thought @jostein_olsen graph would get me a more true representation of the topography.

Thank you again for your help!

Mike Tuter

@jostein_olsen thank you so much for your reply!

Your blog is a great resource for us newbs. Please keep it up! I have enclosed some more screen shots, my LandXML file in .txt format and the Dynamo graph. The problem I am seeing is that I should only have an “A”, “B” & “C” idex, but for some reason I have values in the “D” index aw well. any suggestions would be greatly appreciated.

Thank you!

Mike Tuter

MDC LandXML_Surface_Web.dyn (36.8 KB)

56-01-75_C-SP-04_Proposed_Composite_10-27-16.txt (51.7 KB)

any thoughts with the additional data I provided?

Yeah, I’m sorry Mike. It required a little sit down, and haven’t had much of that lately.
The workflow I set up was originally made for multiple surfaces, and I guess you don’t need that. Also I found that my script doesn’t work very well if there is gaps in the point ids from the civil 3D surface file since the index-grouping in the txt-file are pointing to these ids.

EDIT: Made some changes using dictionaries, should work better.

MDC LandXML_Surface_Web.dyn (32.9 KB)

1 Like

@jostein_olsen Great idea and work! To be honest I am a little of envious of you capabilities.
I tried your dyn script for multiple surfaces (I have two) and have still the same problem like Mike mentioned.

I don’t get it, why the index group generates the D value even though the are only three values in the list.
Do you hava any idea what the source of the malfunction might be?

I have to see more of your graph unfortunately to be able to tell. The D-value doesn’t matter.

Well, there you go. Attached the dyn file LandXML_Multiple_Surfaces.dyn (34.3 KB) and also the LandXML txt-fileSurfaces.txt (81.4 KB).

Thank you very much! :muscle:

Hi @jostein_olsen
I have another issue with the LandXML dyn script. Actually I’m not really sure if that is a problem with the dyn script or a general Revit problem.:thinking:
I have a simple LandXML file in Civil 3D

I use the regular export function of civil to generate the LandXML file. LandXML_File.txt (120.0 KB)
Using the dyn file which you posted here, thank you again for that, that rescued me by the way couple of times, I get that in Revit.
Do you think you can spend 5 minutes to check if you get the same result in Revit as I get? I would be really grateful for that. If you like, I can also send you the Civil 3D file, though I don’t think there is something wrong with the Civil file.
LandXML_Single_Surfaces.dyn (32.7 KB)

Hi, I get the same result unfortunately. I haven’t really got any good explanation for you, seems to be something fishy going on in the indexing of points pr face, since it can’t create some of the faces. I’ll check arounf a little bit more and let you know if I find anything.

Actually, it creates more faces than necessary. I can’t understand where those additional faces come from . There is no entry in the DTM in Civil 3D for that…Very strange.


I have also been working on the script provided by Jostein on an xml-file exported from Civil 3D. I encountered the same problem as you, and here is what I found out:

  1. For some reason, the xml-export from civil 3D includes deleted surfaces, recognised by i=“1” when you open the xml in notepad. Only the surfaces which do not have the i=“1” should be created in Dynamo, and hence the deleted surfaces should be filtered.

When extracting the number of faces I simply changed the search string from “<F” to “<F n”:

For the index groups, I created a boolean mask to lose the indexes of the deleted faces:

  1. The point index doesn’t always start with the number 1. Here the first id-number is 5:

I.e. the indexes will be out of bounds when the wrong number is subtracted. In Jostein’s script all indexes are subtracted by one, where in my case the correct number was five. I’ve also had xml-files where the point index started with one for some surfaces, and then five for others. So make sure to check the output of this node!

  1. The Mesh.ByPointsFaceIndices does not create a mesh if the input surface contains more than 1000 points. I have no other solution for this than to split the surfaces into smaller pieces in Civil 3D.

Side note: It is correct that the IndexGroup.ByIndices wrongfully creates a value D. However, Mesh.ByPointsFaceIndices does seem to work properly despite this. I have in any case reported the problem to the Dynamo team.

1 Like

Hi rnil,

great stuff. Would you mind sharing you dyn file here?

LandXML_Surface_Web.dyn (68.9 KB)

Of course.

Please note:

  • X and Y coordinates are switched
  • The script only handles point indices which either start at 1 or 5. If your indices start with other numbers, change the input to List.ContainsItem and the function “subtractcorrect”, see screen shots. Or enhance the code :slight_smile:


Thank you very much! I think there are much more people fighting with exact this problem.
Fur my purpose it was much more important to have the ability to set different materials during the export. This is why I changed the script from @jostein_olsen to “importing only one single surface” and adopted your filtering routine.
LandXML_Single_Surfaces.dyn (40.7 KB)

I think it is less complex and no problems with point indexes. The only think you’ll have to do is to export the LandXML files seperatly from CIVIL 3D. I think one usually does not have 20 different surfaces to import :wink:

But again, thank you for your help!