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:

Roger Martin from CNC Software

CNC Software
  • Posts

    2,870
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Roger Martin from CNC Software

  1. You've learned a lesson today. ;( The Windows file association stuff leaves a bit to be desired. For dealing with those, I use -> FileTypesMan utility http://www.nirsoft.net/utils/file_types_manager.html
  2. If you're not seeing the "Tip String Text" , there's something wrong with this Resource item. What appears between the "quotes" for the dnTip in the FT is the name of the String Resource item in here -> dnRES_NAME "UHM_Open.NETHook"
  3. Check the Mastercam Log just after starting Mastercam. There will be complaints in there if Mastercam could not find the specified Resources in your DLL. If an Add-In is not showing up when you have an FT for it, that's that first place to look.
  4. NO - Do not do that! You create your own separate .FT file for your C-Hook (or NET-Hook) Add-In. Something like this -> *Shown below is a sample FT for a C-Hook type Add-In. The .FT for a NET-Hook Add-In would differ in the fact that it would have a FUNCTION NET section where you declare the entry point method and the tip-string and icons resources and the addition of a dnRES_NAME line where you would specify the "name" of the Resources in the .NET Assembly where Mastercam is to look to find those "resource" items. # MyAwesomeAddIn.FT # # Application name should be uniquely named and be specific # to your company and/or product. # 3rd party add-ins should NOT make this "Mastercam"! APPLICATION "MyAwesomeAddIn_CP_PISTONS" # Point to the locations of your function and resource libraries. FUNC_DLL "chooks\MyAwesomeAddIn.dll" RES_DLL "chooks\MyAwesomeAddIn.dll" CATEGORY "CP PISTONS Add-Ins" # Specify the name of your entry point function, # the Resource IDs of the tool tip string and # the small and large icon images for your add-in. # The small icon must be a 16x16 pixel PNG image. # The large icon must be a 32x32 pixel PNG image. FUNCTION CPP "m_main" TIP 1 SPNG 18001 LPNG 18002 END_FUNCTION
  5. What you're seeing in that list are special Add-Ins already "known" by Mastercam. You let Mastercam know about your Add-In with a (.FT) Function Table file. Now in Options, select in the Choose command from: Commands Not in the Ribbon -or- All Commands If your FT is proper, your add-in TipString will appear in the command list. If not, check the Mastercam Log as it will complain if something is incorrect in the .FT file.
  6. The ToolNetApi.dll is installed with Mastercam. You'll find it in the main Mastercam ("\Program Files\mcam2018" in this case) folder. You add a Reference to it in your NET-Hook project, just like you do for the std. NET-Hook API (NETHook3_0.dll) There's also the ToolNetApi.xml in there, so you have Intellisense . If you need details on how to do something specific, I should be able to round up some sample code using the TloolNetAPI. *Be sure to send your request to SDK <at> mastercam <dot> com
  7. We always need to know -> what version of Mastercam? The way to positively identity a Tool in the local part file's tool list is -> by its Slot number What types of Operations are you manipulating? The NET-Hook API itself does not support all operation types. But... There the the ToolNetAPI (starting in 2017) that can (should) be used to manipulate tools via a NET-Hook Add-In. You can submit your detailed info to SDK <at> mastercam <dot> com This forum is not sufficient fore doing detailed API support.
  8. ' Ask the user to select a point position ' -- Start Script Call Main() 'Call OtherAskPoint() ' Sub Declaration Sub Main() Dim objPoint Dim strX, strY, strZ Set objPoint = New McPt ' Prompt for a point location and fill a McPt with the result If askPoint(objPoint) Then ' Show the user some properties of this point With objPoint strX = "X = " & FormatNumber(.X, 4, -1) strY = "Y = " & FormatNumber(.Y, 4, -1) strZ = "Z = " & FormatNumber(.Z, 4, -1) End With ShowString PointPickType & vbCrLf & "Point Coordinates" & vbCrLf & strX & vbCrLf & strY & vbCrLf & strZ Else Call ShowString("No point selected") End If Set objPoint = Nothing End Sub ' Another method of asking for a point position Sub OtherAskPoint() Dim strX, strY, strZ if AskForPoint () Then ' Show the user some properties of this point strX = "X = " & FormatNumber(GetPoint(0), 4, -1) strY = "Y = " & FormatNumber(GetPoint(1), 4, -1) strZ = "Z = " & FormatNumber(GetPoint(2), 4, -1) ShowString PointPickType & vbCrLf & "Point Coordinates" & vbCrLf & strX & vbCrLf & strY & vbCrLf & strZ Else Call ShowString("No point selected") End If End Sub ' Retrieve the point pick type "description" Function PointPickType () Dim str Dim ptType ptType = GetPointType () Select Case ptType Case "1" str = "EndPoint #1" Case "3" str = "EndPoint #2" Case "C" str = "Center" Case "I" str = "Intersection" Case "K" str = "Sketch" Case "M" str = "MidPoint" Case "O" str = "Origin" Case "P" str = "Point" Case "U" str = "Quadrant" Case Else str = "UnKNown" End Select PointPickType = "*" & str & "*" ' returned End Function
  9. For the latest NET-Hook API docs, see - https://nethookdocs.mastercam.com The ability to get/set the Program "Number" and Program "Name" were not in the API. Not sure why, but fairly recent requests from the field have changed that. In the NET-Hook API online docs, under Version History for Mastercam 2020 you'll see - Added: Methods for retrieving and updating the Program Number. In a single Operation object, or all, or just the selected operations in the Toolpath Manager. See: ProgramNumber and SetProgramNumber Added: Methods for retrieving and updating the Program Name of all, or just the selected operations in the Toolpath Manager. See: GetProgramName and SetProgramName Of course Program "Number" and Program "Name" can be manipulated using a C-Hook type add-in, in any version of Mastercam.
  10. Peter, Please submit your question/request to SDK <at> mastercam <dot> com Also supply us with... Which version of Mastercam? Are you doing this with a C-Hook or NET-Hook Add-In?
  11. Which public "Retrieve" function? The Retrieve method in the Operation (and Tool) class is not "public". That said, yes the Retrieve methods call LoadDefaults. What are you trying to do?
  12. Operation::LoadDefaults () is a "protected" method in the Operation class. Meaning your client NET-Hook Add-In cannot call this method, as it's for "internal" use by the API. What it does is retrieve information from Mastercam's database about an operation to populate a NET-Hook Operation object. There are many LoadDefaults () in the API that do the same function – That is, pull data about an item (Operation, Tool, Entity, etc.) from Mastercam's database into the NET-Hook (aka. Managed) representation of that data.
  13. This is not available in the VB-Script The ability to set the Program Number was just recently added to the NET-Hook API for the upcoming Mastercam 2020. Meaning, the only way to do this now, is with a C-=Hook Add-In.
  14. Check the Tool Offset Registers setting the Control Definition. It's on the Tool -> Mill topic page.
  15. The Gear utility that is shipped and installed with Mastercam? Run Add-In and select the Gear.dll
  16. As you’ve seen, the NET-Hook API does not retrieve the "name" of the Solid. I’ve logged a request (S-59312) to add this data to the SolidGeometry class in the API . It you’d like to continue this discussion, please email us with your contact info to -> [email protected] This functionality could be done with a C-Hook Add-In, or even a C-Hook type DLL that a NET-Hook Add-In can reference (like it does the std. API) to retrieve this "name of solid" data. That’s probably the simple part. I’m not sure what you intend here by - "automatically add labels" ->
  17. It's complaining about a missing KeyMap file -> Mastercam.kmp Either: Restore it from your configuration backups. (You do have backups of your CONFIG, correct?) Or: Go into your "my mcamx7\CONFIG" folder and see you have a "Default.kmp" file in there. Make a copy of it can name it "Mastercam.kmp"
  18. You say – "Just point entities", but then "...which is vector data." Of course, Point Entities do not have vector data. If you want to just output the X,Y,Z data for Point Entities in a file, you can do a SaveAs and select the Save as Text (.txt or csv) filter option. Someone else asked about outputting Line data to a text file. The Save as Text option mentioned above only does Points. To output Line data, (all?, only selected?, or only those on this level?, or this color?) could easily be done with a NET-Hook add-in.
  19. What is the actual data you're working with in Mastercam? Just a bunch of Point Entities?, or...? What version of Mastercam?
  20. The APPLICATION "name" in the FT is a unique ID for the add-in. It does not have to match, or even contain the name of the actual DLL file. unique ID means exactly that, so the name given for this is case sensitive -> APPLICATION "MyAddIn" The FUNCTION "name" is the actual name of the function (method) to be run in the Add-In DLL. And of course function names are case sensitive.
  21. The application name is only "Mastercam" if it is Mastercam "internal". Never use "Mastercam" as the application name in a FT file that you have created. As I described, you can call any function declared in any FT file. Which of course include your own FT/DLL combos.
  22. In the NET-Hook API, you have -> PostFTCommand (String AppName, String CommandString); RunFTCommand (String AppName, String CommandString); // in Mastercam 2019 In The C-Hook SDK, you have -> post_FT_command (CString appName, CString entryName); Just like it sounds, you’re firing a Function Table (FT) command. You feed these functions with these parameters. The name of the application and the name of the function in that application DLL. In the target FT file, (showing a C-Hook style FT here) you have… APPLICATION "CreatePlaneAddIn" FUNCTION CPP "m_main" If you’re firing a function in a NET-Hook DLL, you would use… APPLICATION "ImportOperationsExample" FUNCTION NET "Run"
  23. You now use the "ToolSystem" functionality when working with tools in Mastercam. Check your e-mail.
  24. No. But I'm old enough that I've done programming in both! Fortran (before PCs existed), UCSD Pascal and then Borland Turbo Pascal. wikipedia - UCSD Pascal wikipedia - Turbo Pascal A project done in Turbo Pascal -> eMastercam Fourm - ESSI format Mastercam's been around for 35 years. In case you've not seen the news. C++ did not exist then (C++ first appeared 33 years ago), so before C++, you had 'C'. wikipedia - C++
  25. Just so you know... Mastercam is not programmed in Visual basic.

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