[CADImage] Filename Extension

Discuss and ask questions about CAD DLL (CAD Image DLL, CAD Importer DLL).

Moderators: SDS, support, admin

Post Reply
gavroche
Posts: 3
Joined: 06 Oct 2005, 16:19

[CADImage] Filename Extension

Post by gavroche » 06 Oct 2005, 16:27

Hello

We're using CADImage.dll to batch convert DXF and DWG files into the jpg format. The files are named by a unique handle, e.g. File-324.1 (the extension stands for the version of the file).

As far as I realized, CADImage.dll takes the filename extension to recognize the MIME type. Because our filenames end with 1, 2, 3 etc., they would have to be renamed to get the appropriate extension (dxf, dwg...) before beeing opened by CADImage.dll.

Is there a way to get araound the renaming? E.g. specifie the type as an additional argument in CADImage = CreateCAD(NULL,inFile);?

Thanks in advance

Mike

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 07 Oct 2005, 11:51

Hello,

CreateCAD should not create correctly necessary object type without extension.

As far as we could understand your question the extensions of your files are standard:

1 - dxf
2 - dwg
3 - hpgl
4 - plt (for example)
...

If that is right we'll make a special build for you.

Sergey.


please post questions to the forum or write to support@cadsofttools.com

gavroche
Posts: 3
Joined: 06 Oct 2005, 16:19

Post by gavroche » 07 Oct 2005, 13:13

Hello Sergey

No. We have some kind of versioning system with metadata. The original filename is stored in a database, all the files are named after the same pattern.

Let's say we have a file called "section.dxf". That filename will be stored in the database and the unique filename-handle File-23 will be given. Now, the first version of "section.dxf" will be named "File-23.1" (in the filesystem), the second "File-23.2" etc.

So we can't generalize that "1" stands for dxf etc. But because we know (in the metadata) what kind of filetype File-23 is, we would like to call CrateCAD somehow like:

CreateCAD(NULL,inFile,"dxf")

Which means we give an additional argument (overloaded methods?) to tell the constructor which MIME-type inFile will be.

Would this be possible?

Thanks
mike

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 07 Oct 2005, 17:02

Dear Mike,

Inside of CreateCAD occures opening of the file by the pointed way. That is why we are not able to say exactly how should it work with your MIME. We need any example for testing.

CreateCAD(NULL,inFile,"dxf")

We can make such calling for you. But this will be our primary experience with Multipurpose Internet Mail Extensions (MIME). We need an example of such file and then we'll say exactly whether this is possible for us to do implement this task.

Sergey.

please post questions to the forum or write to support@cadsofttools.com

gavroche
Posts: 3
Joined: 06 Oct 2005, 16:19

Post by gavroche » 10 Oct 2005, 00:40

Dear Sergey

I'm sorry but there seem to be few misunterstandings. Let me try to put the question different:

We have a bunch of files in a directory. They are all either dxf, dwg or plt files. We know, which is a dwg, which a plt and which a dxf. But the files have obscured names without extensions (the ".dxf", ".dwg" or ".plt" is missing in the filename). So now, if I try to open the file with CreateCD, it'll fail. I suppose this is because it doesn't recognize a valid filename extension.

What we would like to be able to do is, to tell CreateCAD what kind of format it will have to expect. This informationen could be given by an additional argument for CreateCAD, I thought.

Thank you, Sergey

mike

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 10 Oct 2005, 12:40

Hello Mike,

We'll send you a special build of CADImage.DLL.

Sergey.

please post questions to the forum or write to support@cadsofttools.com

support
Posts: 3254
Joined: 30 Mar 2005, 11:36
Contact:

Post by support » 10 Feb 2006, 12:48

Hello all,

Function <b>CreateCADEx</b> has been added to CADImage.dll (available on: http://www.cadsofttools.com/download/CADImage.zip).

The <b>CreateCADEx</b> function creates a new CADImage object and loads it from the specified file.

<b><i>HANDLE CreateCADEx</i></b>(
<b>HWND</b> hWindow, // handle of application main window
<b>LPCSTR</b> lpFileName, // pointer to file name
<b>LPCSTR</b> lpExt
);

<b>Parameters</b>

<i>hWindow</i>
Identifies the window that will get system messages during the loading of file. Usually it is the main window of client application. If no file is specified, <i>hWindow</i> can be NULL.

<i>lpFileName</i>
Points to a null-terminated string that specifies the CAD file name to be loaded. If this parameter is NULL, no file is loaded and the empty CADImage object is created.

<i>lpExt</i>
Points to a null-terminated string that specifies an extension for CAD file name to be loaded.
<b>Note</b>:
If <i>lpExt</i> is equal to the one of the following extensions: ( '.dxf', '.dwg', '.plt', '.hgl', '.rtl', '.hg', '.plo', '.hp', '.hp1', '.hp2', '.hpg', '.hpgl', '.hpgl2', '.gl2', '.prn', '.spl', '.svg', '.cgm') then specified by <i>lpFileName</i> and <i>lpExt</i> file will be loaded to the created CADImage object.
If <i>lpExt</i> is not equal then extension in <i>lpFileName</i> will be checked. If it will be equal to the one of mentioned above then file specified in <i>lpFileName</i> will be loaded to the created CADImage object.
If extension in neither <i>lpExt</i> nor <i>lpFileName</i> are not equal to the one of mentioned above then function fail.
Parameter <i>lpExt</i> is ignored if filename in <i>lpFileName</i> parameter specifies with extension.

<b>Return values</b>

If the function succeeds, the return value is a handle of new CADImage object.
If the function fails, the return value is <b>NULL</b>. To get extended error information, call <b>GetLastErrorCAD</b>.

Sergey.


please post questions to the forum or write to support@cadsofttools.com

Post Reply