 # How to set 30' of degree?

How to change 40’ of degree?
I want to set 40’ degree from 58’ degree.

How to change?

## Look at the below image.

Thank you.

40’ means forty feet (and 58’ means fifty-eight feet); I can’t imagine what it has to do with degrees in a circle.

Can you rephrase your question without the single quotes? I’m sure you don’t mean feet; do you mean percent?

I don’t know english well.
40’ means is Decimal Degree.
It’s 40’ Angular Dimensions.

I hope I understood the question.

Thank you.
But i want to change by blender python.

This is a bit more involved then just finding the angle, but had fun solving it.
To resume, i create a space based on the angle’s vertex position and both adjacent edges of the angle.
I move the 3 verts to this space where i create a vector of the desired angle from edge1, and intersect with the opposite edge to find the position. I then bring this new position back to object space and update the desired vertex.

You have to be in edit mode, then in order select the 3 vertices making the angle you want to change. The last vertex you pick is the one that will move. So A-B-C, where B is the vertex holding the angle you want to change, and C is the vertex you want to move.
Then just run the script.

``````

import bpy,bmesh
from math import *
from mathutils import *

C = bpy.context

class ChangeAngle :

o = C.active_object
bm = bmesh.from_edit_mesh(o.data)

triSpace = None #triangle space basis
anglePos = None #pos of vertex holding target angle

def __init__(self,newAngle):

#-- Create space aligned with target angle
self.triSpace = self.createSpace()
#-- Create vector representing new angle value
vec = self.createAngleVec(newAngle)
#-- find new vert position in triSpace
#-- intersect vector to opposite edge to find new position
pos = self.findPos(vec)
#-- Convert pos from trispace back to object
#-- set vertex position
self.setPos(pos)

bmesh.update_edit_mesh(self.o.data,False,False)

#to transform to and from triangle space
def createSpace(self):

v1 = self.bm.select_history
v2 = self.bm.select_history #target angle
v3 = self.bm.select_history

self.anglePos = Vector(v2.co)

xbasis = (v1.co - v2.co).normalized()
secEdge = (v3.co - v2.co).normalized()
zbasis = xbasis.cross(secEdge).normalized()
ybasis = zbasis.cross(xbasis)

return Matrix( [ xbasis , ybasis , zbasis ] )

def createAngleVec(self,Angle):
return v #in triSpace

def findPos(self,vec):

tsv = [] #2D verts in triSpace, relative to angle pos

for i in range(3):
v = Vector(self.bm.select_history[i].co) - self.anglePos
v = v * self.triSpace.transposed()
tsv.append(v.to_2d())

#Now working in 2D XY. Intersect opposite edge with new vector.
#opposite
op1 = tsv.y - tsv.y
op2 = tsv.x - tsv.x
op3 = (op1 * tsv.x) + (op2 * tsv.y)

#vec (point 2 is zero)
vc1 = vec.y
vc2 = 0 - vec.x
vc3 = 0

delta = (op1*vc2) - (op2*vc1)

interX = ( vc2*op3 - op2*vc3 )/delta
interY = ( op1*vc3 - vc1*op3 )/delta

return Vector([ interX , interY , 0.0 ])

def setPos(self,pos):

#2D triSpace pos back to object pos
newPos = (pos * self.triSpace)+ self.anglePos
self.bm.select_history.co = newPos

#--- TEST ---
# Set desired angle here
ChangeAngle(35)

``````
``````
import bpy
import bmesh
import math
from mathutils import Quaternion

mesh = bpy.context.active_object.data
bm = bmesh.from_edit_mesh(mesh)

p0 = bm.select_history
p1 = bm.select_history
p2 = bm.select_history

v0 = p0.co - p1.co
v1 = p2.co - p1.co
mag = v1.magnitude

v0.normalize()
v1.normalize()

axis = v0.cross(v1).normalized()

q = Quaternion(axis, angle)
p2.co = mag * (q * v0) + p1.co

bmesh.update_edit_mesh(mesh)

``````

Yes that works great too.
I just gave myself the extra trouble of conserving the opposite edge’s direction and the value of the angle opposite of the rotating edge. You know, for fun If that’s not necessary then this method is better (and cleaner).

imteresting code snippet

can this work in 3D or faces need to be parallel to main axis ?

thanks

@Ricky Both these scripts currently work in 3D