TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: jbuzbee on February 08, 2010, 08:29:38 AM

Title: the Swamp Block Library Manager?
Post by: jbuzbee on February 08, 2010, 08:29:38 AM
http://www.theswamp.org/index.php?topic=32046.0

Seems to be a need for a good, easy to set up, easy to use Block Library Manager.  How many here at the Swamp would be willing to contribute to put something out there people could use?  Any interest?  I, of course, would like to volunteer to handle the GUI.  Model, Modeless, and Palette forms could be used.

What seems to be the question is how to make it "customizable".  Allow the user to customize location, naming conventions, container type, that sort of stuff without using code.  Think maybe an .ini file.  I know the code is already written in many of our libraries out there; it would just be a matter of collectively deciding the direction then someone managing compilation.

Any interest let me know.

jb

Here it is: v4.0
Title: Re: the Swamp Block Library Manager?
Post by: GDF on February 08, 2010, 10:11:52 AM
James

Sounds like a worth while project. I'm still using my klunky dcl interface routine that requires making slides and slide libraries. The routine uses an .ini file and thus requires updating along with the slide library every time a new block is added.

Gary
Title: Re: the Swamp Block Library Manager?
Post by: hermanm on February 08, 2010, 10:33:38 AM
I use this one:

http://www.cadwerx.net/default.aspx?Path=BlockWerx
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 08, 2010, 11:07:40 AM
I can help with some lisp coding stuff.
Title: Re: the Swamp Block Library Manager?
Post by: TimSpangler on February 08, 2010, 11:09:53 AM
I'm in.
Title: Re: the Swamp Block Library Manager?
Post by: Bob Wahr on February 08, 2010, 11:20:55 AM
What do people think about using this not only as a useful tool but a learning project for .net?
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 08, 2010, 11:43:02 AM
What do people think about using this not only as a useful tool but a learning project for .net?

I think it could be a good program to learn with, but it's in the Lisp forum ( the idea ), and I'm not sure how many people want to learn .Net right now.  Experienced programmers think one should learn the .Net language before one starts programing with it.  I think that is a good thought also, but I'm one who just jumped right in, and learns along the way, so I'm game either way.
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 08, 2010, 11:45:01 AM
Thanks guys, I think with the expertease around here we can cobble something together that's pretty nice.  

Let me get my thoughts together - you do the same - and we'll get together soon.  I may cobble a prelim. GUI to start the conversation. We can also source the CAD general forum for some real world feedback. Man, isn't this site NICE!

Bob, I think that's a great idea.  I'm personally not interested in learning a new language BUT, I think developing the two projects concurrently can help us old lisper's understand the .net process a little easier.  We can highlight certain functions / features and post the two languages side by side.  

Well, wait a minute; that's sounds like a really good way to learn .net: maybe I am interested . . ..  :wink:
Title: Re: the Swamp Block Library Manager?
Post by: rhino on February 08, 2010, 12:49:56 PM
I've just started looking at openDCL - there's already a Block preview code there in - probably someone with expertise in openDCl can whip up something quick.

the .net version would be cool! - from the user perspective (me) hehe
Title: Re: the Swamp Block Library Manager?
Post by: dgorsman on February 08, 2010, 02:13:38 PM
I might be willing to help on the configuration/reporting side for XML-based files for the LISP side of things.  Of course, paid work comes first.   ;-)
Title: Re: the Swamp Block Library Manager?
Post by: Matt__W on February 08, 2010, 02:42:55 PM
I've just started looking at openDCL - there's already a Block preview code there in - probably someone with expertise in openDCl can whip up something quick.

the .net version would be cool! - from the user perspective (me) hehe
*cough* James *cough* *cough*   :roll:
Title: Re: the Swamp Block Library Manager?
Post by: Lee Mac on February 08, 2010, 02:46:04 PM
I'd be happy to chip in with the coding side... never used OpenDCL though..
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 08, 2010, 02:48:18 PM
If there are enough Lispers, then maybe I can try to mimic that code in .Net ( C# ), so people can see the comparisons.
Title: Re: the Swamp Block Library Manager?
Post by: dgorsman on February 08, 2010, 02:56:07 PM
If there are enough Lispers, then maybe I can try to mimic that code in .Net ( C# ), so people can see the comparisons.

Something that would be very useful from the LISP side is some convenient .NET -defined LISP interface functions - for those that don't want to get hot and heavy with the .NET world.  Also could be used to demonstrate "good" modularity for those that do.
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 08, 2010, 03:15:39 PM
If there are enough Lispers, then maybe I can try to mimic that code in .Net ( C# ), so people can see the comparisons.

Something that would be very useful from the LISP side is some convenient .NET -defined LISP interface functions - for those that don't want to get hot and heavy with the .NET world.  Also could be used to demonstrate "good" modularity for those that do.

True.  Have to look out for those though, as the .Net lisp functionality didn't arrive until later version of Acad.  I think around '09.
Title: Re: the Swamp Block Library Manager?
Post by: dgorsman on February 08, 2010, 05:48:15 PM
If there are enough Lispers, then maybe I can try to mimic that code in .Net ( C# ), so people can see the comparisons.

Something that would be very useful from the LISP side is some convenient .NET -defined LISP interface functions - for those that don't want to get hot and heavy with the .NET world.  Also could be used to demonstrate "good" modularity for those that do.

True.  Have to look out for those though, as the .Net lisp functionality didn't arrive until later version of Acad.  I think around '09.

2008, at least - I can do it here.  There was a change in objects returned from .NET defined LISP functions, I think, around 2009.
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 09, 2010, 08:29:22 AM
Thanks everyone for the replies and support.  I've cobbled together a palette in OpenDCL and will post it later, unfortunately I have to be out on appointments most of the day.  I posted a query on the CAD General site http://www.theswamp.org/index.php?topic=32081.0 (http://www.theswamp.org/index.php?topic=32081.0)

Maybe someone can keep tabs on that today and answer any questions that come up.

Thanks!

jb
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 09, 2010, 07:58:03 PM
OK, it's late but the feedback at the CAD general forum has been indispensable:  Folder based, single drawing per block.  Lets run with that!

On a side note: today was very productive.  The economic outlook is . . . wait for it . . . very promising!  Had several good meetings.  Some of you may know I'm going in a different professional direction: think Risk Management.

But this kinda stuff is what I live for.  The Swamp is a great community.


Stay tuned . . .

jb
Title: Re: the Swamp Block Library Manager?
Post by: It's Alive! on February 09, 2010, 08:09:12 PM
....Think maybe an .ini file. ....

You could use SQLitelsp to store file names, paths, etc. maybe the GUI could use queries to pull up specific groups of blocks
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 10, 2010, 04:03:48 AM
Probably Something similar to this will do to build on ...

The F:\VENDOR folder used here is a temp folder I built to test this, so your structure will be very different.
The App handles nested  Folders ( haven't tested how deep)

[added:]
Haven't made the time to test this in Bricscad yet, but it should be pretty good( touch wood)



Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 10, 2010, 04:11:34 AM
Configurable defaults read from an INI file.
Remembers where it's been.
Reads DWG files direct for the bitmap ... so no slides required.
Navigates full folder trees, so drawings can be catalogued logically, or on a whim.

OpenDCL Dialog.

Source code provided.

Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 10, 2010, 04:36:21 AM
Needs some polishing ... I haven't made time to play with this for a while.


KDUB_BlockInserter

[edit:
--------------------------------
Original Build_06:2010.0210.19:00
--------------------------------
Build_07:2010.0211.23:45
Replaced module _1003_InsertBlock
--------------------------------
Code: [Select]

(vl-load-com)
(command "_OpenDcl")
;;;---------------------------------------------------------------------------
;;;---------------------------------------------------------------------------
;;;
;|
Library Functions
kdub:iniget-validatefilename
kdub:iniget-entryvalue
kdub:assertlayer
kdub:string->strlist

Global Variables
G1003-ParentFolderString
G1003-SelectedFolder
G1003-InsertData

Add Error and Check Handling
Add ucs check ??
--------------------------------
Build_06:2010.0210.19:00
--------------------------------
Build_07:2010.0211.23:45
Replaced module _1003_InsertBlock
--------------------------------
|;
;; (setq G1003-InsertData nil)

(setq qualified_INIFileName    (kdub:iniget-validatefilename (findfile "KDUB_BlockInserter.ini")
                               )
      G1003-ParentFolderString (kdub:iniget-entryvalue qualified_INIFileName
                                                       "CONFIGURATION"
                                                       "PATH"
                               )
      G1003-Layer              (kdub:iniget-entryvalue qualified_INIFileName "CONFIGURATION" "LAYER")
      qualified_INIFileName    nil
)
(or G1003-ParentFolderString (setq G1003-ParentFolderString (getvar "DWGPREFIX")))
(or G1003-Layer (setq G1003-Layer (getvar "CLAYER")))
;;-----------------------------------------------------
(or kglobal:acadapp (setq kglobal:acadapp (vlax-get-acad-object)))
(or kglobal:activedoc (setq kglobal:activedoc (vla-get-activedocument kglobal:acadapp)))
;;-----------------------------------------------------
(kdub:assertlayer G1003-Layer)
;;;---------------------------------------------------------------------------
;;;---------------------------------------------------------------------------
;;;
(defun c:KDUB_BlockInserter (/ dclReturn
                             ;; FUNCTIONS
                             *error* _1003_InsertBlock _1003_Restore_Previous)
   ;;------standard error trap------------------
   (defun *error* (msg /)
      (while (< 0 (getvar "cmdactive")) (command))
      (setvar "menuecho" 1)
      (vla-endundomark kglobal:activedoc)
      ;;----- Display error message if applicable _-------------------
      (cond ((not msg))                                               ; no error, do nothing
            ((member (strcase msg t)                                  ; cancel
                     '("console break" "function cancelled" "quit / exit abort")
             )
            )
            ((princ (strcat "\nApplication Error: " (itoa (getvar "errno")) " :- " msg))
             ;;----- Display backtrace if in debug mode ---------------------
             (if kglobal:debug_on
                (vl-bt)
             )
            )
      )
      (setvar "errno" 0)
      (acet-error-restore)
   )
   ;;-------------------------------------------
   (vla-endundomark kglobal:activedoc)                                ; end any open undo group
   (vla-startundomark kglobal:activedoc)                              ; start new group  
   ;;-------------------------------------------
   (acet-error-init (list (list "CMDECHO"
                                0
                                "expert"
                                5
                                "BLIPMODE"
                                0
                                "SNAPANG"
                                0
                                "SNAPMODE"
                                0
                                "OSMODE"
                                0
                                "SNAPANG"
                                0
                                "PICKADD"
                                1
                                "PICKBOX"
                                5
                                "INSUNITS"
                                0
                                "CLAYER"
                                (getvar "clayer")
                                "SORTENTS"
                                1
                          )
                          0
                    )
   )
;;;-------------------------------------------
   (prompt "\nkdub_BlockInserter :   Build_06:2010.0210.19:00\n")
;;;-------------------------------------------  
;;;-------------------------------------------------------------------
;;;
   (defun _1003_InsertBlock (/ lay tmp)
      (if (vl-cmdf "._-INSERT"
                   (vl-string-subst "\\" "\\\\" (cdr (assoc "Block" G1003-InsertData)))
                   "_S"
                   (atof (cdr (assoc "Scale" G1003-InsertData)))
                   "_R"
                   (atof (cdr (assoc "Rotation" G1003-InsertData)))
                   pause
          )
         (progn (if (/= "" (setq lay (cdr (assoc "Layer" G1003-InsertData))))
                   (vl-cmdf "._chprop" (entlast) "" "_LA" lay "")
                )
                (if (= 1 (cdr (assoc "Explode" G1003-InsertData)))
                   (vl-cmdf "._explode" (entlast))
                )
         )
         (alert "Ooooops .. error in  '_1003_InsertBlock' Function")
      )
   )  
;;;-------------------------------------------------------------------
;;;
;;;-------------------------------------------------------------------
;;; (SETQ G1003-InsertData NIL)
;;;
   (defun _1003_Restore_Previous (/                  PreviousItem
                                  PreviousFolder     PreviousSubFolders
                                  PreviousDoc        splitItems
                                  CurrentFolder
                                 )
      (setq PreviousItem       (cdr (assoc "Block" G1003-InsertData))
            PreviousFolder     (vl-filename-directory PreviousItem)
            PreviousSubFolders (vl-string-subst ""
                                                (strcat G1003-ParentFolderString "\\")
                                                PreviousFolder
                               )
            PreviousDoc        (vl-string-subst "" (strcat PreviousFolder "\\") PreviousItem)
            splitItems         (kdub:string->strlist PreviousSubFolders "\\")
      )
      (setq CurrentFolder G1003-ParentFolderString)
      (foreach Folder splitItems
         (setq CurrentFolder (strcat CurrentFolder "\\" Folder))
         (c:KDUB_BlockInserter_Main_Tree_OnSelChanged nil CurrentFolder)
      )
      (dcl_tree_selectitem KDUB_BlockInserter_Main_Tree PreviousFolder)
      ;;
      (if (= PreviousFolder G1003-ParentFolderString)
         (progn
            (c:KDUB_BlockInserter_Main_Tree_OnSelChanged nil G1003-ParentFolderString)
            (dcl_tree_expanditem KDUB_BlockInserter_Main_Tree G1003-ParentFolderString 1)
            (dcl_tree_selectitem KDUB_BlockInserter_Main_Tree
                                 (dcl_tree_getrootitem KDUB_BlockInserter_Main_Tree)
            )
         )
      )
      ;; select the piccy
      (c:KDUB_BlockInserter_Main_ListBox_OnSelChanged nil PreviousDoc)
      (dcl_listbox_setcursel
         KDUB_BlockInserter_Main_ListBox
         (dcl_listbox_findstringexact KDUB_BlockInserter_Main_ListBox PreviousDoc)
      )
      (dcl_control_setvalue KDUB_BlockInserter_Main_Explode
                            (cdr (assoc "Explode" G1003-InsertData))
      )
      (dcl_control_settext KDUB_BlockInserter_Main_Scale
                           (cdr (assoc "Scale" G1003-InsertData))
      )
      (dcl_control_settext KDUB_BlockInserter_Main_Rotation
                           (cdr (assoc "Rotation" G1003-InsertData))
      )
      (dcl_combobox_selectstring KDUB_BlockInserter_Main_Layer
                                 (cdr (assoc "Layer" G1003-InsertData))
      )
   )
   ;;------------------------
   ;;------------------------
   ;; MAIN
   ;;------------------------  
   ;;
   (dcl_project_load "KDUB_BlockInserter.odcl")
   (setq dclReturn (dcl_form_show KDUB_BlockInserter_Main))
   (if (and (= 100 dclReturn) G1003-InsertData)
      (_1003_InsertBlock)
   )
   (acet-error-restore)
   (princ)
)

;;;---------------------------------------------------------------------------
;;;---------------------------------------------------------------------------
;;;
;;; EVENT FUNCTIONS
;;;
;;;---------------------------------------------------------------------------
;;;---------------------------------------------------------------------------
;;;
(defun c:KDUB_BlockInserter_Main_OnInitialize (/ ParentID Folders)
                                              ;|
  The form is being displayed.
  Populate the textFields
  Add the Parent(root) to the Main_Tree.  
  |;
   (dcl_control_settext KDUB_BlockInserter_Main_RootFolderText G1003-ParentFolderString)
   (dcl_combobox_selectstring KDUB_BlockInserter_Main_Layer G1003-Layer)
   ;;
   (setq ParentID (dcl_tree_addparent KDUB_BlockInserter_Main_Tree
                                      G1003-ParentFolderString 0
                                      -1                       1
                                     )
   )
   ;|
  Determine if the root has ChildFolders :
  If so, add each ChildFolder to the root in the Main_Tree ,
  (dcl_tree_addchild KDUB_BlockInserter_Main_Tree
                     (list                                                  
                           <ParentItem [as Handle  or   String]>
                           <Label      [as  String] >
                           <Key        [as  fully qualified path-String] >

                           {ImageIndex         [as Integer]} ;not used
                           {SelectedImageIndex [as Integer]} ;not used
                           {ExpandedImageIndex [as Integer]} ;not used
                     )
  )
  Expand the Main_Tree to show the Children
  |;
   (if
      (= ".." (cadr (setq Folders (vl-directory-files G1003-ParentFolderString NIL -1))))
        (setq RootChildFolders (cddr Folders))
   )
   (foreach folder RootChildFolders
      (dcl_tree_addchild
         KDUB_BlockInserter_Main_Tree
         (list (list ParentID folder (strcat G1003-ParentFolderString "\\" folder)))
         ;; (list (list ParentID folder (strcat G1003-ParentFolderString "\\" folder) ))
      )
   )
   (dcl_tree_expanditem KDUB_BlockInserter_Main_Tree ParentID 1)
   ;;
   ;;
   ;|
  Restore the previous settings, if applicable.
  |;
   (if G1003-InsertData
      (_1003_Restore_Previous)
      ;; else first run ...
;;;    (dcl_tree_selectitem KDUB_BlockInserter_Main_Tree
;;;                         (dcl_tree_getfirstchilditem KDUB_BlockInserter_Main_Tree ParentID)
;;;    )
      (dcl_tree_selectitem KDUB_BlockInserter_Main_Tree
                           (dcl_tree_getrootitem KDUB_BlockInserter_Main_Tree)
      )
   )
)
;;;---------------------------------------------------------------------------
;;;---------------------------------------------------------------------------
;;;

(defun c:KDUB_BlockInserter_Main_Tree_OnSelChanged
       (Label Key / SubFolders subFiles SUBLIST)
   (dcl_listbox_clear KDUB_BlockInserter_Main_ListBox)
   (dcl_dwgpreview_clear KDUB_BlockInserter_Main_DwgPreview1)
   (if (= (type Key) 'str)
      (progn
         (setq G1003-SelectedFolder key
               SubFiles             (vl-directory-files G1003-SelectedFolder "*.dwg" 1)
         )
         (if (= ".."
                (cadr (setq SubFolders (vl-directory-files G1003-SelectedFolder NIL -1)))
             )
            (setq SubFolders (cddr SubFolders))
         )
      )
      (progn
         (setq G1003-SelectedFolder G1003-ParentFolderString)
         (setq SubFiles (vl-directory-files G1003-SelectedFolder "*.dwg" 1))
         (if (= ".."
                (cadr (setq SubFolders (vl-directory-files G1003-SelectedFolder NIL -1)))
             )
            (setq SubFolders (cddr SubFolders))
         )
      )
   )
   (if SubFolders
      (progn (setq subList '())
             (foreach folder SubFolders
                (setq subList (cons (list G1003-SelectedFolder
                                          folder
                                          (strcat G1003-SelectedFolder "\\" folder)
                                          2
                                          3
                                    )
                                    subList
                              )
                )
             )
             (dcl_tree_addchild KDUB_BlockInserter_Main_Tree (reverse subList))
      )
   )
   (if subFiles
      (progn (setq subList '())
             (foreach file subFiles (setq subList (cons file subList)))
             (dcl_listbox_clear KDUB_BlockInserter_Main_ListBox)
             (dcl_listbox_addlist KDUB_BlockInserter_Main_ListBox (reverse subList))
             ;;
             (dcl_listbox_setcursel KDUB_BlockInserter_Main_ListBox 0)
             (dcl_dwgpreview_loaddwg
                KDUB_BlockInserter_Main_DwgPreview1
                (strcat G1003-SelectedFolder
                        "\\"
                        (dcl_listbox_getitemtext KDUB_BlockInserter_Main_ListBox 0)
                )
             )
      )
   )
)
;;;---------------------------------------------------------------------------
;;;---------------------------------------------------------------------------
;;;
(defun c:KDUB_BlockInserter_Main_ListBox_OnSelChanged (ItemIndex Value /)
   (dcl_dwgpreview_loaddwg KDUB_BlockInserter_Main_DwgPreview1
                           (strcat G1003-SelectedFolder "\\" Value)
   )
   (dcl_control_redraw KDUB_BlockInserter_Main_DwgPreview1)
)
;;;---------------------------------------------------------------------------
;;;---------------------------------------------------------------------------
;;;
(defun c:KDUB_BlockInserter_Main_RootFolderButton_OnClicked (/ root)
   (if (setq Root (dcl_selectfolder "Select Root Folder" G1003-ParentFolderString nil))
      (progn (setq G1003-ParentFolderString root
                   G1003-InsertData nil
             )
             (dcl_tree_clear KDUB_BlockInserter_Main_Tree)
             (dcl_listbox_clear KDUB_BlockInserter_Main_ListBox)
             (dcl_dwgpreview_clear KDUB_BlockInserter_Main_DwgPreview1)
             (c:KDUB_BlockInserter_Main_OnInitialize)
      )
   )
)
;;;---------------------------------------------------------------------------
;;;---------------------------------------------------------------------------
;;;
(defun c:KDUB_BlockInserter_Main_Insert_OnClicked (/ ItemText)
   (setq ItemText (dcl_listbox_getitemtext
                     KDUB_BlockInserter_Main_ListBox
                     (dcl_listbox_getcursel KDUB_BlockInserter_Main_ListBox)
                  )
   )
   (setq G1003-InsertData
           (list (cons "Block" (strcat G1003-SelectedFolder "\\" ItemText))
                 (cons "Scale"
                       (dcl_control_gettext KDUB_BlockInserter_Main_Scale)
                 )
                 (cons "Rotation"
                       (dcl_control_gettext KDUB_BlockInserter_Main_Rotation)
                 )
                 (cons "Explode"
                       (dcl_control_getvalue KDUB_BlockInserter_Main_Explode)
                 )
                 (cons "Layer"
                       (dcl_combobox_getebtext KDUB_BlockInserter_Main_Layer)
                 )
           )
   )
   (dcl_form_close KDUB_BlockInserter_Main 100)
)
;;;---------------------------------------------------------------------------
;;;---------------------------------------------------------------------------
;;;
(defun c:KDUB_BlockInserter_Main_ListBox_OnDblClicked (/)
   (c:KDUB_BlockInserter_Main_Insert_OnClicked)
)
;;;---------------------------------------------------------------------------
;;;---------------------------------------------------------------------------
;;;
(princ "\nKDUB_BlockInserter at the Command Line")
(princ)

[edit:
--------------------------------
Original Build_06:2010.0210.19:00
--------------------------------
Build_07:2010.0211.23:45
Replaced module _1003_InsertBlock
--------------------------------
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 10, 2010, 04:37:01 AM

Suppport files.

INI FILE
Code: [Select]
;; KDUB_BlockInserter.ini
;; Revise the default PATH and LAYER to suit
[CONFIGURATION]
PATH=F:\VENDOR
LAYER=ST-BLOCKS




LIBRARY STUFF
Code: [Select]
;;;------------------------------------------------------------------
;;;------------------------------------------------------------------
;;;------------------------------------------------------------------
;;; Return the #<VLA-OBJECT IAcadLayer Object or nil
;;; (kdub:assertLayer "ST25")
(defun kdub:assertlayer (layername / iacadlayer)
  (if (vl-catch-all-error-p
        (setq iacadlayer (vl-catch-all-apply
                           'vla-add
                           (list (vla-get-layers kglobal:activedoc)
                                 layername
                           )
                         )
        )
      )
    nil
    iacadlayer
  )
)
;;;------------------------------------------------------------------
;;;------------------------------------------------------------------
;;;
 ;|--------------------------------------------------------
Function:      KDUB:string->strlist (searchstring delimstring)
DESCRIPTION:   Converts string  into string list, removing delimiters
Remove delimiter chars such as space , \t \n

ARGS: searchstring  : any valid string
delimstring   : any valid string

EXAMPLE:
(KDUB:string->strlist "x,,2,3,," ",")  =>> ("x" "2" "3")
(KDUB:string->strlist &!34;x,,2,3,," ",x")  =>> ("2" "3")
(KDUB:string->strlist (getenv "ACAD") ";")   =>>  (^_*)
(KDUB:string->strlist "xxxx \tyyy \nzz" " \t\n") ==>> "xxxx" "yyy" "zz")
----------------------------------------------------------|;
(defun kdub:string->strlist (searchstring  delimstring
                             /             tempstring
                             index         tempchar
                             returnlist    delimchars
                            )
  (setq delimchars (vl-string->list delimstring)
        tempstring ""
        index      (1+ (strlen searchstring))
  )
  (while (> (setq index (1- index)) 0)
    (setq tempchar (substr searchstring index 1))
    (if (member (ascii tempchar) delimchars)
      (if (/= tempstring "")
        (setq returnlist (cons tempstring returnlist)
              tempstring ""
        )
      )
      (setq tempstring (strcat tempchar tempstring))
    )
  )
  (if (/= tempstring "")
    (cons tempstring returnlist)
    returnlist
  )
)
;;;------------------------------------------------------------------
;;;------------------------------------------------------------------
;;;

;|
acet-ini-get inifile [section [key [default]]])
Retrieve data from INI file.
Arguments
inifile: Name of the INI file to search.
section: Section name within the INI file.
key: Key name within the section.
default: Default value to return if key cannot be located.

Return Values
The return value depends on the parameters provided.
If only inifile is given, this function returns a list of section names
(or nil if inifile cannot be opened).
If a section name is given, a list of key names will be returned.
If a key is given, returns the value associated with the key (or default,
if the key cannot be located). Returns nil if no information can be found.
|;

;;;------------------------------------------------------------------
;;;
;|
(KDUB:iniget-entrylist
< inifile > : as string - fully qualified drive:\\path\\name
< section >  : as string
)
ReturnList shall be either :
1 ]  association list as (string key . string entryvalue) for entrys in section
2 ]  nil if process error ,  no section , no keys.

KWBrown :- Rev : 2003-Oct-17
For Acad R15, R16
|;
(defun kdub:iniget-entrylist
       (inifile section / entrylist templist entrydata returnlist)
  (if (setq entrylist (acet-ini-get inifile section))
    (progn (foreach key entrylist
             (setq entrydata (acet-ini-get inifile section key)
                   entrydata (if entrydata
                               entrydata
                               ""
                             )
                   templist  (cons (cons key entrydata) templist)
             )
           )
           (setq returnlist (reverse templist))
    )
    ;; no valid entry in section
  )
  returnlist
)
;;;------------------------------------------------------------------
;;;------------------------------------------------------------------
;;;
;|
(KDUB:iniget-entryvalue
< inifile > : as string - fully qualified drive:\\path\\name
< section > : as string
< key >: as string
)
Returnstring shall be either :
1 ]  entryvalue  as string
2 ]  nil if  process error, no key , key has no value.

KWBrown :- Rev : 2003-Oct-17
For Acad R15, R16
|;

(defun kdub:iniget-entryvalue (inifile section key / returnstring)
  (acet-ini-get inifile section key)
  ;; nil if not existing or empty 
)
;;;------------------------------------------------------------------
;;;------------------------------------------------------------------
;;;
;|
(KDUB:iniget-entry-names
< inifile > : as string - fully qualified drive:\\path\\name
< section > : as string
)
Returnlist shall be either :
1 ]  a list of entry names as strings
2 ]  nil if  process error or ini file has no section header or no entrys in header.

KWBrown :- Rev : 2003-Oct-17
For Acad R15, R16
|;

(defun kdub:iniget-entry-names
       (inifile section / tempdata returnlist)
  (acet-ini-get inifile section)
)
;;;------------------------------------------------------------------
;;;------------------------------------------------------------------
;;;
;|
(KDUB:iniget-section-names
< inifile > : as string - fully qualified drive:\\path\\name
)
Returnlist shall be either :
1 ]  a list of section names as strings
2 ]  nil if  process error or ini file has no section headers.

KWBrown :- Rev : 2003-Oct-17
For Acad R15, R16
|;

(defun kdub:iniget-section-names (inifile / tempdata returnlist)
  (acet-ini-get inifile)
)
;;;------------------------------------------------------------------
;;;------------------------------------------------------------------
;;;
;|
(KDUB:iniget-validatefilename
< inifile >  : as string - file name or qualified "drive:\\path\\name" or nil
)

Return  tempfile shall be either :
1 ]  string  qualified drive:\\path\\name.ext
2 ]  nil if  process error or file not found.

KWBrown :- Rev : 2003-Oct-17
For Acad R15, R16
|;

(defun kdub:iniget-validatefilename (inifile / returnstring)
  (or (and inifile (setq returnstring (findfile inifile)))
      (setq returnstring "")
  )
  (if (zerop (strlen returnstring))
    (setq returnstring (getfiled "Select Configuration .INI file"
                                 (if inifile
                                   inifile
                                   ""
                                 )
                                 "INI"
                                 0
                       )
    )
  )
  (if (not returnstring)
    ;; invalid filefind
    ;; if user cancels from file selection
    (acet-ui-message "Unable to process request - .INI file not found"
                     "File find Error --- time for a beer or three :)"
                     (+ 0 16)
    )
  )
  returnstring
)
;;;------------------------------------------------------------------
;;;------------------------------------------------------------------
;;;
(princ)


Title: Re: the Swamp Block Library Manager?
Post by: MvdP on February 10, 2010, 05:39:18 AM
Found this a couple of years ago on the www.

http://www.theswamp.org/index.php?topic=6576.0 (http://www.theswamp.org/index.php?topic=6576.0)

(http://home.broadpark.no/~avarnes/autolisp/gif/blib.gif)

(http://home.broadpark.no/~avarnes/autolisp/gif/blib-cfg.gif)
Title: Re: the Swamp Block Library Manager?
Post by: It's Alive! on February 10, 2010, 06:27:56 AM
....Haven't made the time to test this in Bricscad yet, but it should be pretty good( touch wood)

I don't think Bricscad has a acet-ini-get method. but it wouldn't be hard to make one  :-)
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 10, 2010, 06:33:48 AM

sounds like a project for someone trying to learn c++
<<-------- :)

Though I do have a really old lispy one  ...
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 10, 2010, 10:56:54 AM
Looks good Kerry.  I'll try and make some time, so that I can test it.
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 10, 2010, 11:05:15 AM
Ok, heres' what I have so far.  I'm using a simple tab delimited file to store the root folder location.  If someone wants to make that a little glitzier have at it!

What I really need right now, from one of you mapcar / lamda gurus is a function that builds a list of folders and subfolders to any depth - or should we put a limitation on that?

I'm using the latest Alpha build of OpenDCL 6.0 so this might not open in older versions of the studio:  I can easily recreate in 5.0 if need be.

Load the lisp and type swBlockManager to get the form. For testing I created a folder at c:/test and thru some files in there.

Let me know what you think . . ..
Title: Re: the Swamp Block Library Manager?
Post by: Lee Mac on February 10, 2010, 11:08:38 AM
What I really need right now, from one of you mapcar / lamda gurus is a function that builds a list of folders and subfolders to any depth - or should we put a limitation on that?

Perhaps you can glean something from this  :wink:

http://www.theswamp.org/index.php?topic=31712.0 (http://www.theswamp.org/index.php?topic=31712.0)
Title: Re: the Swamp Block Library Manager?
Post by: Shinyhead on February 10, 2010, 11:14:31 AM
Ok, heres' what I have so far.  I'm using a simple tab delimited file to store the root folder location.  If someone wants to make that a little glitzier have at it!

What I really need right now, from one of you mapcar / lamda gurus is a function that builds a list of folders and subfolders to any depth - or should we put a limitation on that?

I'm using the latest Alpha build of OpenDCL 6.0 so this might not open in older versions of the studio:  I can easily recreate in 5.0 if need be.

Load the lisp and type swBlockManager to get the form. For testing I created a folder at c:/test and thru some files in there.

Let me know what you think . . ..


OK, when I load it it exits the loading with the following error
" ; error: syntax error"

then it doesn't recognize the command.
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 10, 2010, 11:31:29 AM
Thanks Lee, I'll have a look.

There are mistakes - I'm cleaning up now.  (and I apparently can't spell manager!)
Title: Re: the Swamp Block Library Manager?
Post by: rhino on February 10, 2010, 11:41:44 AM
some food for thought...

This is what we use in our Eng dept - does not need AutoCAD to be running.

I'll check if the previews are of the individual dwg or sld and have a word with the coder too :D

Title: Re: the Swamp Block Library Manager?
Post by: Krushert on February 10, 2010, 12:04:02 PM
Wow all this fancy dialog boxes put my pull-down with slides to shame. 
I will be the token lisp newbie that needs it tweaked to fit his uses.  :-)
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 10, 2010, 01:15:05 PM
Hey, Lee,

Ok, I've had a look and am very confused - can you give me a hand in revising this to only return directories - no files.

If you have time thanks, or just give me some simple instructions and I can take it from there!

Thanks!
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 10, 2010, 01:37:08 PM
Not Lee, but here is one that will list all sub-directories.

Code: [Select]
(defun GetSubFolders ( path / GetSubs )
    
    (defun GetSubs ( path / tempList tempPath )
        
        (foreach i (vl-directory-files path "*" -1)
            (if
                (and
                    (not (= i "."))
                    (not (= i ".."))
                )
                (progn
                    (setq tempPath (strcat path i "\\") )
                    (setq tempList (cons tempPath tempList))
                    (setq tempList (append tempList (GetSubs tempPath)))
                )
            )
        )
        tempList
    )
    ;-------------------------------------------
    (vl-sort
        (cons path (GetSubs path))
        (function
            (lambda ( a b )
                (< (strcase a) (strcase b))
            )
        )
    )
)

Call like

Code: [Select]
(GetSubFolders "c:\\temp\\")

Edit:  Add what is returned.
Code: [Select]
Command: (getsubfolders "c:\\mycustom\\lisps\\")
("c:\\mycustom\\lisps\\" "c:\\mycustom\\lisps\\Ants\\"
"c:\\mycustom\\lisps\\Ants\\CADArmyAnts\\"
"c:\\mycustom\\lisps\\Ants\\CADArmyAnts\\Bin\\"
"c:\\mycustom\\lisps\\Ants\\CADArmyAnts\\Bin\\A2004\\"
"c:\\mycustom\\lisps\\Ants\\CADArmyAnts\\Bin\\A2007\\"
"c:\\mycustom\\lisps\\Downloaded\\" "c:\\mycustom\\lisps\\ForPosting\\")
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 10, 2010, 01:44:46 PM
Thanks Tim, I'll give it a try.
Title: Re: the Swamp Block Library Manager?
Post by: Lee Mac on February 10, 2010, 05:03:23 PM
Hey James,

I wasn't sure whether you wanted all files or a list of directories - anyway, I used this (from CAB) to get a list of all directories:

Code: [Select]
  (defun Get_Subs (folder / file) ;; CAB
    (mapcar
      (function
        (lambda (x) (setq file (strcat folder "\\" x))
          (cons file (apply (function append) (get_subs file)))))
      (cddr (vl-directory-files folder nil -1))))
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 11, 2010, 02:53:14 AM

Anyone had any difficulty with mine ... need help ... comments ?
Title: Re: the Swamp Block Library Manager?
Post by: Hugo on February 11, 2010, 04:10:02 AM
Hallo Ich

Auf der Deutschen Version lüft das Programm nicht richtig.
Beim einfügen passt die Skalieren nicht, sie wird nicht übernommen.
sonst ein recht Tooles Programm
Danke

Hello I

In the German version of the program is not ventilating properly.
Add When the scale does not fit, it will not be accepted.
otherwise a fairly Tools Program
Thanks
Title: Re: the Swamp Block Library Manager?
Post by: Hugo on February 11, 2010, 04:15:00 AM
Hallo jbuzbee

Get the following error

Command: (LOAD "C:/Dokumente und Einstellungen/Dober.LAND/Eigene
Dateien/SwampBlockMananger/SwampBlockMananger.LSP") ; error: syntax error

Command: *Cancel*

Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 11, 2010, 05:48:15 AM
Can I get some info from international users ...
I have used
;;;-------------------------------------------  
;;;-------------------------------------------------------------------
;;;
   (defun _1003_InsertBlock (/ lay tmp)
      (setq tmp
              (vl-cmdf "._-INSERT"
                       (vl-string-subst "\\" "\\\\" (cdr (assoc "Block" G1003-InsertData)))
                       "S"  
                       (atof (cdr (assoc "Scale" G1003-InsertData)))
                       "R"
                       (atof (cdr (assoc "Rotation" G1003-InsertData)))
                       pause
              )
;; < ...... snip >

should this be changed to
;;;-------------------------------------------  
;;;-------------------------------------------------------------------
;;;
   (defun _1003_InsertBlock (/ lay tmp)
      (setq tmp
              (vl-cmdf "._-INSERT"
                       (vl-string-subst "\\" "\\\\" (cdr (assoc "Block" G1003-InsertData)))
                       "_Scale"  ;<<<--------******************************
                       (atof (cdr (assoc "Scale" G1003-InsertData)))
                       "_Rotate" ;<<<--------******************************
                       (atof (cdr (assoc "Rotation" G1003-InsertData)))
                       pause
              )
;; < ...... snip >

to work correctly in international Versions  ??


[added]
looks like I missed this as well  :oops:
vl-cmdf "._chprop" (entlast) "" "LA" lay "") ;<<==== "LA" Should be changed to "_LA" :-
vl-cmdf "._chprop" (entlast) "" "_LA" lay "")
Title: Re: the Swamp Block Library Manager?
Post by: Lee Mac on February 11, 2010, 06:11:01 AM
Kerry,

I always put something like

Code: [Select]
(vl-cmdf "_.-insert" ...  "[color=red]_[/color]S" ... "[color=red]_[/color]R")

With every command call I use, as it should account for other languages this way  :-)
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 11, 2010, 06:13:56 AM

Hi Lee,
I usually do as well ... seemed to have missed it here :(

May resolve an issue Hugo has with inserting ( hopefully )

Thanks
Title: Re: the Swamp Block Library Manager?
Post by: Lee Mac on February 11, 2010, 06:18:19 AM

Hi Lee,
I usually do as well ... seemed to have missed it here :(

May resolve an issue Hugo has with inserting ( hopefully )

Thanks


No worries  :-)

Oh, and remember the '-' on the insert command, can sometimes cause a problem if not used  :wink:
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 11, 2010, 06:45:21 AM
The insert module will change to this in the next build
Change it in your source in the mean time.
Code: [Select]
;;;-------------------------------------------------------------------
;;;
   (defun _1003_InsertBlock (/ lay tmp)
      (if (vl-cmdf "._-INSERT"
                   (vl-string-subst "\\" "\\\\" (cdr (assoc "Block" G1003-InsertData)))
                   "_S"
                   (atof (cdr (assoc "Scale" G1003-InsertData)))
                   "_R"
                   (atof (cdr (assoc "Rotation" G1003-InsertData)))
                   pause
          )
         (progn (if (/= "" (setq lay (cdr (assoc "Layer" G1003-InsertData))))
                   (vl-cmdf "._chprop" (entlast) "" "_LA" lay "")
                )
                (if (= 1 (cdr (assoc "Explode" G1003-InsertData)))
                   (vl-cmdf "._explode" (entlast))
                )
         )
         (alert "Ooooops .. error in  '_1003_InsertBlock' Function")
      )
   )
  
;;;-------------------------------------------------------------------
;;;


[edit: Source and attachment in post#21 updated ]
--------------------------------
Original Build_06:2010.0210.19:00
--------------------------------
Build_07:2010.0211.23:45
Replaced module _1003_InsertBlock
--------------------------------
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 11, 2010, 07:02:02 AM
For anyone who wants info on OpenDCL try this page http://opendcl.com/wordpress/?page_id=10

Have a look at
Quote
If you’re new to OpenDCL the “Beginners Tutorial” will walk you through creating your first project.

  • English (by: Barry Ralphs)


.. and thanks to Barry (BazzaCAD) !



Title: Re: the Swamp Block Library Manager?
Post by: Hugo on February 11, 2010, 08:59:15 AM
Hallo Kerry Brown

Der Blockmanager ist super. sollte man auf seiner Platte haben.

The block manager is great. you should have on his plate. :lol: :lol: :lol:
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 11, 2010, 10:55:44 AM
I wasn't able to look at it yet Kerry, as I don't have Acad at home at this moment.
Title: Re: the Swamp Block Library Manager?
Post by: rhino on February 11, 2010, 11:55:10 AM
the screens I posted are of a .net program and the images are dwf files of the individual .dwg block drawings

But no chance of getting the source as it was written specifcally for our company. :roll:
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 12, 2010, 02:40:32 PM
Ok, here it is.  It's not polished, but it works.

Notes:
1. Make sure you have OpenDCL installed (I'm using the latest Alpha)
2. Make sure the BlockManager.dat file is in AutoCAD's search path
3. Edit the dir entry in the .dat file using similar syntax.  Future versions can use the .dat file to save additional settings.
4. Once the SwampBlockmanager.lsp is loaded type "swBlockManager".  If you have edited the .dat file correctly the treeview should show all folders and subfolders to any depth.  

I'd like to consolidate many of the single service subs into larger ones - I did this to help with debugging.  I'd also like to add insert features to the .dat file: flags for prompting during insertion, etc.

Thanks to Tim, CAB, Jim Short and everyone else you provided input. In the final version I'll have a more descriptive header.

jb
Title: Re: the Swamp Block Library Manager?
Post by: TimSpangler on February 12, 2010, 03:31:31 PM
WOW jb,

looks great.  When the discussion started about a block manager I remembered that I had started on one about a year or so ago.  It was going to be my first attempt at a full blown proggy using OpenDCL.

Here is what I had to date.  Very similar to what you had.  I think I started with a demo project and started to chop it it up from there.  Needless to say, it never got finished.  Maybe I should brush off the dust and finish it up.  I would like to have it as a palette as well as a floating form.  Maybe the form could roll up just leaving the buttons at the top.  I also want to double click the block view to show a larger form with just the block view and directory.  Maybe I can add the Layer, Linetype, color boxes at the bottom with the insert button.  I like the ability it has to use the file open dialog to set the directory rather that users manually changing it.

Anyway here it is (unfinished) in case anyone wants a peeky poo.
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 12, 2010, 04:26:36 PM
Kerry,

Your is pretty nice, but one thing I noticed, is that you don't check the value of the system variable ' attreq '.  I inserted a block with one attribute, and the attribute value is the call to ' _.chprop '.  Just a quick test.
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 12, 2010, 04:34:13 PM
James,

I don't see any sub folders beside the one deep.  I didn't read any help files, just loaded and tested real quick.  :-)

Right click and left click do the same thing.

The preview window shows the current drawing when called a second time, and third time, after closing the first time in the same drawing.

Prints a ' T ' to command line, which I think can be fixed by just adding a ' princ ' to the commands it calls.  Maybe this is a desired result for testing.

Doesn't remember size/location on subsequent calls.
Title: Re: the Swamp Block Library Manager?
Post by: stevesfr on February 12, 2010, 06:22:35 PM
Ok, here it is.  It's not polished, but it works.

Notes:
1. Make sure you have OpenDCL installed (I'm using the latest Alpha)
2. Make sure the BlockManager.dat file is in AutoCAD's search path
3. Edit the dir entry in the .dat file using similar syntax.  Future versions can use the .dat file to save additional settings.
4. Once the SwampBlockmanager.lsp is loaded type "swBlockManager".  If you have edited the .dat file correctly the treeview should show all folders and subfolders to any depth. 

I'd like to consolidate many of the single service subs into larger ones - I did this to help with debugging.  I'd also like to add insert features to the .dat file: flags for prompting during insertion, etc.

Thanks to Tim, CAB, Jim Short and everyone else you provided input. In the final version I'll have a more descriptive header.

jb




Following is what I get when trying to run the file.

Command: appload
SwampBlockMananger.LSP successfully loaded.


Command: ; error: syntax error
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 12, 2010, 06:52:00 PM
This is why I hate doing this kind of stuff: worked fine here.

ALERT: for serious AutoLISP users ONLY . . ..

sorry, can't be more helpful.

jb
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 12, 2010, 07:04:09 PM
With the latest one you posted, I was able to load the lisp without problems.  Only the small issues I saw that I mentioned in my other post.  Other than that, great job James.

I was wondering if you want to put a toggle button, or something like that, so that people can switch between blocks stored within folders, or blocks stored within drawings.  If you want something like that, then I will see how to code it up if you like, with what you have.
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 12, 2010, 09:11:16 PM
Kerry,

Your is pretty nice, but one thing I noticed, is that you don't check the value of the system variable ' attreq '.  I inserted a block with one attribute, and the attribute value is the call to ' _.chprop '.  Just a quick test.

Thanks for looking Tim.
The attreq is easily resolved. We  just change the settings for the program specific vars for ATTREQ and ATTDIA
ie
   (acet-error-init (list (list "CMDECHO"   0
                                "expert"    5                               
                                "ATTREQ"    1
                                "ATTDIA"    1
                                "BLIPMODE"  0
                                "INSUNITS"  0
                                "OSMODE"    0
                                "PICKADD"   1
                                "PICKBOX"   5
                                "SNAPANG"   0
                                "SNAPMODE"  0                                                             
                                "SORTENTS"  1
                          )
                          0
                    )
   )

This will temporarily set these values and restore them to their prior setting on program completion.
now if the attributes are not preset the attribute value dialog will display.

Source to be uploaded :
--------------------------------
Build_07.1:2010.0213.12:05
Allow for attributes which are not preset
set app var ATTREQ to1
set app var ATTDIA to1
--------------------------------
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 15, 2010, 12:36:25 PM
Thanks Tim, the toggle is a good idea, maybe Tabs?

Quote
Doesn't remember size/location on subsequent calls.

I think that's an Alpha build issue - this worked fine in the last stable release.  I'd really like to take the time to clean up the code, but as I'm a designer / problem solver, now that it's figured out I'll probably lose interest. 

Well, I hope it at least is something people can pick apart and use.

Thanks again for your help.
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 15, 2010, 01:26:30 PM
If you give me the option in the dialog, then I'll try and see if I can get the code to show between files and folders.
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 16, 2010, 08:09:25 PM
Tim, I'm coding that functionality now - Have a tree control bug that needs to be dealt with.  I've also changed the way the "root path" is stored: if the string in the .dat file isn't correctly formatted it throws the aforementioned "syntax error".  I've since changed this to be saved in the registry using the "selectFolder" method: thus standardizing the path "string".

Once I get everything ironed out we can continue . . . stay tuned!

This is really shaping up to be a useful tool to non-AutoLISP users.  The next step is to get some real world feedback over at the CAD general forum.

Thanks, everyone!
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 17, 2010, 04:34:10 PM
This should be it.  The tree control error is being fixed and will be in the next alpha build.  For now while testing if a node is selected when the Select Path button is clicked, you'll get an error - but everything continues fine.  So point it to a path and try leaving it . . . if that makes any sense.

I've also seperated the code into multiple files: the name give a clue to the functions inside.  I've also included a .fas file for easy loading.  Let me know . . ..
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 17, 2010, 05:25:58 PM
Thanks James.  I'll take a look when I can.  May not be this week though.
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 17, 2010, 05:43:44 PM
James,

I see no ' .fas ' file.  I think you uploaded the old zip file.
Title: Re: the Swamp Block Library Manager?
Post by: TimSpangler on February 17, 2010, 08:27:49 PM
I will give it a try tomorrow.  I am also in the process of dusting off my old one as well.  More for learning OpenDCL ( I have a work project that I think would be a great candidate for it)

I'll post it here upon completion.
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 18, 2010, 07:34:32 AM
oops.

It was a long day yesterday - but productive.

OK, now I know how to edit a post.  The attachment on the first post will be the latest - sorry for any confusion.
Title: Re: the Swamp Block Library Manager?
Post by: Atwist on February 18, 2010, 03:19:35 PM
Hi

How can I start the "Blockmanager" :oops:
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 18, 2010, 04:14:07 PM
Hi

How can I start the "Blockmanager" :oops:

Make sure you have the latest build of the arx file for OpenDCL, and it's loaded, make sure all the lisp files within the zip file get loaded into Acad, and the odcl file is located within a directory in the search paths of Acad.  Then type ' blockmanager ' at the command line.
Title: Re: the Swamp Block Library Manager?
Post by: Atwist on February 18, 2010, 05:19:19 PM
Hi

Do you know where I can download the latest built of de ARX file.
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 18, 2010, 05:29:00 PM

here is the full install with the editor :
http://sourceforge.net/projects/opendcl/

via here
http://opendcl.com/wordpress/
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 18, 2010, 10:16:49 PM
Kerry, thanks for your support.

We need to look at performance enhancement: i'm going to look at your process of loading subfolders on-demand.  Any thing else you guy's can think of let me know . . ..

jb
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 18, 2010, 11:04:44 PM
James,
I haven't had a look at your code yet so can't comment.
mine seemed to be adequately fast enough to suit our work across a server, you're welcome to gut it.
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 18, 2010, 11:13:56 PM

One thing I will comment on :
you seem to have versions spread all over the place, here and elsewhere, without any way of anyone telling which is the most recent.  Renaming your zip files accordingly seems like a sensible idea .... and removing redundant releases may help.


With that in mind, where is your most recent version ?
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 18, 2010, 11:25:25 PM
Hi

How can I start the "Blockmanager" :oops:

Make sure you have the latest build of the arx file for OpenDCL, and it's loaded, make sure all the lisp files within the zip file get loaded into Acad, and the odcl file is located within a directory in the search paths of Acad.  Then type ' blockmanager ' at the command line.

Seems to me that only the .FAS file needs to be loaded, not all files.

added :
And it looks like the .odcl has been converted to an asci file and included with the build, so the .ODCL does not need to be on the path( 'cause it is never loaded as is)
Title: Re: the Swamp Block Library Manager?
Post by: T.Willey on February 19, 2010, 12:14:02 AM
I don't know how many people would load a .fas file, so that is why I said it the way I did.  Nice tip about the other information.
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 19, 2010, 12:21:16 AM
James,

you definately need to have another look at the code.
I crashed Autocad by selecting a primary drive.
required a regedit.

Crashed autocad changing root folders via the directory button.

Incredibly slow displaying folders.

never got to see a drawing :(

added:
FYI : I loaded the build from your OpenDCL forum post

Title: Re: the Swamp Block Library Manager?
Post by: Hugo on February 19, 2010, 05:17:48 AM
Hallo jbuzbe

Ein Vorgabe von Layer und Skalierung wäre noch eine Tolle sache.
sonst super Super.


One target of scaling layer and would be even sache a madwoman.
otherwise super super.

Danke
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 19, 2010, 08:25:51 AM
Thanks Hugo, glad you like it.  I'm going to work on the tree performance issue.

Kerry, I added the form definition to your lisp file so you won't have to load the odcl file seperately.  That'a a nice little feature Owen added.  Really cleans up deployment!

Title: Re: the Swamp Block Library Manager?
Post by: pkohut on February 19, 2010, 10:33:52 AM
Possible speed ups - Looking at the source code and the picture at this link
http://www.theswamp.org/index.php?topic=32081.msg377241#msg377241

I think you can get rid of the file modification dates and sizes without loosing functionality, as it's just visual noise. 1) For those rare occasions when a user wants the info they can get it by other means.  2) The code to retrieve and format the display info is fairly involved. 3) How efficient are vl-file-size and vl-file-systime?  Do they do a file open and close for each operation (don't know)? If they do then this can be a very expensive operation, and more so over a network.

Having not run the application or knowing anything about OpenDCL and such, I can only guess that the directory tree is being fully populated at startup.  If this is the case then you will get a huge performance boost by only retrieving directories/sub directories info when needed, ie. by expanding a sub directory leaf.
Title: Re: the Swamp Block Library Manager?
Post by: t-bear on February 19, 2010, 11:43:58 AM
OK...minor problem.  This keeps resetting ATTREQ and FILEDIA to "0".   :roll:
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 19, 2010, 03:41:57 PM
< .. >

Kerry, I added the form definition to your lisp file so you won't have to load the odcl file seperately.  That'a a nice little feature Owen added.  Really cleans up deployment!


Yes James I know about the ability to add the ASCII dialog to .LSP source. I don't do it for developments or sample code .

For anyone who wants to use this I remind you that Post #21 has the attachments for the supporting Library File and .INI Configutation File and ALSO  the Source .ODCL file if you want to make changes to the dialog.
Also note Reply #56 : the changes I've noted in that post should be made if your attributes are NOT preset and require confirmation .

I'll call this Build _08 since _07 has been used.
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 19, 2010, 04:11:15 PM
Which one tbear, mine or Kerry's?  Mine shouldn't set any variables at all.

This is why hijacks are so problematic . . ..
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 19, 2010, 04:23:48 PM
OK...minor problem.  This keeps resetting ATTREQ and FILEDIA to "0".   :roll:


Which one tbear, mine or Kerry's?  Mine shouldn't set any variables at all.

This is why hijacks are so problematic . . ..

Well that's not mine :)
Any changes I make I restore, even after errors
... and I don't set ATTREQ and FILEDIA to "0".   
Title: Re: the Swamp Block Library Manager?
Post by: CAB on February 19, 2010, 06:07:54 PM
I smell a command call.  he he he :evil:
Title: Re: the Swamp Block Library Manager?
Post by: CAB on February 19, 2010, 06:27:53 PM
When you use the command to insert a block with attributes you must address the following system variables.
Code: [Select]
;|
ATTDIA
Controls whether the -INSERT command uses a dialog box for attribute value entry. See "INSERT Command Line."
0        Issues prompts on the command line
1        Uses a dialog box

ATTMODE
Controls display of attributes.
0        Off: Makes all attributes invisible
1        Normal: Retains current visibility of each attribute: visible attributes are
                displayed; invisible attributes are not
2        On: Makes all attributes visible

ATTREQ
Determines whether the INSERT command uses default attribute settings during insertion of blocks.
0        Assumes the defaults for the values of all attributes
1        Turns on prompts or dialog box for attribute values, as specified by ATTDIA

TEXTEVAL
Controls the method of evaluation of text strings.
0        All responses to prompts for text strings and attribute values are taken literally
1        Text starting with an opening parenthesis [ ( ] or an exclamation mark (!) is
            evaluated as an AutoLISP expression, as for nontextual input
|;

(setq sysattdia (getvar "ATTDIA"))
(setq sysattreq (getvar "ATTREQ"))
(setq systxteva (getvar "TEXTEVAL"))
(setvar "ATTDIA" 0)
(setvar "ATTREQ" 0)
(setvar "TEXTEVAL" 0)


<do your lisp>


(setvar "ATTDIA"   sysattdia)
(setvar "ATTREQ"   sysattreq)
(setvar "TEXTEVAL" systxteva)

;;================================================================
;|
Alternately you can use the sys var EXPERT

EXPERT
Type: Integer
Not saved
Initial value: 0
Controls whether certain prompts are issued.

0 Issues all prompts normally.
1 Suppresses "About to regen, proceed?" and "Really want to turn the current layer off?"
2 Suppresses the preceding prompts and "Block already defined. Redefine it?" (BLOCK) and "A drawing with this name already exists. Overwrite it?" (SAVE or WBLOCK).
3 Suppresses the preceding prompts and those issued by the LINETYPE command if you try to load a linetype that's already loaded or create a new linetype in a file that already defines that linetype.

4 Suppresses the preceding prompts and those issued by UCS Save and VPORTS Save if the name you supply already exists.
5 Suppresses the prompt, "That name is already in Use, redefine it?" issued by the -DIMSTYLE Save option when you supply the name of an existing dimension style.

When a prompt is suppressed by EXPERT, the operation in question is performed as
though you  entered y  at the  prompt. Setting  EXPERT can  affect scripts, menu
macros, AutoLISP, and the command functions.

|;
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 19, 2010, 06:38:13 PM

As can be seen from post  Reply #56

(acet-error-init (list (list "CMDECHO"   0
                                "expert"    5              ;;<<==                           
                                "ATTREQ"    1            ;;<<==
                                "ATTDIA"    1             ;;<<==
                                "BLIPMODE"  0
                                "INSUNITS"  0
                                "OSMODE"    0
                                "PICKADD"   1
                                "PICKBOX"   5
                                "SNAPANG"   0
                                "SNAPMODE"  0                                                             
                                "SORTENTS"  1
                          )
                          0
                    )
   )

The variables noted are stored, changed to the value nominated for the duration of the routine and the previous values are restored on termination or error.

I don't set either ATTREQ or FILEDIA to "0".
 
Title: Re: the Swamp Block Library Manager?
Post by: CAB on February 19, 2010, 06:48:59 PM
That a slick trick Kerry, haven't been following this thread much so I missed #56.  :-)
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 19, 2010, 06:59:53 PM
That a slick trick Kerry, haven't been following this thread much so I missed #56.  :-)

Yes, I like the idea.
I have my own custom routines for that and error trapping routines ... but chose not to post them, so used the ExpressTools routines instead.


added:
if you add
"CLAYER"(getvar "CLAYER")
or
something like "CLAYER" "MySpecialTextLayer"


to the list any layer changes during the procedure will nullified at termination when CLAYER is reset to the initial value
Title: Re: the Swamp Block Library Manager?
Post by: t-bear on February 22, 2010, 09:14:28 AM
I am using what I believe is jbuzbee's original build....might be the problem.  I kinda got lost with all the builds ans stuff.  Will have to hunt up the latest installment of this and try again.
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 22, 2010, 04:33:18 PM
The latest is in the original post - I finaaly figured out how to fully edit a post  :-P

I'm still working on the whole tree thing . . . could use some help.
Title: Re: the Swamp Block Library Manager?
Post by: t-bear on February 23, 2010, 08:51:01 AM
The latest is in the original post - I finaaly figured out how to fully edit a post  :-P

I'm still working on the whole tree thing . . . could use some help.

Thanks amigo, I'll reload it.
As far as helping you with this, you might have noticed....I'm worthless.....sorry.  :cry: :|
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 23, 2010, 09:56:33 AM
Quote
I'm worthless.....sorry

No problem man -

If anyone is still looking I need some help with the whole tree population thing:  only populating the first set of parents and siblings.  Sorry Kerry, I know your code does that but it's very difficult for me to follow (remember, I'm an Architect - NOT a programmer(and Architects aren't that bright to begin with!))

Thanks for any help.
Title: Re: the Swamp Block Library Manager?
Post by: Krushert on February 24, 2010, 11:11:34 AM
Quote
I'm worthless.....sorry

No problem man -

If anyone is still looking I need some help with the whole tree population thing:  only populating the first set of parents and siblings.  Sorry Kerry, I know your code does that but it's very difficult for me to follow (remember, I'm an Architect - NOT a programmer(and Architects aren't that bright to begin with!))

Thanks for any help.

HEY! I resemble that remark.   :-D :-D
Title: Re: the Swamp Block Library Manager?
Post by: Hugo on February 25, 2010, 01:10:14 AM
Hello jbuzbee
Block Manager

Get the following error

Command: insert .- Unknown command "INSERT". Press F1 for help.

Command: D: \ symbols individually \ Bel \ Flutlichtleuchte.dwg Unknown command
"D: \ SYMBOLS INDIVIDUALLY \ BEL \ FLUTLICHTLEUCHTE.DWG. Press F1 for help.

Hallo jbuzbee
Blockmanager

Bekomme folgende Fehlermeldung

Befehl: .-insert Unbekannter Befehl "-INSERT". Drücken Sie F1-Taste für Hilfe.

Befehl: D:\Symbole einzeln\Bel\Flutlichtleuchte.dwg Unbekannter Befehl
"D:\SYMBOLE EINZELN\BEL\FLUTLICHTLEUCHTE.DWG". Drücken Sie F1-Taste für Hilfe.
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on February 25, 2010, 01:20:41 AM

Hugo
Somewhere in the code will be something like this

".-INSERT"
find it and change it to this
"._-INSERT"


The _ underscore is needed in international versions so that the command evaluator will recognise the English spelling
Title: Re: the Swamp Block Library Manager?
Post by: Hugo on February 25, 2010, 02:07:14 AM
Hello Kerry Brown

This is not. Lsp file but one. Fas.
Since I can not change anything.

Thanks for your tip


Hallo Kerry Brown

Das ist keine .lsp Datei sondern eins .fas.
Da kann ich nichts ändern.

Danke für dein Tip
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on February 25, 2010, 02:34:05 PM
Ok, I'll change that.  I'm not at my ACAD station so I can't work on it.  I've got to many projects going right now (trying to get SOMETHING started here) I'll see if I can look at it this weekend.  I still need to figure out the tree thing.
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on March 02, 2010, 11:14:55 AM
Updated Version 0.2 is on the first post.

I think I caught everything.  The subfolder code isn't pretty but it seems to work well.
Title: Re: the Swamp Block Library Manager?
Post by: Hugo on March 02, 2010, 12:26:19 PM
Hallo Kerry

I think there is missing a file.
And although the ending with. Fas.
Thanks

Ich glaube da fehlt eine Datei.
Und zwar die mit der Endung .fas.
Danke
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on March 02, 2010, 02:45:18 PM
Here you go Hugo:

jb
Title: Re: the Swamp Block Library Manager?
Post by: Hugo on March 03, 2010, 02:32:37 AM
Danke
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on March 06, 2010, 09:56:51 AM
OK, my last version.

I changed the Block Preview to a Drawing Preview to speed things up.  I added a Preview button that brings up a separate modeless form for panning and zooming.  The whole app is much faster now.  If there are any changes in the future I've included the command "BlockManagerVer" which returns the version number.

I'll be working on an alternative version using drawings as containers for my own use.  I'll definitely share when I get a working copy done.

My intention was to provide a real world example of how easy and robust OpenDCL is.  I hope this example will help with anyones future development.

New version up on first post.

Title: Re: the Swamp Block Library Manager?
Post by: Crank on March 06, 2010, 12:25:33 PM
Very cool James!
I will certainly use this: A black background color is much better for all those yellow lines. :)

Nb.:
I don't know if this is a bug in your program or in OpenDCL: If the palette is floating or docked everything is working fine, but when you anchor it to the left or right side of the screen it's impossible to work with (acad2008 / OpenDCL6.0.0.23).
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on March 06, 2010, 06:05:35 PM
Does it flash if you hold the cursor over the docked name or icon?

That's an OpenDCL issue that is being looked at: how the form paints itself.
Title: Re: the Swamp Block Library Manager?
Post by: Crank on March 07, 2010, 01:22:13 AM
Yes, I think that what's happening. Good to know this is being looked at.
Title: Re: the Swamp Block Library Manager?
Post by: cadmonkey13 on June 23, 2010, 04:53:44 AM
I am ver interested in a block manager for our office. How do I load and run these files?  Where do I need to copy the files to?
Title: Re: the Swamp Block Library Manager?
Post by: Gilles on July 05, 2010, 12:38:39 PM
Hello everyone.

This Blockmanager looks very interesting.
I would like to test it.
But I do not manage to launch it.
It would be appropriate to give a little instruction manual so that the largest number of non-technical users can test or use.

Thank's in advance. :grazy:
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on July 06, 2010, 12:27:35 PM
Sorry guys - I don't frequent theSwamp much anymore.  The easiest way to load the file is create an acaddoc.lsp file (AutoCAD will automatically load it everytime a drawing is opened.)  Make sure that acadDoc.lsp AND the BlackManager.fas file are in AutoCAD's search path. 

I've attached a simple acadDoc.lsp to get you started.
Title: Re: the Swamp Block Library Manager?
Post by: fisherridge on August 09, 2010, 10:18:02 PM
jbuzbee,
I installed and ran BlockManagerv3.0 and it worked fine for a few insertions, then it stopped inserting. When I click the insert button it starts the scale command.

Command: _.insert Enter block name or [?]:
Command: _scale
Select objects: 1 0 found
Select objects:

Any ideas why?

Mike
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on August 10, 2010, 01:07:39 PM
Sounds like a stray variable.  I'll take a look when I have time.

jb
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on August 11, 2010, 02:34:38 PM
I revised the insert command - should work now.

Download v4.0 on first page.

jb
Title: Re: the Swamp Block Library Manager?
Post by: CADwiesel on March 02, 2011, 11:55:17 AM
I got an Error while trying:

The OpenDCL arx module did not load!

I tried Acad 2006 and 2010

is it possible to fix it?

Thanks
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on March 02, 2011, 03:26:01 PM
CADwiesel, welcome to theSwamp.

You'll need to download the OpenDCL runtime here:

http://www.opendcl.com/download/ (http://www.opendcl.com/download/)

This project was not meant to be a finished productivity tool , but rather, a learning exercise to illustrate the GUI possibilities with OpenDCL.

Have fun!
Title: Re: the Swamp Block Library Manager?
Post by: CADwiesel on March 04, 2011, 04:52:29 AM
 :oops: Yes, sorry for my stupid Question. I'd figgert this out bevore
Title: Re: the Swamp Block Library Manager?
Post by: jbuzbee on March 04, 2011, 10:27:21 AM
Quote
sorry for my stupid Question

I hope I didn't come off harsh - that was not my intent. 

And there are No stupid questions!!

Thinking that way won't get you very far on this site. 

I can't imagine how much of an idiot CAB, Lee Mac, MP, et al think I am!!  :wink:
Title: Re: the Swamp Block Library Manager?
Post by: Lee Mac on March 04, 2011, 11:21:38 AM
I can't imagine how much of an idiot CAB, Lee Mac, MP, et al think I am!!  :wink:

Oh, not at all  :roll:

joking of course
Title: Re: the Swamp Block Library Manager?
Post by: CAB on March 04, 2011, 11:40:52 AM
:oops: Yes, sorry for my stupid Question. I'd figgert this out bevore

As we mix languages, ACAD versions, programing levels and personalities it is easy to miss interpret
messages and intent.

As James said there are no Stupid Question here just misunderstanding's.   :-)
Title: Re: the Swamp Block Library Manager?
Post by: 77077 on September 28, 2014, 08:33:12 PM
Good topics! but some rontine need install Odcl.
Title: Re: the Swamp Block Library Manager?
Post by: Kerry on September 28, 2014, 08:41:00 PM
Good topics! but some rontine need install Odcl.
Yes, that is mentioned in the original post.
http://opendcl.com/wordpress/