Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import bpy
import math
# それぞれの建物メッシュの原点からの距離を計算した結果を格納する
distance_lists =[]
# 各メッシュのx,y座標
pos_lists =[]
# Blenderに表示されている全てのメッシュxとy座標を取得して、distanceを計算して配列に格納する
for obj in bpy.context.view_layer.objects:
if obj.type == 'MESH':
pos_lists.append([obj.location.x,obj.location.y])
distance = obj.location.x * obj.location.x + obj.location.y * obj.location.y
distance_lists.append(math.sqrt(distance))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment