Author Topic: Block Manager [Option 2]  (Read 25321 times)

0 Members and 1 Guest are viewing this topic.

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Block Manager [Option 2]
« on: March 03, 2010, 01:04:00 PM »
****NEW CODE ADDED****
-Check the lisp header for changes

So in response to this thread >Here<.

I have finally gotten off of my arse and finished the first OpenDCL project that I started.  I want to thank JB for some of the ObjectDBX code.

A quick run down:

-It is a palette form that utilizes OpenDCL.
-It was created in [5.1.2.3]
-It writes all of its setting to the registry (theswamp\block manager\)
-It can use either a Folder library or a Drawing container Library
-It has the ability to save libraries as favorites for quicker access
-It has the ability to select the insert layer as long as it is in the drawing
-It has the ability to open the current block for editing
-It has a quick link to theswamp.....

Here are some pics:

The Palette:


The Favorites:


The File info:


The palette starts with a dialog asking for the library type.  Once selected it will then ask for the library location:

-For Folder type this will be the top level of the library and will show all the sub folders as libraries in the drop down.  Select the library and it will show all of the drawings in that
sub folder as blocks in the list.

-For Drawing type this will be the folder that contains all of the container drawings.  The drawing will be listed as libraries.  Select the library and the blocks in that drawing will be listed as block in the list.

You can change library type by selecting either the large text or the button.

To add the current library as a favorite select the favorite button (the little piece of paper) and it will bring up the dialog.  Just hit add. Delete should be obvious.  Load is as it says, you can also load by dbl clicking the favorite in the list.

To reset the directory, just click the open file button and reselect the directory.  This will change the current directory.

Double clicking the block in the block list will show the file properties of the selected block (if it is a drawing) or the properties of the container drawing.

Double clicking the the block preview will insert the block on the layer listed (if it is not changed it should be the current layer).  Using the insert button will do the same.

Close button will close the palette (duh)

The ? will not do anything  (YET).

I hope that this explains most everything, if not, you know where to find me (hiding in the corner)

Comments / Feedback welcome

ENJOY!

« Last Edit: August 05, 2010, 01:01:08 PM by TimSpangler »
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Block Manager [Option 2]
« Reply #1 on: March 03, 2010, 01:18:46 PM »
Tim,

Excellent work!  I like the graphic at the bottom!  Thanks for doing this - I was getting bored with mine (very short attention span  :lol: )

I'm eager to download it and give it a try.  Looks like a lot of nice features . . ..

jb

PS: good work.
James Buzbee
Windows 8

nivuahc

  • Guest
Re: Block Manager [Option 2]
« Reply #2 on: March 03, 2010, 01:26:10 PM »
Tim,

Looks fantastic!

One minor problem:

Code: [Select]
Specify scale factor: <1>
.-insert Enter block name or [?]: S:\ACAD\Blocks\\J-Box.dwg
Invalid block name.
; error: Function cancelled

nivuahc

  • Guest
Re: Block Manager [Option 2]
« Reply #3 on: March 03, 2010, 01:30:50 PM »
This fixed it. Not sure how it affects DWG Library type blocks...

Code: [Select]
(defun c:BLOCK_PREVIEW_OnDblClicked (/ TmpEnt tmpScale)

;; Get the insertion scale
(if (null (setq tmpScale (getreal "\n Specify scale factor: <1>")))
(setq tmpScale 1)
)
;; Insert the selected block
(if (= SBM_LibType "Folder")
;; Insert the block
[color=red];(command ".-insert" (strcat SBM_Directory "\\" SBM_Library "\\" SBM_Block) "scale" tmpScale PAUSE PAUSE)[/color]
[color=blue](command ".-insert" (strcat SBM_Directory "\\" SBM_Library SBM_Block) "scale" tmpScale PAUSE PAUSE)[/color]
(progn
;; Import the block from the container
(BLOCK_ImportDbx (strcat SBM_Directory "\\" SBM_Library) SBM_Block)
;; Insert the block
(command ".-insert" SBM_Block "scale" tmpScale PAUSE PAUSE)
)
)
;; Get the block
(setq TmpEnt (entget(entlast)))
;; Change the layer
(setq TmpEnt (subst (cons 8 SBM_Layer)(assoc 8 TmpEnt) TmpEnt))
(entmod TmpEnt)
;; Send status
(princ (strcat "\n " SBM_Block " was inserted...."))
;; Silent Exit
(princ)
)

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Block Manager [Option 2]
« Reply #4 on: March 03, 2010, 01:33:59 PM »
This fixed it. Not sure how it affects DWG Library type blocks...

Code: [Select]
(defun c:BLOCK_PREVIEW_OnDblClicked (/ TmpEnt tmpScale)

;; Get the insertion scale
(if (null (setq tmpScale (getreal "\n Specify scale factor: <1>")))
(setq tmpScale 1)
)
;; Insert the selected block
(if (= SBM_LibType "Folder")
;; Insert the block
[color=red];(command ".-insert" (strcat SBM_Directory "\\" SBM_Library "\\" SBM_Block) "scale" tmpScale PAUSE PAUSE)[/color]
[color=blue](command ".-insert" (strcat SBM_Directory "\\" SBM_Library SBM_Block) "scale" tmpScale PAUSE PAUSE)[/color]
(progn
;; Import the block from the container
(BLOCK_ImportDbx (strcat SBM_Directory "\\" SBM_Library) SBM_Block)
;; Insert the block
(command ".-insert" SBM_Block "scale" tmpScale PAUSE PAUSE)
)
)
;; Get the block
(setq TmpEnt (entget(entlast)))
;; Change the layer
(setq TmpEnt (subst (cons 8 SBM_Layer)(assoc 8 TmpEnt) TmpEnt))
(entmod TmpEnt)
;; Send status
(princ (strcat "\n " SBM_Block " was inserted...."))
;; Silent Exit
(princ)
)

Weird?  It has been working great since I started testing it a week ago.  Let me have another look at that.  As far as drawing blocks that code is right below the code that you modified.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Block Manager [Option 2]
« Reply #5 on: March 03, 2010, 01:35:54 PM »
James,

I do have one small issue with the dbx code.  It seems to leave the selected container drawing locked until autocad closes?  have you seen this?
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Block Manager [Option 2]
« Reply #6 on: March 03, 2010, 01:39:24 PM »
I'm out of the office and my laptop doesn't have ACAD so I can't look / test, but you are releasing the DBXDOC object?  This should be done as soon as possible in the code.  I'll have a look tonight at home - that is until Ghost Hunters comes on!

James Buzbee
Windows 8

alanjt

  • Needs a day job
  • Posts: 5353
  • Standby for witty remark...
Re: Block Manager [Option 2]
« Reply #7 on: March 03, 2010, 02:28:48 PM »
Very nice Tim! Will have to test tomorrow.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Block Manager [Option 2]
« Reply #8 on: March 03, 2010, 03:16:50 PM »
As for the Scale, I would suggest of adding a check box(s) the set to the scale to dimscale and/or cannoscale.
My 1/2 cent opinion.
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Block Manager [Option 2]
« Reply #9 on: March 03, 2010, 03:28:33 PM »
This fixed it. Not sure how it affects DWG Library type blocks...

Code: [Select]
(defun c:BLOCK_PREVIEW_OnDblClicked (/ TmpEnt tmpScale)

;; Get the insertion scale
(if (null (setq tmpScale (getreal "\n Specify scale factor: <1>")))
(setq tmpScale 1)
)
;; Insert the selected block
(if (= SBM_LibType "Folder")
;; Insert the block
[color=red];(command ".-insert" (strcat SBM_Directory "\\" SBM_Library "\\" SBM_Block) "scale" tmpScale PAUSE PAUSE)[/color]
[color=blue](command ".-insert" (strcat SBM_Directory "\\" SBM_Library SBM_Block) "scale" tmpScale PAUSE PAUSE)[/color]
(progn
;; Import the block from the container
(BLOCK_ImportDbx (strcat SBM_Directory "\\" SBM_Library) SBM_Block)
;; Insert the block
(command ".-insert" SBM_Block "scale" tmpScale PAUSE PAUSE)
)
)
;; Get the block
(setq TmpEnt (entget(entlast)))
;; Change the layer
(setq TmpEnt (subst (cons 8 SBM_Layer)(assoc 8 TmpEnt) TmpEnt))
(entmod TmpEnt)
;; Send status
(princ (strcat "\n " SBM_Block " was inserted...."))
;; Silent Exit
(princ)
)

Chuck,

What is the actual block name that you are inserting?  Are you using folder or drawing library?

ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016

Crank

  • Water Moccasin
  • Posts: 1503
Re: Block Manager [Option 2]
« Reply #10 on: March 03, 2010, 03:29:09 PM »
As for the Scale, I would suggest of adding a check box(s) the set to the scale to dimscale and/or cannoscale.
My 1/2 cent opinion.
If you want to use cannoscale, you have to make the block annotative and let Autocad handle the scaling.
I think the scale options should be the same as with normal toolpalettes.
Vault Professional 2023     +     AEC Collection

nivuahc

  • Guest
Re: Block Manager [Option 2]
« Reply #11 on: March 03, 2010, 03:37:22 PM »
Folder, and that happened no matter which block I chose. For the record, the one I posted above was named J-Box.dwg

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: Block Manager [Option 2]
« Reply #12 on: March 03, 2010, 03:51:45 PM »
As for the Scale, I would suggest of adding a check box(s) the set to the scale to dimscale and/or cannoscale.
My 1/2 cent opinion.
If you want to use cannoscale, you have to make the block annotative and let Autocad handle the scaling.
I think the scale options should be the same as with normal toolpalettes.


Code: [Select]

(setq CANN0SCALE (getvar "cannoscalevalue"))
(setq ARCHVALUE (/ 1 CANN0SCALE)) ;start of Calculations

Returns
Quote
ARCHVALUE = 96.0
CANN0SCALE = 0.0104167
I have it inserting Dumb Blocks all day long? 
Am i using it wrong?
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: Block Manager [Option 2]
« Reply #13 on: March 03, 2010, 04:04:26 PM »
Quote
I have it inserting Dumb Blocks all day long? 
Am i using it wrong?

No.  That's how I use it for like tags and stuff.  The new way is to let AutoCAD manage annotative blocks, scaling them when the annoscale changes.  I find this functionality limited for a number of reasons.  Besides, we use the Project Navigator in Architecture so all annotation goes into a View drawing which never changes scale.
James Buzbee
Windows 8

TimSpangler

  • Water Moccasin
  • Posts: 2010
  • CAD Naked!!
Re: Block Manager [Option 2]
« Reply #14 on: March 03, 2010, 04:08:50 PM »
Folder, and that happened no matter which block I chose. For the record, the one I posted above was named J-Box.dwg

From you example above, it seems to be adding extra \  between the library and the block?  I am not seeing that.  I will check through the code again.
ACA 2015 - Windows 7 Pro
All Comments and Content by TimSpangler, Copyright 2016