cncah
-
Posts
37 -
Joined
-
Last visited
Content Type
Profiles
Forums
Downloads
Store
eMastercam Wiki
Blogs
Gallery
Events
Posts posted by cncah
-
-
Thanks for the replies. The problem is not knowing which way to round.
I appreciate the example on how to use a function Jeff.
I will do something similar with a bunch of if statements to get the output I need.
-
Is there a function to round UP a decimal to the nearest integer?
I am in need of rounding numbers like 1.415 to 2, 3.46 to 4, etc.
Any help with getting my G-Code more accurate would be greatly appreciated. Thanks.
-
Thanks Jeff! Worked like a charm!
-
How do add a quotation mark (inch mark) manually in the middle of a string?
Any help would be much appreciated.
-
That did it. Thanks!
-
I was going through the API help and was having a hard time finding the method for using Mastercam's "Merge" command. Does it exist in VB.Net?
-
Amen to that! That's the method I use. We have anywhere from 1 to 200 configurations in a single model in Solidworks and using Mastercam for Solidworks has saved me countless hours!
-
I've been looking in the API help and can't seem to find an API call for a Transform operation. Is there an interface in the NETHook API to tell if an operation is a transform op?
If so, how can I tell if it has any operations selected? Any help would be appreciated. Thanks!
-
Thanks for the reference Roger. I think that is close to what I'm looking for. I tried the RefreshOperationsManager command
after setting the RefreshEnabled property to True, but it didn't work. I will research the API info to see if I can find a method that works.
Thanks again for the help. I'll keep you posted as I'm able to find time to work on this project.
-
Nethook. Mcam 2017.
-
I'm writing a loop that deletes certain operations if they meet certain criteria and I'm wondering if there is a refresh command that I need to do after the loop is finished?
Currently after the loop is finished, the operation id numbers don't re-order themselves like they do if you delete an operation manually.
-
Thanks Mick. I had thought about that but I figured that might cause extra processing time especially if there were a lot of 3D toolpaths. Here is what I ended up with:
For i As Integer = 0 To UBound(ops) Dim op As Mastercam.Database.Operation = CType(ops(i), Mastercam.Database.Operation) If Not op Is Nothing Then If op.Type = 4 Then If op.Selected = False Then op.Selected = True op.Commit() op.Regenerate() End If Else If op.Selected = True Then op.Selected = False op.Commit() op.Regenerate() End If End If End If Next i
I tried to only call the operation's change in selection if it was needed to keep the regenerate time to a minimum.
Thanks again.
-
Hello,
I'm wondering if there is an API call that I'm missing when trying to unselect certain ops. I'm adding to a custom VB.Net Nethook.
I'm looping through the list of operations and trying to unselect certain ones with this code:
Dim ops As Array = Mastercam.Support.SearchManager.GetOperations().ToArray If ops.Length = 0 Then Exit Sub For i As Integer = 0 To UBound(ops) Dim op As Mastercam.Database.Operation = CType(ops(i), Mastercam.Database.Operation) If Not op Is Nothing Then If op.Type = 4 Then op.Selected = True Else op.Selected = False End If op.Commit() End If Next i
Problem I'm running into is if I call op.Commit() then it marks the ops I want to unselect dirty. If I leave the op.Commit() code out then the code doesn't do anything.
Am I missing something?
-
Thanks Roger! I didn't have the current NetHook API help. Thanks for the link!
-
-
Hello,
I was wondering if there is a way to get the directory for the current open file in VB.Net?
I am also trying to obtain the "Toolpath Directory" from the Group Manager. I found how
to loop through all the groups but didn't see a method for extracting the information I need.
Any help would be appreciated. Thanks
-
Ok. Thanks for the quick response Colin. I'll look into adding it to my NetHook library.
-
Hello,
I'm trying to add a switch in the header of our post that turn on Force Tool Change for every operation but am having trouble
with getting it to come out right. I found this in the header:
frcetoolch : 1 #Force toolchange at each operation? 0 = No, 1 = Yes
But I cannot find the variable: frcetoolch anywhere else in the post.
My company uses a modified version of the MP Master. Any help would be appreciated. Thanks
-
Ok, thanks Mick. I'll just have to let the guys know that they won't be able to use it on empty or unnamed levels.
-
I'm trying to create a NetHook that will renumber levels like the "Renumber Tools" does in the toolpaths manager. The programmers here want
to be able to renumber levels based on these options:
All Levels
Visible Levels
Non Visible Levels
I'm just trying to make sure the NetHook accounts for everything so I don't have to skip levels that don't have geometry or a name assigned to them.
-
Hello,
I'm starting a new NetHook and saw how to get a list of levels in a NetHook example project. But I was having trouble locating a way to get a list of all the levels even if they do not contain geometry or a name. Is there an API call for this? I've been looking through the API Reference Guide but have had trouble finding anything. Any help would be greatly appreciated. Thanks.
-
I sent the project with a test file. I appreciate the help. Thanks.
-
Thanks Mick! I was missing the "SetChainArray". Only problem I'm having is this works for when I chain
off of wire geometry that I draw myself in Mastercam or curves that I extract from the edges of the solid
model, but it doesn't work if I chain directly from the solid itself. Is there a way of checking what kind of
entity is used for the chain? Because right now it is deleting the chain if a solid edge is used.
-
I am trying to reverse the chains, and before reversing the chains, store in a variable if the operation is using
left or right cutter comp. Then after reversing the chain set the cutter comp back to what it was previously.
This is what I have so far:
Public Overrides Function Run(ByVal param As Integer) As MCamReturn 'Make sure there are operations to modify Dim ops As Array = Mastercam.Support.SearchManager.GetOperations().ToArray If ops.Length = 0 Then Debug.WriteLine("There Are No Operations To Modify") Return MCamReturn.FunctionExit End If Dim bSelect As Boolean = False 'Loop through all operations to see if there are any selected For i As Integer = 0 To UBound(ops) Dim op As Mastercam.Database.Operation = CType(ops(i), Mastercam.Database.Operation) If Not op Is Nothing Then If op.Selected = True Then bSelect = True Exit For End If End If Next i 'If there are no selected operations then let's exit If bSelect = False Then Debug.WriteLine("There Are No Selected Operations To Modify") Return MCamReturn.FunctionExit End If 'Process all selected operations Dim bSuccess As Boolean = LoopThroughSelectedOps(ops) If bSuccess = True Then MsgBox("Chains Reversed And Flipped") Else MsgBox("Error Reversing Chains") End If Return MCamReturn.NoErrors End Function
Here is the code from my module:
Public Sub ReverseChains(ByVal OpToRegen As Mastercam.Database.Operation, ByVal chains As Array) If chains.Length = 0 Then Exit Sub For i As Integer = 0 To UBound(chains) Dim chain = CType(chains(i), Mastercam.Database.Chain) If chain.Direction = Mastercam.Database.Types.ChainDirectionType.Clockwise Then chain.Direction = Mastercam.Database.Types.ChainDirectionType.CounterClockwise ElseIf chain.Direction = Mastercam.Database.Types.ChainDirectionType.CounterClockwise Then chain.Direction = Mastercam.Database.Types.ChainDirectionType.Clockwise End If OpToRegen.Commit() OpToRegen.Regenerate() Next i End Sub Public Function LoopThroughSelectedOps(ByVal OpsToProcess As Array) As Boolean Dim TheAnswer As Boolean = False If OpsToProcess.Length = 0 Then TheAnswer = False Return TheAnswer Exit Function End If For i As Integer = 0 To UBound(OpsToProcess) Dim TheOp As Mastercam.Database.Operation = CType(OpsToProcess(i), Mastercam.Database.Operation) If TheOp IsNot Nothing Then If TheOp.Selected = True Then If TheOp.Type = Mastercam.Database.Types.OperationType.Contour Then Dim ContourOp As Mastercam.Operations.ContourOperation = CType(TheOp, Mastercam.Operations.ContourOperation) ReverseChains(TheOp, ContourOp.GetChainArray) 'Dim ChainArray = ContourOp.GetChainArray End If 'End of Contour Operation type if If TheOp.Type = Mastercam.Database.Types.OperationType.Pocket Then Dim PocketOp As Mastercam.Operations.PocketOperation = CType(TheOp, Mastercam.Operations.PocketOperation) ReverseChains(TheOp, PocketOp.GetChainArray) End If 'End of Pocket Operation type if If TheOp.Type = Mastercam.Database.Types.OperationType.SlotMill Then Dim SlotMillOp As Mastercam.Operations.SlotMillOperation = CType(TheOp, Mastercam.Operations.SlotMillOperation) ReverseChains(TheOp, SlotMillOp.GetChainArray) End If 'End of SlotMill Operation type if End If 'End of TheOp being selected if End If 'End of TheOp being nothing if Next i Return TheAnswer End Function
So far I am just trying to do the reverse chain part and when I debug the current code I have
it seems to delete the chain rather than reversing it.
Stock Setup using CHOOK or NETHOOK
in Mastercam C-Hook, NET-Hook and VBScript Development
Posted
In the Nethook API there is a property under OperationsManager called "JobSetupStockSize"
The API says it returns a Point3D object. Might have a look at that.