Filenames - Mesh names when importing files and filenames for export of multiple clouds

If you are allergic to bug trackers, you can post here any remarks, issues and potential bugs you encounter
Post Reply
m_clouds
Posts: 6
Joined: Thu Nov 23, 2023 9:31 am

Filenames - Mesh names when importing files and filenames for export of multiple clouds

Post by m_clouds »

Hello everyone,
I have some questions concerning the naming conventions of imported and exported files.

Concerning the import of multiple meshes
I have a folder with multiple meshes (.ply files) and use a command line script to regroup them into one single .bin file. The .ply files have all different names, but once regrouped into a single .bin file, all meshes are simply called "Mesh" with no other way to distinguish them in the DB Tree.
Illustration_Meshes_Bin.jpg
Illustration_Meshes_Bin.jpg (18.46 KiB) Viewed 451 times
Is it possible to import the meshes while keeping the filenames referenced?

I used following code to import the ply files

Code: Select all

set Directory=[DirectoryToFiles]
set PathCC=[PathToCloudCompare]
setlocal enabledelayedexpansion
set Open_Ply_Files=
set "Folder_Ply_Files=%Directory%Ply_Files\*.ply"
for %%f in ("%Folder_Ply_Files%") do (
	if not defined Open_Ply_Files (
		set "Open_Ply_Files=-O %%f"
	) else (
		set "Open_Ply_Files=!Open_Ply_Files! -O %%f"
	)
)

cd /D %PathCC%
CloudCompare -SILENT -AUTO_SAVE OFF -NO_TIMESTAMP %Open_Ply_Files% -SAVE_MESHES ALL_AT_ONCE FILE "%Directory%All_Scans_Meshes.bin"
Concerning the export of multiple .asc files
I use the command line to open a .bin file with multiple clouds and export them one by one as .asc files.
The original .bin file has following DB Tree structure
Illustration_BinFile.jpg
Illustration_BinFile.jpg (18.59 KiB) Viewed 451 times
To export the files, I provide filenames, creating a list of names.

Code: Select all

setlocal enabledelayedexpansion
set NumberOfClouds=14
set /a "ScanNumber=%NumberOfClouds%-1"
set Names_List=
for /L %%i in (%ScanNumber%,-1,0) do (
	if %%i LSS 10 (
		if not defined Names_List (
			set "Names_List=%Directory%S0%%i"
		) else (
			set "Names_List=!Names_List! %Directory%S0%%i"
		)
	) else (
		if not defined Names_List (
			set "Names_List=%Directory%S%%i"
		) else (
			set "Names_List=!Names_List! %Directory%S%%i"
		)
	)
)
set Names_List="%Names_List%"
Then, I call CloudCompare

Code: Select all

cd /D %PathCC%
CloudCompare -SILENT -AUTO_SAVE OFF -NO_TIMESTAMP -O %FILE_PATH% -C_EXPORT_FMT ASC -SAVE_CLOUDS FILE %Names_List%
This successfully creates following files
Illustration_Created_Asc_Files.jpg
Illustration_Created_Asc_Files.jpg (15.43 KiB) Viewed 451 times
If no filenames are provided, the export does not reference the individual cloud name, but only the .bin filename followed by the numerical suffix.
Is it possible, instead of having to create an exhaustive list of names, to have the name of the specific cloud (eg. Scan13) used as name for the exported file?
If not, is there an option to omit the automatic addition of the numerical suffix if I provide an exhaustive list of filenames?
As a sidenote, I noticed that the file extension should not be mentioned in the Names_List since the export automatically adds a numerical suffix, and if the file extension is already given, it adds the suffix after the extension (eg. S00.asc_13).

Thank you in advance for any help or insight :)
daniel
Site Admin
Posts: 7717
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Filenames - Mesh names when importing files and filenames for export of multiple clouds

Post by daniel »

Ok, so the fact is that things are currently fairly simple as they are generic and have to work for all formats:
- when a file is opened, a group with the filename is created, and all entities found inside the file (there can be one of a single type, but there can a lot of entities of different types) will all be created inside this group (with 'type' as base name, plus an index if there are multiple of them). Some formats store a name for each entity, in which case we will try to use it
- the command-line tool lods one or several files, and stores all the entities in 2 buckets (clouds or meshes). The original filename is stored for each entity, but it's not used to name the entity. It's currently used by the AUTO_SAVE command when no custom name is provided. I guess you could add a CLI option to transfer the base filename to the entities (if any).
- and batch-saving multiple files at once is almost never supported, apart for the ASCII format (because someone implemented it specifically). This can also be implemented for some other formats, but sadly this is something that has to be done for each individual format (as CC shows only the formats that can support and save the current selection of entities). Else we would have to change things quite a bit, or have a dedicated saving option, to make it a more generic behavior.
Daniel, CloudCompare admin
Post Reply