Exploding Tin surface by lisp

Exploding Tin surface by lisp

Anonymous
Not applicable
702 Views
3 Replies
Message 1 of 4

Exploding Tin surface by lisp

Anonymous
Not applicable

Hi!

I'm fairly new to AutoLISP, and may very well be doing this all wrong so please tell me if there is a better way of doing this.

I want to explode (or extract) the triangles from the surfaces within my drawing by lisp. This is as far as I've gotten:

 

(defun surfextr ( / ss)
(command "view" "o" "F")
  (setq ss (ssget "A" '((0 . "AECC_TIN_SURFACE"))))
    (command "._explode" ss)
    (princ)
)

 

I change the view to "front" just to make sure I just don't explode the borders... Not neat, I know, but only way I could figure out to do this.

Problem is, this command does exactly what I want, but only for one of the three surfaces within my drawing.

Any suggestion as to why this is, and how I can fix it?

Sincerely,

Fredrik

0 Likes
Accepted solutions (2)
703 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant
Accepted solution

Hi.. the EXPLODE command does not handle a selection set, so you need to go thru ss and explode one entity by one.

 

(defun c:surfextr ( / ss i)
  (command "_.view" "_o" "_F")
  (if (setq ss (ssget "A" '((0 . "AECC_TIN_SURFACE"))))
    (repeat (setq i (sslength ss))
      (command "_.explode" (ssname ss (setq i (1- i))))))
  (princ)
)

With "c:" prefix you can run it as regular command typing: surfextr

0 Likes
Message 3 of 4

Anonymous
Not applicable
Accepted solution

Thank you for your reply! Your help got me there in the end. Just wanted to note down, if anyone else would be interested, that I had to edit your reply just a bit. This is final, working, lisp:

 

(defun c:surfextr ( / ss i)
  (command "_.view" "_o" "_F")
  (setq ss (ssget "A" '((0 . "AECC_TIN_SURFACE"))))
    (repeat (setq i (sslength ss))
      (command "_.explode" ss))
  (princ)
)

 

Thanks!
Fredrik

0 Likes
Message 4 of 4

ВeekeeCZ
Consultant
Consultant

Glad you found the solution. 

0 Likes