Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
help locating a code to draw arc length
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: help locating a code to draw arc length (Read 1707 times)
0 Members and 1 Guest are viewing this topic.
andrew..
Newt
Posts: 24
help locating a code to draw arc length
«
on:
March 20, 2019, 03:05:26 PM »
a few years ago there was code shared that draws arc length based on numeric input.
I can not seem to located it here.
Would anyone happen to have a copy of it they can share?
thanks
Logged
ribarm
Gator
Posts: 3274
Marko Ribar, architect
WWW
Re: help locating a code to draw arc length
«
Reply #1 on:
March 20, 2019, 03:37:51 PM »
I've found something posted by I think @gile at autodesk forums... It's based on Newton's formula :
Code - Auto/Visual Lisp:
[Select]
(
defun
c:arcstptenptlength
(
/
ArcStartEndLength p1 p2 len
)
(
defun
ArcStartEndLength
(
startPoint endPoint arcLength
/
newton chord ang rad mid cen
)
;; use the Newton method to compute the arc half angle according to its length and chord
(
defun
newton
(
arc chord
/
k x
)
(
setq
k
(
/
chord arc
)
x
(
sqrt
(
-
6
(
*
6
k
)
)
)
)
(
repeat
6
(
setq
x
(
-
x
(
/
(
-
(
sin
x
)
(
*
k x
)
)
(
-
(
cos
x
)
k
)
)
)
)
)
)
(
setq
chord
(
distance
startPoint endPoint
)
)
(
if
(
<
chord arcLength
)
(
progn
(
setq
ang
(
newton arcLength chord
)
rad
(
abs
(
/
chord
2
.
(
sin
ang
)
)
)
mid
(
mapcar
'
(
lambda
(
p1 p2
)
(
/
(
+
p1 p2
)
2.0
)
)
startPoint
endPoint
)
)
(
if
(
equal
(
/
pi
2
)
ang 1e
-
009
)
(
setq
cen mid
rad
(
/
chord
2
.
)
)
(
setq
cen
(
polar
mid
(
+
(
angle
startPoint endPoint
)
(
/
pi
2
)
)
(
*
rad
(
cos
ang
)
)
)
)
)
(
entmakex
(
list
(
cons
0
"ARC"
)
(
cons
10
cen
)
(
cons
40
rad
)
(
cons
50
(
angle
cen startPoint
)
)
(
cons
51
(
angle
cen endPoint
)
)
)
)
)
)
)
(
setq
p1
(
getpoint
"
\n
Pick or specify start point of arc : "
)
)
(
setq
p2
(
getpoint
"
\n
Pick or specify end point of arc : "
)
)
(
initget
7
)
(
setq
len
(
getdist
(
strcat
"
\n
Pick or specify arc length (must be larger than : "
(
rtos
(
distance
p1 p2
)
2
20
)
") : "
)
)
)
(
while
(
<=
len
(
distance
p1 p2
)
)
(
prompt
"
\n
Arc length must be larger than : "
)
(
princ
(
rtos
(
distance
p1 p2
)
2
20
)
)
(
prompt
"... Pick or specify length again : "
)
(
setq
len
(
getdist
)
)
)
(
ArcStartEndLength p1 p2 len
)
(
princ
)
)
HTH., M.R.
Logged
Marko Ribar, d.i.a.
(graduated engineer of architecture)
M.R. on Youtube
gile
Gator
Posts: 2507
Marseille, France
WWW
Re: help locating a code to draw arc length
«
Reply #2 on:
March 20, 2019, 03:42:31 PM »
Hi,
There was also
this reply
.
Logged
Speaking English as a French Frog
Lee Mac
Seagull
Posts: 12914
London, England
WWW
Re: help locating a code to draw arc length
«
Reply #3 on:
March 20, 2019, 05:48:51 PM »
Here's another:
https://www.cadtutor.net/forum/topic/43920-can%C2%B4t-draw-a-correct-arc-lengthplease-help/?do=findComment&comment=359272
Logged
Lee Mac Programming
•
Twitter
•
Exchange App Store
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
help locating a code to draw arc length