No Debug window, no scLoadDrawing

Request and discuss new features
Post Reply
jemmyell

No Debug window, no scLoadDrawing

Post by jemmyell »

Hi Les,

I'm starting to feel dumb, but I can't get the debug window to show in 3.1.0.16 and I still can't get scLoadDrawing to display my .DXF. Note that if I call scLoadDrawing with the filepath as NULL I do get the dialog and I can successfully load my DXF. I am attaching my sheetcam.ini file for you to have a look at. :(

-James
User avatar
Les Newell
Site Admin
Posts: 3661
Joined: Thu May 11, 2006 8:12 pm

No Debug window, no scLoadDrawing

Post by Les Newell »

Hi James,

I just tried your ini file here and the debug window shows. It is a
separate window and should appear on the left of the screen. Check it
isn't just hidden by SheetCam's main window.

I'll have another look at scLoadDrawing and see if I can spot any problems.

Les
I'm starting to feel dumb, but I can't get the debug window to show in 3.1.0.16 and I still can't get scLoadDrawing to display my .DXF. Note that if I call scLoadDrawing with the filepath as NULL I do get the dialog and I can successfully load my DXF. I am attaching my sheetcam.ini file for you to have a look at. :(
User avatar
Les Newell
Site Admin
Posts: 3661
Joined: Thu May 11, 2006 8:12 pm

No Debug window, no scLoadDrawing

Post by Les Newell »

Hi James,

I have just found why your drawing won't load. It was an incorrect enum
in PluginAPI.h. The attached header file should fix the problem.

Les

#ifndef PLUGINAPI_H_INCLUDED
#define PLUGINAPI_H_INCLUDED

#define scAPI_VER (1)

enum {scMENU_CHECKED =1, scMENU_ENABLED =2, scMENU_SHOWN =4};


#ifdef SHEETCAM_APP
#define DLLEXPORT __declspec(dllexport)
#else
#ifdef __BORLANDC__
#define DLLEXPORT __declspec(dllimport)
#else
#define DLLEXPORT
#endif
#endif


extern "C"{


#ifdef SHEETCAM_APP
typedef bool WINAPI (*scInit)(int PluginID, int APIVer);
typedef void WINAPI (*scOnMenu)(int MenuIndex);
typedef void WINAPI (*scOnClose)(void);
#else
#define DLLIMPORT __declspec(dllexport)
/*Functions that SheetCam can call.
Apart from scInit(), all other functions are optional. If they exist
they will be called. If not they will be ignored
*/



/* this function must be implemented. It is called immediately after the
dll is loaded. If it returns false then the dll will be ignored.

Use PluginID in all calls to SheetCam where it is needed. If APIVer > scAPI_VER
then you must return false immediately.
*/
DLLIMPORT bool WINAPI scInit(int PluginID, int APIVer);

/* called when a plugin's menu is accessed*/
DLLIMPORT void WINAPI scOnMenu(int MenuIndex);

/* called when SheetCam closes*/
DLLIMPORT void WINAPI scOnClose(void);

#endif


/* Functions available to the plugin*/


/* Load a drawing into the current part
If FileName == NULL then the user will be prompted for a file and
FileType will be ignored.
returns:
true if file loaded successfully
*/
enum scFILETYPES{scFILETYPE_DXF =1,scFILETYPE_HPGL,scFILETYPE_EXCELLON,
scFILETYPE_EMF};

DLLEXPORT bool WINAPI scLoadDrawing(LPSTR FileName, scFILETYPES FileType);

/* Load a job. If FileName == NULL then the user will be prompted for a file
returns:
true if file loaded successfully
*/
DLLEXPORT bool WINAPI scLoadJob(LPSTR FileName);

/* Check if SheetCam is processing paths. You can still safely call most
functions while SheetCam is processing paths.
returns:
true if SheetCam is processing paths
*/
DLLEXPORT bool WINAPI scIsProcessing(void);

/* Run the currently selected post processor. This function will wait for
SheetCam to finish processing paths before returning.
If OutFile == NULL then the user will be prompted for a file name.
returns:
true if processing complete with no errors
false if file not opened or there were any errors
*/
DLLEXPORT bool WINAPI scRunPost(LPSTR OutFile);


/*Menu functions.*/

/*Add a main menu. It will appear before 'Before'. For instance if
Before =="Tools", the menu will appear between 'View' and 'Tools'.
If Before == NULL or the name does not exist then the menu will appear before
the 'Help' menu. If 'Name' already exists then no new menu will be created and
the index of the existing menu will be returned. Note Name is not case sensitive
and should not include the & underline symbol.

Returns: -1 to indicate an error or a unique MenuID that can be used
to refer to the menu.
*/
DLLEXPORT int WINAPI scAddMainMenu(int PluginID, LPSTR Before, LPSTR Name);


/*Get the MenuID of an existing menu. Path is a fully qualified path to the menu.
For instance "/Options/Complexity" refers to the Options->Complexity menu.
Note the unix style forward slash!
The names always apply to the English translation even if the menus are
displayed in a different language. They are NOT case sensitive and the & symbol
is ignored.
For example "View" or "vieW" refer to the View menu even if it is displayed
as 'Anzeige'(German translation).

Returns: -1 if the menu does not exist or a unique Id for that menu
*/

DLLEXPORT int WINAPI scGetMenuID(LPSTR Name);

/*Add a sub menu to a menu. Use the & symbol to underline a letter.
For instance &File would underline the F.

Returns: -1 to indicate an error or a unique MenuID
*/
DLLEXPORT int WINAPI scAddMenu(int PluginID, int MenuID, LPSTR Name);

/* Trigger a menu as it it has been clicked.

Returns: true if the menu was found
*/
DLLEXPORT bool WINAPI scDoMenu(int MenuID);


/* Show/hide a menu.
If State == true the menu is shown otherwise it is hidden.

Returns: true if the menu was found
*/
DLLEXPORT bool WINAPI scShowMenu(int MenuID, bool State);

/* Enable a menu.
If State == true the menu is enabled otherwise it is disabled(grayed).

Returns: true if the menu was found
*/
DLLEXPORT bool WINAPI scEnableMenu(int MenuID, bool State);

/* Add/remove a check mark on this menu.
If State == true the menu is checked otherwise it is unchecked.

Returns: true if the menu was found
*/
DLLEXPORT bool WINAPI scCheckMenu(int MenuID, bool State);

/* Get menu state.

Returns: -1 if the menu was found otherwise a bitwise combination of:
scMENU_CHECKED | scMENU_ENABLED | scMENU_SHOWN

*/
DLLEXPORT int WINAPI scGetMenuState(int MenuID);


/* Minimize SheetCam window.

Returns: nothing

*/
DLLEXPORT void WINAPI scMinimize(void);

/* Restore SheetCam window and activate

Returns: nothing

*/
DLLEXPORT void WINAPI scShow(void);


}; //extern"C"
#endif
jemmyell

Ok, scLoadDrawing is working AND I found the debug window

Post by jemmyell »

Hi Les,

Ok, fixing the enum for the DXF filetype did the trick for scLoadDrawing. Also IF SheetCam is mamimized, the debug window is BEHIND the main window and cannot be found since it isn't in the ALT-TAB window switch order! :D

Would it be possible to do something about setting Drawing Options in the sheetcam.ini so I can suppress the dialog that pops up? Maybe a section:

[RunSilent]
...Drawing Option Params here....

I want SheetCam to be as hidden as possible when it is minimized. Even when it is visible, it would be nice if the menus were disabled so I don't have to deal with the user doing unexpected things (like closing SheetCam manually) while I am using it.

Did you think about adding the function to let me stop SheetCam?

-James
User avatar
Les Newell
Site Admin
Posts: 3661
Joined: Thu May 11, 2006 8:12 pm

No Debug window, no scLoadDrawing

Post by Les Newell »

Hi James,
Ok, fixing the enum for the DXF filetype did the trick for scLoadDrawing. Also IF SheetCam is mamimized, the debug window is BEHIND the main window and cannot be found since it isn't in the ALT-TAB window switch order! :D
Yes - that would happen. I run two monitors and SheetCam usually runs on
a different monitor to the debug window.
Would it be possible to do something about setting Drawing Options in the sheetcam.ini so I can suppress the dialog that pops up? Maybe a section:
I was waiting for this request ;-). I think I need to add some extra
parameters to the scLoadDwg() function. I'll stick it on the to-do list.
I want SheetCam to be as hidden as possible when it is minimized. Even when it is visible, it would be nice if the menus were disabled so I don't have to deal with the user doing unexpected things
You can already use the API to manipulate menus. For instance:
scShowMenu(scGetMenuID("/File"),false)
will hide the file menu.
There isn't much you can do about stopping the user from closing
SheetCam though.
Did you think about adding the function to let me stop SheetCam?
Err - sorry, I forgot about that one.

Les
jemmyell

Any news on these last two features?

Post by jemmyell »

Hi Les,

Any news on the extra params for scLoadDrawing and the new function to let me shut down SheetCam?

All is well otherwise, development proceeds well.

-James
User avatar
Les Newell
Site Admin
Posts: 3661
Joined: Thu May 11, 2006 8:12 pm

No Debug window, no scLoadDrawing

Post by Les Newell »

Hi James,

You can shut down SheetCam by using the menu functions to call the
file->exit menu. Sorry I haven't got round to sorting out the extra
parameters. I have been away from the office a lot recently.

Les

Any news on the extra params for scLoadDrawing and the new function to let me shut down SheetCam?

All is well otherwise, development proceeds well.
jemmyell

Thanks for the new functions

Post by jemmyell »

Hi Les,

I also have been WAY too busy. Thanks for the new functionality I will work with it soon. I am at a convention the 21st to 25th but I have my laptop all loaded up and will use my off time while I am there.

-James
Post Reply