动图吧 关注:49,667贴子:4,320
  • 3回复贴,共1

回复:个人收藏1

取消只看楼主收藏回复











IP属地:中国台湾5楼2023-01-27 22:34
回复
    吧友的贴,有计算弧长的LISP代码。
    https://tieba.baidu.com/p/6939455524?share=9105&fr=sharewise&see_lz=0&share_from=post&sfc=copy&client_type=2&client_version=12.57.5.0&st=1713017561&is_video=false&unique=DE8E8B586409C0CC9A80E5F99F06135D


    IP属地:中国台湾来自Android客户端11楼2024-04-13 22:18
    回复
      吧友的代码,用弧长画弧。
      (defun c:AAA (/ p1 p2 s a l x xx fx flx r c c1 c2 mspace myobj)
      (defun N ()
      (setq c (- (+ a (* 0.5 pi)) (* x 0.5)))
      (setq cen (polar p1 c r))
      (setq c1 (+ c pi))
      (setq c2 (+ c1 x))
      (setq myobj (vla-addarc mspace (vlax-3d-point cen) r c1 c2))
      (princ)
      )
      (setq p1 (getpoint "\n请输入圆弧第一点:"))
      (setq p2 (getpoint p1 "\n请输入圆弧第二点:"))
      (setq s (getdist p1 "\n请输入弧长:"))
      (setq a (angle p1 p2))
      (setq l (distance p1 p2))
      (vl-load-com)
      (setq mspace (vla-get-modelspace
      (vla-get-activedocument (vlax-get-acad-object))
      )
      )
      (if (<= s l)
      (progn
      (prompt "您所要画的圆弧并不存在!")
      (princ)
      )
      (progn
      (setq x 2)
      (setq fx (- (/ (sin (/ x 2)) x) (/ (* 0.5 l) s)))
      (setq
      flx (/ (- (* 0.5 x (cos (* 0.5 x))) (sin (* 0.5 x))) (* x x))
      )
      (setq xx (- x (/ fx flx)))
      (while (> (abs (- x xx)) 0.0000000001)
      (setq x xx)
      (setq fx (- (/ (sin (/ x 2)) x) (/ (* 0.5 l) s)))
      (setq flx
      (/ (- (* 0.5 x (cos (* 0.5 x))) (sin (* 0.5 x))) (* x x))
      )
      (setq xx (- x (/ fx flx)))
      )
      (setq r (/ s xx))
      (initget "N S")
      (setq aa (getkword "\n 请输入圆弧方向[逆时针(N)/顺时针(S)]:"))
      (if (= aa nil)
      (setq aa "N")
      )
      (if (= aa "N")
      (N)
      (if (= aa "S")
      (progn
      (setq c (- (+ a (/ x 2)) (* 0.5 pi)))
      (setq cen (polar p1 c r))
      (setq c1 (- (+ c pi) x))
      (setq c2 (+ c pi))
      (setq myobj (vla-addarc mspace (vlax-3d-point cen) r c1 c2))
      (princ)
      )
      )
      )
      )
      )
      )


      IP属地:中国台湾来自Android客户端12楼2024-04-13 22:31
      回复
        cad新手入门练习https://tieba.baidu.com/p/763325850?pn=1


        IP属地:中国台湾13楼2024-04-26 22:04
        回复