Import LandXML surfaces

Cobbled together an add-on to import TIN surfaces from LandXML. Probably limited use to most but thought I’d throw this out.
Takes a LandXML 1.0 compatible export file from Bentley Inroads and parses the surfaces in the file and creates a mesh from the vertice and triangle information. Other CAE packages use different versions of the LandXML spec so this likely is useful only for a surfaces exported from Bentley Inroads.
LandXML schema can be found at http://landxml.org along with example files.
Inspiration from svg importer by JM Soler & Sergey Sharybin.

Updated for 2.72
io_LandXML.zip (3.55 KB)

I know this is a very old thread but it seems your plugin would do exactly what I need. I am using a total station to get a point cloud that I have been putting through several bits of software to get an FBX file that I can then import into blender so I can make my models. this script looks like it would cut down my workflow considerably but i can seem to get it working, which version of blender does this work on?

I’ve updated the script for 2.72. Hopefully it works for you.

Attachments

io_LandXML.zip (3.55 KB)

see OP for updated script

Hello tomburford,

I need a similar workflow to yours (weird coincidence I suppose)… I’ve looked quickly at the importer code linked here (just the source, haven’t tried running it) and one issue it would have in this workflow is that the importer is assuming that the landXML file contains surfaces, when in fact what will come out of a total station is just a series of points (CgPoint entries in landXML).

The importer should be easily modifiable to handle this. If you or someone you know has basic python knowledge and tackles this issue, let me know. Otherwise I might try my hand at it.

ericplante is correct. The script assumes you have a triangulated surface. If you don’t have the triangulated surface pretty easy to modify the script to just pull in the points. Another alternative is to use the Sverchok add-on. It’s pretty easy to setup a point import from a CSV file and it even can run a convex hull or delaunay triangulation if needed.

Hi again tomburford anc civis,

I playedaround with the landxml importer and made this version (included in this post) which will import points rather than surfaces. Thanks civis for the original code and showing me how to (1) write code in Python and (2) write an importer for Blender. :slight_smile:

io_LandXML_points.zip (5.59 KB)

Thank you Civis for the script. I have used it successfully to import surfaces created in Civil3D and exported as XML.
With regard to the size of points/info that the script can handle, I successfully imported a 190MB triangulated surface (1.5M polys). It took a few minutes though. I also went into the script and added a transform in the loop for the coordinates import to center my surfaces around the origin in Blender. I looked into the blender manual for a way to change the origin but did not find any. For people who want some sort of accuracy this may be necessary as in some coordinate systems the vertex coordinates can have very high values (in my case they are in the 6,000,000 range). Without the transform, they will import into Blender but they will lose accuracy as the coordinate values are rounded due to their size (mine were being rounded in .5 increments). I think this has to do with an actual limitation of the size (in terms of digits) of the Float variable. Anyway as it applies to us, if the values get beyond the 1,000,000 they start losing practical accuracy. Anybody that is interested can check that out at: https://www.blender.org/manual/advanced/limits.html
I was thinking of maybe adding variables for those transforms and trying to define them externally from the script along with a UI input to modify them prior to running the import, but that is more programming than I know.

Thanks again.

Thanks for this module. It’s hard to find software that can load LandXML files. I tried it on Blender 3.0.1 from Ubuntu 22.04, but learned that the module needs to be updated to support Blender 2.8 (and above, I guess). Knowing nothing about Blender or the add-on API, I Googled my way through updating everything to the Blender 2.8 way and got it working. If you are interested, I can share the updated module. Only, I couldn’t do it right away since, apparently, I can not upload attachments as a new user.