{"id":20896,"date":"2018-09-10T09:55:08","date_gmt":"2018-09-10T13:55:08","guid":{"rendered":"https:\/\/blogs.solidworks.com\/tech\/?p=20896"},"modified":"2019-01-09T16:12:50","modified_gmt":"2019-01-09T21:12:50","slug":"modeling-challenge-sketching-an-approximate-sine-wave","status":"publish","type":"post","link":"https:\/\/blogs.solidworks.com\/tech\/2018\/09\/modeling-challenge-sketching-an-approximate-sine-wave.html","title":{"rendered":"Modeling Challenge &#8211; Sketching an Approximate Sine Wave"},"content":{"rendered":"<p><span style=\"color: #999999\"><i>* This is one of a series of <\/i><a style=\"color: #999999\" href=\"https:\/\/blogs.solidworks.com\/tech\/category\/modelingchallenge\"><i>modeling challenges<\/i><\/a><i> you can use to test your SOLIDWORKS skills. \u00a0First, read the challenge and try to figure out a solution on your own. \u00a0Then, compare your solution with my good, better, and best recommendations. \u00a0As always, feel free to share even more tips and tricks in the comments below.<\/i><\/span><\/p>\n<p>Let me start off with a disclaimer as I know I\u2019m tip-toeing on shaky grounds considering the engineering audience that frequents this blog. \u00a0In fact, our Product Development team would be the first to cry out, \u201cIt\u2019s mathematically impossible to represent a sine wave (any part of it) with a Bezier curve!\u201d (as I intend to do). \u00a0I know, because that\u2019s exactly what they told me. So please take note of the word \u201capproximate\u201d in the title of this blog post. My goal is to show you the quickest and easiest way to sketch an approximation of a sine curve. \u00a0\u00a0If you\u2019re looking for an empirical sine curve to use to design ultra-precise cams, I would suggest checking out some of our <a href=\"https:\/\/www.solidworks.com\/sw\/products\/engineering-software-partners.htm\">Partner Products<\/a> like <a href=\"https:\/\/camnetics.com\/camtrax64\/index.htm\">CamTrax for SOLIDWORKS<\/a>. \u00a0If you\u2019re cool with \u201cpretty darn close\u201d, then carry on.<\/p>\n<h1><b>Equation Driven Curve<\/b><\/h1>\n<p>One of the first tools I turned to was our <a href=\"https:\/\/help.solidworks.com\/2018\/english\/solidworks\/sldworks\/c_equation_driven_curves.htm\">Equation Driven Curves<\/a> which were introduced in 2009. \u00a0Both explicit and parametric equations can be used to drive the geometry on a 2D plane or within a 3D sketch. \u00a0In our case, I\u2019d just like to sketch half a period of a sine wave starting at the maximum negative amplitude and back up to the peak of the maximum positive amplitude (see below). \u00a0Stringing together a sequence of these sine curves is a popular practice for designing an initial 2D layout of a cylindrical cam.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-20897 size-large\" src=\"https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Sine-Wave-half-period-615x461.png\" alt=\"\" width=\"615\" height=\"461\" srcset=\"https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Sine-Wave-half-period-615x461.png 615w, https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Sine-Wave-half-period-300x225.png 300w, https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Sine-Wave-half-period-768x576.png 768w, https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Sine-Wave-half-period-728x546.png 728w, https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Sine-Wave-half-period.png 1024w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><\/p>\n<p>To make this happen, we\u2019ll have to dust off our math books and recall that a sine wave function looks something like this: \u00a0Y(x) = A * sin(Bx + C) where A is the amplitude, B is the angular frequency, and C is the phase\u2026 yada, yada, yada. Typically, too much for my simple mind to remember. \u00a0All I care about controlling is the overall height (a.k.a. the amplitude) and the length (a.k.a. the period). Anytime you want to simplify and centralize the inputs that control your CAD model, consider using <a href=\"https:\/\/help.solidworks.com\/2018\/english\/solidworks\/sldworks\/c_global_variables.htm\">Global Variables<\/a> (and in this case, <a href=\"https:\/\/help.solidworks.com\/2018\/english\/SolidWorks\/sldworks\/HIDD_EQUATION_MANAGER.htm?id=b9732201ede24c2ab67aa943d9a1229d#Pg0&amp;ProductType=&amp;ProductName=\">Equations<\/a> too). \u00a0That way, I can save this as a template and use it over and over again by tweaking a couple of Global Variables rather than having to recreate it from scratch.<\/p>\n<ol>\n<li>Open the <a href=\"https:\/\/help.solidworks.com\/2018\/english\/SolidWorks\/sldworks\/t_accessing_equations_dialog_box.htm?id=5efa6f38c23f43b3ab2f16baf3345af9#Pg0&amp;ProductType=&amp;ProductName=\">Equations dialog box<br \/>\n<\/a><span style=\"color: #999999\"><i>I use equations a lot, so I recommend adding this button to my top toolbar (where the New Document, Save, and Print buttons are located) so it\u2019s always easily accessible.<\/i><\/span><\/li>\n<li>Create two Global Variables for our primary inputs &#8211; \u201cLENGTH\u201d and \u201cHEIGHT\u201d<br \/>\n<span style=\"color: #999999\"><i>Type any name you prefer and the current value.<\/i><\/span><\/li>\n<li>Create a Global Variable for each variable of the sine wave function &#8211; \u201cA\u201d, \u201cB\u201d, and \u201cC\u201d<br \/>\n<span style=\"color: #999999\"><i>Mathematical equations can be created by referencing other global variables, custom properties, or dimensions. \u00a0To make it easier for you to recall the method to your madness, always make sure to add helpful comments to your equations.<br \/>\n<\/i><\/span><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-20898 size-large\" src=\"https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equations-Dialog-Box-615x273.png\" alt=\"\" width=\"615\" height=\"273\" srcset=\"https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equations-Dialog-Box-615x273.png 615w, https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equations-Dialog-Box-300x133.png 300w, https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equations-Dialog-Box-768x341.png 768w, https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equations-Dialog-Box-728x324.png 728w, https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equations-Dialog-Box.png 783w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><\/li>\n<li>Start a 2D sketch<\/li>\n<li>Create an Equation Driven Curve by entering the following values in the PropertyManager\u2019s input fields<br \/>\n<span style=\"color: #999999\"><i>You can reference Global Variables by typing their names in between quotation marks.<br \/>\n<\/i><\/span><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-20899\" src=\"https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equation-Driven-Curve-PropertyManager.png\" alt=\"\" width=\"231\" height=\"520\" srcset=\"https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equation-Driven-Curve-PropertyManager.png 231w, https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equation-Driven-Curve-PropertyManager-133x300.png 133w\" sizes=\"auto, (max-width: 231px) 100vw, 231px\" \/><\/li>\n<li>You\u2019ll need to define the location and position of the Equation Driven Curve using sketch relations and dimensions to fully define the sketch<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-20900\" src=\"https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equation-Driven-Curve-Sketch-615x352.png\" alt=\"\" width=\"615\" height=\"352\" srcset=\"https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equation-Driven-Curve-Sketch-615x352.png 615w, https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equation-Driven-Curve-Sketch-300x172.png 300w, https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equation-Driven-Curve-Sketch-728x417.png 728w, https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Equation-Driven-Curve-Sketch.png 746w\" sizes=\"auto, (max-width: 615px) 100vw, 615px\" \/><\/p>\n<p>This is exactly what I was looking for shape-wise, but that took a lot more thinking than my brain would prefer to spend on a single sketch entity of an entire model. \u00a0That said, don\u2019t underestimate the power of Equation Driven Curves. Once you start playing around with 3D curves, the geometry you can create with some creative math is pretty sweet. \u00a0It makes it very easy to design products such as wave springs\/washers.<\/p>\n<h1><b>Reverse Engineer with a Spline<\/b><\/h1>\n<p>Admittedly, this example is a pretty hokey solution, but bear with me. \u00a0When you\u2019re desperate, you\u2019ll try anything. Plus, there are a few tips to learn from this approach and it will conveniently set up my best solution quite nicely.<\/p>\n<p>&nbsp;<\/p>\n<p>You can sketch pretty much sketch anything with splines. \u00a0Let\u2019s say you had an image of a sine wave profile to reference while sketching your spline. \u00a0All you\u2019d have to do is insert the <a href=\"https:\/\/help.solidworks.com\/2018\/english\/SolidWorks\/sldworks\/c_Sketch_Picture.htm?id=45c6fc72d0fa452a8f1dc8fb1e3072f5#Pg0&amp;ProductType=&amp;ProductName=\">Sketch Picture<\/a>, <a href=\"https:\/\/help.solidworks.com\/2018\/english\/SolidWorks\/sldworks\/t_insert_and_resize_pictures.htm?id=ad42322f3bfd4ff8bb87f8bd6d510f9b#Pg0&amp;ProductType=&amp;ProductName=\">scale it<\/a> appropriately, and then start another sketch on top of it (<span style=\"color: #999999\"><i>I prefer keeping the sketch picture isolated in its own sketch so you can easily toggle its visibility from the FeatureManager tree while editing a separate sketch<\/i><\/span>) to create your spline wave \u2026 \u00a0I mean, sine wave. In my case, we already have the Equation Driven Curve I created from the previous attempt, so we\u2019ll just use that as a reference.<\/p>\n<p>&nbsp;<\/p>\n<ol>\n<li>Sketch a 2-point spline by placing the two endpoints at both ends of the reference sine wave<\/li>\n<li>Select the spline so the spline handles appear<\/li>\n<li>Drag the diamond shape on the spline handle to reposition the initial trajectory of the spline and, while it\u2019s still selected, add a horizontal relation to it<br \/>\n<span style=\"color: #999999\"><i>Dragging different grips on the spline handle (diamond shape, arrowhead) isolate the type of geometric modification you\u2019ll make (direction, magnitude). \u00a0Or you can drag the dot at the end of the arrowhead to modify both direction and magnitude at the same time.<\/i><\/span><\/li>\n<li>Repeat step #3 for the opposite spline handle<\/li>\n<li>Drag the arrowheads of each spline handle until it closely matches the underlying reference<\/li>\n<li>Activate the Smart Dimension tool and apply a dimension to the arrowhead of one of the spline handles<br \/>\n<span style=\"color: #999999\"><i>Don\u2019t worry about the specific value. \u00a0It\u2019s only a magnitude and doesn\u2019t correlate to an actual linear distance. \u00a0Even though the value is a little mysterious, it\u2019s pretty cool that you can use these dimensions to fully define a spline.<\/i><\/span><\/li>\n<li>Repeat step #7 for the opposite arrowhead, but rather than typing a numerical value, type \u201c=\u201d and then click the dimension created in step #7 to make the second dimension always equal to the first<br \/>\n<span style=\"color: #999999\"><i>Typing \u201c=\u201d is a quick way to create equations on the fly. \u00a0You can even do this within PropertyManager input fields. Additionally, you can add comments on the fly by typing \u201c\u2018\u201c (an apostrophe) at the end of your equation followed by your comment.<\/i><\/span><\/li>\n<li>Modify the first dimension to automatically update both dimensions at once to fine tune the shape of the spline<\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-20901 size-full\" src=\"https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Traditional-Spline-Sine-Wave.gif\" alt=\"\" width=\"676\" height=\"374\" \/><\/p>\n<p>This method is way too imprecise due to the manual nature of the technique. \u00a0I wasn\u2019t lying when I said it was hokey, but without experiencing the pain associated with this approach, you wouldn\u2019t fully appreciate the convenience of my next (and best) solution.<\/p>\n<h1><b>Style Spline<\/b><\/h1>\n<p>Sometimes too much customization and flexibility is a bad thing. \u00a0This can occasionally be the case with traditional Splines. Taking too much manual control over spline handles (especially on a spline with many control vertices) can make the final shape tricky to manage and a pain to fully define. \u00a0In 2014, <a href=\"https:\/\/help.solidworks.com\/2018\/english\/SolidWorks\/sldworks\/c_about_style_splines.htm?id=3f38c470b0b542d28e7fcd89ef70d170#Pg0&amp;ProductType=&amp;ProductName=\">Style Splines<\/a> were introduced to simplify spline creation when a high level of customization is not needed. \u00a0By forfeiting just a little control, SOLIDWORKS can automatically manage the rate of curvature throughout the length of the Style Spline which ensures you\u2019ll get the highest quality curve every time with virtually no hassle. \u00a0Best of all, Style Splines are extremely easy to fully define which makes them a great fit for precise applications like this sine wave modeling challenge.<\/p>\n<ol>\n<li>Create a 4-point Style Spline following a slanted step pattern (see below)<br \/>\n<span style=\"color: #999999\"><i>Rather than control handles, Style Splines are controlled by a polygon of construction lines making them much easier to fully define with traditional dimensioning schemes.<\/i><\/span><\/li>\n<li>Add Horizontal and Equal relations to the first and last construction lines<\/li>\n<li>Add overall length and height dimensions<\/li>\n<li>Add a dimension to one of the horizontal construction lines and make it equal to the overall length multiplied by the magical ratio of 0.3642.<br \/>\n<span style=\"color: #999999\"><i>Don\u2019t ask me to explain this value, but I\u2019ve tested it on many spline curves and it proves to provide consistently accurate results.<\/i><\/span><\/li>\n<\/ol>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-20902 size-full\" src=\"https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Style-Spline-Sine-Wave.gif\" alt=\"\" width=\"855\" height=\"503\" \/><\/p>\n<p>That\u2019s it! \u00a0Not matter what the overall length and height of the curve is, this ratio produces great results. \u00a0You don\u2019t believe me? Create a solid body using your traditional technique, and recreate a separate body in the same location using my technique. \u00a0Then use the <a href=\"https:\/\/help.solidworks.com\/2018\/english\/SolidWorks\/sldworks\/HelpViewerDS.aspx?version=2018&amp;prod=SolidWorks&amp;lang=english&amp;path=sldworks%2fc_combine_bodies.htm&amp;id=6887ed75a23d408d9bda68064fbcd1dc\">Combine<\/a> tool to <a href=\"https:\/\/help.solidworks.com\/2018\/english\/SolidWorks\/sldworks\/t_combining_bodies_subtract.htm?id=432f02fa64c141eb82355a3c8edc0562#Pg0&amp;ProductType=&amp;ProductName=\">subtract<\/a> one body from the other and see what happens. \u00a0If you receive an error, it\u2019s most likely because the difference between the bodies was too small to calculate. \u00a0If you own a license of SOLIDWORKS Professional or Premium, you can use the <a href=\"https:\/\/help.solidworks.com\/2018\/english\/SolidWorks\/sldworks\/c_Compare_Overview.htm?id=c0b7a853f7cb46e7a38981e475184851#Pg0&amp;ProductType=&amp;ProductName=\">Compare Utility<\/a> to <a href=\"https:\/\/help.solidworks.com\/2018\/english\/SolidWorks\/sldworks\/t_example_compare_geometry.htm\">compare the geometry<\/a> of the two bodies with better visual feedback.<\/p>\n<p>One of the best parts of this solution is that once you create this sketch the first time, you can drag and drop it into your <a href=\"https:\/\/help.solidworks.com\/2018\/english\/solidworks\/sldworks\/HelpViewerDS.aspx?version=2018&amp;prod=solidworks&amp;lang=english&amp;path=sldworks%2fr_design_library.htm\">Design Library<\/a> where it\u2019ll be stored as a <a href=\"https:\/\/help.solidworks.com\/2018\/english\/SolidWorks\/sldworks\/c_blocks_top.htm?id=c08dcb7d69044532af5a1b4bc53b054e#Pg0&amp;ProductType=&amp;ProductName=\">Sketch Block<\/a>. \u00a0At anytime in the future, you (<span style=\"color: #999999\"><i>or anyone in your company if you store your Design Library on a shared server drive<\/i><\/span>) can drag and drop this sketch block from your Design Library into an active sketch, snap it into place with sketch relations, edit the block, tweak the length and height values, and you\u2019re done! \u00a0In fact, you can <a href=\"https:\/\/blog-assets.solidworks.com\/uploads\/sites\/4\/Sine-Wave.zip\">download my pre-created 2018 sine wave sketch block here<\/a>.<\/p>\n<p>Impressed by the ease of use and the quality of Style Splines? \u00a0Try this. Go back to one of your legacy designs that contains a spline, select the spline within the sketch it was originally create in, and then select \u2018Convert to Style Spline\u2019 from the context toolbar. \u00a0Thanks to this helpful button, you can toggle between traditional Splines and Style Splines (and vice versa) at any time. For complex shapes, sometimes it\u2019s easier to sketch the initial shape with a traditional Spline, convert it to a Style Spline, and then fully constrain it with relations and dimensions. \u00a0Please explore this technique and let me know how you like it in the comments below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>* This is one of a series of modeling challenges you can use to test your SOLIDWORKS skills. \u00a0First, read the challenge and try to figure out a solution on your own. \u00a0Then, compare your solution with my good, better,<\/p>\n... <a href=\"https:\/\/blogs.solidworks.com\/tech\/2018\/09\/modeling-challenge-sketching-an-approximate-sine-wave.html\">Continued<\/a>","protected":false},"author":193,"featured_media":20897,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1709],"tags":[142],"class_list":["post-20896","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-modelingchallenge","tag-sketching"],"acf":[],"_links":{"self":[{"href":"https:\/\/blogs.solidworks.com\/tech\/wp-json\/wp\/v2\/posts\/20896","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.solidworks.com\/tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.solidworks.com\/tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.solidworks.com\/tech\/wp-json\/wp\/v2\/users\/193"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.solidworks.com\/tech\/wp-json\/wp\/v2\/comments?post=20896"}],"version-history":[{"count":5,"href":"https:\/\/blogs.solidworks.com\/tech\/wp-json\/wp\/v2\/posts\/20896\/revisions"}],"predecessor-version":[{"id":22955,"href":"https:\/\/blogs.solidworks.com\/tech\/wp-json\/wp\/v2\/posts\/20896\/revisions\/22955"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.solidworks.com\/tech\/wp-json\/wp\/v2\/media\/20897"}],"wp:attachment":[{"href":"https:\/\/blogs.solidworks.com\/tech\/wp-json\/wp\/v2\/media?parent=20896"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.solidworks.com\/tech\/wp-json\/wp\/v2\/categories?post=20896"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.solidworks.com\/tech\/wp-json\/wp\/v2\/tags?post=20896"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}