Page 1 of 1

Help with radius

Posted: Tue Apr 21, 2020 2:16 pm
by MM1970
Hello,

can please someone help how to draw with script attached curve?

Many thanks Martin

Re: Help with radius

Posted: Tue Apr 21, 2020 3:42 pm
by CVH
A: Your arc has a radius of 25000, not 50000
There is a second text "R 50.000" @ (2900,1142.35677...)

B: By simple math ... calculate the centerpoint from two points on an arc and the radius.
C: Calculate the inclosed arc and the start and end angle.
D: Use the simple API function addArc(center, radius, startAngle, endAngle, reversed)
Where: 'center' is a Rvector, 'radius' and 'angles' are values, the angles are in degrees, reversed is a boolean.

Regards,
CVH.

Re: Help with radius

Posted: Tue Apr 21, 2020 6:55 pm
by MM1970
Hello CVH,

Thank you, for your reply. I understand how work addArc, but how to calculate start and end angle. I want to find some setup for different radius and width between two parallel lines. I import numbers as coordinates from excel table and do not know how to calculate in this setup start and end angle for different radius... Can you please let me know how to do it?

Thank you Martin

Re: Help with radius

Posted: Tue Apr 21, 2020 9:15 pm
by Husky
Hi,
MM1970 wrote:
Tue Apr 21, 2020 6:55 pm
I import numbers as coordinates from excel table and do not know how to calculate in this setup start and end angle for different radius...
Do I understand that correctly that your plan is to automatically create a script based drawing for pool enclosures but you are struggeling to calculate the different radii parameter ...

Re: Help with radius

Posted: Tue Apr 21, 2020 11:03 pm
by CVH
Assuming:
The chord is always horizontal.
The arc passes thrue P1(x1,y) and P2(x2,y).
The arc has radius R.

The chord length: c = x2-x1
The x coordinate of the center is x1+(c/2)

The central angle: a = 2arcsin(c/2R) (! in degrees)
The sagitta: h = R(1-cos(a/2))

The center is R-h lower then P1 & P2
The y coordinate of the center is y-(R-h)

Straight up is 90 degrees.
Start angle is 90+(a/2), End angle is 90-(a/2), non-reversed

Done. :wink:
CVH

Re: Help with radius

Posted: Wed Apr 29, 2020 10:41 am
by CVH
MM1970,
you had send me a PM where I did reply on.
I see my reply is still in my Outbox.
Pls have a look at your 'Private messages'.

CVH

Re: Help with radius

Posted: Wed May 27, 2020 8:26 pm
by MM1970
Hello CVH,

I am sorry for not replying sooner, I solved my request alone thank to your explanation how to draw curved lines. I made calculation(was not so easy for me, but after some mistakes I finished it..) in Excel for curved and straight lines and then I made set of coordinates for complicated drawing and with help of Ctrl C and Ctrl V I load set of coordinates into QCAD, where nice and exact drawing is finished in 2 seconds...this is absolutely outstanding solution, because I can spend 3-4 hours with each customer drawing!!!! So very easy change of parameters in few seconds.

Many thanks for your time and help!
Martin