例如,在lisp中,它使用左-右-上-下绘制pline
例如R100 U100 L100 C绘制了一个100框
- ; draw a pline by direction Up Down left or Right use upper or lowercase
- ; by Alan H dec 2015
- ; this version is a metric/decimal version
- ; version 2 depending on request will be a imperial version
- ; 1'8 1/4" input d1.8.25 start with 1.8 = 1'8" then add second fraction ver 3
- ; how to use u123.45 D34.57 R102.6 l53
- (defun ah:left ( / pt2)
- (setq pt2 (polar pt pi (atof (substr ans 2 (- (strlen ans) 1)))))
- (setq pt pt2)
- (command pt2)
- )
- (defun ah:up ( / pt2)
- (setq pt2 (polar pt (/ pi 2.0) (atof (substr ans 2 (- (strlen ans) 1)))))
- (setq pt pt2)
- (command pt2)
- )
- (defun ah:right ( / pt2)
- (setq pt2 (polar pt 0.0 (atof (substr ans 2 (- (strlen ans) 1)))))
- (setq pt pt2)
- (command pt2)
- )
- (defun ah:down ( / pt2)
- (setq pt2 (polar pt (* 1.5 pi) (atof (substr ans 2 (- (strlen ans) 1)))))
- (setq pt pt2)
- (command pt2)
- )
- (defun C:ahpliner ( / pt ans)
- (command "_pline")
- (command (setq pt (getpoint "Pick start point - Enter or C to finish")))
- (while (= (getvar "cmdactive") 1 )
- (setq ans (getstring "Enter L123 U456 R67 D78"))
- (cond ((= ans "")(command ""))
- ((= "L"(strcase (substr ans 1 1)))(ah:left))
- ((= "U"(strcase (substr ans 1 1)))(ah:up))
- ((= "D"(strcase (substr ans 1 1)))(ah:down))
- ((= "R"(strcase (substr ans 1 1)))(ah:right))
- ((= "C"(strcase (substr ans 1 1)))(command "close"))
- ) ;cond
- ) ; while
- )
|