def config_units(): C.scene.unit_settings.scale_length = SCALE_LENGTH C.scene.unit_settings.length_unit = LENGTH_UNIT C.scene.unit_settings.mass_unit = MASS_UNIT “C” and “D” are Blender Python standards to alias “bpy.context” and “bpy.data”, objects which get used… frequently. The “addon_utils” functions will get used to enable the 3D Printing tools. Remove Default Scene objects import bpy from addon_utils import check, enable C = bpy.context D = bpy.data SCALE_LENGTH = 0.001 LENGTH_UNIT = ‘MILLIMETERS’ MASS_UNIT = 'GRAMS' CLIP_END = 100000 PRINT_UTIL = “object_print3d_utils” Ensure that the official 3D Print Tools Add-on is enabledĥ. Configure the Viewports to display at the updated scaleĤ. Change the Scene scale & units from Meters to Millimetersģ. For full debugging, you’ll have to tab over to the CLI where Blender was launched. The default workspace includes a Console and an Info Panel that reflects the underlying Python executed by actions taken in the GUI. It’s also worth going into Edit > Preferences > Interface and enabling the Python Tooltips checkbox. Because this will vary with OS, check Blender’s documentation for yours: Launching from the Command Line.įor convenience, all of the screenshots I’m including show the Blender Scripting environment - but any text editor works. Finally, turns out this is a pretty good way to start learning the Blender Python API.įor full access to the debugging output generated in the Python script, launch Blender from the command line. I assume I’m not the only one, but even if that were the case, it would still be worth writing down these notes to help future-Jim.īlender is great for 3D Printing, but configuring the environment each time is tedious - and clicking back and forth between Blender and YouTube trying to remember all of the settings to change wasn’t cutting it. Besides, writing this kind of boilerplate-useful code is 1000% the type of thing I tend to do, then forget how I did. Time to start changing both those conditions. Writing tutorials is good - and I haven’t been doing it repetitive clicky-draggy thing things are bad, and I’ve been doing it too much. Launch Blender for 3D Printing via Python
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |