;;做多义线
(defun fs_mak_pline (ss / la ss2)
  (setvar "cmdecho" 0)
  (setq la (entlast))
  (command ".pedit" "m" ss)
  (while (> (getvar "cmdactive") 0) (command ""))
  (setq ss2 (fsxm-newselection la))
  (command ".pedit" "m" ss ss2 "" "j" 1e-4)
  (while (> (getvar "cmdactive") 0) (command ""))
  (princ)
)
(defun c:mak_pline (/ ss)
  (princ "\n选择要连成多线段的线,弧,多线段:")
  (setq ss (ssget '((0 . "line,arc,lwpolyline"))))
  (if ss
    (fs_mak_pline ss)
  )
)
;;整体偏移
(defun c:join_offset (/ dist la lst pt ss nss obj)
  (setq ss (ssget '((0 . "line,arc,lwpolyline"))))
  (or ss (fsxm-silenceexit))
  (setq la (entlast))
  (command ".copy" ss "" "@" "@")
  (setq nss (fsxm-newselection la))
  (fs_mak_pline nss)
  (setq lst (fsxm-newenlist la))
  (setq dist (fsxm-tostring (getvar "offsetdist")))
  (setq dist (getdist (strcat "\n指定或测量偏移距離<" dist ">:")))
  (or dist (setq dist (getvar "offsetdist")))
  (setq pt (getpoint "\n指定要在那一側偏移<双向>:"))
  (if pt
    (progn
      (command ".offset" dist)
      (foreach en lst (command en "non" pt) (entdel en))
      (command "")
    )
    (foreach en	lst
      (setq obj (vlax-ename->vla-object en))
      (vl-catch-all-apply 'vla-offset (list obj dist))
      (vl-catch-all-apply 'vla-offset (list obj (- dist)))
      (entdel en)
    )
  )
  (foreach en (fsxm-newenlist la)
    (fsxm-setendxf en 8 (getvar "clayer"))
  )
  (sssetfirst nil (fsxm-newselection la))
  (princ)
)