Author Topic: rename block with preview  (Read 11340 times)

0 Members and 1 Guest are viewing this topic.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: rename block with preview
« Reply #30 on: August 06, 2012, 10:15:45 AM »
If not too much trouble, could you say what utility it was which crashes this? Perhaps it's something which doesn't work too well with ODCL.

Anyhow:
Looking at the code, it should refresh the list from scratch, so I would expect changes to be reflected. There may be a bug somewhere causing it to not complete the reset because of an error. I'll have a look when I get a minute. If you still have the code, you might check the return value of the Reset function to see if it returns T or NIL. I'll bet it returns NIL (indicating an error).
You seem to be correct. There might have been something wrong in the DWG I tested - causing the reset to error.

I've made a 2nd command RenBlocks2 which uses a block-list instead of a generic list. Also made it so it reselects the renamed block after the rename - not sure if it's correct to do so though  :| . BTW, the generic list allows for simply passing the string to be selected, while I need to find out which index to select in the block-list (and seeing as it's sorted that's not a trivial task). Also I now left the generic list, since the block-list has no means of filtering by wildcard.

Fixed another issue in the generic-list: Omitted block names coming from inside xrefs. That was rather silly of me!  :-[
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

HasanCAD

  • Swamp Rat
  • Posts: 1317
Re: rename block with preview
« Reply #31 on: August 06, 2012, 10:49:30 AM »
Great irneb

Sam

  • Bull Frog
  • Posts: 201
Re: rename block with preview
« Reply #32 on: August 06, 2012, 11:07:09 AM »
If not too much trouble, could you say what utility it was which crashes this? Perhaps it's something which doesn't work too well with ODCL.

Anyhow:
Looking at the code, it should refresh the list from scratch, so I would expect changes to be reflected. There may be a bug somewhere causing it to not complete the reset because of an error. I'll have a look when I get a minute. If you still have the code, you might check the return value of the Reset function to see if it returns T or NIL. I'll bet it returns NIL (indicating an error).
You seem to be correct. There might have been something wrong in the DWG I tested - causing the reset to error.

I've made a 2nd command RenBlocks2 which uses a block-list instead of a generic list. Also made it so it reselects the renamed block after the rename - not sure if it's correct to do so though  :| . BTW, the generic list allows for simply passing the string to be selected, while I need to find out which index to select in the block-list (and seeing as it's sorted that's not a trivial task). Also I now left the generic list, since the block-list has no means of filtering by wildcard.

Fixed another issue in the generic-list: Omitted block names coming from inside xrefs. That was rather silly of me!  :-[
dear sir nice
some block preview & some block not previw
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: rename block with preview
« Reply #33 on: August 06, 2012, 11:38:27 AM »
I run this from a pulldown, no preview, but just pick the one you want to rename, and viola.
I'm sure I got it from TheSwamp from someone:
Code: [Select]
(defun c:BlockRename ()
  (vl-load-com)
  (setq bname (vla-get-EffectiveName (vlax-ename->vla-object (car(entsel "\nSelect block: ")))))
  (command "rename" "block" bname pause)
  );DEFUN

Bhull1985

  • Guest
Re: rename block with preview
« Reply #34 on: September 24, 2013, 10:56:07 AM »
Irneb would this at all be possible to modify to include a 2nd list_box, required for dynamic blocks with visibility states?
So that the first list_box will be populated with the block names and upon selection the 2nd list_box would be populated with the selected's visibility states?
That would be...amaazzzing!

jonathanpiette

  • Guest
Re: rename block with preview
« Reply #35 on: February 06, 2015, 01:14:42 PM »
Dear All,

It's Possible rename block with preview

YES ITS POSSIBLE without any LISP.  in 2014, I'm using DESIGN CENTER (Ctrl-2) on one side of the screen, Select Blocks , Right-Clic on View/Large... OR Right-clic on View/Preview

Then I use command RENAME on the other side of the screen to rename what I see in Design Center. Y

You have to close your RENAME windows everytime you want to change the bloc preview on DC but it's better than nothing!