Thank you!
edwilliams16 wrote:...There's a bug here if the initial angle is less than 1 degree...
It is not possible to rotate using the original macro in less than 1 degree:
class 'TypeError'>: 'float' object cannot be interpreted as an integer
and it works fine for 1 degree rotated assembly, so I think this is non-issue?
edwilliams16 wrote:....It's also inefficient to move in 1 degree chunks...
1 degree is perhaps extreme
, but...
- (at least for my original macro) I used 1 degree increment because I wanted to rotate with 1 degree precision
how do you rotate to (for example) 237 degrees if your increments are 20 degrees?
- in case of your macro (return to O degree) I guess it is not an issue?, but...
- both macros have adavantage of doing things in small increments to make assembly solver life easy.
too big jumps totally confuse the solver
- if it was that simple, I could simply manually modify value of "Angle" for the "Constraint016" in Property view...
works OK for small increments, but goes totally wobbly for bigger ones
(hence my desire for macros which take away the tedium of manually rotating at small increments)
edwilliams16 wrote:Code: Select all
angle = FreeCAD.ActiveDocument.getObject("Constraint016").Angle
nsteps = int(abs(angle)//20) + 1
steps = [m*angle/n for m in list(range(0,nsteps))][::-1]
for ang in steps:
FreeCAD.ActiveDocument.getObject("Constraint016").Angle = ang
Gui.runCommand('asm3CmdQuickSolve',0)
FreeCADGui.updateGui()
rotates in 20 degreechunks.
I am afraid
this one doesn't work...
line 18, in <listcomp>
steps = [m*angle/n for m in list(range(0,nsteps))][::-1]
<class 'TypeError'>: unsupported operand type(s) for /: 'float' and 'str'
edwilliams16 wrote:There may be an issue here if FreeCAD.ActiveDocument.getObject("Constraint016").
Angle returns its value in radians, not degrees. Can you check that?
- angle.jpg (37.04 KiB) Viewed 2018 times