arraypolar extrusion 2

arraypolar extrusion 2

saitoib
Advocate Advocate
313 Views
2 Replies
Message 1 of 3

arraypolar extrusion 2

saitoib
Advocate
Advocate
Hi all
I thought I had solved my problem with the method you instructed me to use last time, but a new problem has arisen.
Line 36 of the following code solved the problem successfully.
Is there any way to then extrude the selection set and batch select again?
Thank you.
キャプチャ.PNG

 

(defun c:test ( / pt1 pt2 ss nn id ent ob lid)
  (setq pt1 (getpoint "\nSelect point"))
  (setq pt2 (getcorner pt1 "\nAnother corner"))
  
  (setq ss (ssget "_C" pt1 pt2(list (cons 0 "LWPOLYLINE"))))
  (setq nn (sslength ss))
  (setq i 0)
  (repeat nn
    (setq id (ssname ss i))
    (push id)
    (setq i (1+ i))
  )
)

(defun push ( id / th pts panel ss nn i iid shape)
  (setq th 5)
  
  (setq pts (vl-remove-if '(lambda (x) (/= (car x) 10)) (entget id)))
  (setq pts (mapcar 'cdr pts))
  
  (command "copy" id "" '(0 0 0) '(0 0 0))
  (command "extrude" (entlast) "" 5)
  (setq panel (entlast))
  
  (setq ss (ssget "WP" pts))
  (setq nn (sslength ss))
  (setq i 0)
  (repeat nn
    (setq iid (ssname ss i))
    (setq shape (cdr (assoc 0 (entget iid))))

    (cond
      ((= shape "INSERT")
        (command "copy" iid "" '(0 0 0) '(0 0 0))
        (command "explode" iid)
        (setq iid (ssget "_P"))
        (command "extrude" iid "" th)
        ;(setq iid (entlast))
        (setq iid (ssget "_p"));----------- Here iid is nil
        (command "subtract" panel "" iid "")
      )
      (T
        (command "copy" iid "" '(0 0 0) '(0 0 0))
        (command "extrude" (entlast) "" th)
        (command "subtract" panel "" (entlast) "")
      )
    )
    (setq i (1+ i))
  )
)

 

Saitoib
0 Likes
Accepted solutions (1)
314 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant
Accepted solution

I thought there was a setting that controlled whether the result of EXTRUDE of multiple objects was one Solid or a separate one for each source object, but I can't find one.  You may need to do it by Extruding and Subtracting each individually:

        (command "copy" iid "" '(0 0 0) '(0 0 0))
        (command "explode" iid)
        (setq iid (ssget "_P"))
        (repeat (setq n (sslength iid))
          (command "extrude" (ssname iid (setq n (1- n))) "" th)
          (command "subtract" panel "" (entlast) "")
        ); repeat
Kent Cooper, AIA
0 Likes
Message 3 of 3

saitoib
Advocate
Advocate

It was a really basic method.
I was careless.
I was able to solve it.
Thank you again and again.

Saitoib
0 Likes