使用blender脚本无法读取SVG文件并导出为JSON

时间:2016-09-12 15:01:17

标签: python-2.7 blender

以下是阅读svg文件并记录材料,mest等的blender脚本(2.77版)

import bpy
bpy.ops.import_curve.svg (filepath="test.svg")
bpy.ops.object.delete(use_global=False)
bpy.context.space_data.system_bookmarks_active = 1
bpy.ops.transform.resize(value=(5.38055, 5.38055, 5.38055), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.translate(value=(0, 5.83748, 0), constraint_axis=(False, True, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, release_confirm=True)
bpy.ops.transform.resize(value=(1.36144, 1.36144, 1.36144), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.rotate(value=1.5708, axis=(1, 0, 0), constraint_axis=(True, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)
bpy.ops.transform.translate(value=(0, 0, 9.82884), constraint_axis=(False, False, True), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, release_confirm=True)
bpy.ops.object.join()
bpy.data.materials.new("foo")
bpy.context.object.data.materials.append(mat)
bpy.context.space_data.context = 'DATA'
bpy.context.object.data.dimensions = '3D'
bpy.context.object.data.dimensions = '2D'
bpy.context.space_data.context = 'MODIFIER'
bpy.context.space_data.context = 'DATA'
bpy.context.space_data.context = 'MATERIAL'
bpy.context.object.active_material.diffuse_color = (0.239552, 0.239552, 0.239552)
bpy.context.space_data.viewport_shade = 'WIREFRAME'
bpy.context.space_data.viewport_shade = 'MATERIAL'
bpy.ops.object.convert(target='MESH', keep_original=True)
bpy.data.window_managers["WinMan"] = False
bpy.ops.object.convert(target='MESH', keep_original=False)
bpy.data.window_managers["WinMan"] = False
bpy.ops.object.convert(target='MESH', keep_original=True)
bpy.data.window_managers["WinMan"] = False
bpy.ops.object.modifier_add(type='EDGE_SPLIT')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="EdgeSplit")

以下是遇到的错误

AttributeError:' SpaceTextEditor'对象没有属性' system_bookmarks_action'

请提出前进的方法

由于 ASH

1 个答案:

答案 0 :(得分:0)

您应该检查调用system_bookmarks_action的位置。看来这应该是system_bookmarks_active。如果我搜索引用,则根本找不到system_bookmarks_actionhttps://www.blender.org/api/blender_python_api_2_77_release/search.html?q=system_bookmarks_action&check_keywords=yes&area=Default