MichaelH27 发表于 2022-7-6 07:28:45

角度、距离Lisp例程

大家好,
 
我知道有一个角度/距离lsp例程,因为我在过去的工作中使用过它。有人知道这个网站上有没有贴?
 
这是一个简单的惯例。拾取终点,选择后座点,输入角度,输入距离,等等。
 
Lsp也可以称为连续遍历??
 
谢谢

Tyke 发表于 2022-7-6 07:40:19

看看李的网站,他有很多很棒的LISP例程。
 
链接:http://lee-mac.com/

BlackBox 发表于 2022-7-6 07:42:26

自2006年6月2日起:
 

MichaelH27 发表于 2022-7-6 07:52:45

嗨,小家伙,在网站上找不到。
 
RenderMan,我用过@100
 
我需要从这条线的终点开始我的遍历,回到我设置的那条线上,这将把角度设置为“0”。然后我可以在354.65的距离处输入95d03'45英寸的角度。
 
我应该从我以前的工作中去掉Lisp程序!

Tharwat 发表于 2022-7-6 08:00:32

像这样的事情?
 
如果没有,就用更多的细节来阐明你的目标。
 

(defun c:Test (/ p)
;;; Tharwat 28. Sep. 2012 ;;;
(if (and (setq p (getpoint "\n Specify start point of line :"))
          (setq a (cond ((getangle (strcat "\n Specify Angle in Degree "
                                           (if a
                                             (strcat "< " (rtos a 2) " >")
                                             ""
                                           )
                                           ":"
                                 )
                         )
                        )
                        (t
                         (if a
                           a
                           nil
                         )
                        )
                  )
          )
          (setq d (cond ((getdist (strcat "\n Specify Distance "
                                          (if d
                                          (strcat "< " (rtos d 2) " >")
                                          ""
                                          )
                                          ":"
                                  )
                         )
                        )
                        (t
                         (if d
                           d
                           nil
                         )
                        )
                  )
          )
   )
   (entmake (list '(0 . "LINE")
                  (cons 10 (trans p 0 1))
                  (cons 11 (polar p a d))
            )
   )
   (princ)
)
(princ)
)

nod684 发表于 2022-7-6 08:07:21

 
 
试试这个,我从某个我不记得的地方得到的:
 
;Tip1741:BD.LSP         Bearing/Distance lines         (c)2001, Joon Hong$50 Bonus Winner
(defun C:BD()
(setvar "cmdecho" 0)
(initget 1)
(setq PT (getpoint "\nPick a starting point: "))
(initget 1 "NE NW SE SW")
(setq BR (getkword "\nPick bearing (NE/NW/SE/SW): "))
(setq OPT (strcase BR))
(initget 1)
(setq LEN (getreal "\nType the length: "))
(setq DEG (getstring "\nType the degree: ")
       minx (getstring "\nType the minute: ")
       SEC (getstring "\nType the second: "))
(if (= DEG "")
   (setq DEG "0"))
(if (= minx "")
   (setq minx "0"))
(if (= SEC "")
   (setq SEC "0"))
(cond ((= "SW" OPT)
      (setvar "angbase" (cvunit 270 "degree" "radian"))
      (setvar "angdir" 1))
       ((= "SE" OPT)
      (setvar "angbase" (cvunit 270 "degree" "radian"))
      (setvar "angdir" 0))
       ((= "NW" OPT)
      (setvar "angbase" (cvunit 90 "degree" "radian"))
      (setvar "angdir" 0))
       ((= "NE" OPT)
      (setvar "angbase" (cvunit 90 "degree" "radian"))
      (setvar "angdir" 1)))
(command "line" PT (strcat "@" (rtos LEN) "<" DEG "d" minx "'" SEC "\"") "")
(setvar "angbase" 0)
(setvar "angdir" 0)
(setvar "cmdecho" 1)
(princ))
(princ "\nType 'BD' to draw lines with bearings")
(princ)
 
第二部分在新线的起点和终点附近拾取线。这将返回现有角度,然后可以输入摆动角度,该角度添加到现有线角度,极轴将给出新的pt,依此类推。您可以选择“拾取起始线或新pt拾取空白屏幕”或按enter键,然后在输入真实方位的情况下询问拾取起始点。您可能还需要输入后方位,这取决于您输入的BRG。

eldon 发表于 2022-7-6 08:12:57

MSasu 发表于 2022-7-6 08:16:34

I believe that as long the current UCS is aligned with the base line, there is nothing to prevent the usage of relative coordinates; for sure, the units for angles had to be set accordingly, too.
Please check the Object option of UCS command - select the base line close to the end where you want the origin of your custom coordinates system.

MSasu 发表于 2022-7-6 08:26:14

Alternatively, if you had enabled the Polar Tracking feature, there is the option to provide the polar angle as absolute value or relative to the last segment.

BIGAL 发表于 2022-7-6 08:31:46

My 5 cents worth first nod684
 

Its easier to do ddd.mmss and convert only need 1 getreal.(setq DEG (getstring "\nType the degree: ")       minx (getstring "\nType the minute: ")       SEC (getstring "\nType the second: "))(setq DEGbrg(getreal "\nType the degree DDD.MMSS : ")(setq DEG = You take the DEGbrg fix, subtract *100 fix subtract divide 60 subtract divide 3600 so end up with decimal angle. Just need your units variables set correct. ) No cad at moment.
 
2nd part pick line near start end of new line this returns exist angle then you can enter swing angle which is added to existing line angle and a polar gives new pt and so on. You would have an option like "pick start line or new pt   pick blank screen or press enter so then asks pick start point with true bearings entered.You may need a back bearing entered as well depends what BRG's you are entering.
页: [1]
查看完整版本: 角度、距离Lisp例程