harrison-matt Posted October 4, 2010 Posted October 4, 2010 All, Before i start bashing my head on the desk reverting back to old trig, is there anywone with neat suggestions to drawing a cosine wave between two points? Matt Quote
lpseifert Posted October 4, 2010 Posted October 4, 2010 Save a desk... have a look here http://www.cadalyst.com/cad/autocad/autolisp-solutions-draw-a-sinusoidal-curve-a-spline-or-polyline-5120 Quote
BlackBox Posted October 4, 2010 Posted October 4, 2010 Use the getint, getpoint (with an (initget 32) twist), distance, angle, and polar functions..? Oh! And for kicks, throw in a little lambda+mapcar combo on the side (to handle any curve frequency). :wink: Quote
BlackBox Posted October 4, 2010 Posted October 4, 2010 Save a desk... have a look herehttp://www.cadalyst.com/cad/autocad/autolisp-solutions-draw-a-sinusoidal-curve-a-spline-or-polyline-5120 I didn't see your post until I was done typing mine, great link, Larry! Quote
harrison-matt Posted October 4, 2010 Author Posted October 4, 2010 I like this function however, I am really trying to find out how to draw one by specifying two points. The ratio of Period to Amp i am looking forward is 2:0.5 and i would like to be able to specify the Amp Quote
BlackBox Posted October 4, 2010 Posted October 4, 2010 I like this function however, I am really trying to find out how to draw one by specifying two points.The ratio of Period to Amp i am looking forward is 2:0.5 and i would like to be able to specify the Amp See post #3. Quote
harrison-matt Posted October 4, 2010 Author Posted October 4, 2010 Do you think a Spline or polyline should be the victom of this command? Quote
David Bethel Posted October 4, 2010 Posted October 4, 2010 (initget 7) (setq amp (getdist "\nAmplatude: ")) (initget 7) (setq frq (getdist "\nFrequency: ")) (initget 6) (setq rep (getint "\n# of Points per Wave <1000>: ")) (and (not rep) (setq rep 1000)) (setq i 0 inc (/ (* 2 pi) rep)) (command "_.PLINE") (repeat (1+ rep) (command (list (* i frq) (* amp (sin i)))) (setq i (+ i inc))) (command "") -David Quote
Lee Mac Posted October 4, 2010 Posted October 4, 2010 Another 'fun' one (defun c:DynFun ( / _GenerateFunctionPoints fun p1 gr ) ;; © Lee Mac 2010 ;; Function to evaluate (setq fun sin) (defun _GenerateFunctionPoints ( p1 p2 / d a1 a2 i j ) (setq d (distance p1 p2) a1 (angle p1 p2) a2 (+ a1 (/ pi 2.)) i 0 p3 (polar p1 a2 (fun 0.))) (while (<= (setq x (* 0.1 (setq i (1+ i)))) d) (grdraw p3 (setq p3 (polar (polar p1 a1 x) a2 (fun x))) 3) ) ) (if (setq p1 (getpoint "\nSpecify First Point: ")) (while (= 5 (car (setq gr (grread 't 13 0)))) (redraw) (_GenerateFunctionPoints p1 (cadr gr)) ) ) (princ) ) Could work with any function I like this one (setq fun (lambda ( x ) (* (sin (* 2.0 x)) (exp (/ x 10.0))))) Quote
BlackBox Posted October 4, 2010 Posted October 4, 2010 Another 'fun' one Lee, DynFun is really neat. (fun 2) is also cool. :wink: Quote
harrison-matt Posted October 4, 2010 Author Posted October 4, 2010 Lee, That is really cool! Grread is pretty sweet! i'll keep trying on my end and will post my attempts and errors here. David, thanks for the tips. Thanks, Matt Quote
Lee Mac Posted October 4, 2010 Posted October 4, 2010 That is really cool! Grread is pretty sweet! i'll keep trying on my end and will post my attempts and errors here. Grread is great for visual effect, but useless for practical applications as you have no OSnap, Ortho, Tracking or any other standard functionality. GrRead is purely for tracking keystrokes, mouse movements - general user input. Any OSnap or other functionality must be imitated within the grread loop. Lee Quote
AHMEDSAL Posted April 7, 2012 Posted April 7, 2012 This is awosome and exactly what i want, drawing sin wave controlling amplitude decreasing increasing i am doing some FEA project but life cant be awsome like that always cause i got this error SINECURVE - Error: quit / exit abort SYSTEM VARIABLES have been reset i googled the system variables thing but never got an answer beside the original forum is closed down and i cant get to Tony the man how come up with it ....please if any one know any thing on how to fix this error in 2011 i would really appreciated I am attaching the files for the SINCURVE function if you can do anything to fix the errors please 0305.lsp 0305alspsol-sinecurve.dcl Quote
marko_ribar Posted April 7, 2012 Posted April 7, 2012 Here, I've corrected error (it was name of *.dcl - you should not rename file as it was written - should be sinecurve.dcl)... Anyway, I've incorporated dcl into lsp and you don't have to store it in support search path of ACAD - you can load it from anywhere - it should work - creates temp dcl file, use that dcl and at the end removes temp dcl... Regards, M.R. sinecurve.lsp Quote
raed Posted November 2, 2020 Posted November 2, 2020 (edited) I know this is a super old topic, but I've been looking for something like this. I ended up coming to my own solution for parametric sine/cosine waves using contiguous ellipse arcs with an apparatus of parametric construction geometry to define osnaps for each axis of the unit arc. However the only parameters I could figure out to create, and which I think might exist with a setup like this, are the amplitude and frequency - no damping or anything like that. Additionally I just came across this: https://www.cadstudio.cz/en/apps/2dplot/, which looks like it might be really for providing appropriate fidelity and additional parameters such as damping. sine_generator.dwg Edited November 2, 2020 by raed not quadrants Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.