From 5db8ebd59d75efdbd7522a289936e94c920847e9 Mon Sep 17 00:00:00 2001 From: jacopods Date: Fri, 2 Feb 2018 00:04:56 -0500 Subject: [PATCH] Project along the z when shrinkwrapping this reduces the legend deformations that are especially bad on the SA profile --- import_keyboard.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/import_keyboard.py b/import_keyboard.py index 6fb742c..f5d0177 100644 --- a/import_keyboard.py +++ b/import_keyboard.py @@ -1016,8 +1016,7 @@ def read(filepath): ] # the SA caps are thicker and we need to lift the label more - cap_thickness = 0.001 if key["p"] in [ - "DCS", "DSA"] else 0.004 + cap_thickness = 0.001 if key["p"] in ["DCS", "DSA"] else 0.008 try: # add text new_label = bpy.data.curves.new( @@ -1041,7 +1040,7 @@ def read(filepath): new_label.data.align_y = alignText[pos][1] new_label.location = [-1 * key["x"] - alignLegendsProfile( - key["p"])[0], key["y"] + alignLegendsProfile(key["p"])[1], 1] + key["p"])[0], key["y"] + alignLegendsProfile(key["p"])[1], 2] new_label.rotation_euler[2] = pi scn.objects.link(new_label) @@ -1058,6 +1057,13 @@ def read(filepath): new_label.modifiers["Shrinkwrap"].offset = 0.0005 new_label.modifiers[ "Shrinkwrap"].target = new_obj_tl + new_label.modifiers["Shrinkwrap"].wrap_method = 'PROJECT' + new_label.modifiers[ + "Shrinkwrap"].use_project_z = True + new_label.modifiers[ + "Shrinkwrap"].use_positive_direction = True + new_label.modifiers[ + "Shrinkwrap"].use_negative_direction = True new_label.to_mesh(scn, True, "PREVIEW") if legendLed: new_label.active_material = bpy.data.materials["led: %s" % @@ -1091,7 +1097,7 @@ def read(filepath): new_label.data.align_y = alignText[pos][1] new_label.location = [-1 * key["x"] - alignLegendsProfile( - key["p"])[0], key["y"] + alignLegendsProfile(key["p"])[1], 1] + key["p"])[0], key["y"] + alignLegendsProfile(key["p"])[1], 2] new_label.rotation_euler[2] = pi scn.objects.link(new_label) @@ -1106,6 +1112,13 @@ def read(filepath): bpy.ops.object.modifier_add(type='SHRINKWRAP') new_label.modifiers["Shrinkwrap"].offset = 0.0005 + new_label.modifiers["Shrinkwrap"].wrap_method = 'PROJECT' + new_label.modifiers[ + "Shrinkwrap"].use_project_z = True + new_label.modifiers[ + "Shrinkwrap"].use_positive_direction = True + new_label.modifiers[ + "Shrinkwrap"].use_negative_direction = True new_label.modifiers[ "Shrinkwrap"].target = new_obj_tl new_label.to_mesh(scn, True, "PREVIEW")