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:

acam

Resellers
  • Posts

    73
  • Joined

  • Last visited

Everything posted by acam

  1. yeah, but this one only creates bitmap 256x256 pixels. I would like to have a big image. Regards.
  2. Hello, I have another question regarding Nethook options. I would like to make a printscreen image of a graphic view. I can succesfully save the image of the entire screen. I use this method for this: Rectangle bounds = Screen.GetBounds(Point.Empty); // create the bitmap to copy the screen shot to Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height); // now copy the screen image to the graphics device from the bitmap using (Graphics gr = Graphics.FromImage(bitmap)) { gr.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size); } return bitmap; But the problem is that this method returns image of the entire screen. I would like to get the image of only a graphic window. I see 2 possible solutions to this: get the bounds of the graphic screen and use them in the previously shown method use direct function from mastercam (if it exists) to get the image directly (like the Screen/To clipboard function inside of Mastercam) I was checking the Nethhok help but I see no option to achieve any of these using nethook functions. Any of the solutions would be greatly appreciated. Thanks
  3. thanks I'll try this. I am sure it will work as it does always when you help Regards.
  4. I have a question regarding setting a gview vith the nethook. I have a task to set some gviews inside a nethook for Mastercam X5. I cannot find the right method to set the gview to Mastercam predefined graphic views (like TOP, ISO, FRONT,....). I tried these: ViewManager.GraphicsView.ViewName = "ISO"; ViewManager.GraphicsView.ViewName = "TOP"; ViewManager.GraphicsView.ViewName = "FRONT"; but they don't work. I even tried the ViewManager.GraphicsView.ViewNumber , but this one is read only method. Is there an option to set the gview by using a method in .net? Any help would be greatly appreciated. Best regards.
  5. Thanks! Yes you were totally right. I forgot to set this folder fro the linker. It works perfectly now. Best regards.
  6. Hello, we have some Nethook projects that also use some functions from the CHOOK SDK. This projects were written for X4 and they are working just fine. Now we tried to recompile them for X5 and the Nethook part went just fine (they work fine in X5). The problem is compiling the Chook part of projects (the dll worker). When compiling I get 3 such errors: code: Error 5 error LNK2001: unresolved external symbol "__declspec(dllimport) char __cdecl calc_note(struct __ent *,short,double * const,unsigned char *)" (__imp_?calc_note@@YADPAU__ent@@FQANPAE@Z) main.obj ColorCodeWrk when converting to X5 I also changed the paths to the "Additional Include Directories" to the ones in the X5 SDK installation directory. There are three functions that seem to be the problem: calc_note store_ent get_ent I am using several other functions (like OnDisplayInfo(int param) or OnWCSAxesToggle(int param) and they work fine. Every help is greatly appreciated. Thanks
  7. Hello, thanks for reply. I also got an email from Roger Martin with a similar solution. I'll check both ideas and give them a try. I have no doubt that it would be successful (with such good help from you guys!) . Regards. Gorazd
  8. Hello! I have a similar problem regarding labels. I want to create a Label (Single note without any leaders) at designated position in designated color with some text. This is what I was able to do (it is a C++ function called from a Nethook using P/Invoke): code: extern "C" __declspec(dllexport) void calc_note() { ent entity; short view; p_3d point; MC_BYTE text = 3 ; point[0] = 10; point[1] = 10; point[2] = 0; view = 1; calc_note(&entity, view, point, &text); } I believe my main problem is that I don't know how to add a string to the MC_BYTE text variable. If anybody can help me I would really appreciate it. Thanks.
  9. Hello, I have another NETHOOK project in mind and I have problem finding the arcs (their center points, radii and sweeps). What I would like to do: - Select all arcs in the MCX file - Change the color of all FULL ARCS WITH CERTAIN RADIUS (for instance: if arc radius is in range between 10mm and 11 mm and it's sweep equals 360 degrees then the color of this circle is changed to red) - create a drafting note at the center of the circle (for instance "CIRCLE: 10MM TO 11 MM" Does the NETHOOK API have the functions that would enable me to do something like described above or should I start looking at Chook SDK? If it is possible I would greatly appreciate some code snippets. Best regards. Gorazd
  10. Hello, It seems that I will have to put you as the the main programmer under the "Authors:" section. You help me so much! Regards.
  11. Great, thanks! Now I know why I did not find that. If I do a search for "OnDisplayInfo" in the SDK help file there are no results. One other question. Is there an option to find out whether this "OnDisplayInfo" is currently ON or OFF? I would like to know it's current state before I run the toggle function. Regards.
  12. Hello, I have another question. I went through the Chook SDK and Nethook help, but I cannot find the function that would enable setting on/off the brown axes (F9 on the keyboard). I can do this by using VBS : code: Call RunMastercamCommand("OnDisplayInfo") I am sure it is possible in Nethook/Chook I just can't find it. Any help will be appreciated. Regards. Primoz
  13. Thanks! Once again you nailed it. The example you sent to me works perfectly. And once again - another question: I am saving levels as STL files using this line: code: FileManager.SaveAs(OurFileNameAndPath_STL, true); Is there any option to set the STL resolution setting. The way it works now (it uses the default value of 0.02 in MM) means that this value is sometimes too small, so the STL files are too big. Thanks for the reply Regards
  14. Hello, thanks it works great! Of course now I have a new question. Is there an option to get RGB values of these colors? Regards
  15. Hello, we are writing a little nethook and cannot get the color # of the element. Our goal is to get the color # of first element of each populated level. Does a function like that exist in Mastercam Nethook? If it does any code snippet would be greatly appreciated. Regards. Gorazd
  16. Hello, I have tried both things and the thing is that the Nethook is working on my Vista Laptop and does not work on my brand new Windows7 PC. The error states this: "A .NET Library error occurred and the user application "CHOOKSMULTI_MACHINES_POST.DLL", has stopped executing. Roger, I can send you the whole project, so you can see how I have done it. Maybe you find an error in a project. Regards. Gorazd.
  17. Thanks for both ideas. I will try that and let you know about results.
  18. Hello, we created a nethook for Mastercam X4 (we created it by using the NetHook2Example from the Mastercam web page and Microsoft Visual Studio 2005. It worked fine in X4 and X4MU1 After installing MU2 the Nethook does not run any more. We get this error instead: "Exeption has been thrown by the target of an invocation." Does any of you know what would be the reason for this error. Best regards Gorazd Peterlin
  19. Hello, I am trying to use a chain manager for selecting geometry. The reason for this is that a general selection chaining [sHIFT+CLICK] is not working well enough on complex 3D parts (it stops chaining on branches). For now I have been trying with some VB functions and all I could do was to save chained elements to a geometry group. From here on I can not find a way to make all the elements in this group active so I could use them in some other function (like project this geometry to a Z=100). Here is my code: code: Call Main() Sub Main() Dim result, result1, prev_result1 ' open the chain manager result = AskForChain("test") result1 = GetEntityEptr() ' go through all the elements in the chain and save them in the geomtry group "TEST" ' when previous EntityEptr is different than current EntityEptr ' it means that I have not reach the and of chain yet While result1 <> prev_result1 prev_result1 = result1 result1 = AddCurrentEntToGroup("TEST") result = MoveForwardOnChain() result1 = GetEntityEptr() wend Call RunFTCommand("MASTERCAM", "SelectAllMask") ' this one is not working End Sub Has anybody tried to do something like this? Is it even possible by using VB or would I have to use .NET or even C++? Regards
  20. Sorry, I guess my question was a little bit silly. My idea was: - before starting backplot we could export the "tool manufacturer" strings from selected operations. - during backploting your chook would "somehow" catch the name of the current tool and replace the holder files according to "manufacturer" string previously read. - this would allow totally automatic connection of tool holders and tools. In the tool parameters you would write the tool holder (in the "tool manufacturer" string for instance) and Mastercam would automatically set the holder accordingly. I made some tests yesterday after I wrote my post and I found out this: - If you change the tool holder when backplot is active, Mastercam does not update it. You must restart backplot in order to update holder. so, once again, it was just an idea which can not be realized so easily (or maybe not at all). Thanks for the your holder management anyway, it is great tool and I will certainly use it!
  21. Hello, this is great tool, but its shortcoming is that it does not allow to connect a tool with a holder inside a tool library (of cours this is what Mastercam should have for 10 years). I have an idea. Could you extend the work of your c-hook so that it would read the string from the tools holder. And then replace the appropriate files according to this string. This would mean that we would be able to set a holder name in the tools' properties and therefore would be able to make tool/holder groups.
  22. Hello, I just tried this function but the result is still not the way I would like. This is the code: code: sit = no2asc(34) sfile = sit + spathnc$ + snamenc$ + sextnc$+ sit + " " + sit + spathnc$ + snamesub$ + sextnc$ + sit #Set file path result = setncstr(2, sfile) Mastercam opens both files in the editor and stays "locked" until I manualy close the Cimco editor. After that I can use Mastercam again. Is this the way this should work? I would like the editor would stay open and Mastercam "unlocked". Best Regards Gorazd
  23. Thanks for the replies. I didn't know that this "setncstr" function even exists. It most certainly is not mentioned in the Post Ref Guide. I will try it right now. best regards. Gorazd
  24. Hello. I am trying to launch several NC files in external editor in ppost$ block and I have one little problem. Here is how my code looks: code: seditor "C:McamX3commoneditorsCIMCOEdit5CIMCOEdit.exe" s_iteral s_main_spindle s_sub_spindle s_nc_files ppost$ s_main_spindle = spathnc$ + snamenc$ + sextnc$ s_sub_spindle = spathnc$ + snamesub$ + sextnc$ s_iteral = no2asc(34) s_nc_files = s_iteral + s_main_spindle + s_iteral + " " + s_iteral + s_sub_spindle + s_iteral result = launch(seditor, s_nc_files) Both files are getting opened in the Cimco Edit, but the problem is that the posting does not finish after launching EXE file. Mastercam just waits there until I CLOSE the editor and only then it finishes with posting. I don't want to close the editor - I want to leave it open. Is there any solution to this?

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...