question on the dwg preview function

Started by andrew, December 04, 2009, 07:46:07 AM

Previous topic - Next topic

andrew

ive been using the viewdwg files that come with the studio for reference and wanted to know if its possible to use the dwg preview function without using a button to browse for the file?
i tried to set the dwg using a set path but was getting errors

if it is possible, is there a tutorial that explains how to do it?

thanks

Fred Tomke

Hi, andrew,

there are two ways of doing this:

1. You create many DwgPreview controls on a form and manage the files to preview by yourself. Have a look at a sample here. In that sample there are symbols from a database which are displayed in the preview controls.
2. Have a look at the dwglist control of OpenDCL. In that case all the dwg files of a given folder are displayed automatically.

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

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

andrew

hi Fred,

that image is sorta what im trying to create

ill take a look at the dwglist function

thanks for the tip

andrew

#3
anyone know of any tutorials for this
im getting all kinds of errors..


ok i got the errors fixed however i still have a question.

in the sample file "dwglist" when i click on the combobox and then select a directory, in the dwglist box, it displays the sub directory right away, in my model, it doesnt. i have to press the button i made to use as "previous" or "up" to get it to display the directory i selected.
what should i be looking for to get the directory i choose to display right away?

comparing it to the sample odcl file it looks as if i have the same settings.


Fred Tomke

That's a pity. I just finished a sample for you! Have a try, you'll like it! It's very easy with less of code.

You may have to enable events to catch if you change a value in the directory picker or in the dwglist. Just have a look into my sample.

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

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

andrew

thanks Fred for your sample. I was overlooking it and i think i got it working now, somewhat.
in your coding, i dont understand why you used the following lines

  (if (setq lstChars (reverse (cdr (member 92 (reverse (vl-

string->list strFolder))))))...

i tried to change it a bit, but it didnt work so i "stole" your code, hope ya dont mind.

also how many dwgs does this dwglist hold if you know?
i tried my code and went to a directory with 2400 blocks and my autocad just shut down.
i tried your files and it did the same thing, just shut down no error or anything.

is this a limitation thing or a bug in the code?

hope someone can answer that

any help is appreciated

Fred Tomke

#6
Hi,
Code (autolisp) Select
(setq lstChars (reverse (cdr (member 92 (reverse (vl-string->list strFolder))))))
It returns a list of ascii codes as integers before the last backslashs. In combination wth
Code (autolisp) Select
(setq strFolder (apply 'strcat (mapcar 'chr lstChars)))
it returns the parent folder of the given folder.

Quotei tried to change it a bit, but it didnt work so i "stole" your code, hope ya dont mind.
no, that's why I published it.

Quotealso how many dwgs does this dwglist hold if you know?
No, I don't know. I'm not using DWGLIST control in practice. But I afraid that so much files will cause a long delay to read and list all files. I'd prefer to organize the dwg files into separate subfolders or to use a couple of dwgpreview controls and a scrollbar to navigate the files (see the sample of my first answer).

Quotei tried your files and it did the same thing, just shut down no error or anything.
Did you meant that my code was crashing?
is this a limitation thing or a bug in the code?

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

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

andrew

thanks for the reply Fred.

yes your code was crashing but only when trying to read a directory with around 2400 dwgs in it otherwise it works perfectly

ill play around with the dwg preview functions i guess to see if i get figure any of that out

thanks for the help