Skip to content

Commit

Permalink
feat: add a dynamic relationship between inner radius and width param…
Browse files Browse the repository at this point in the history
…eters, for more predictive results, and better ring generation
  • Loading branch information
tristan-hm committed Jan 31, 2022
1 parent 2831254 commit 03b15f6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions generators/ring_and_bolt.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ def modal(self, context, event):
elif self.key_step_down:
if self.key_alt:
self.inner_radius = max(0, self.inner_radius - inner_radius_factor)
self.width = max(self.inner_radius * -0.5, self.width)
elif self.key_ctrl:
self.width = max(0, self.width - width_factor)
self.width = max(self.inner_radius * -0.5, self.width - width_factor)
elif self.key_no_modifiers:
self.segments = max(3, self.segments - segment_factor)

Expand Down Expand Up @@ -132,6 +133,7 @@ def add_screw_z_modifer(self):
screwZ.render_steps = self.segments
screwZ.use_merge_vertices = True
screwZ.merge_threshold = 0.0001
screwZ.use_normal_calculate = True

self.screwZ = screwZ

Expand Down Expand Up @@ -178,7 +180,7 @@ def draw_text_callback(self):

draw_property(
self,
"Width: {0:.1f}".format(self.width * 2000),
"{0}: {1:.1f}".format("Width" if self.inner_radius > 0 else "Radius", self.width * 2000),
"Ctrl (±{0:.1f}) | Shift + Ctrl (±{1:.1f})".format(self.base_width_factor * 1000, (self.base_width_factor / 10) * 1000),
active=self.key_ctrl,
alt_mode=self.key_shift_ctrl)
Expand Down

0 comments on commit 03b15f6

Please sign in to comment.