Nolan Driessen Posted July 13, 2020 Posted July 13, 2020 (edited) I have been looking into this for a few hours now with no luck, I know similar posts have been made but I dont believe they are answering my question specifically. Apologies if this is a repeat. I am trying to explode every block in my drawing on an unlocked layer, but I find after I run (command "Explode" "All" "") nothing is changed, but I do get a message in the text window saying "Unknown command "VLIDE"". It is worth noting I have many locked layers, but the layer I want exploded is unlocked. The text window also gives many "The object is on a locked layer." messages, which again is expected due to having locked layers. If I run this separate from the rest of my code, just in the Visual LISP Console I get the same problem, so I know it is not due to any other potential errors. Because my command is so simple I know there is not an extra return in the statement, I can run this manually in AutoCAD and it works. Any help would be appreciated. Thank you. Edited July 13, 2020 by Nolan Driessen Quote
pkenewell Posted July 13, 2020 Posted July 13, 2020 Please share the code. Can't diagnose what is going on if we can't see how you are applying the command statement. Quote
Nolan Driessen Posted July 13, 2020 Author Posted July 13, 2020 56 minutes ago, pkenewell said: Please share the code. Can't diagnose what is going on if we can't see how you are applying the command statement. The code I've been using to test is about as simple as it gets. (defun Test_Explode ( / ) (command "Explode" "ALL" "") ) While there is more that will be done in the main routine, whatever problem is causing this line to not explode all is really tripping me up. Quote
Roy_043 Posted July 14, 2020 Posted July 14, 2020 The Explode command behaves slightly differently when called from Lisp. You need to get rid of the Enter (""): (defun Test_Explode () (command "_.explode" "_all") ) 1 Quote
Lee Mac Posted July 14, 2020 Posted July 14, 2020 (edited) 9 hours ago, Roy_043 said: The Explode command behaves slightly differently when called from Lisp. You need to get rid of the Enter (""): (defun Test_Explode () (command "_.explode" "_all") ) This behaviour is dependent on the value of the bit-coded QAFLAGS system variable in AutoCAD - if bit 1 is set, the EXPLODE command accepts selection sets when called through AutoLISP, else the EXPLODE command will only accept a single entity. As such, I would suggest: (setq qaf (getvar 'qaflags)) (setvar 'qaflags 1) (command "_.explode" "_all" "") (setvar 'qaflags qaf) FWIW, here is the documentation I have on the QAFLAGS system variable: QAFLAGS (Category: Environment) Read-only: False Data Type: Integer Stored In: Registry Default Value: 0 Comments: Undocumented Participates in the SysVarChanged Event: True Description: An internal system variable that is used by Autodesk. It stands for Quality Assurance Flags. Below are some of the values that have been discovered and tested. There are more, but no one really knows them all because each developer uses this variable differently. 0 - Commands work like normal 1 - ^C in menu cancels grips in they are active, simulating the ESCape key, allows selection sets in explode when used in AutoLISP. 2 - No pauses during the List command 4 - No Alert boxes displayed 8 - Unknown 16 - Unknown 32 - Unknown 64 - Unknown 128 - Allows for the use of Noun/Verb and Grips via. The AutoLISP command function (e.g., emulate user picks while AutoCAD is at the Command: prompt) 256 - Unknown 512 - Sets Bind type to insert in AutoCAD R14 Edited July 14, 2020 by Lee Mac 1 Quote
Nolan Driessen Posted July 14, 2020 Author Posted July 14, 2020 (edited) 50 minutes ago, Lee Mac said: This behaviour is dependent on the value of the bit-coded QAFLAGS system variable in AutoCAD - if bit 1 is set, the EXPLODE command accepts selection sets when called through AutoLISP, else the EXPLODE command will only accept a single entity. As such, I would suggest: (setq qaf (getvar 'qaflags)) (setvar 'qaflags 1) (command "_.explode" "_all" "") (setvar 'qaflags qaf) FWIW, here is the documentation I have on the QAFLAGS system variable: QAFLAGS (Category: Environment) Read-only: False Data Type: Integer Stored In: Registry Default Value: 0 Comments: Undocumented Participates in the SysVarChanged Event: True Description: An internal system variable that is used by Autodesk. It stands for Quality Assurance Flags. Below are some of the values that have been discovered and tested. There are more, but no one really knows them all because each developer uses this variable differently. 0 - Commands work like normal 1 - ^C in menu cancels grips in they are active, simulating the ESCape key, allows selection sets in explode when used in AutoLISP. 2 - No pauses during the List command 4 - No Alert boxes displayed 8 - Unknown 16 - Unknown 32 - Unknown 64 - Unknown 128 - Allows for the use of Noun/Verb and Grips via. The AutoLISP command function (e.g., emulate user picks while AutoCAD is at the Command: prompt) 256 - Unknown 512 - Sets Bind type to insert in AutoCAD R14 10 hours ago, Roy_043 said: The Explode command behaves slightly differently when called from Lisp. You need to get rid of the Enter (""): (defun Test_Explode () (command "_.explode" "_all") ) Thank you for the responses. I have updated my code, and finally managed to get it to work though even without the extra enter I still had issues where explode all did nothing to the blocks, and getting a selection set of the blocks and exploding that selection set did nothing as well (but I was no longer getting "Unknown command VLIDE"). My final solution was to select all blocks, repeat through all of them, and explode one object at a time. This is a solution I am not happy with for a few reasons, mostly because I don't understand why it works when others failed. Thank you all for the help, I had not realized there were flags I should be setting, nor did I realize commands could differ in LISP from what you would enter manually. Edited July 14, 2020 by Nolan Driessen Quote
Lee Mac Posted July 14, 2020 Posted July 14, 2020 43 minutes ago, Nolan Driessen said: My final solution was to select all blocks, repeat through all of them, and explode one object at a time. This is a solution I am not happy with for a few reasons, mostly because I don't understand why it works when others failed. Because QAFLAGS is evidently set to 0, as explained above, and so EXPLODE will only accept one object at a time. Quote
Nolan Driessen Posted July 14, 2020 Author Posted July 14, 2020 21 minutes ago, Lee Mac said: Because QAFLAGS is evidently set to 0, as explained above, and so EXPLODE will only accept one object at a time. The AutoCAD command window was filled with "The object is on a locked layer." messages though, implying the explode was at least looking at many objects. Note the layer I cared about was unlocked, others were locked however. Would QAFLAGS set to 0 mean only the first object was exploded while others were processed in some way that would give that message but not actually explode? Quote
Roy_043 Posted July 15, 2020 Posted July 15, 2020 BricsCAD also has the QAFLAGS system variable. But its implementation is not compatible with AutoCAD. The variable has no effect on calling the Explode command from Lisp. Quote
pkenewell Posted July 15, 2020 Posted July 15, 2020 Thanks All. I re-learned something too that I had forgotten about! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.