Author Topic: the Swamp Block Library Manager?  (Read 61455 times)

0 Members and 1 Guest are viewing this topic.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: the Swamp Block Library Manager?
« Reply #15 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.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: the Swamp Block Library Manager?
« Reply #16 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

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

Thanks!

jb
James Buzbee
Windows 8

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: the Swamp Block Library Manager?
« Reply #17 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
James Buzbee
Windows 8

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8696
  • AKA Daniel
Re: the Swamp Block Library Manager?
« Reply #18 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

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: the Swamp Block Library Manager?
« Reply #19 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)



« Last Edit: February 10, 2010, 04:55:57 AM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: the Swamp Block Library Manager?
« Reply #20 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.

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: the Swamp Block Library Manager?
« Reply #21 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
--------------------------------
« Last Edit: February 11, 2010, 09:00:02 AM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: the Swamp Block Library Manager?
« Reply #22 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)


kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MvdP

  • Guest
Re: the Swamp Block Library Manager?
« Reply #23 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




It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8696
  • AKA Daniel
Re: the Swamp Block Library Manager?
« Reply #24 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  :-)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: the Swamp Block Library Manager?
« Reply #25 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  ...
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: the Swamp Block Library Manager?
« Reply #26 on: February 10, 2010, 10:56:54 AM »
Looks good Kerry.  I'll try and make some time, so that I can test it.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: the Swamp Block Library Manager?
« Reply #27 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 . . ..
« Last Edit: February 19, 2010, 07:15:04 AM by jbuzbee »
James Buzbee
Windows 8

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: the Swamp Block Library Manager?
« Reply #28 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

Shinyhead

  • Guest
Re: the Swamp Block Library Manager?
« Reply #29 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.