Hi,
Is there a way creating a line that shows a function like "f(x)=x²"? Optimal case is that I can set the start point e.g. at x=-3 and the end point at x=3 so I get the function in that area.
Is there anything like this?
Thanks for help.
Aaron
Solved! Go to Solution.
Solved by TheCADnoob. Go to Solution.
You can make a lisp or create a script pleased to Excel to send a spline.
The only thing is to determinate how many points you want 😉
The more you draw, the more precise you are.
Check out this article about using Excel to create functions and then pasted in AutoCAD.
CADnoob
(defun c:fun1(/ *osmode* inter a b dis)
(setq inter 25 a -3 b 3
dis(/(- b a)(float inter)))
(setq *osmode*(getvar"osmode"))
(setvar"osmode"0)
(command "_pline"(list a (* a a)))
(repeat inter(command(list(setq a(+ a dis))(* a a))))
(command)
(setvar"osmode"*osmode*)
)
You can easily change inter, a and b.
Load that and run FUN1
@TheCADnoob The link is a nice write up but the command parameters should specify fit points not not control vertices since the explicit function for sine is used.
That is, spline m f 0,0 not spline m cv 0,0
Also, when choosing the delta x value for something like a trig function it would be better if the minimum and maximum values were explicitly specified.
As a side note, the attached Excel file includes a custom function I wrote for creating of B-splines from control vertices. It will duplicate the splines created in AutoCAD if the weights of vertices are all 1.0 (a B-spline and not a NURBS). The worksheet compares the accuracy of a degree 3 B-spline (AutoCAD spline) for 180°with a true sine curve. Macros must be enabled for the Excel file to use the custom Excel BSPLINE function.
Can't find what you're looking for? Ask the community or share your knowledge.