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

0 Members and 2 Guests are viewing this topic.

owenwengerd

  • Bull Frog
  • Posts: 451
Re: rename block with preview
« Reply #15 on: August 01, 2012, 10:57:27 AM »
I tried using the Block List instead of a normal listbox, since it shows a preview directly inside the listbox (similar to Design Center). But I couldn't find a way to reset the lisbox after renaming the block - it would still display the old name  :| . Perhaps I've missed something.

Did you try the (dcl_BlockList_Reset) method?

This would make a nice OpenDCL sample. Do you mind if I steal it? I would change the name to RENAMEBLOCK and make a few small changes. For example, I would put the initialization code inside OnInitialize instead of in the main function after the (dcl_Form_Show) call.

HasanCAD

  • Swamp Rat
  • Posts: 1420
Re: rename block with preview
« Reply #16 on: August 01, 2012, 11:09:17 AM »
Should I instal OpenDCL Or loading *.arx is enough?

You should install, then it will load automatically without changing your AutoCAD configuration.

IT do not install 3rd party programs so Is there a way to use ODCL without install 3rd party application?


jbuzbee

  • Swamp Rat
  • Posts: 851
Re: rename block with preview
« Reply #17 on: August 01, 2012, 11:18:03 AM »
Dude, I am so with you - but OpenDCL is soo different. Owen is the the MAN!  He has taken on this free programming to heart and is commited to continuing the developmont of this OPEN DEVOLPMENT PLATFORM.

Go Owen!
James Buzbee
Windows 8

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: rename block with preview
« Reply #18 on: August 01, 2012, 11:57:45 AM »
IT do not install 3rd party programs so Is there a way to use ODCL without install 3rd party application?
It is possible to arxload the OpenDCL runtime instead of letting it load itself after installing. There's still an issue regarding this though: you still need all the required files (ARX/DLL) and the relevant settings like support paths - basically you need to manually change stuff which the install would have done for you.

Also if you manually arxload, you need to figure out which ARX you need to load for your acad version and 32/64 bit. This is done automatically for you by the OPENDCL command. So it makes you programming more complex than it would otherwise be - and it might cause unforeseen errors. That's probably why Owen's advising you against going this route. Also, I'm not sure if licensing would permit you to do this - you'd probably need to ensure you copy all the files from the install MSI (including any licensing stuff).

Did you try the (dcl_BlockList_Reset) method?
I did yes, but it had no effect. I added it as a final call in the c:RenBlocks_frmRenBlocks_btnRen_OnClicked event (i.e. after the rename happened). But the list would still show the old name - and then clicking on the old blockname would not update the preview tile.

As I understand the reset idea (from ODCL's help on the function), it reverts a blocklist from displaying an external DWG's blocks to displaying the current DWG's blocks. And for me it seems that's exactly what it does and no more - i.e. if it's already showing the current DWG's content, it doesn't "reset" to re-read the content.

This would make a nice OpenDCL sample. Do you mind if I steal it?
Sure any time! I don't mind ... especially as I've given the code away on here already  ;)

I would change the name to RENAMEBLOCK and make a few small changes. For example, I would put the initialization code inside OnInitialize instead of in the main function after the (dcl_Form_Show) call.
Good point! That would be a lot better, probably also minimize on errors!  :kewl:
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

owenwengerd

  • Bull Frog
  • Posts: 451
Re: rename block with preview
« Reply #19 on: August 01, 2012, 02:06:34 PM »
Did you try the (dcl_BlockList_Reset) method?
I did yes, but it had no effect. I added it as a final call in the c:RenBlocks_frmRenBlocks_btnRen_OnClicked event (i.e. after the rename happened). But the list would still show the old name - and then clicking on the old blockname would not update the preview tile.

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).

Sam

  • Bull Frog
  • Posts: 201
Re: rename block with preview
« Reply #20 on: August 02, 2012, 03:25:35 AM »
Glad to help. Attached is a version  which uses ODCL. Note you'll need to install the ODCL Runtime version 6, either that or the Studio if you want to create your own ODCL dialogs. You don't need both as the Studio includes the runtime already.

Save both files into a folder on your support path & have the LSP file loaded. Then the command is RenBlocks. It should open a modeless dialog (i.e. while it's open you can still do other things in the drawing) with a list of block names and a preview. Below the preview is a field to type the new block name and a rename button.

Dear sir,

thankssssssssssssss , save my time thxxxxxx
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

Sam

  • Bull Frog
  • Posts: 201
Re: rename block with preview
« Reply #21 on: August 02, 2012, 03:31:17 AM »
dear sir,

thx for u r effort,

one problem i rename same name no alert come ( example : duplicate name or block already exist)

sorry for my bad english
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

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: rename block with preview
« Reply #22 on: August 03, 2012, 11:02:20 AM »
Sorry, yes - bad of me to not catch that!

Try this 2nd version: Added an alert if the name already exists. It also now incorporates a search field so you can filter blocknames by a few characters inside their name. Followed suit with Owen's suggestion to move intialization into an initialize event (also included defuns inside this so the defuns are only created once the dialog is displayed).

Edit: See next post for further fix.
« Last Edit: August 03, 2012, 11:20:15 AM by irneb »
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: rename block with preview
« Reply #23 on: August 03, 2012, 11:19:46 AM »
And a 3rd version to actually work if you have more than 1 DWG open at a time. It uses the On Document Activated event to reload the block-name list. Also allows for you to add the RenBlocks command to an autoload statement instead of forcing you to have it loaded in all DWG manually.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Sam

  • Bull Frog
  • Posts: 201
Re: rename block with preview
« Reply #24 on: August 04, 2012, 01:40:42 AM »
And a 3rd version to actually work if you have more than 1 DWG open at a time. It uses the On Document Activated event to reload the block-name list. Also allows for you to add the RenBlocks command to an autoload statement instead of forcing you to have it loaded in all DWG manually.
Dear Sir,

Thx.. sorry for inconvenience

one problem i rename same name (duplicate name)
example (already block name is 1st floor & i rename second block same name no alert r comes)

some error are new version
Code: [Select]
Command: RENBLOCKS

OpenDCL Runtime [7.0.0.6] loaded
; error: ADS request error
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

Lee Mac

  • Seagull
  • Posts: 12905
  • London, England
Re: rename block with preview
« Reply #25 on: August 05, 2012, 07:07:12 PM »
This thread inspired me to attempt to create a block preview using standard DCL:-)

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: rename block with preview
« Reply #26 on: August 06, 2012, 04:19:36 AM »
Dear Sir,

Thx.. sorry for inconvenience

one problem i rename same name (duplicate name)
example (already block name is 1st floor & i rename second block same name no alert r comes)

some error are new version
Code: [Select]
Command: RENBLOCKS

OpenDCL Runtime [7.0.0.6] loaded
; error: ADS request error
Could you perhaps attach a sample DWG file with a block causing this? Also which version of ACad are you using?

I can't seem to duplicate the error.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Sam

  • Bull Frog
  • Posts: 201
Re: rename block with preview
« Reply #27 on: August 06, 2012, 05:45:17 AM »
Dear Sir,

Thx.. sorry for inconvenience

one problem i rename same name (duplicate name)
example (already block name is 1st floor & i rename second block same name no alert r comes)

some error are new version
Code: [Select]
Command: RENBLOCKS

OpenDCL Runtime [7.0.0.6] loaded
; error: ADS request error
Could you perhaps attach a sample DWG file with a block causing this? Also which version of ACad are you using?

I can't seem to duplicate the error.
dear sir,
i am using autocad 2012 & windows 7 32 bit
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

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: rename block with preview
« Reply #28 on: August 06, 2012, 06:03:40 AM »
That file seem to work perfectly for me (Acad 2012 on Win7-64 bit with ODCL 6.0.2.5)
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

Sam

  • Bull Frog
  • Posts: 201
Re: rename block with preview
« Reply #29 on: August 06, 2012, 06:35:16 AM »
That file seem to work perfectly for me (Acad 2012 on Win7-64 bit with ODCL 6.0.2.5)
dear sir,
thx for help
problem solve because some utility crash with this lisp, i unload all utility work is fine

thxxx again u save my working times
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