I did similar import from different format and different purpose, so now I have Iropython script for M9 that was easy enought to adapt to your case. I have not tested it at all, so expect some errors. I use properties of certain table [00_Constants] to define projectwise constants. That way the constants are accessible from scripts and queires alike. # IronPython from System import Array querytemplate = """ INSERT INTO [T4 Result] SELECT VectorValue(GeomCoordXYZ([Geom], 0), 0) AS [X], VectorValue(GeomCoordXYZ([Geom], 0), 1) AS [Y], VectorValue(GeomCoordXYZ([Geom], 0), 2) AS [Z], [CLASSIFICATION], [GEOM] FROM [<LAS>]::[<LAS>] WHERE [CLASSIFICATION] = <CLASS> ; """ def Main(): app = Manifold.Application db = app.GetDatabaseRoot() LASFirstNumberFrom = int(db.GetProperty('00_Constants', 'LASFirstNumberFrom')) LASFirstNumberTo = int(db.GetProperty('00_Constants', 'LASFirstNumberTo')) LASLastNumberFrom = int(db.GetProperty('00_Constants', 'LASLastNumberFrom')) LASLastNumberTo = int(db.GetProperty('00_Constants', 'LASLastNumberTo')) LASFileNameBeginsWith = db.GetProperty('00_Constants', 'LASFileNameBeginsWith') LASNumberFormat = len(db.GetProperty('00_Constants', 'LASNumberFormat')) LASFirstNumber = range(LASFirstNumberFrom, LASFirstNumberTo+1) LASLastNumber = range(LASLastNumberFrom, LASLastNumberTo+1) class = int(db.GetProperty('00_Constants', 'LASImportClass')) ### If not one range then list all block numbers and uncomment next line #LASFirstNumber = [18,20] #LASLastNumber = [35,36,38] for f in LASFirstNumber: for l in LASLastNumber: las = block_prefix + str(f).rjust(LASNumberFormat, '0') + str(l).rjust(LASNumberFormat, '0') app.Log("Reading las " + las) text = querytemplate.replace("<LAS>", las).replace("<CLASS>", class) try: cmd = db.RunCompile(text) except: app.Log(las + " does not exist ") else: with db.Run(text) as table: with table.SearchAll(Array[str]([ "result" ])) as sequence: sequence.Fetch() # fetch the only record app.Log(str(sequence.GetValues()[0].Data) + " points (class " + str(class) + ") inserted from " + las) Attachments: Lidar_point_cloud_py_import_script.mxb
|