Multiple Sweep

Multiple Sweep

evanhughes
Enthusiast Enthusiast
1,462 Views
2 Replies
Message 1 of 3

Multiple Sweep

evanhughes
Enthusiast
Enthusiast
Hi All I have found the following code on this forum but need it modified to select object (closed polyline, block or region) instead of using circle with dia. Any help much appreciated. (defun c:M-Sweep (/ cir diam1 hnd itm num ss) (if (= diam nil) (setq diam 0.25);; change the 0.25 to the diameter you use most );; if (setq diam1 (getreal (strcat "\Enter the tube diameter < " (rtos diam 2 4) " >: ") ) ) (if (= diam1 nil) (setq diam1 diam) (setq diam diam1) );; if (prompt "\nSelect the sweep paths: ") (if (setq ss (ssget '((0 . "LINE,*POLYLINE,3dpoly")))) (progn (setq itm 0 num (sslength ss) ) (while (< itm num) (setq hnd (ssname ss itm)) (entmakex (list (cons 0 "Circle") (cons 10 '(0.0 0.0 0.0)) (cons 40 (/ diam 2)) ) ) (setq cir (entlast)) (command "sweep" cir "" hnd) (setq itm (1+ itm)) );; while );; progn );; if (princ) );; M-Sweep Evan
0 Likes
1,463 Views
2 Replies
Replies (2)
Message 2 of 3

marko_ribar
Advisor
Advisor

I use something like this :

 

(defun c:shp-sweep-m ( / *adoc* shp ss i curve shpn )

  (vl-load-com)

  (vla-startundomark (setq *adoc* (vla-get-activedocument (vlax-get-acad-object))))
  (prompt "\nPick unit shape for sweep along curves : ")
  (while (not (ssget "_+.:E:S:L" (list '(-4 . "<or") '(-4 . "<and") '(0 . "*POLYLINE") '(-4 . "<or") '(70 . 1) '(70 . 3) '(70 . 5) '(70 . 9) '(70 . 13) '(70 . 129) '(70 . 131) '(70 . 133) '(-4 . "or>") '(-4 . "and>") '(-4 . "<and") '(0 . "SPLINE") '(-4 . "<or") '(70 . 3107) '(70 . 2051) '(70 . 1067) '(70 . 11) '(-4 . "or>") '(-4 . "and>") '(-4 . "<and") '(0 . "ELLIPSE") '(-4 . "<and") '(41 . 0.0) '(42 . 6.28319) '(-4 . "and>") '(-4 . "and>") '(0 . "CIRCLE,REGION") '(-4 . "or>"))))
    (prompt "\nEmpty sel.set... Please pick unit shape for sweep along curves again...")
  )
  (setq shp (ssname (ssget "_P") 0))
  (prompt "\nSelect curve entities to make sweeps with unit shape...")
  (if (setq ss (ssget '((0 . "*POLYLINE,LINE,SPLINE,ARC,CIRCLE,ELLIPSE,HELIX"))))
    (repeat (setq i (sslength ss))
      (setq curve (ssname ss (setq i (1- i))))
      (setq shpn (vlax-vla-object->ename (vla-copy (vlax-ename->vla-object shp))))
      (command "_.SWEEP" shpn "" curve)
      (while (< 0 (getvar 'cmdactive)) (command ""))
    )
    (prompt "\nEmpty sel.set... Please select curve entity(ies) next time when routine is started again...")
  )
  (vla-endundomark *adoc*)
  (princ)
)

HTH...

Marko Ribar, d.i.a. (graduated engineer of architecture)
0 Likes
Message 3 of 3

evanhughes
Enthusiast
Enthusiast

Hi Marko

 

Thank you for your quick response.

The code you sent works but only for polyline where as i need it to work for polyline, block or region.

 

Regards

 

Evan

0 Likes