Author Topic: [XDrX-PlugIn(105)] Multiple offsets  (Read 546 times)

0 Members and 1 Guest are viewing this topic.

xdcad

  • Swamp Rat
  • Posts: 527
[XDrX-PlugIn(105)] Multiple offsets
« on: January 25, 2024, 05:25:17 AM »
1.Multiple offsets, positive numbers shift outwards, negative numbers shift inward, separate with commas, use * for repetitions, such as 300*2,

2."\nEnter the offset distance (+-, repeat *), separated by commas <Exit>: "

Code: [Select]
(defun c:XDTB_CurveOffset (/ d1 d2 ss strl dl s i)
  (if (setq ss (xdrx-ssget (xdrx-string-multilanguage "\n选取要多重偏移的曲线<退出>:"
"\nSelect the curves to be multi-offset<Exit>:"
      )
      '((0 . "*line,circle,arc,ellipse"))
       )
      )
    (progn
      (if (/= ""
      (setq strl (getstring
   (xdrx-string-multilanguage "\n输入偏移距离(+-,重复*),以逗号分隔<退出>: "
      "\nEnter the offset distance (+-, repeat *), separated by commas <Exit>: "
   )
)
      )
  )
(progn (xdrx_begin)
       (setq dl (xdrx_string_split strl ","))
       (mapcar '(lambda (x)
  (setq d2 nil)
  (setq d1 (xdrx_string_split x "*"))
  (if (= (length d1) 2)
    (progn (setq i 0)
   (repeat (atoi (cadr d1))
     (setq d2 (cons (* (setq i (1+ i)) (atof (car d1))) d2))
   )
    )
    (progn (setq d2 (list (atof (car d1)))))
  )
  (mapcar '(lambda (y) (xdrx_curve_getoffsetcurves ss y)) d2)
)
       dl
       )
       (xdrx_end)
)
      )
    )
  )
  (princ)
)
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net