Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Turn off Explode on insert

9 REPLIES 9
Reply
Message 1 of 10
jlamber
2584 Views, 9 Replies

Turn off Explode on insert

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

9 REPLIES 9
Message 2 of 10
Kent1Cooper
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, AIA
Message 3 of 10
Kent1Cooper
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, AIA
Message 4 of 10
jlamber
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

Message 5 of 10
Kent1Cooper
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, AIA
Message 6 of 10
Lee_Mac
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.

Message 7 of 10
jlamber
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

 

 

Message 8 of 10
Lee_Mac
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.

Message 9 of 10
Shneuph
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)
Message 10 of 10
jlamber
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 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost