Converting all groups to united 3d solids

Converting all groups to united 3d solids

Anonymous
Not applicable
912 Views
1 Reply
Message 1 of 2

Converting all groups to united 3d solids

Anonymous
Not applicable

I need to write script that will convert each group to separate 3d solid. I found function which splits groups to several 3d solids. How can I make reverse action?

 

  (defun PurgeAllGroups (/ grpList index grp)
  (setq grpList (dictsearch (namedobjdict) "ACAD_GROUP"))
  (setq index 1)
  (while (setq grp (nth index grplist))
    (if  (= (car grp) 3)
; I think, here is I need to convert group to 3d solid (entdel (cdr (nth (+ index 1) grplist))) ) (setq index (+ 1 index)) ) (princ))

I will be grateful for help with script 🙂

0 Likes
Accepted solutions (1)
913 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

I solved it by my self, but my script works slow a bit.

 

(defun C:UnionAllGroups () 
	(setq grplist (dictsearch (namedobjdict) "ACAD_GROUP")) 
	(setq index 1)
	(while (setq grp (nth index grplist))
		(if  (= (car grp) 3)
			(progn
				(setq grpname (cdr grp))
				(setq currentgrp (dictsearch (cdr (assoc -1 grplist)) grpname)) 
				(setq ss (ssadd)) 
				(while (/= (assoc 340 currentgrp) nil) 
					(setq ent (assoc 340 currentgrp)) 
					(setq ss (ssadd (cdr ent) ss)) 
					(setq currentgrp (subst (cons 0 "") ent currentgrp)) 
				) 
				(COMMAND "UNION" ss "")
			)
		)
		(setq index (+ 1 index))
	)
	(princ)
)
0 Likes