43
« on: April 08, 2015, 09:00:32 AM »
Hello
I have a personal toolbox (code see bolow)
scince update to 1.1, the toolbox does not work. that means the comands from the toolbox (Smooth & boundingbox...)
does anyone have the same problem or know what I should do?
****************************************************************************************************************************
import PhotoScan, math
def main():
doc = PhotoScan.app.document
chunk = doc.activeChunk
if chunk.model:
x = PhotoScan.app.getInt("Input number of smoothing steps:", 3)
chunk.smoothModel(x)
print("Smoothing by script finished.")
return 1
else:
print("No model. Script aborted.")
return 0
PhotoScan.app.addMenuItem("ristag/Smooth model", main)
thanks!
def rotateBb():
doc = PhotoScan.app.document
chunk = doc.activeChunk
T = chunk.transform
v = PhotoScan.Vector( [0,0,0,1] )
v_t = T * v
v_t.size = 3
m = chunk.crs.localframe(v_t)
m = m * T
s = math.sqrt(m[0,0]**2 + m[0,1]**2 + m[0,2]**2) #scale factor
R = PhotoScan.Matrix( [[m[0,0],m[0,1],m[0,2]], [m[1,0],m[1,1],m[1,2]], [m[2,0],m[2,1],m[2,2]]])
R = R * (1. / s)
reg = chunk.region
reg.rot = R.t()
chunk.region = reg
PhotoScan.app.addMenuItem("ristag/Bounding box to coordinate system", rotateBb)