Search
 
SCRIPT & CODE EXAMPLE
 

LISP

elisp return type

import bpy
from mathutils import Matrix, Vector
import bmesh
context = bpy.context
obj = context.edit_object
mw = obj.matrix_world.copy()
bm = bmesh.from_edit_mesh(obj.data)
face = bm.select_history.active
o = face.calc_center_median()

axis_src = face.normal
axis_src2 = face.calc_tangent_edge()
axis_dst = Vector((0, 0, 1))
axis_dst2 = Vector((0, 1, 0))

vec2 = axis_src * obj.matrix_world.inverted()
matrix_rotate = axis_dst.rotation_difference(vec2).to_matrix().to_4x4()

vec1 = axis_src2 * obj.matrix_world.inverted()
axis_dst2 = axis_dst2*matrix_rotate.inverted()
mat_tmp = axis_dst2.rotation_difference(vec1).to_matrix().to_4x4()
matrix_rotate = mat_tmp*matrix_rotate
matrix_translation = Matrix.Translation(mw * o) #

obj2 = context.scene.objects.get("Cube.001")
obj2.matrix_world = matrix_translation * matrix_rotate.to_4x4()
Comment

PREVIOUS NEXT
Code Example
Lisp :: magit pull request 
Cobol :: gatsby with yarn 
Erlang :: erlang exit from shell 
Assembly :: docker cannot stop container 
Assembly :: x86 assembly hello world 
Assembly :: pycryptodome aes 256 cbc 
Assembly :: set assembly highligh vim 
Assembly :: undefined reference to `cv::inRange 
Assembly :: dd utility skip 
Assembly :: how to check whether a row contains a numeric value or not in df 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: js redirect to url new tab 
Javascript :: jquery set attribute readonly 
Javascript :: a href confirm javascript 
Javascript :: ajax cdn 
Javascript :: js replace space with underscore 
Javascript :: jquery check if element exists 
Javascript :: npm update all packages 
Javascript :: Finished. Please run Mix again. 
Javascript :: how to start json server in particular port 
Javascript :: allow paste js code 
Javascript :: angular validators number only in reactive form 
Javascript :: javacsript update text in span 
Javascript :: java sleep 1 sec 
Javascript :: regex pattern for positive numbers only 
Javascript :: hide header react navigation 
Javascript :: react navigation no header 
Javascript :: how to unmount bottom tab screens 
Javascript :: jquery button remove disabled attribute 
Javascript :: format money javascript commas 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =