Prev: API - How to get swApp total Frame Size?
Next: custom property macro for Weight, how to get the parenthesis?
From: strela on 24 Dec 2007 04:54 Is there a way to use mathematical functions for curves used in sketch to describe cross section of a part? For example, square without one straight edge (eg. top one), but curve that would have some mathematical function (y = - x*x ; if coordinate system positioned on the vertical axe of square; y is oriented vertical up, x horizontal; )? Is it possible to state some mathematical function for curve in sketch and then use part of it for a sketch of a part? Thanks in advance. Best regards.
From: Edward T Eaton on 26 Dec 2007 01:58 The one that comes to mind based on your post is to use Insert> curve> Curve through XYZ points, then browse to a file created by Excel or whatever that delivers a dataset from the calculation that you are running. Keep in mind that equations in SWx can do a lot, or simple sketch relations (if you really know your trig) can pull off amazing things, and I would suggest that you look at those with a creative eye - especialy simple sketch relations, which I have seen underutilized so many times. But based on the vague request - the "for instance..." I suspect that importing a dataset to use with "curve through XYZ points" is what you want. Good luck, and let us know if this doesn't work so you can come back with a more specific problem -with more detail - for us to comment on. Ed
From: Cliff on 26 Dec 2007 05:04 On Mon, 24 Dec 2007 10:54:15 +0100, "strela" <abecebedeznam(a)wmf.de> wrote: >Is there a way to use mathematical functions for curves used in sketch to >describe cross section of a part? For example, square without one straight >edge (eg. top one), but curve that would have some mathematical function (y >= - x*x ; if coordinate system positioned on the vertical axe of square; y >is oriented vertical up, x horizontal; )? > >Is it possible to state some mathematical function for curve in sketch and >then use part of it for a sketch of a part? A mathematical function has at most one value for Y for each value of X. Your "curve" would also have non-continuous derivatives at the "corners" and thus could not be represented by a polynomial, such as a NURBS curve. Now, there are things called step functions and other series approximations (such as Fouier series) but ... -- Cliff
From: That70sTick on 26 Dec 2007 10:26 If all you need is a parabola (y = ax^2 + bX + c), SW has a parabola entity in the sketch entities menu. Draw and constrain accordingly.
From: TOP on 26 Dec 2007 23:20 This comes to mind. A simple macro. You do the math. If you want 3D use a 3D spline. Paste the text below into an empty macro. TOP Option Explicit ' ****************************************************************************** ' macro recorded on 12/26/07 by kellnerp ' ****************************************************************************** Dim swApp As Object Dim Part As Object Dim boolstatus As Boolean Dim longstatus As Long, longwarnings As Long Dim FeatureData As Object Dim Feature As Object Dim Component As Object Sub main() Set swApp = Application.SldWorks Set Part = swApp.ActiveDoc boolstatus = Part.Extension.SelectByID("Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing) boolstatus = Part.Extension.SelectByID("Front Plane", "PLANE", 0, 0, 0, False, 0, Nothing) Part.InsertSketch2 True Part.ClearSelection2 True Dim x0, xn, a, b, c As Double Dim x(20), y(20) As Double Dim i As Long x0 = 0# xn = 1# a = 2# b = 2# c = 2# 'y=ax^2+bx+c For i = 0 To 20 x(i) = x0 + (xn - x0) / 20 * i y(i) = a * x(i) * x(i) + b * x(i) + c Part.SketchSpline 20 - i, x(i) * 0.0254, y(i) * 0.0254, 0 Next i Part.ClearSelection2 True Part.InsertSketch2 True End Sub
|
Next
|
Last
Pages: 1 2 Prev: API - How to get swApp total Frame Size? Next: custom property macro for Weight, how to get the parenthesis? |