Consecutive Numbering in Nested Blocks

Consecutive Numbering in Nested Blocks

Dan-Rod
Advocate Advocate
86 Views
1 Reply
Message 1 of 2

Consecutive Numbering in Nested Blocks

Dan-Rod
Advocate
Advocate

Hello, I would like to see if you can help me, I have an LSP that lists the blocks called 'Cavity' but I need to explode the blocks since this is nested. I would like to see if it is possible for a routine to leave the consecutive ones just as in the example I attached, without the need to explode the blocks. I hope you can help me.

0 Likes
87 Views
1 Reply
Reply (1)
Message 2 of 2

paullimapa
Mentor
Mentor

try this thought process:

1) First run Undo Mark command

2) Next select all the Blocks you want Exploded

3) Then use lisp function to set entity marker

;;;--- aec_setmrk is used w/ (aec_getmrk) it sets pt. marker
(defun aec_setmrk ()
  (command "_.Point" "@")
  (setq aec_pt-mrk (entlast))
  (entdel aec_pt-mrk)
  (princ)
) ;defun

4) Next run your lisp function that labels all the Cavity blocks which are no longer nested

5a) Run Wblock command use lisp function to create selection set of all entities added to the point of the entity marker

;;;--- aec_getmrk starts at aec_pt-mrk (aec_setmrk) retrieves to current entity
(defun aec_getmrk (/ aec_ss)
	(if aec_pt-mrk
		(progn
			(setq aec_ss (ssadd))
			(while (setq aec_pt-mrk (entnext aec_pt-mrk))
				(ssadd aec_pt-mrk aec_ss)
			)
      (setq aec_pt nil)
			aec_ss
		)
	) ;if
) ;defun

5b) Wblock drawing should go to temp folder location

6) Run Undo Back command to restore everything to step 1)

7) Run Insert command bringing in the temp folder drawing Exploded


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes