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:

rocheey1

Verified Members
  • Posts

    341
  • Joined

  • Last visited

Posts posted by rocheey1

  1. Well, if your Form is shown as non-modal (not ShowDialog), you should be able to click on the entities, just tried it, and it works ......

     

    however ...

     

    you have to click on the graphics screen first to set the focus, so your first click is wasted.

     

    There is another way to set the focus to the graphics window beforehand, using Interop API calls. This type of coding is not guaranteed to work between major versions, tho. Lemme know if you are interested ...

    • Like 1
  2. The MasterCam .net API allows a program to be notified just before, and just after a save is done. I'm running my own little macro on myself, partially to keep track of what, and when, things were done. It pops up a little box letting me add a description before it saves, then logs the date/time/description of the save.

     

    You might also wish to check out these post parameters (I have never used these, myself)

     

    15087 Selected for editing, deleting and reordering (True/False)

    15095 Binary NCI of operation has been edited (True/False)

    15326 Number of times the operation has been edited

    15338 Toolpath edited (True/False)

  3. Any time I try to create a new tool in MasterCam X7, the Tool Manager just freezes. I end up having to kill Mcx thru Ctrl-Alt-Del. Im working around this by coping a random tool from a random library, then re-editing the tool to make a 'new' tool.

     

     

    I was previously running 32 bit ver of X7, 4 gigs Ram, and did not have this problem. I recently wiped my hdd clean, installed 64 bit, using 10 gigs ram, Quadro FX1800, and have installed the latest OEM network / Gfx drivers.

     

    I have disabled the antivirus, ensured no extraneous programs are running, and have no other apps installed on this box except for MsOffice.

     

    Any ideas ?

  4. FWIW, there are some example VBScript files located in your C:\Users\Public\Documents\shared mcamx8\vb folder that I wrote a few years ago that may also help, GetJobInformation.vbs and MS Excel Data.vbs for example .

     

    and those are awesome examples. I'd bet those two snippets, along with my fav, "Toolpath Door CHook.vbs", are plagiarized more than any other code except the very first "Hello World" program. (at least after I was done with them) :p If you want a little more functionality than they give, its a LOT more work, and less speedy code (CHooks excluded, natch)

     

    and as you can see from my Last Post , me and my old friend VBScript still spend some quality time :)

  5. Are there different types of "selected" states for entities?

     

    I ask because, other than using "SelectionManager.SelectAllGeometry()", which highlights the selected Geometry like manual selection, any other type of selection thru code does not highlight the entities.

     

    It seems that only the highlighted entities will get erased by hitting the "delete" key. Selecting entities thru code, and verifying that they are selected, will not be erased when hitting the 'delete' key. And it is also the same for code requiring preselected geometry.

     

    Im bringing this up because I need to preselect geometry thru code. Manually selecting beforehand, or using "SelectAllGeometry", works.

     

    Ive tried 'SelectAllGeometryOnLevel', and SearchManager.GetGeometry. Ive then run a loop to debug.writeline geometry.selected, and it comes back TRUE. I can also rerun the loop and use Geometry.selected=False, and debug,writeline tells me the geometry is not selected.

     

    Im trying to translate, and scale, a large amount of entities. The .net version is prohibitively slow, and Ive found that outputting some on-the-fly vbs works well. However, it only works on geometry that is preselected manually, or preselected using SelectAllGeometry, which highlights the geometry. The selection thru VBS "Chaining" fails the same way .... I either have to manually preselect, or use "SelectAll"

     

    Is there another way ?

  6. Well, first,, there are two ways I know of to access the tool info -

    1) from the tool library inside the MCam document, which would be all tools, regardless if they are used or not

    2) by parsing thru all the (selected) operations, and getting only the tools used, but you have to filter out the duplicates.

     

     

    Second, you didnt specify what version of MasterCam you are coding for. The code below works in MCam X6, but SHOULD work as legacy in X7. (using the supplied Nethook 2 lib)

     

    Third, if you have the choice, GO WITH X7. The nethook library has been drastically updated, and you can access all Tool Params, where in X6, it is limited.

     

     

    The first sub below will run just by calling it. It gives you all the tools in the MCam document.

     

    The second requires you to select some operations before you call it. It will give you a list of only the tools used, with duplicates filtered out. This list is not sorted (because your head may explode) but when you are ready for sorting, gimme a whistle.

     

    The MCam Excel lib is very stable; however, if you need more functionality, you'll need to roll your own, and Late Binding has proved for me to be the most stable between Office versions.

     

    Cheers.

     

    Sub GetLibraryTools()
     Dim AllTools() As Mastercam.Database.Tool = Mastercam.Support.SearchManager.GetTools()
     'GC.Collect()	 ' uncomment this line if you are getting strange crashes in X6
     Dim ToolNumber As Integer = 0
     Dim ToolDia As Double = 0.0
     Dim FluteLength As Double = 0.0
     Dim Msg As String = String.Empty
    
     For Each SingleTool As Mastercam.Database.Tool In AllTools
    	 ToolNumber = SingleTool.Number
    	 ToolDia = SingleTool.Diameter
    	 FluteLength = SingleTool.FluteLength
    	 Msg = Msg & ToolNumber.ToString & vbTab & Format(ToolDia, "0.000") & vbTab & Format(FluteLength, "0.000") & vbCrLf
     Next
     MsgBox(Msg, MsgBoxStyle.Information, "Complete Tool List")
    End Sub
    
    Sub GetOperationTools()
     ' parse down selected ops and get tools associated with those SELECTED ops
     Dim op As Mastercam.Database.Operation
     Dim OpList() As Mastercam.Database.Operation = Mastercam.Support.SearchManager.GetOperations(True)
     Dim intOuterLoop As Integer = -1, intInnerLoop As Integer = -1
     Dim ToolIsDuplicate As Boolean = False
     Dim ToolList() As Mastercam.Database.Tool = {}
     Dim ToolListCount As Long = -1
     Dim ToolNumber As Integer = 0
     Dim ToolDia As Double = 0.0
     Dim FluteLength As Double = 0.0
     Dim Msg As String = String.Empty
    
     For Each op In OpList
    	 Select Case op.Type
    		 Case 17, 4, -1 ' MANUAL, tRANSORM, OR UNKNOWN - no tool or cant extract tool
    		 Case Else
    			 Dim SingleTool As Mastercam.Database.Tool = op.OperationTool
    			 ToolNumber = SingleTool.Number
    			 ToolDia = SingleTool.Diameter
    			 FluteLength = SingleTool.FluteLength
    			 ToolIsDuplicate = False
    			 If ToolListCount = -1 Then
    				 ToolIsDuplicate = False
    			 Else ' check the list
    				 For intInnerLoop = 0 To ToolListCount
    					 If ToolNumber = ToolList(intInnerLoop).Number Then
    						 ToolIsDuplicate = True
    						 Exit For
    					 End If
    				 Next
    			 End If
    			 ' If our Tool is not flagged as a duplicate, add it to the array
    			 If ToolIsDuplicate = False Then
    				 ToolListCount = ToolListCount + 1
    				 ReDim Preserve ToolList(ToolListCount)
    				 ToolList(ToolListCount) = SingleTool
    				 Msg = Msg & ToolNumber.ToString & vbTab & Format(ToolDia, "0.000") & vbTab & Format(FluteLength, "0.000") & vbCrLf
    			 End If
    	 End Select
     Next op
    
     MsgBox(Msg, MsgBoxStyle.Information, "Operation Tool List")
    
    End Sub
    

     

    FYI: check out this link: http://www.emastercam.com/board/index.php?showtopic=65946

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