Michaels 发表于 2022-7-6 09:12:27

弧与多段线弧的角度

大家好。
 
我有一个弧,我提取了它的dxf代码加上它的角度。

(0 . "ARC")
(330 . <Entity name: 7ef0dcf8>)
(5 . "184")
(100 . "AcDbEntity")
(67 . 0)
(410 . "Model")
(8 . "0")
(100 . "AcDbCircle")
(10 18.7416 8.43585 0.0)
(40 . 3.50105)
(210 0.0 0.0 1.0)
(100 . "AcDbArc")
(50 . 6.06166)
(51 . 3.36312)

 
如何转换要在多段线的弧中使用的弧的角度?
 
希望有人能在编码之前给我解释一下。
 
提前感谢

Lee Mac 发表于 2022-7-6 09:26:23

我使用的是:
 
;; Arc to Bulge - Lee Mac 2011
;; cen- Centre
;; ang1 - Start Angle
;; ang2 - End Angle
;; rad- Radius
;; Returns: (<vertex> <vertex> <bulge>)

(defun LM:Arc->Bulge ( cen ang1 ang2 rad )
(list
   (polar cen ang1 rad)
   (polar cen ang2 rad)
   ( (lambda ( a ) (/ (sin a) (cos a))) (/ (rem (+ pi pi (- ang2 ang1)) (+ pi pi)) 4.))
)
)

;; Bulge to Arc - Lee Mac 2011
;; p1   - Start Vertex
;; p2   - End Vertex
;; bulg - Bulge
;; Returns: (<centre> <start angle> <end angle> <radius>)

(defun LM:Bulge->Arc ( p1 p2 bulg / cen ang rad )
(setq ang (* 2.0 (atan bulg))
       rad (/ (distance p1 p2) (* 2.0 (sin ang)))
       cen (polar p1 (+ (- (/ pi 2.) ang) (angle p1 p2)) rad)
)
(if (minusp bulg)
   (list cen (angle cen p2) (angle cen p1) (abs rad))
   (list cen (angle cen p1) (angle cen p2) (abs rad))
)
)为了解释凸出到圆弧的函数,考虑这个关系并重新排列R。
 

 
还要注意,负凸起表示顺时针弧,因此在这种情况下,弧角必须反转,因为弧总是逆时针定义的。
 
为了解释弧到凸度函数,这使用了多段线弧的凸度是四分之一夹角的切线这一事实。

David Bethel 发表于 2022-7-6 09:41:49

这些是我多年来保存下来的:
 

;;;;From Cadtutor

;For 90 degrees bulge
;tangent (90/4) = 0.4142 (+/-)

;(tan (/ (* pi 0.5) 4))

;Wizman
(defun Tan (X)
(if (zerop (cos X))
(prompt "Tangent error.")
(/ (sin X) (cos X))))

;Gile
(defun tan (a) (/ (sin a) (cos a)))


; AutoLISP function to convert from Polyline "Bulge" representation
; of an arc to AutoCAD's normal "center, radius, start/end angles"
; form of arc.This function applies the bulge between two adjacent
; vertices.It assumes that global symbols "sp", "ep", and "bulge"
; contain the current vertex (start point), next vertex (end point),
; and bulge, respectively.It sets the appropriate values in global
; symbols "cen", "rad", "sa", and "ea".

; by Duff Kurland - Autodesk, Inc.
; July 7, 1986

(defun cvtbulge (/ cotbce x1 x2 y1 y2 temp)
(setq x1 (carsp) x2 (carep))
(setq y1 (cadr sp) y2 (cadr ep))
(setq cotbce (/ (- (/ 1.0 bulge) bulge) 2.0))

; Compute center point and radius

(setq cen (list (/ (+ x1 x2 (- (* (- y2 y1) cotbce))) 2.0)
               (/ (+ y1 y2    (* (- x2 x1) cotbce) ) 2.0))
)
(setq rad (distance cen sp))

; Compute start and end angles

(setq sa(atan (- y1 (cadr cen)) (- x1 (car cen))))
(setq ea(atan (- y2 (cadr cen)) (- x2 (car cen))))
(if (< sa 0.0)                      ; Eliminate negative angles
    (setq sa (+ sa (* 2.0 pi)))
)
(if (< ea 0.0)
    (setq ea (+ ea (* 2.0 pi)))
)
(if (< bulge 0.0)                   ; Swap angles if clockwise
    (progn
       (setq temp sa)
       (setq sa ea)
       (setq ea temp)
    )
)
)

VVA 发表于 2022-7-6 09:54:01

多段线凸起(afralisp)。浏览internet explorer

Michaels 发表于 2022-7-6 10:06:25

非常感谢大家。
 
这肯定需要很多时间才能取得好结果。
 
谢谢。

Lee Mac 发表于 2022-7-6 10:17:03

终于开始在我的网站上添加这个主题:
 
http://lee-mac.com/bulgeconversion.html
 
希望这有帮助
页: [1]
查看完整版本: 弧与多段线弧的角度