Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Takashi Sato from Ai Solutions.

Verified Members
  • Posts

    338
  • Joined

  • Last visited

Everything posted by Takashi Sato from Ai Solutions.

  1. I did that before, and it worked. code: typedef void (*get_hasp_info_func)(MC_BOOL countLicenses, mcSimInfo *info); get_hasp_info_func get_hasp_info=NULL; HMODULE hMod=::LoadLibrary("SimAccess.dll"); if(hMod) { get_hasp_info = (get_hasp_info_func)::GetProcAddress(hMod,("?get_hasp_info@@YAXDPAUmcSimInfo@@@Z")); if(get_hasp_info!=NULL) { mcSimInfo sim; get_hasp_info(FALSE,∼); CString info; info.Format("%d %d",sim.userType,sim.serialNumber); AfxMessageBox(info); } }
  2. to make user to pick a entity/entities, I think you need to use these functions. Nethook code: namespace Mastercam.IO { public class SelectionManager { public unsafe static Geometry AskForGeometry(string PromptText, GeometryMask SelectionMask); public unsafe static Geometry[] AskForMultipleGeometry(string PromptText, GeometryMask SelectionMask); } } chook code: DllImpExp int select_ent (LPCTSTR cs, ent *entity, DB_LIST_ENT_PTR *eptr, p_2d sel_pt, double *t, short smask, long emask, int s_color, MC_BOOL *succf); DllImpExp int select_ents (LPCTSTR cs, long emask, MC_BOOL *succf, MC_PRESEL preSel=PRESEL_OFF, DB_LIST_ENT_PTR **eptrs=NULL, int *num_eptrs=NULL);
  3. it may work. code: /** * * @par Purpose: * This method sets select bits for entities that lie within the window and * clears select bits for entities that lie outside the window. * * @param[in] corner1 1st window corner, in uu coordinates * @param[in] corner2 2nd window corner, in uu coordinates * @param[in] set_ptn bits to set in .sel * @param[in] clr_ptn bits to clear in .sel * @param[in] ent_mask compare .id against this mask * @param[in] draw whether or not to re-draw entity after changing .sel * @param[in] mode 1= inside, 2= in+intr, 3= intersect, 4= out+intr, 5= outside * @param[out] succf TRUE if method was succesful; FALSE otherwise * */ extern DllImpExp void mark_window ( p_2d corner1, p_2d corner2, USHORT set_ptn, USHORT clr_ptn, ULONG ent_mask, MC_BOOL draw, short mode, MC_BOOL *succf);
  4. Hi it just works for me. I'm using list_manager for getting tools and operations. hmm... // "" is cuurent tool library in the database. list_manager(TL_ID, "", LSTMGR_GET, (void**)&tl_head); // tool_library -> ToolLibraryStr() or ToolLibrary().GetBuffer(0) or "c:mcamx2mill....test.tools" etc.. list_manager (TL_ID, ToolLibraryStr(), LSTMGR_GET, (void **)&tl_head);
  5. If you use the express edition, mfc is not supported, so you have to remove mfc/AFX(Application Framework eXtensions )related things. http://en.wikipedia.org/wiki/Microsoft_Foundation_Classes http://en.wikipedia.org/wiki/Visual_Studio_Express_Edition Here is my simple chook project for the express ediition, which creates point entities by clicking. http://ai-sols.sytes.net/download/chook_src_express.zip I dont see anything until seeing your error messages.
  6. arg, an another thing in my mind is locale thing. but when you dont use multibyte characters, it wont be a problem. setlocale(LC_CTYPE, "")
  7. "clipping planes" are drawing limit planes of left, right, top, bottom, nearest, farest in the viewport( projection coordinates ,not model view coordinates). Anyway I have no idea for the question. ...run command of selecting by window and send two mouse click messages to the curent gview??
  8. It seems you are trying to read a text data from text file. If you use ifstream, use getline function, and read a line text to a buffer. and if you use fopen, try "rt". it is read text mode. fopen("C:mcamxaxis_alignment.txt","rt"); HTH
  9. Deleting toolbars.atb may reset the toolbar settings. C:McamX2commoneditorsmastercamtoolbars.atb HTH
  10. Rakesh, You have to go to the image menu -> Scale Image, and change the width * the height into 512 *512 or smaller, then Save it. http://docs.gimp.org/en/gimp-image-scale.html
  11. Hi Rakesh, it seems good. To bring the normal background back, Please run it again by alt+c texture.dll. it toggles on/off. the texture chook resamples the image into 256*256,512*512,etc internally. and the maximum size is 512*512 because using large a texture slows down the graphic repaint. All textures that OpenGL uses have to be size 2^n pixels^2 so that could be: 64*64 512*512 256*256... Personally, I like to use gimp for windows when I edit the images. http://gimp-win.sourceforge.net/ and sometimes I also use Texture maker.. http://www.texturemaker.com/screenshots.php HTH
  12. this is not related to the main subject though. I've change the drawing depth for the texture. and the texture will fit the graphic viewport. http://ai-sols.sytes.net/download/Texture.zip this one also supports bmp,gif,png files. and you can browse the image files by ali+c -> texture.dll. edit: the image file size should be 512*512 or 256*256 or 128*128 pixels.
  13. I've added a non-MFC Dialog class and a non-MFC String class to the sample code file below. (the classes are originally from codeguru/codepoject sites, and you will find useful codes at http://www.codeguru.com or http://www.codeproject.com/ ). http://ai-sols.sytes.net/download/chook_src_express.zip As far as I see the chook sdk for X2,the express edition works with X2. but MFC dependent functions/classes are not available for the express edition. code: //non-MFC Dependent extern DllImpExp int OpenFile(char* filen, MC_BOOL bGetFilenameOnly=FALSE); #ifdef _AFX // MFC Dependant extern DllImpExp int OpenFile(CString& filen, MC_BOOL bGetFilenameOnly=FALSE); #endif moreover, I think you can also use CLI(.NET Framework),you can make form application with it. [ 12-23-2006, 10:14 AM: Message edited by: MasterShake ]
  14. ah,, the lack of MFC is a big deal , but still we can use windows api for making the windows/dialogs.. well, I just installed the express edition to my old pc and made a small chook with it. it just works anyway. http://ai-sols.sytes.net/download/chook_src_express.zip woot, the express edition also lacks the ability of editing resources. we have to edit the resource files with a text editor.. but I say it is good for learing c/c++ language. [ 12-21-2006, 11:33 AM: Message edited by: MasterShake ]
  15. As for free developer's environment.. Until the express editon was released, there was a free compiler from microsoft. it is called Visual C++ Toolkit 2003. but it has no GUI thing and you have to edit the source codes with notepad or the other editors and compile the code and link the .exe/dll files under console command prompt. (if you bought std or pro edition 2003, they had GUI) and the Visual C++ Toolkit 2003 has been replaced by Visual C++ 2005 Express Edition. it has GUI http://msdn2.microsoft.com/en-us/visualc/aa336490.aspx The platform SDK is different from chook sdk or .net framework sdk. I think you can make nethook without platform sdk, but you want to make chooks, you will need the platfrom sdk. http://msdn.microsoft.com/vstudio/express/visualc/download/ HTH
  16. I already have professional edition, so I have never checked VS 2005 express edition. but I guess you can make a dll with it. still it's ability seems limited compared with std or pro editions. web page if you have the express edition already, you can confirm that. and if you downloaded the express edition on the web, I think the installer does not contain Platform SDK, so you have to download it. I think the express edition is good enough to learn programing languages, but as you getting used to it, you may feel insufficient with its limited features.. it may be the time to buy the other better editions..
  17. Colin, As for texture chook, The texture is supposed to fit the screen background like this.(not geometry texturing) http://ai-sols.sytes.net/download/img/tex.jpg I've tested it on 2 pcs, and it worked good. So I'll test it with differnt graphic cards later. and if you set Debug=1 in Texture.ini, you will see the viewport size and Projection matix, ModelView Matrix and clipping depth informations for debugging. And I must say there is no advantage by using this chook, you just feel different than usual.. and feel a bit slow graphics repaint..
  18. Hello 1)I wrote the code below. can you try it? GetEntityLevel code: ' -- Start Script Call Main() ' //////////////////// ' Sub Declaration ' //////////////////// Sub Main() Dim bRet ' -- Start our search bRet = StartDBSearch(mc_alive, 8 Or 128) Do While bRet 'If GetEntityLevel = 1 DeleteEntity(GetEntityEptr) ' -- Get another entity bRet = NextDBSearch Loop Call RunMastercamCommand("OnScreenRegenerate") End Sub ---------------------------------------------- this is from chook sdk #define P_ID (ulong)1 ///< Point (bit 0) #define L_ID (ulong)2 ///< Line (bit 1) #define A_ID (ulong)4 ///< Arc (bit 2) #define S_ID (ulong)8 ///< Parametric spline (bit 3) #define N_ID (ulong)16 ///< Note/Label (bit 4) #define W_ID (ulong)32 ///< Witness/Leader (bit 5) #define D_ID (ulong)64 ///< Dimension (bit 6) #define NB_ID (ulong)128 ///< NURBS curve (bit 7) #define SURF_ID (ulong)256 ///< All surfaces (bit 8) #define DB_ID (ulong)512 ///< Database management (bit 9) #define CONS_ID (ulong)1024 ///< Curve ON Surface (bit 10) #define CD_ID (ulong)2048 ///< Copious data (bit 11) #define XH_ID (ulong)4096 ///< Crosshatch (bit 12) #define CC_ID (ulong)8192 ///< Composite curve (bit 13) #define ASSOC_ID (ulong)16384 ///< Associative ents (bit 14) #define CHILD_ID (ulong)0x8000 ///< Nonzero: ignore back pointer (bit 15) #define SOLID_ID (ulong)0x10000 ///< Solid entity (mc_solid_ent) (bit 16) #define SOLIDXMT_ID (ulong)0x20000 ///< Solid .x_t file (mc_solid_xmt_ent) (bit 17) #define FILE_ID (ulong)0x40000 ///< File entity (bit 18) #define RELIEF_ID (ulong)0x80000 ///< Art Relief Info entity (bit 19) 2)it seems "simplify" command does not support pre-selection. so you may have to hit enter key.. HTH
  19. Colin, it is not supposed to cover the geometry. it is so colled a BUG.. http://ai-sols.sytes.net/download/Texture.zip I've changed it a little. can you try this? Thanks Texture.ini will be created in the chooks folder. Mode=1 is a default value, Mode=0 is turning off the texture. [Texture] //Mode:0-4 Mode=1 Debug=0
  20. Hi, Tom, I have not figured out why it sometimes does not work for you yet. Nils, Is it working without any problem for you? if so, it's ok. I will update the chook if I find the way to fix Tom's problem. and thank you for testing it. what the curret SaveVisible chook does is as follows.. 1. save the current database temporarily. 2. delete all teh invisible and blanked entities. 3. call normal save-as dialog function. 4. restore the database back. code: extern "C" __declspec(dllexport) int m_main (int not_used) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); MC_BOOL succf; save_temp_db (&succf); ent e; DB_LIST_ENT_PTR dPtr, foundPtr; MC_BOOL tp_ref_warn=false; // toolpath_init (true,true,true,true,&succf); dPtr=db_start; do { get_raw_ent(false,&dPtr, &foundPtr, &e , 0 , ALL_ENTITIES_MASK, &succf ); if(succf&&e.eptr) { if(!is_level_visible (e.level)) { delete_ent(e.eptr,true,false,true,&tp_ref_warn,false); } else if(e.sel&BLANK_BIT) { delete_ent(e.eptr,true,false,true,&tp_ref_warn,false); } } } while(succf); rebuild_graphics(); CString filen=geo_filename; SaveFile(filen, FALSE); restore_temp_db (); return MC_NOERROR|MC_UNLOADAPP; }
  21. Welcome to developer's hell I think that is doable. you can import operations by using import_operations function. and xfrom the geometries by xfrom fucntions like translate_silent, or just rewrite the existing entities. and then assign them to the operations and regenerate them. just a thought.. there are lots of ways to do what you want to do.
  22. OK Tom, I uploaded the new one again. http://ai-sols.sytes.net/download/SaveVisible.zip *changed it also ignore blank entities. hope this one works. *off topic* I also made a texture background chook. http://ai-sols.sytes.net/download/Texture.zip you need a 512 * 512 pixel jpeg file, and save it as Texture.jpg.
  23. Thank you Tom, I did not tested it with large file, I'm going to investigate it. thanks

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...