- (defun dtr (a)
- (* pi (/ a 180.0))
- )
- (defun gpuser ()
- (setq sp (getpoint "\nStart point of path: "))
- (setq ep (getpoint "\nEnd point of path: "))
- (setq hwidth (getdist "\nHalf width of path: " sp))
- (setq trad (getdist "nRadius of tiles: " sp))
- (setq tspac (getdist "\nSpacing between tiles: " sp))
- (setq pangle (angle sp ep))
- (setq plength (distance sp ep))
- (setq width (* 2 hwidth))
- (setq angp90 (+ pangle (dtr 90))) ; Path angle + 90 deg
- (setq angm90 (- pangle (dtr 90))) ; Path angle - 90 deg
- )
- (defun drawout ()
- (Command "pline"
- (setq p (polar sp angm90 hwidth))
- (setq p (polar p pangle plength))
- (setq p (polar p angp90 width))
- (polar p (+ pangle (dtr 180)) plength)
- "close"
- ))
- (defun drow (pd offset)
- (setq pfirst (polar sp pangle pd))
- (setq pctile (polar pfirst angp90 offset))
- (setq pltile pctile)
- (while (< (distance pfirst pltile) (- hwidth trad))
- (Command "circle" pltile trad)
- (setq pltile
- (polar pltile angp90 (+ tspac trad trad))))
- (setq pltile (polar pctile angm90 (+ tspac trad trad)))
- (while (< (distance pfirst pltile) (- hwidth trad))
- (Command "circle" pltile trad)
- (setq pltile
- (polar pltile angm90 (+ tspac trad trad)))))
- (defun drawtiles ()
- (setq pdist (+ trad tspac))
- (setq off 0.0)
- (while (<= pdist (- plength trad))
- (drow pdist off)
- (setq pdist
- (+ pdist (* (+ tspac trad trad) (sin (dtr 60)))))
- (if (= off 0.0)
- (setq off (* (+ tspac trad trad) (cos (dtr 60))))
- (setq off 0.0))))
- (defun C:PATH ()
- (gpuser)
- (setq sblip (getvar "blipmode"))
- (setq scmde (getvar "cmdecho"))
- (setvar "blipmode" 0)
- (setvar "cmdecho" 0)
- (drawout)
- (drawtiles)
- (setvar "blipmode" sblip)
- (setvar "cmdecho" scmde)
- (princ)
- )
并启用正交(F8) |