anyway to get the dwg list to display just the filenames?

Started by andrew, December 14, 2009, 07:38:08 AM

Previous topic - Next topic

andrew

is it possible to get the dwg list function to display only the file names and not the thumbnails?

reason i ask is because i have a few directories with more then 200 dwgs in them and when i select anyone of those directories via my project, the dialog box closes.

i tried using the listbox to avoid the thumbnail views but it doesnt work the same.

any suggestions or possible work around welcomed

Fred Tomke

Hi, andrew,

Quote from: andrew on December 14, 2009, 07:38:08 AM
i tried using the listbox to avoid the thumbnail views but it doesnt work the same.

Why did it not work?
I just wanted to recommend you to do it like Windows Explorer: toggle between DWG-List and listbox or listview.
Why shouldn't it work?

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

andrew

Quote from: Fred Tomke on December 14, 2009, 07:41:13 AM
Hi, andrew,

Quote from: andrew on December 14, 2009, 07:38:08 AM
i tried using the listbox to avoid the thumbnail views but it doesnt work the same.

Why did it not work?
I just wanted to recommend you to do it like Windows Explorer: toggle between DWG-List and listbox or listview.
Why shouldn't it work?

Fred

Hi Fred,

I have it working like that, sorta, instead of showing the filename in the dwglist, it shows the filename AND thumbnail.
after testing it further, it appears that the dialog and acad will crash if the directory your are displaying in the dwg list window has more then 1000 dwgs, even then it gives you a "no responding" warning then it comes out of it and displays the dwgs.

when i made a test project using a listbox instead of a dwglist, it was able to diplay the filenames of more then 1000 dwgs and not crash but i just couldnt get the "up a directory" to work.

here are my project files if you want to see how i have it
i know the code is a mess but it works i just wont display more then 1000 dwgs.


critiquing welcomed

Fred Tomke

Quote from: andrew on December 14, 2009, 08:32:24 AM
when i made a test project using a listbox instead of a dwglist, it was able to diplay the filenames of more then 1000 dwgs and not crash but i just couldnt get the "up a directory" to work.

Unfortunately, you have not send the version with the listbox - as far as I can see it.
Note: you will have to fill the list by your own.

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

andrew

Quote from: Fred Tomke on December 14, 2009, 09:57:47 AM
Quote from: andrew on December 14, 2009, 08:32:24 AM
when i made a test project using a listbox instead of a dwglist, it was able to diplay the filenames of more then 1000 dwgs and not crash but i just couldnt get the "up a directory" to work.

Unfortunately, you have not send the version with the listbox - as far as I can see it.
Note: you will have to fill the list by your own.

Fred

no i didnt Fred.
I wasnt having much luck with getting it to work so i just abandoned it and went back to my working project and just put in some code to stop the selection of this specific directory from being selected

however if anyone wishes to check out my working project and critique it i welcome all. i would love to improve upon it.


Fred Tomke

#5
Hi andrew,

have a look with the attached sample, it should work (note: refreshing the dwgpreview may not work in the current alpha release, but in the stable release).

Fred

EDIT: Replace the function dwgbrowser_fillpreview with the version below to update the preview in the current Alpha release:
If you make the scrollbar working, you wil have a similar way to navigate between the dwg-files.

Code (autolisp) Select

(defun dwgbrowser_fillpreview (intItem / strPath intRow strCompleteFile)
  (setq strPath (dwgbrowser_check_path (dcl_ComboBox_GetDir dwgbrowser_browser_dir)))
  (setq intLen (dcl_ListView_GetCount dwgbrowser_browser_lst))
  (foreach intRow '(0 1 2 3 4 5 6 7 8)
    (if (>= (+ intItem (1+ intRow)) intLen)
      (dwgbrowser_invisible (eval (read (strcat "dwgbrowser_browser_dwg" (itoa (1+ intRow))))))
      (progn
        (setq oControl (eval (read (strcat "dwgbrowser_browser_dwg" (itoa (1+ intRow))))))
        (dwgbrowser_visible oControl)
        (if (setq strCompleteFile (findfile (strcat strPath (dcl_ListView_GetItemText dwgbrowser_browser_lst intRow 0) ".dwg")))
          (progn
            (dcl_DWGPreview_LoadDwg oControl strCompleteFile)
            (dcl_Control_Redraw oControl)
          ); progn
          (dcl_DwgPreview_Clear oControl)
        ); if
      ); progn
    ); if
  ); foreach
); dwgbrowser_fillpreview
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

andrew

Thanks Fred for the sample files.
I ran them as a test to see how it works, and even your coding "hangs" while trying to access a directory with more then 1000 files


andrew

Fred,
After overlooking your code
im a bit confused on a list view function as i tried to duplicated it from scratch and just get errors maybe you or anyone else thats reading can clarify for me what it is that im not understanding.

(dcl_ListView_FillList od-test_Form1_ListView1 as List of Lists as ((ItemLabel [as String] {ItemImageIndex [as Integer]} {Column1Label [as String]} {Column1ImageIndex [as Integer]} ...) ...))

a list of lists...
what exactly is a list of lists?

example:
if my lsp code reads a file and puts the contents of that file in a list
the function code i have reads
(dcl_ListView_FillList od-test_Form1_ListView1
      (list filelist)

)

with it this way it only shows the first item of the list and not the others
how do you go about getting the other items to display?





BazzaCAD

Quote from: andrew on December 16, 2009, 12:17:30 PM

(dcl_ListView_FillList od-test_Form1_ListView1 as List of Lists as ((ItemLabel [as String] {ItemImageIndex [as Integer]} {Column1Label [as String]} {Column1ImageIndex [as Integer]} ...) ...))

a list of lists...
what exactly is a list of lists?



Code (autolisp) Select

(list
 (list "Item 1" 1 1 1)
  (list "Item 2" 2 2 2)
  (list "Item 3" 3 3 3)
)
a.k.a.
Barry Ralphs
barryDOTralphsATgmailDOTcom

Kerry


Andrew,
Do you just want to feed the fileList to the ListView ?
ie what do you want the listView to look like ?
Perfection is not optional.
My other home is TheSwamp

andrew

Quote from: Kerry Brown on December 16, 2009, 01:00:44 PM

Andrew,
Do you just want to feed the fileList to the ListView ?
ie what do you want the listView to look like ?

yes
thats what i was trying to do but i get errors
example of what i tried:


  (setq dfile "C:\\test.txt")
  (setq fil (open dfile "r")) 
   (while (setq curline (read-line fil)) 
      (setq filelist (cons curline filelist)) 
  ) 
  (close fil) 

  (setq filelist (reverse filelist))

(dcl_ListView_FillList od-test_Form1_ListView1
(list filelist)
)

this list only displays the first item of the list.

using :
(dcl_ListView_FillList od-test_Form1_ListView1
(list
   (list filelist)
)
)
doesnt work

andrew

Quote from: BazzaCAD on December 16, 2009, 12:40:03 PM
Quote from: andrew on December 16, 2009, 12:17:30 PM

(dcl_ListView_FillList od-test_Form1_ListView1 as List of Lists as ((ItemLabel [as String] {ItemImageIndex [as Integer]} {Column1Label [as String]} {Column1ImageIndex [as Integer]} ...) ...))

a list of lists...
what exactly is a list of lists?



Code (autolisp) Select

(list
 (list "Item 1" 1 1 1)
  (list "Item 2" 2 2 2)
  (list "Item 3" 3 3 3)
)


thats what i thought it was but i get errors when i do that
just wanted to make sure i understood it correctly

Kerry

#12
Andrew ,
The trick is in how you translate the fileList into a list of lists.
If you JUST want the list in column 1 try something like this :

Code (autolisp) Select
(setq populatelist1 (mapcar '(lambda (x) (list x)) layernamelist))

Code (autolisp) Select


(vl-load-com)
(command "_OPENDCL")

(defun c:doit (/ layernamelist dialogreturn)
 (setq layernamelist '("0"          "Layer1"     "Layer2"
                       "Layer3"     "Layer4"     "Layer5"
                       "Layer6"     "Layer7"     "Layer8"
                       "Layer9"     "Layer10"    "Layer11"
                       "Layer12"
                      )
 )
 (dcl_project_load "kdub_ListView_11.odcl" t)
 ;; Show the main form
 (setq dialogreturn (dcl_form_show kdub_listview_11_main))
 ;;------
 (princ)
)

;|<<OpenDCL Event Handlers>>|;
(defun c:kdub_listview_11_main_oninitialize (/)
 (dcl_listview_addcolumns
   kdub_listview_11_main_listview1
   '(("Layer Name" 0 100) ("Col 2" 0 50) ("Col 3" 0 50))
 )
 (dcl_listview_addstring kdub_listview_11_main_listview1
                         "Item 1\tItem 1-2\tItem 1-3"
 )
)
(defun c:kdub_listview_11_main_textbutton1_onclicked (/)
 (setq populatelist1 (mapcar '(lambda (x) (list x)) layernamelist))
 (dcl_listview_filllist kdub_listview_11_main_listview1
                        populatelist1
 )
)
(princ " << Enter DOIT to run >> \n")
(princ)



if you want more than this, you'll have to start explaining what you want.

Refer the Attachments:
Perfection is not optional.
My other home is TheSwamp

Fred Tomke

Quote from: andrew on December 16, 2009, 07:17:15 AM
Thanks Fred for the sample files.
I ran them as a test to see how it works, and even your coding "hangs" while trying to access a directory with more then 1000 files

H andrew, I recommend you a closer look to your drawings.

1. Of course it take a while until the files were read out. But you should have noted a text within the listview (see loading.png). Have you seen it?

2. As you can see in my screenshot listing.png that I could list 5705 dwg files. I had to wait 5 seconds for the first time. But i other cases I had to wait 30 seconds (depending on the harddrive speed).

I think that maybe one of your drawings may be corrupt? Can you compress them and send them as email attachment to me?

Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

Kerry



I think, somehow, we are all talking about different things :)

I may have missed something.
Perfection is not optional.
My other home is TheSwamp