This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy, bmesh, mathutils | |
| # an example script of getting the boundary paths of selected faces on a mesh and outputting them in x,y cooridnates. | |
| # not sure what other people might do with it, but I found this a needed step in 2d-3d workflows | |
| # fn determine if vert is a boundary OF SELECTION vert | |
| def fnDetermineVertBoundary(objVert): | |
| if objVert.select == True: | |
| for objFace in objVert.link_faces: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| from mathutils import Matrix | |
| import bmesh | |
| ob = bpy.context.view_layer.objects.active | |
| def create_empty(coord): | |
| obj = bpy.data.objects.new('em', None) | |
| bpy.context.collection.objects.link(obj) | |
| obj.location = coord |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### blender addon template | |
| import bpy | |
| #used for file open browser | |
| from bpy_extras.io_utils import ImportHelper | |
| ####|| OPERATORS ||#### | |
| class HI_OT_DoStuff(bpy.types.Operator): | |
| bl_idname = 'do.go' | |
| bl_label = 'Do Stuff' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ### blender addon template | |
| import bpy | |
| #used for file open browser | |
| from bpy_extras.io_utils import ImportHelper | |
| ####|| OPERATORS ||#### | |
| class HI_OT_DoStuff(bpy.types.Operator): | |
| bl_idname = 'do.go' | |
| bl_label = 'Do Stuff' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| class EXAMPLE_panel: | |
| bl_space_type = "VIEW_3D" | |
| bl_region_type = "UI" | |
| bl_category = "Hi" | |
| bl_options = {"DEFAULT_CLOSED"} | |
| #The primary panel, no parents | |
| class EXAMPLE_PT_panel_1(EXAMPLE_panel, bpy.types.Panel): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| import bpy.utils.previews | |
| class HelloWorldPanel(bpy.types.Panel): | |
| """Creates a Panel in the Object properties window""" | |
| bl_label = "HI" | |
| bl_category = "HI" | |
| bl_idname = "HI_Panel" | |
| bl_space_type = 'VIEW_3D' | |
| bl_region_type = 'UI' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import bpy | |
| #define what the property in the colection will look like | |
| class scad_params(bpy.types.PropertyGroup): | |
| materialname: bpy.props.StringProperty(name="Material", default="") | |
| slot: bpy.props.IntProperty(name="Slot") | |
| #operator, connected the button that adds the params | |
| class HiOp(bpy.types.Operator): | |
| bl_idname = 'hi.go' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # List of common operations to run on imported objects like .stl | |
| # paste all or some into a script window in blender and run. | |
| # If there's any interest in seeing this in addon form somewhere let me know, it seemed too basic/common to be another addon to install. | |
| import bpy | |
| # resize objects imported that were unit=1mm and Blender is set at 1m | |
| bpy.ops.transform.resize(value=(0.001, 0.001, 0.001), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False) | |
| # toggle to edit mode for a few things | |
| bpy.ops.object.editmode_toggle() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*----====|| LIBRARY IMPORTS || ====----*/ | |
| //import React, { useContext,useEffect,useState } from 'react'; | |
| //import { Layout } from 'antd'; | |
| /*----====|| COPMPONENT IMPORTS || ====----*/ | |
| //import MyComponent from './components/myComponent.js'; | |
| /*----====|| CONTEXT || ====----*/ | |
| import {UserContext,ConfigContext} from '../context.js'; | |
| /*----====|| STYLE IMPORTS || ====----*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #example calling | |
| # arrVerts=[] | |
| # for objVert in objMesh.verts: | |
| # if objVert.select == True: | |
| # arrVerts.append(objVert) | |
| objScale= fnGetScale(arrVerts) | |
| print(objScale) | |
| def fnGetScale(arrVerts): |