Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

function f(x)

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
yakaic
351 Views, 6 Replies

function f(x)

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

Tags (3)
6 REPLIES 6
Message 2 of 7
tramber
in reply to: yakaic

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.

 

Message 3 of 7
TheCADnoob
in reply to: yakaic

Check out this article about using Excel to create functions and then pasted in AutoCAD. 

 

https://forums.autodesk.com/t5/autodesk-community-voices/autocad-excel-your-design-with-a-graphing-c...

CADnoob

EESignature

Message 4 of 7
tramber
in reply to: yakaic

 

(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

 

Message 5 of 7
leeminardi
in reply to: TheCADnoob

@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.

leeminardi_0-1698765117491.png

 

lee.minardi
Message 6 of 7
Kent1Cooper
in reply to: yakaic

Perhaps >this topic< may be of interest to you.

Kent Cooper, AIA
Message 7 of 7
TheCADnoob
in reply to: leeminardi

fantastic points

CADnoob

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta