Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Created July 25, 2021 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flushpot1125/4d9adb72233f2d6a643104884372a286 to your computer and use it in GitHub Desktop.
Save flushpot1125/4d9adb72233f2d6a643104884372a286 to your computer and use it in GitHub Desktop.
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