Lisp routine doesn't work on new computer

Lisp routine doesn't work on new computer

Amito
Enthusiast Enthusiast
751 Views
3 Replies
Message 1 of 4

Lisp routine doesn't work on new computer

Amito
Enthusiast
Enthusiast

I've been using the lisp below with succes on my old PC, but somehow it doesn't react the same way on my new PC.

(defun c:BAB (/) (c:BrstAllBlocks))

(defun c:BrstAllBlocks (/ sstBlocks)

  (setvar "cmdecho" 0)

;;; START REMOVE BLOCKS

  (setq sstBlocks (ssget "X" '((0 . "INSERT"))))

  (if (= sstBlocks nil)
    (princ "\nNo blocks present in this drawing"))

  (while (and (/= sstBlocks nil) (> (sslength sstBlocks) 0))
    (princ (strcat "\nNumber of blocks to burst: "
		   (itoa (sslength sstBlocks))))
	(sssetfirst nil sstBlocks)
	(c:burst)
    (setq sstBlocks nil)
    (setq sstBlocks (ssget "X" '((0 . "INSERT"))))
  )

;;; END REMOVE BLOCKS
(Defun C:ByToCol()
	(vl-vbarun "P:\\DATA\\ACAD\\Common Files\\Lisp\\by2col.dvb!Module1.ColorToEntity")
	)
  (setvar "cmdecho" 1)
  (princ)
)

 

After the burst command it now asks me to select the objects to burst for the second time, as you can see in the log below: Command: bab Number of blocks to burst: 2 Initializing...0 found Select objects: I've exported the profile of the old computer and imported it on the new one to be sure every setting is the same. I even copied the old shortcut to the new computer to be sure Autocad Mechanical is started with the same profile. Although it worked on my old computer somehow, I think my lisp routine is messy and some lines are not necessary or clean enough. Can anyone tell me what's going wrong, espescially in this part:

  (setq sstBlocks (ssget "X" '((0 . "INSERT"))))

  (if (= sstBlocks nil)
    (princ "\nNo blocks present in this drawing"))

  (while (and (/= sstBlocks nil) (> (sslength sstBlocks) 0))
    (princ (strcat "\nNumber of blocks to burst: "
		   (itoa (sslength sstBlocks))))
	(sssetfirst nil sstBlocks)
	(c:burst)
    (setq sstBlocks nil)
    (setq sstBlocks (ssget "X" '((0 . "INSERT"))))
  )

 

Thank you in advance.

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

Jonathan3891
Advisor
Advisor
You are calling another lisp from the lisp you posted.

Have you updated this path to point to where the file is located?

P:\\DATA\\ACAD\\Common Files\\Lisp\\by2col.dvb!Module1.ColorToEntity

Jonathan Norton
Blog | Linkedin
0 Likes
Message 3 of 4

ВeekeeCZ
Consultant
Consultant
Accepted solution

I tried your routine without vba - I guess this is not causing the problem. But make sure you have a VBA enabler installed -  vba enabler

 

On my AutoCAD 2015 it works.

 

But consider upgrading your algorithm - if you select some un-explode-able block it ends in endless loop.

 

Maybe try to see this thread where were used this routine by Lee Mac. 

Message 4 of 4

Amito
Enthusiast
Enthusiast

@Jonathan3891, it isn''t the VBA routine, that part works fine, it stops after de burst command.

 

@ВeekeeCZ, thanks for the recommendation, I found that thread yesterday too and tried with LM:burst instead of C:burst and everything worked fine. Thanks for the help anyway Smiley Happy

0 Likes