Draw order based on BlockName

Draw order based on BlockName

cliffordcudal
Participant Participant
229 Views
2 Replies
Message 1 of 3

Draw order based on BlockName

cliffordcudal
Participant
Participant

Hi,

I'm trying to create lisp that will set draw order based on block name. can anyone check the code, it does not work when I try it. Thanks

 

(defun c:xblk (/ s blockList)
(setq blockList '("__4_Structure" "__3_Beam" "__2_Purlins" "__1_Modules)) ;  top-most first
(foreach blk blockList
(if (setq s (ssget "_X" (list (cons 2 blk))))
(command "_.draworder" s "" "_front")
)
)
(prin1)

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

komondormrex
Mentor
Mentor
Accepted solution

hey,

syntax only corrected

(defun c:xblk (/ s blockList s)
(setq blockList '("__4_Structure" "__3_Beam" "__2_Purlins" "__1_Modules")) ;  top-most first
(foreach blk blockList
	(if (setq s (ssget "_X" (list (cons 2 blk))))
		(command "_.draworder" s "" "_front")
	)
)
	(prin1)
)

 

0 Likes
Message 3 of 3

cliffordcudal
Participant
Participant

It works, Thank you!

0 Likes