I have several pieces of geometry, seemingly imported from some parametric modelling tool. They all have an ".ipt" in their object name. My original goal was to write a script that goes through all the objects in the scene, gets the object's dimensions, counts the number of vertices in a an object, compares it to the same parameters in the active object, and replaces object data if it finds a match. To that end I wrote the following:
from bpy import context
scene = bpy.context.scene
actob = bpy.context.selected_objects[0]
actobdat = bpy.context.selected_objects[0].data
ob = bpy.context.object
dimact = actob.dimensions
conapp = 0.007
actobvert = len(actobdat.vertices)
for ob in scene.objects:
dimob = ob.dimensions
obvert = len(ob.data.vertices)
if abs(dimact[1] - dimob[1]) < conapp and abs(dimact[2] - dimob[2]) < conapp and abs(dimact[0] - dimob[0]) < conapp and actobvert == obvert:
ob.select = True
ob.data = actobdat
In response to this I received the following error message: AttributeError: 'NoneType' object has no attribute 'vertices'
I did some searching online, but still failed to solve the issue. Any help would be greatly appreciated! Thank you!