Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Distinguished Contributor
jlamber
Posts: 128
Registered: ‎10-08-2004
Message 1 of 10 (492 Views)

Turn off Explode on insert

492 Views, 9 Replies
10-10-2011 01:50 PM

I have used Lisp and the insert command to do *blockname to explode the insertion of a block.    this sets the explode check mark on the insert dialog.    Once I set it on the next insert an explode occurs.     I do not find away to turn it off.     Is there some trick to use that will uncheck the explode box.  I don't seem to find any system variable.    I thought of inserting a dummy block without the asterisk.   I thought about trying to do a cancel somehow on insert.    Anyone got a trick they might have used?

 

Jim

*Expert Elite*
Kent1Cooper
Posts: 5,879
Registered: ‎09-13-2004
Message 2 of 10 (481 Views)

Re: Turn off Explode on insert

10-10-2011 08:19 PM in reply to: jlamber

jlamber wrote:

I have used Lisp and the insert command to do *blockname to explode the insertion of a block.    this sets the explode check mark on the insert dialog.    Once I set it on the next insert an explode occurs.     I do not find away to turn it off.     Is there some trick to use that will uncheck the explode box.  I don't seem to find any system variable. ....


Yes, there's a System Variable for that.  If the Explode check-box is on, this will turn it off for you, keeping the same Block name:

 

(if (= (substr (getvar 'insname) 1 1) "*")

  (setvar 'insname (substr (getvar 'insname) 2))

)

Kent Cooper
*Expert Elite*
Kent1Cooper
Posts: 5,879
Registered: ‎09-13-2004
Message 3 of 10 (464 Views)

Re: Turn off Explode on insert

10-11-2011 07:39 AM in reply to: Kent1Cooper

Kent1Cooper wrote:

.... 

(if (= (substr (getvar 'insname) 1 1) "*")

  (setvar 'insname (substr (getvar 'insname) 2))

)


Or, if you don't feel a need to retain the same default Block name, simply:

 

(setvar 'insname "")
 

That will leave you with the Explode box in the dialog box un-checked, and the default offered will just be the first Block in the list, as when you first open a drawing.

Kent Cooper
Distinguished Contributor
jlamber
Posts: 128
Registered: ‎10-08-2004
Message 4 of 10 (458 Views)

Re: Turn off Explode on insert

10-11-2011 08:34 AM in reply to: jlamber

Kent,

I appreciate your response.    I first tried the technic of pulling the * off the front of the insname variable.    I found however that the blocks I'm inserting are on a network path and the variable doesn't like more than a block name.     I tried to use just a dummy block name without a change in the check.   Your second message came and I just tired plugging that in to clear the insname.    It clears the insname okay but when I do an insert just after that the * is still checked.

 

We are missing something here yet.

 

Jim

*Expert Elite*
Kent1Cooper
Posts: 5,879
Registered: ‎09-13-2004
Message 5 of 10 (454 Views)

Re: Turn off Explode on insert

10-11-2011 08:52 AM in reply to: jlamber

jlamber wrote:

....   Your second message came and I just tired plugging that in to clear the insname.    It clears the insname okay but when I do an insert just after that the * is still checked.

....


Hmmm....  I now find that (setvar 'insname "") sometimes unchecks the Explode check-box in the Insert dialog box [I did try it before suggesting it earlier, and it worked then, and again the first time just now], but not always.  If I can figure out what makes the difference, maybe it will suggest a solution, but I'm kinda stumped.

 

EDIT:  And to make matters worse, I now find that, if the Insert dialog box has Explode checked, and I use the non-dialog-box -INSERT command to put in a Block non-exploded, that Block's name becomes the default, but the Explode check-box remains checked!

Kent Cooper
*Expert Elite*
Lee_Mac
Posts: 1,270
Registered: ‎12-29-2009
Message 6 of 10 (449 Views)

Re: Turn off Explode on insert

10-11-2011 09:18 AM in reply to: jlamber

To uncheck the 'Explode' toggle on the Insert dialog:

 

(vl-registry-write
    (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (getvar 'CPROFILE) "\\Dialogs\\insert_dialog")
    "Explode"
    0
)

 

However, this will require an AutoCAD restart to see the change.

Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)
Expert Elite
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Distinguished Contributor
jlamber
Posts: 128
Registered: ‎10-08-2004
Message 7 of 10 (440 Views)

Re: Turn off Explode on insert

10-11-2011 01:17 PM in reply to: Lee_Mac

Lee,

Thank you also.   I was able to run and reopen the drawing to find it was reset off.   There is a concern however.    The user must know he has to restart AutoCAD.    It would be just as easy for user to insert another block and uncheck the box complete the insert and erase the block.    I was hoping that one could switch off without the user interaction and having to remember to do it before inserting another block.

 

I was hoping someone had a magic idea like:   Do the insert but have some way to uncheck the box,  then cancel the insert after it was set off.    The box has it's own magic and is in the registry it appears.

 

If I created a dummy block and insert without the explode.   Then do something like and erase previous and purge it.

 

Jim

 

 

*Expert Elite*
Lee_Mac
Posts: 1,270
Registered: ‎12-29-2009
Message 8 of 10 (436 Views)

Re: Turn off Explode on insert

10-11-2011 01:39 PM in reply to: jlamber

As you have correctly ascertained from my post, the setting is indeed stored in the registry, however, AutoCAD only reads the registry on startup, then modifies the registry when the user changes various settings to be stored and read upon the next restart.

 

I can't presently see any other way to alter the Explode setting without doing it manually through the Insert dialog.

Lee Mac ProgrammingTwitterExchange App StoreDropbox (500MB free)
Expert Elite
With Mathematics there is the possibility of perfect rigour, so why settle for less?
Valued Mentor
Shneuph
Posts: 356
Registered: ‎11-26-2007
Message 9 of 10 (415 Views)

Re: Turn off Explode on insert

10-12-2011 10:28 AM in reply to: Lee_Mac

I think a combination of the registry write and setting insname to "" will do the trick?  no?

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Distinguished Contributor
jlamber
Posts: 128
Registered: ‎10-08-2004
Message 10 of 10 (377 Views)

Re: Turn off Explode on insert

12-13-2011 07:55 AM in reply to: Shneuph

Thank all for suggestions.    I ended up changing my process so that it used the "explode" "last".   Doing this avoided setting the insert command to explde and then finding away to reset insert explode.

 

More than one way to skin a cat.....thanks again.

 

Jim 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.