iLogic and CAM API get operation parameter value by name rather than index?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, is there a way to get operations parameter value by using the parameter name rather than its index?
Currently pulling mainly tooling information via the following method. (obviously missing a good amount of setup but gets the idea across)
Dim toolOALength As Double
Dim toolDia As Double
Dim thisOpObject As HSMOperation
toolOALength = thisOpObject.Parameters.Item(53).Value
toolDia = thisOpObject.Parameters.Item(41).Value
this works great for most operations, though i just output a Drill operation where the index is different for the parameter named tool_overallLength. While most operations seem to have tool_overallLength as index #53; "Drill" operation uses index #54 for tool_overallLength since there is an added parameter at index #18 which offsets the parameters by one for most tooling info.
What I'm looking for is something like:
toolOALength = thisOpObject.Parameters.Name("tool_overallLength").Value
Hoping someone else has some experience with this in the iLogic cam API?
The primary function here is for iLogic to pull a tooling list and compare it to our machine's proprietary tooling library file. If the tool isn't seen in the library or set up with the proper parameters required by the machine, it then prompts the user to set up the tooling prior to posting.
PS: hoping parameters will be read/write soon??
EDIT: here's my current work-around, which I'll need to customize for each operation where indices are different offsets. you'll notice all indices in the "IF" are increased by 1 compared to those within the "ELSE"
If thisOpObject.Strategy = "drill" Then 'all operations equal to "drill", parameter index is +1 compared to most others
toolOALength = thisOpObject.Parameters.Item(54).Value
toolDia = thisOpObject.Parameters.Item(42).Value
toolName = thisOpObject.Parameters.Item(38).Value
toolClockwise = thisOpObject.Parameters.Item(90).Value 'tool_clockwise, true/false
toolFeedSpeed = thisOpObject.Parameters.Item(80).Value
If toolClockwise = True Then
toolSpindleSpeed = thisOpObject.Parameters.Item(76).Value 'positive RPM for CW rotation
Logger.Info("Tool spins clockwise; rpm is " & toolSpindleSpeed)
Else
toolSpindleSpeed = -thisOpObject.Parameters.Item(76).Value 'negative RPM for CCW rotation
Logger.Info("Tool spins counter-clockwise; rpm is " & toolSpindleSpeed)
End If
Else 'all non-drill operations
toolOALength = thisOpObject.Parameters.Item(53).Value
toolDia = thisOpObject.Parameters.Item(41).Value
toolName = thisOpObject.Parameters.Item(37).Value
toolClockwise = thisOpObject.Parameters.Item(89).Value 'tool_clockwise, true/false
Logger.Info(toolClockwise)
toolFeedSpeed = thisOpObject.Parameters.Item(79).Value
If toolClockwise = True Then
toolSpindleSpeed = thisOpObject.Parameters.Item(75).Value 'positive RPM for CW rotation
Logger.Info("Tool spins clockwise; rpm is " & toolSpindleSpeed)
Else
toolSpindleSpeed = -thisOpObject.Parameters.Item(75).Value 'negative RPM for CCW rotation
Logger.Info("Tool spins counter-clockwise; rpm is " & toolSpindleSpeed)
End If
End If