Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha implementation of lattice2 Roll Orient Mode #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lattice2PolarArray2.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def derivedInit(self,selfobj):
selfobj.UseArcRange = ['ignore', 'as Span', 'as Step']
selfobj.addProperty('App::PropertyBool', 'UseArcRadius', "Polar Array", "If True, and attachment mode is concentric, supporting arc's radius is used as array radius.")
selfobj.addProperty('App::PropertyEnumeration','OrientMode',"Polar Array","Orientation of placements. Zero - aligns with origin. Static - aligns with self placement.")
selfobj.OrientMode = ['Zero', 'Static', 'Radial', 'Vortex', 'Centrifuge', 'Launchpad', 'Dominoes']
selfobj.OrientMode = ['Zero', 'Static', 'Radial', 'Vortex', 'Centrifuge', 'Launchpad', 'Dominoes', 'Roll']
selfobj.OrientMode = 'Radial'
selfobj.addProperty('App::PropertyBool', 'Reverse', "Polar Array", "Reverses array direction.")
selfobj.addProperty('App::PropertyBool', 'FlipX', "Polar Array", "Reverses x axis of every placement.")
Expand Down Expand Up @@ -158,7 +158,7 @@ def derivedExecute(self,selfobj):
V( ),
V(-1, 0, 0)
))
elif selfobj.OrientMode == 'Launchpad':
elif selfobj.OrientMode == 'Launchpad' or selfobj.OrientMode == "Roll":
baseplm = App.Placement(V(), App.Rotation(
V( 0, 0, 1),
V( ),
Expand Down Expand Up @@ -191,7 +191,12 @@ def derivedExecute(self,selfobj):
output = [] # list of placements
for ang in values:
localrot = App.Rotation(App.Vector(0,0,1), ang * mm + angleplus)
localtransl = localrot.multVec(App.Vector(radius,0,0))
if selfobj.OrientMode == "Roll":
localtransl = localrot.multVec(App.Vector(radius,
-radius*((ang - 0.5*(max(values) - min(values)))*math.pi/180.0),
0))
else:
localtransl = localrot.multVec(App.Vector(radius,0,0))
localplm = App.Placement(localtransl, localrot)
resultplm = localplm.multiply(baseplm)
if is_zero:
Expand Down