Google Sketchup import script

Hi all!

Today I installed Google Sketchup in my Ubuntu Linux 6.06 (thanks WINE)!
Works fine, (with exception of the menu) but the only export options is Google Earth and Google Sketchup(KMZ).

http://img90.imageshack.us/img90/218/gs04kr0.th.png

But, since Google released the format of KMZ files (using a bad Collada file) the JMS script don’t work anymore.

Anyone have any news about that ??

Regards,
Dalai Felinto
Rio de Janeiro - Brasil

PS;: sorry my BABELFISH english :wink:

use simple google earth export instead of the ‘google earth 4’ .

I’m trying to import the edges too (just like I talked before).

The work is going well, but I have a question - what this function do:


def cree_FORME(v,TESSEL) :
            VE=[(v[0]-DOCUMENTORIGINE[0])* 85331.2,
                   (v[1]-DOCUMENTORIGINE[1])* 110976.0,
                    (v[2]-DOCUMENTORIGINE[2])  ]
            TESSEL.append(VE)

Or better: of where they come these values (85331.2 and 110976.0)?

I will apreciate any help.

Regards,
Dalai
sorry the english again

These 2 constants are needed to give a visual thickness in Blender .

I exported a cube of 1x1x1 meter from sketchup and found with a very simple equation how the x, y and z should be multiplied to get a cube of 1.0 x 1.0 x 1.0 in blender .

Is too much hard!

Well, the file with some changes is here:
http://www.casadosonho.art.br/3D/kmz_ImportWithMeshandLines_19.py

But still don’t work :(:confused::confused::confused::confused::confused:

For today it is enough.

Thanks jms, regards,
Dalai Felinto
EDIT: Any help will be very apreciated :slight_smile:

Could you post me a few examples of file with edges ?

http://jmsoler.free.fr/util/blenderfile/py/kmz_ImportWithMesh_Z018d.py
modified version which creates a mesh with all the edges and broken lines found in the file .

I did a few tests with dxf 2d files imported in Google Sketchup and reexported in simple kmz . It seems to work rather well .

Look at theses files:
http://www.casadosonho.art.br/3D/planta_baixa.dwg
http://www.casadosonho.art.br/3D/planta_baixa.kmz
http://www.casadosonho.art.br/3D/planta_baixa2.kmz

Can you see the difference? If some “geometry”(i.e. faces) is in file, then the importation is ok, else (a pure 2D file) the importer doesn’t work.
The problem is in the code below:

        if POLYGON_NUMBER==0 :

And an automatic “remove double” will be fine too.

Anyway, my dream is becaming true :slight_smile: import DWG in Blender
http://www.casadosonho.art.br/3D/screen_gs.jpg

Merci beaucoup jms,
au revoir :wink:
Dalai Felinto

The first file seems to be damaged . But not a big problem, i could do something with the two others :
http://jmsoler.free.fr/didacticiel/blender/tutor/py_import_kml-kmz_en.htm#kmz_Mesh_complete_import-0.1.9

Thanks jms,
the script is beautifull :slight_smile:

Now I can recommend Blender for all of my student collegues without the frustation in importing CAD files.

This newness deserves a notice in the BlenderNation.

This kind of thing makes me fill very happy in using Open Source and help (a little help from my part, I know ;)).

Good night (in Brasil is 21:00)!
And goob bye,
Dalai Felinto

Not ended : I will add an option to deselect “free edges” management .
Basic users mainly need to import polygons quickly .

JMS, some advice instead of adjusting the script

Set Vertex mode in python with
Blender.Mesh.Mode(Blender.Mesh.SelectModes.VERTEX)

use more of blenders functions- Blender.sys.sep rather then importing nt or posix, seems overkill anyway.

[O.select(0) for O in Blender.Object.Get()] - use the scenes objects only.

your updating the mesh in a loop which is a bit inefficient, would be worth working out a way not to do this.

Do you really believe that I import nt or posix just for the separator ?
:slight_smile:

Recall : the module Blender.sys (which is just a double and, in fact, re-level to nt and posix modules ) makes the scripts unusable on PowerPC G3/G4 and MorphOS . This is already in the bug tracker . It seems that this part of the current guidelines aims to prevent the use of the bundle scripts on non-conventional OS .

Guillaume “Yomgui” Roguez, maintainer of the blender portage on Morphos, already asked me to do not use this Blender.sys and directly work with the python’s official os and os.path modules .

Please, do not forget to what kind of results you are going to with this kind of advises :

http://cobalt3d.free.fr/didacticiel/blender/tutor/images/python/kml_import/cambo_import.jpg

MorphOS - is unsupported, the maintainer needs to address this bug.
Guillaume “Yomgui” Roguez needs to fix this, sure this importer may work, but a whole lot more in blender will not.

of course removing me.update() cant be done thaughtlessly, best way to do it is to have a dummy mesh for filling that you reuse, that way editmode enter/exit is fast. and you only have to update the NMesh once.

The NMesh version (the version for true security data ) was not updated since the 0.1.4 one .

New version is coming …

You miss the point about secure data-
It dosent realy even apply to an importer because an importer dosent modify existing data.

Data safty is only an issue for scripts that are improperly use the api - Leaving the users mesh modified withoput finishing or distroying teh data,
scripts that correctly use Mesh are just as safe as NMesh.

I don’t think so .

It dosent realy even apply to an importer because an importer dosent modify existing data.

Should not but it could .

Data safty is only an issue for scripts that are improperly use the api -

Chances to improperly modifiy data are tragicaly higest, without any rescue, with Mesh . Thing that you absoloutely do not want to understand .

Leaving the users mesh modified withoput finishing or distroying teh data,
scripts that correctly use Mesh are just as safe as NMesh.
In french : “des salades !”

In fact, your project is to do not let the choice to the user : use Mesh or nothing . But this means that users will loose their time to make a data copy when NMesh did it automatically . In fact, as I already said in an other thread, NMesh works as Blender works internaly, making a copy for editing and Mesh doesn’t .