designerstuart Posted February 7, 2012 Posted February 7, 2012 i want to do smething like: select [enter block name] erase is there a way to do this? i'll use it as part of a script. any way to delete all instances of a block without having to click it would be great. thanks! Quote
designerstuart Posted February 7, 2012 Author Posted February 7, 2012 a bit more info: i've tried using qselect, but can't run it from the command line. i've tried SELECT and ERASE commands, but neither seem to have the ability to chose objects by name? closest i've come is by using the 'previous' bit of a command, but not close enough. thx! Quote
designerstuart Posted February 7, 2012 Author Posted February 7, 2012 Thanks Tiger "QSELECT does not have command line option" - oh dear, as i suspected. i was hoping to avoid lisp - mainly because i was hoping it could be done from the command line. is there really no way to select or delete a block by name without lisping? Quote
Tiger Posted February 7, 2012 Posted February 7, 2012 I ain't the brightest star when it comes to scripting, but I know that you can use the SSGT function right on the comandline - shouldn't that mean it's possible to put it into a script? Quote
designerstuart Posted February 7, 2012 Author Posted February 7, 2012 hmmm i'm afraid i don't know enough about that either....... failing that, anyone know a way to insert the block definition into a drawing, but not the block itself? above i was trying to insert a block, then delete it in a script, but if i can not insert it in the first place that would work. thanks! Quote
rkent Posted February 7, 2012 Posted February 7, 2012 You go through the insert process and cancel when asked for insertion point. The definition is in the drawing but not showing. Quote
dbroada Posted February 7, 2012 Posted February 7, 2012 as I can never remember how to escape from scripts I do it this way.... INSERT myBLOCK 0,0 <etc> ZOOM E ERASE L ZOOM P you may not need the zoom commands provided you drop the block within the visible area of your drawing. Quote
eyde Posted February 7, 2012 Posted February 7, 2012 Have you tried selectsimilar? under Settings just select name. Quote
designerstuart Posted February 7, 2012 Author Posted February 7, 2012 as I can never remember how to escape from scripts I do it this way.... ....... you may not need the zoom commands provided you drop the block within the visible area of your drawing. great dave, thanks for this. yes i have never used the cancel midway script command, but oddly enough did know that you can never remember how to do it! RKent - if you know how to do this, i'd appreciate it. might make a tidier script. otherwise, the script is basically as you show dave. so is the "L" for "last"? did not know that one. i tried using "previous", but as i'd just inserted it, that didn't work. thanks all! Quote
ScribbleJ Posted February 7, 2012 Posted February 7, 2012 Have you tried the command SSX? Once you invoke the command press enter once more for more options. It is all command line. It is what I use in script files for selection. Quote
designerstuart Posted February 7, 2012 Author Posted February 7, 2012 i've updated my script and it work perfectly, so thanks all for the help. and now i am interested....... how do you use this "ssx"? for instance, to select a block by name? Quote
ScribbleJ Posted February 7, 2012 Posted February 7, 2012 i've updated my script and it work perfectly, so thanks all for the help. and now i am interested....... how do you use this "ssx"? for instance, to select a block by name? Enter SSX at the command line the press the enter key once more to see the options. You can then enter B to choose Block name from the options it gives you. Quote
designerstuart Posted February 8, 2012 Author Posted February 8, 2012 ah sweet, thanks scribble. so i could alternatively add ssx block [my block name here] erase previous to my script and it will erase the block by selecting it. think i will have to look into that command, it looks pretty useful. thanks again! Quote
ScribbleJ Posted February 8, 2012 Posted February 8, 2012 Your very welcome. One other thing you might add to that would be the purge command. I use it if I'm replacing a block with an updated version that has the same block name or deleting the engineers stamp for the record drawings. That way engineers stamps are not in the electronic files shipped off to the client. Especially if there is electronic signatures. Quote
CADEveryDay Posted January 31, 2024 Posted January 31, 2024 If I wanted to add it to a routine I have already created how would this look? Below is what I have so far however, it doesn't seem to work as a .lsp. (COMMAND "-SSX" "" "BLOCK" "BLOCK_NAME" "" "ERASE" "PREVIOUS" "") Quote
BIGAL Posted January 31, 2024 Posted January 31, 2024 Try this (defun c:eblk ( / bname ss) (setq bname (cdr (assoc 2 (entget (car (entsel "\nPick a block for name ")))))) (setq ss (ssget "X" '((0 . "INSERT")(cons 2 bname)))) (command "erase" ss "") (princ) ) Quote
CADEveryDay Posted February 1, 2024 Posted February 1, 2024 1 hour ago, BIGAL said: Try this (defun c:eblk ( / bname ss) (setq bname (cdr (assoc 2 (entget (car (entsel "\nPick a block for name ")))))) (setq ss (ssget "X" '((0 . "INSERT")(cons 2 bname)))) (command "erase" ss "") (princ) ) Thanks for the help so far. It looks like this code picks requires user input to 'pick a block for name' I would like to put the block name in the code itself and run it with no user input. any help would be appreciated. Quote
troggarf Posted February 1, 2024 Posted February 1, 2024 Maybe this will help: https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/selection-set-by-block-name/td-p/3356055 Quote
BIGAL Posted February 1, 2024 Posted February 1, 2024 Remove the select bname line and add your block name "asdf" where bname exists in the ssget and all done, rename the defun to something more useful. 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.