OpenStreetMap Forum

The Free Wiki World Map

You are not logged in.

#126 2017-08-16 09:56:53

Registered: 2008-08-20
Posts: 250

Re: Kendzi3D - 3D Viewer as plugin for JOSM.

Looks like you are using webstart. From java 8 it require some additional sigh of components. I do not support it. Please try to use standalone version of JOSM.


#127 2017-08-17 11:18:18

From: Köln
Registered: 2008-05-24
Posts: 639

Re: Kendzi3D - 3D Viewer as plugin for JOSM.

Yes, I do. A few years ago I changed from updating manually to the webstart version.
I will try. Thanks for the hint.


#128 2017-08-18 06:16:33

From: Köln
Registered: 2008-05-24
Posts: 639

Re: Kendzi3D - 3D Viewer as plugin for JOSM.

Works. That was the issue. Thanks.


#129 2018-03-09 16:22:42

Registered: 2008-07-24
Posts: 6

Re: Kendzi3D - 3D Viewer as plugin for JOSM.

Hi all!
I experimented a bit with the Collada/DAE Export of Kendzi3D and I created two Blender/Python scripts which helped me to handle the objects a bit better. I'll share the scripts here in case somebody can make use of it.

Script 1 is "". The imported 3D models uses separate material names for each object. This script merges & renames all materials based on their texture name (file name) or Diffuse color if no texture is assigned. The script will work on all objects & materials in the blender project which follow the typical naming of ID__nnnnn:

import bpy
import re

scene = bpy.context.scene

# only search on own object materials
matchid = re.compile(r'^ID__(\d+|\d+\.\d+)$')	#match osm building objects
matchmat = re.compile(r'^ID_material_[0-9.]+$') 	#match osm material
cleanprefix = "mat_"

ids = [obj for obj in scene.objects if matchid.match(]


bpy.ops.object.mode_set(mode='OBJECT') #works only in Object mode

for ob in ids: = ob  #for bpy.ops.object.* methods to work
	remove_slots = []
	if ob.type == "MESH":
		print("obj: "
	mslots = [ for s in ob.material_slots] #just use names because slots may move because of append
	for sname in mslots:
		slist = [ms for ms in ob.material_slots if]
		if matchmat.match(sname) and (len(slist)>0):
			s = slist[0]
			print("  mat: "+sname)
			cleanMatName = ("%scolor_%02x%02x%02x" % (cleanprefix, int(255*dc[0]),int(255*dc[1]),int(255*dc[2])))
			if (s.material.active_texture is not None) and (s.material.active_texture.type=='IMAGE'):
#					print("    tex: "
				cleanMatName = cleanprefix +
			if sname!=cleanMatName:
				if is None:
					#doesn't exist -> make this the new "clean" material, just rename it
					print("     just rename -> "+cleanMatName) 
					#exists -> assign "wrong" material/faces to existing "clean" material and remove "wrong" material
					wrongMatName = sname
					cleanMat =
					# check if "clean" material is missing in objects materials
					if not (cleanMatName in [ for slot in ob.material_slots]):
						print("     add material slot for "+cleanMatName)
						#object s becomes invalid from here on
						#alternatives: = cleanMat or bpy.ops.object.material_slot_add()
					mat_list = [ for x in ob.material_slots] #"up to date" mat_list
					index_clean = mat_list.index(cleanMatName)
					index_wrong = mat_list.index(wrongMatName)
					print("      reassign "+wrongMatName+"->"+cleanMatName+" ",index_wrong, index_clean)
					print("      done")

					# get the faces which are assigned to the 'wrong' material
					faces = [x for x in if x.material_index == index_wrong]

					for f in faces:
						f.material_index = index_clean


	# now remove all empty material slots:
	for s in remove_slots:
		if s in [ for x in ob.material_slots]:
			print('  removing slot %s' % s)
			ob.active_material_index = [ for x in ob.material_slots].index(s)

#remove all non-used materials
for material in
	if (not material.users) and (matchmat.match(
		print(' removing material %s' %

The second script will try to join all meshes of i.e. a building. So it will join ID_100 with ID_100.001 and ID_100.002 etc. This will help reduce the number of objects and hopefully makes the handling of especially buildings easier:

import bpy
import re

def rename_uv(obj,name):
    for uvmap in
        if count==0:
   = name
   = ("%s_%03d" % (name,count) )

scene = bpy.context.scene

matchid = re.compile(r'^ID__\d+$')

ids = [obj for obj in scene.objects if matchid.match(]

for ob in ids:
    if ob.type == "MESH":
        for obj in #slow but make sure we begin with no selected objects
   = False
        print( + "\n")
        subobjs=[obj for obj in scene.objects if re.match("\\.\\d\\d\\d",]
        for subob in subobjs:
            if subob.type == "MESH":
                print(" +" + "\n")
       = True
        if count>0:            
   = True
   = ob


Last edited by wombatstampede (2018-03-09 16:31:23)


Board footer

Powered by FluxBB