好的,下面是一些解剖:
- (defun c:fdf ( / a4 a5 bmcnt bmcnt1 bmcnt2 bmwdth crtdst dltx dltx1 hlfbmwdth hlfbmwdth2 layerset ptx1 ptx2 ptx3 ptx4 ptx5 strtloc )
- (if
- (and ; prompt the user for inputs
- (not (initget 6))
- (setq bmwdth (getint "Width of beams: ")) ;get beam width
- (not (initget 6))
- (setq bmcnt (getint "Number of beams: ")) ;beam count
- (setq ptx1 (getpoint "\nFirst point for delta x <exit>: ")) ;get first point for the delta x
- (setq ptx2 (getpoint ptx1 "\nSecond point for delta x <exit>: ")) ;get second point for delta x
- )
- (progn ; proceed with calculations
- ;(command "setvar" "hpcolor" "bylayer")
- ;(command "setvar" "hplayer" ".")
- (setq layerset (getvar "clayer"))
-
- (setq bmcnt1 (- 1 bmcnt)) ;minus one beam for space in between beams
- (setq bmcnt2 (* bmcnt1 -1))
- (setq dltx (- (car ptx1) (car ptx2))) ;get the detla x by minusing ptx1 and ptx2
- (setq dltx1 (* dltx -1)) ;turn negative to positive
- (setq crtdst (- dltx1 bmwdth)) ;minus beam width from dist to get correct dist to divide
- (setq hlfbmwdth (/ bmwdth 2)) ;divide beam width in half
- (setq ptx3 (car ptx1)) ;first coordinate in point
- (setq strtloc (+ ptx3 hlfbmwdth)) ;start location for beams
- (setq ptx4 (cadr ptx1)) ;second coordinate in point
- (setq ptx5 (list strtloc ptx4)) ;both coordinates in a list
- (setvar "hporigin" ptx5) ;setting the start point for beams
- (setq strtloc (+ ptx3 [color="red"]hlfbmwdth2[/color])) ;start location for beams
- (setq a4 (/ crtdst bmcnt2)) ;divide for beam spacing
- (setq a5 (* a4 -1))
- ); progn
- ); if
- ); defun
- (vl-load-com)
hlfbmwdth2变量未分配到任何位置。 |