Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

ВeekeeCZ
en respuesta a: cool.stuff

Well, a bit confused by your saying "modification"... As I understand your task, you basically want another function that has nothing to do with the previous task but the scale factor. If I am right, try the following code. If not, elaborate on the issue more.

 

(defun c:FOffset (/ done flg osd)
  
  (or *TD-Scale* (setq *TD-Scale* 1.)) ;; set defaul value
  (or *FO-Dist*  (setq *FO-Dist* 1.))
  (setq osd (getvar 'offsetdist))
  
  (while (not done)
    (princ (strcat "Current settings:  Scale " (rtos *TD-Scale*)))
    (initget "Scale Through Erase Layer")
    (setq flg (getdist (strcat "\nSpecify offset distance or [Scale/Through/Erase/Layer] <" (rtos *FO-Dist*) ">: ")))
    (if (= flg "Scale")
      (progn
	(initget 3) (setq *TD-Scale* (getdist "\nScale factor: ")))
      (setq done T)))

  (if (numberp flg)
    (command "_.offset" (* (setq *FO-Dist* flg) *TD-Scale*))
    (progn
      (setvar 'offsetdist (* *FO-Dist* *TD-Scale*))
      (command "_.offset" flg)))
  (while (> (getvar 'cmdactive) 0) (command pause))
  (setvar 'offsetdist osd)
  (princ)
  )

 

Notes:

- the scale factor would be the same for both routines. *TD-Scale* (rename yourself if not)

- only from the first prompt Specify offset distance or [Scale/Through/Erase/Layer] you can specify a Scale. If you pick any other option it will turn into the regular offset command (with distance already scaled). That means, if pick eg. "Layer" ... then after layer setting you will get back to "Specify offset distance or [Through/Erase/Layer] <20.000>:" prompt, now distance is already scaled (both set and prompted).

Good luck.