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. I recall the ViewName issue and I see that it was addressed in the X6-MU1 update. Prior to that, it would (as you've discovered) "hang" Mastercam when you attempted to .Commit() a view with a new ViewName.
  2. The standard System Views are considered "locked" (by the NETHook API), so a .Commit() of one of those views will fail. If you check the return of the V.Commit() you will see that it is "false".
  3. X7 (MU2) I'm seeing that these "list view" column settings are stored in the Registry. *You can even delete the Registry keys (listed below) and they will be re-created the next time you exit the dialog. 1st screen - The 'Mill Tool Display' list (accessed from Toolpath Parameters) -> If a re-arrange the columns, when I exit the parameters dialog I can see the the values store under this key get updated. HKEY_CURRENT_USER\Software\CNC Software, Inc.\Mastercam X7\GUI\Mill Tool Display\Tool List Settings 2nd screen - The 'Mill Tool Library Selection' list (accessed via Select Library Tool) is stored here -> HKEY_CURRENT_USER\Software\CNC Software, Inc.\Mastercam X7\GUI\Mill Tool Library Selection\Tool List Settings To prove to myself that these were used from session to session. I re-arranged the columns as shown below. Then exited Mastercam. Then restarted X7 and created a new toolpath and... When I go to 'Select Library Tool' the columns remained as I had set them in the previous session.
  4. With X6 you cannot create Toolpath groups with the NETHook API. In X7 you can, as there are (2) overloads of the NewGroup(...) method that take a Parent Group as a parameter. This allows for creating "child" groups, which is what a Toolpath Group really is. (And in X8, some additional functionality has been added to the GroupManager class) X7 (NETHook3 API) here is one of the two NewGroup methods that creates a "child" sub-group) -> Mastercam.Support.GroupManager Mastercam.Support.Group NewGroup(Mastercam.Support.Group ParentGroup) Summary: This method creates and returns a newly created Group object within the specified parent group. Parameters: ParentGroup: The parent group the new group belongs to. Returns: The newly created group object, else null if it failed.
  5. "Program entry point not found" When you run a CHook via the Settings - "Run User Application" (ALT-C) There needs to be the default entry point function called "m_main" for Mastercam to call to start your C-Hook. Using an FT file you can define alternate entry points as you did with "OpenNewCAD". As to why "DoFileOpen" would not be working in Debug, when you say it works in Release - I have no idea. Since "DoFileOpen" is used extensively within Mastercam itself, I know that it works. If you would like me to investigate further, I'm going to need your code. You can send it to SDK[at]mastercam[[dot]com
  6. Just select Yes (also select the “Don’t show this again”) You are not debugging Mastercam, so this is fine. There something wrong with your code and/or the environment, but determining what is the real issue is with just this error message is somewhat impossible. Mastercam doesn't use (run) any CHook DLL without you telling it which one is to be run. How do you start your CHook once Mastercam is running? Main menu – Settings – Run User Application and you select the exact DLL to be loaded. The other way to run a CHook is by a toolbar icon or key assignment. To do this requires a Function Table file (FT) and within that FT file you created, you specify the path (and name) of the CHook DLL to be run when that toolbar icon is clicked. I usually recommend not using the FT file during debugging. Your can but... If your CHook DLL is referenced in an FT, it is automatically loaded when Mastercam starts up and cannot be unloaded during the session. If you forget to copy the DLL you just built over to the folder that your FT points to, you can run into "why doesn't this work?!?" issues. Also, don’t run a Debug build of your CHook using the Release version of Mastercam.exe, as that’ll not work “correctly”. Just select the desired (debug) DLL to run using the ‘Run User Application’ menu. You can easily set your DLL as the default CHook in Configuration, on the Start/Exit page. Set the desired default DLL for the ‘Add-in programs’ on the right side of that page. Then you can just press ALT-C and [enter} to start your CHook.
  7. You do not have to "install" the CHook SDK, if you have it in ZIP form. Ignore the "Error Report" dialog listing "menu" or "toolbar" issues when starting up in Debug mode. (You will always see this dialog when starting up in Debug, as it will always find something to complain about.) Absolutely true -> These setting look correct -> Are you sure you're building the correct bit-ness of your CHook in Debug mode? (32 or 64 bit) Check for an ART.FT file in the mcamx6\CHooks folder and if found change the file's extension to something other than .FT (I doubt that this is the cause, as I would expect to see a different error message if this was the issue.) If you start Mastercam in Debug, but then just try to create some geometry instead of running your CHook, does that work OK? This is a strange error to see in the situation where it runs in Release, but not in Debug. -> "The Microsoft Visual Studio C Runtime Library has detected a fatal error in Mastercam.exe" What is the extract version of X6 your are running? What is the extract version of the Chook SDK?
  8. What version of Mastercam? I just tried setting all of the "system" views using X7-MU2 (NETHook v3) and this worked -> MCView myView = CreateView(); // Create a new "custom" view. Mastercam.IO.ViewManager.CPlane = myView; Mastercam.IO.ViewManager.TPlane = myView; Mastercam.IO.ViewManager.WorkCoordinateSystem = myView; BTW, The .Commit() commands are not needed in this situation. You're setting a View to another View. The .Commit() is only needed when you're creating a new View (plane).
  9. Please email me. Include your company info and the version of Mastercam. SDK (at) mastercam (dot) com
  10. 1> You want to change the Machine (Definition) being used in the Machine Group(s) of a file. and 2> Reset the "Tool Directory" (on the Files page) of these Machine Groups. Correct?
  11. Very few people ever "directly" create Machine Groups. So... What you you going to do with the Machine Group you've created?
  12. Did you figure out the issue with your icons? Starting in X8, the toolbar icon requirements will change: The images must by PNG type. The small icon size is still 16x16 pixels. The large icon size is now 32x32 pixels.
  13. I assume 'Tool Manager' is referring to the new (stand-alone) Tool Manager app. How are you starting Tool Manager? Please send me your NETHook project and the exact steps you do to get the to happen and I can investigate. SDK <at> mastercam <dot> com
  14. I was not able to reproduced this. I ran this the in this environment -> MasterCam X7-MU2 (64 bit), Windows 7 64bit, Visual Studio 2010, .Net FrameWork v4, NetHook3_0 Start Mastercam Launch a NETHook that contains a modeless dialog and displays that dialog when it's Run. Load a (mill) part file containing toolpaths. Start Tool Manager. Select a Tool Database. Create a new (default) EndMill tool. Mastercam still running OK. And to test another possible execution path... I then completely close the ToolManager app, and Mastercam is still fine. I can create geometry and I can also interact with the NETHook's modeless dialog. While possible, I would doubt that using VS-2012 or 2013 would make any difference. If I could reproduce this using 2010, I could try 2012 and 2013 as I have them all. That's one reason why I 'm running out of disk space ;(
  15. "Macro" ==> C-Hook , NET-Hook, VBScript (using ScriptLinker) ? What version of Mastercam? For all versions of Mastercam prior to X8 The small icon must be a 16x16 pixel BMP The large icon must be a 24x24 pixel BMP
  16. I was thinking he wanted to hide his Form while the user was making the geometry selection. That's why I was asking Peter for details - Is this... what you wanted your NETHook to do? A modeless dialog will disappear "behind" Mastercam when you click on Mastercam, which makes Mastercam the active window, so it comes up front. This is because your modeless Form does not really have a "parent" window Mastercam is not the parent window to your Form! To prevent that from happening you set the TopMost property on your Form = true. Now you can control when your Form gets hidden and shown. When I did this -> Hide Form / AskForGeometry / Show Form. I did not need an "extra" click in the Mastercam graphics area before I could select the geometry. But... If you leave the your Form on-screen, you don't do -> Me.Hide()) Then you will need that extra click to make Mastercam the "active" window. Isn't Windows just great!!! You will find more gotchas the more you use modeless dialog! As for the notes in my previous post, some clarification... The "Geometry" variable being set in my sample code snippet is a property I defined in my Form's class, So you would need to define it your Form's class. Public Property Geometry() As Geometry Get Return m_Geometry End Get Private Set m_Geometry = Value End Set End Property Private m_Geometry As Geometry This is a method I defined in my Form's class. I used it to display the data about this line on-screen, so that I would know exactly which mouse click did the geometry selection. I was trying to find if this "extra" mouse click was really needed. So this would pop the instant the AskForGeometry call "did the pick" telling me if it was the 1st or 2nd click on a line in the graphics screen was "doing the pick" of the line. Private Function FormatDecimal(value As Double) As String Return String.Format(value.ToString("F4")) End Function Private Function FormatPoint(pt As Mastercam.Math.Point3D) As String Return String.Format("X {0}, Y {1}, Z {2}", Me.FormatDecimal(pt.x), Me.FormatDecimal(pt.y), Me.FormatDecimal(pt.z)) End Function Private Sub ShowData() If Me.Geometry IsNot Nothing Then Dim line As Mastercam.Curves.LineGeometry = TryCast(Me.Geometry, Mastercam.Curves.LineGeometry) If line IsNot Nothing Then MessageBox.Show(String.Format(vbLf & "PT#1:{0}" & vbLf & "PT#2:{1}", Me.FormatPoint(line.Data.Point1), Me.FormatPoint(line.Data.Point2)), "Line selected:", MessageBoxButtons.OK, MessageBoxIcon.Information) End If End If End Sub *I assume the above code snippets are "good" VB, I converted them from my C# code.
  17. Peter, Is this what you are wanting to do? Your NETHook will display a modeless Form. User clicks a “select” button on your Form. You now want your dialog to hide itself and now all the user sees is Mastercam asking them to “Select one line”. Once the user has made the pick, your dialog reappears. Correct? Unless I do not understand correctly, this appears to be do-able without needing to Enumerate Windows. I created a simple tester NETHook (X7 using NETHook2) and I don’t see this (TopMost is enabled on my Form) -> This worked for me -> *My NETHook was done in C#, but that shouldn't make a difference. Private Sub SelectGeometryButtonclick(sender As Object, e As EventArgs) Me.Hide() Dim GeoMask As GeometryMask = New GeometryMask(False) GeoMask.Lines = True Me.Geometry = SelectionManager.AskForGeometry("Select one line", geoMask) Me.Show() Me.ShowData() End Sub Notes: "Geometry" being set by the AskForGeometry call is a data property of the Form class. "ShowData" is just a method that displays a message box showing the line's coordinate data This pops up as soon as I select a line on the Graphics screen, no "extra" mouse click in the Grpahic screen before being able to select a line was required.
  18. Ah.... Warner Swazey lathes, that brings back memories. One lesson learned was not to create programs at midnight and when in a hurry. A minor programming over sight and that 75+ pound slug pulled right out of the chuck, and yanked the cover/door* right off the machine, sending it skyward. Let’s just say the operator wasn't real happy when it landed on him. Luckily he wasn't hurt, but certainly more than a little bit p!ssed off! *On these 70’s vintage ‘SC’ type lathes, there wasn't a separate door. The “door” consisted of a single large “L” shaped piece that was the door & top cover that rolled to the right to access the inside of the machine. Not the actual machine, but like this ->
  19. Yes, they are edit-able with a standard text editor, but manually adding aluminum and copper would be a task. Exactly which Mits EDM do you have? <= useful information Do you have the Mits supplied PDF of the Machining Condition Data for your machine? <= critical information If you could send me that PDF and your customer information... I could take a look at it and see how we could proceed in getting you a "good" .TECH library. mail to: wire [at] mastercam [dot] com
  20. Something like this? It will keep prompting the user to "Select circle center point..." And for each point they pick it will create a circle there. If they press the ESC key, the "create circle" loop will exit public override MCamReturn Run(int param) { string levelName = "072 - BEARING 3.18 HOLE"; PointMask pointMask = PointMask.EndPoint; // or PointMask.Sketch, etc. int circleCount = CreateCircles(levelName, pointMask); MessageBox.Show( string.Format("Created [{0}] circles.", circleCount.ToString(CultureInfo.InvariantCulture)), "Create Circles", MessageBoxButtons.OK, MessageBoxIcon.Information); return MCamReturn.NoErrors; } /// <summary> Creates circles at the user selected point positions. </summary> /// /// <param name="levelName"> The name of the level to place the circle on. </param> /// <param name="pointMask"> The point mask type to be used. </param> /// /// <returns> The number of circles that were created. </returns> public int CreateCircles(string levelName, PointMask pointMask) { int circleCount = 0; int levelNumber = LevelsManager.GetLevelNumber(levelName); if (levelNumber < 0) { bool rest = LevelsManager.SetLevelName(125, levelName); } Point3D pt = new Point3D(0, 0, 0); // Loop until the user aborts... bool result; do { result = SelectionManager.AskForPoint("Select circle center point...", pointMask, ref pt); if (result) { ArcGeometry cir = new ArcGeometry(1, pt, 10, 360, 0); cir.Level = levelNumber; cir.Color = 75; cir.Commit(); circleCount ++; } } while (result); return circleCount; }
  21. bool res=SelectionManager.AskForPoint("test",PointMask.EndPoint,ref pt); Wouldn't you just check the result "res" from the call to AskForPoint and if it is false exit out of your method?
  22. From this error it appears that your NET-Hook is done in Visual Basic. And I would assume it's attempting to reference the VisualBasic.PowerPacks assembly. So this is telling us that assembly could not be located on that system. If the above is true, this may be a good place to start your research on how to address this issue. Deploying Applications That Reference Power Packs Controls
  23. Not be beat up on Tim... Manually picking thru the Registry in an attempt to clean up a failed uninstall (OK, a delete ) of a large Product (such as Mastercam) is like throwing pebbles into the ocean. You could try using the free MyUnInstaller from NirSoft (good stuff!) It may not be able to help, since most of the Install data must be present and proper in the Registry for an uninstall to run. But it’s free and would be quick and easy to try and certainly safer that digging thru the Registry! An installed Product as a product specific GUID that is used in the Registry for ID purposes. For fun I exported just the HKEY_LOCAL_MACHINE hive of the Registry so that I could manipulate it in an editor. The product specific key for Mastercam X7 (64-bit) was found 2954 times. And this does not mean that I found all occurrence of the X7 install data within the Registry. Doing a search for mcamx7 found 3840 occurrences. Some of these occurrences are "duplicates", as both searched items will sometimes show up together within the same key. You may not find this many occurrences on your system as X7 has been installed/uninstalled dozens (hundreds?) of times on this system*, and I've test installed/uninstalled dozens of Mastercam X7 add-ons that would cause mcamx7 to appear in the Registry. *This is a development system, so Mastercam gets uninstalled/re-installed on average 3-4 times a week. Some additional reading material on the "self repair" or "self healing" Application Resiliency functionality of Windows Installer. Also… If you look at the end of this posting, you’ll see where I mention the related Darwin Descriptor What to take away from this story? Never delete Windows programs, uninstall them “properly”. The Self-Healing/Self-Repair of Windows Installer is cool when it works, but when you confuse it (See #1 above), that’s a whole different story.
  24. You are changing the ViewNumber, but you're not doing a Commit() to update that change in the database. Try this... geo.ViewNumber = 1; geo.Commit();
  25. >>for Contour3d, if fails with entity is not flat error ChainManager.GetGeometryInChain is giving you this "entity not flat" warning? If you could please give me a sample file with that toolpath, I can investigate. >>for Surface toolpaths, I dont know which function to call. For toolpath operations that reference surfaces/solids - this is not possible with a Net-Hook . >>for Drilling, I dont know which function to call to check if the point is an entity in the db . The point(s) are certainly in the database. This I would need to investigate on identifying which points in the database belong to that operation. >>for Lathe Toolpaths, GetOperations() does not return any selected operations. For Lathe toolpaths - this is not possible with a Net-Hook .

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