← Back to team overview

kicad-developers team mailing list archive

[PATCH] Better import of wrl files

 

Hi,

i made some 3d models with openscad and converted them via meshconv to wrl , but i had some difficulites because the format is a little different in organization. Group/Def and some other tags. It's hard for the user to determine why kicad dont show the added wrl file.

The patch is based on bzr revision: revno: 3874 on branch testing


Bye
Georg
=== modified file '3d-viewer/3d_read_mesh.cpp'
--- 3d-viewer/3d_read_mesh.cpp	2012-08-26 13:59:55 +0000
+++ 3d-viewer/3d_read_mesh.cpp	2013-01-01 10:12:14 +0000
@@ -93,7 +93,7 @@
     {
         text = strtok( line, sep_chars );
 
-        if( stricmp( text, "DEF" ) == 0 )
+        if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0)
         {
             while( GetLine( file, line, &LineNum, 512 ) )
             {
@@ -144,7 +144,7 @@
         return 0;
     }
 
-    if( stricmp( command, "DEF" ) == 0 )
+    if( stricmp( command, "DEF" ) == 0 || stricmp( command, "Material") == 0)
     {
         material = new S3D_MATERIAL( this, mat_name );
 
@@ -478,6 +478,12 @@
             continue;
         }
 
+        if( stricmp( text, "solid" ) == 0 )
+        {
+            // ignore solid
+            continue;
+        }
+
         if( stricmp( text, "colorIndex" ) == 0 )
         {
             while( GetLine( file, line, LineNum, 512 ) )


Follow ups