;;;|双向偏移 SNSJ 2004.3.8
(defun ptlay (x y)  (vla-put-layer(car(vlax-safearray->list(vlax-variant-value x)))y))
(defun c:2os (/ getds obj lynm)
  (vl-load-com)
  (setq lynm (getstring "\n输入想要偏移的层名:"))
  (and (= "" lynm) (setq lynm (getvar "clayer")))
  (if (null (tblsearch "layer" lynm))
    (vl-cmdf ".layer" "n" lynm "")
  )
  (initget 2)
  (setq getds (getdist (strcat "\n输入偏移距离<"(rtos(getvar "OFFSETDIST"))">:")))
  (or getds (setq getds (getvar "OFFSETDIST")))
  (setvar "OFFSETDIST" getds)
  (if (ssget '((0 . "Arc,Circle,Ellipse,*Line")))
    (vlax-for obj (vla-get-activeselectionset
		    (vla-get-activedocument (vlax-get-acad-object))
		  )
      (ptlay (vla-offset obj getds) lynm)
      (ptlay (vla-offset obj (* getds -1)) lynm)
    )
    (vlax-release-object obj)
  )
  (princ)
)


