SetFeedSpeedAutoUpdate

Dana Fiorucci

SetFeedSpeedAutoUpdate

As of R29

Both

CurrentActivity.SetFeedSpeedAutoUpdate "SPINDLESPEED",True

CurrentActivity.SetFeedSpeedAutoUpdate "FEEDRATE",True

Are no longer working in script but there is no reference to these commands being depricated in the V5Automation.chm.

I'm able to do a work around for the FEEDRATE by using it's parameter 

CurrentActivity.Parameters.Item("Automatic compute from tooling Feeds and Speeds").ValuateFromString("true")

but when parsing the parameters the exact parameter string is used for the Spindle Auto.

Does anyone know what happened to SetFeedSpeedAutoUpdate method?

Thanks,

Dana

Josh Bender

RE: SetFeedSpeedAutoUpdate
(in response to Dana Fiorucci)

I'm not certain what happened to that. Possibly a problem fixed with a HF or SP? I've actually never used that function, so i can't speak to it.

 

Another way to toggle those (at least from R23 to R28) is through the commands associated with the ManufacturingActivity object. (use type Variant to get all the operations of both)

 

For Feedrate auto update:

Dim MO As Variant
Dim Att As Variant
Dim E(2) As Variant '***
Set MO = CATIA.ActiveDocument.Selection.Item2(1).Value
Set Att = MO.GetAttribute("MFG_FEEDRATE_AUTO_UPD")
If Att.Value = 1 Then
CATIA.ActiveDocument.Selection.Clear
CATIA.ActiveDocument.Selection.Add MO
CATIA.StartCommand ("Remove Tool Path")
End If
Att.Value = True
MO.GetTrajectoryEndPointCoord (E)

For Spindle:

Dim MO as ManufacturingActivity
Dim Att as variant
Set Att = MO.GetAttribute("MFG_SPINDLE_SPEED_AUTO_UPD")
Att.value = True

 

**Note: These extra fun parameters are the ones that return true as 1 instead of -1, so if statements need to be designed with that in mind. But of course you can use the true statement to set them.

 

***To note: For some reason running the feedrate change through the parameter doesn't automatically update the activity, but does note a change. It changes the parameter, but when trying to manipulate feedrates in VBA, it still registers as locked for changes and throws an error. To fix that, just remove toolpaths and then run a GetTrajectoryEndPointCoord function after changing from a true state. It does re-compute toolpaths which may not be desirable in all situations. The other option is simply to open the definition dialogue in CATIA and switch to the feed/speeds tab to have it apply the change. I've added the clause from my routines just in case.

 

Also, I have the following routines for returning all the types of parameter names of a particular operation (or tool resource).

 

Sub GetGeomAttributesNames()

Dim PD As ProcessDocument
Set PD = CATIA.ActiveDocument

Dim sel As Selection
Set sel = PD.Selection

Dim T1, T2()

Set T1 = sel.Item2(1).Value

ReDim T2(T1.NumberOfGeomAttributes - 1)

Call T1.GetListOfGeomAttributes(T2)

Dim T3() As Variant
ReDim T3(UBound(T2))
Debug.Print "--- geom attributes ---"

Dim I As Integer
On Error Resume Next
For I = 1 To UBound(T2)
Set T3(I) = T1.GetAttribute(CStr(T2(I)))
Debug.Print T2(I) & "---" & T3(I).ValueAsString
Next
On Error GoTo 0
Err.Clear

Debug.Print "--- end geom attributes ---"

End Sub


Sub GetFeedAttributes()

Dim PD As ProcessDocument
Set PD = CATIA.ActiveDocument

Dim sel As Selection
Set sel = PD.Selection

Dim T1, T2()

Set T1 = sel.Item2(1).Value

ReDim T2(T1.NumberOfFeedrateAttributes - 1)

Call T1.GetListOfFeedrateAttributes(T2)

Dim T3() As Variant
ReDim T3(UBound(T2))

Dim SName() As String
Debug.Print "--- feed attributes ---"

Dim I As Integer
On Error Resume Next
For I = 0 To UBound(T2)
Set T3(I) = T1.GetAttribute(CStr(T2(I)))
SName = Split(T3(I).Name, "")
Debug.Print T2(I) & "---" & SName(UBound(SName)) & "---" & T3(I).ValueAsString
Next
On Error GoTo 0
Err.Clear
Debug.Print "--- end feed attributes ---"

End Sub

Sub GetStratAttributes()

Dim PD As ProcessDocument
Set PD = CATIA.ActiveDocument

Dim sel As Selection
Set sel = PD.Selection

Dim T1, T2()

Set T1 = sel.Item2(1).Value

ReDim T2(T1.NumberOfStrategyAttributes - 1)

Call T1.GetListOfStrategyAttributes(T2)

Dim T3() As Variant
ReDim T3(UBound(T2))
Debug.Print "--- strat attributes ---"

Dim I As Integer
On Error Resume Next
For I = 1 To UBound(T2)
Set T3(I) = T1.GetAttribute(CStr(T2(I)))
Debug.Print T2(I) & "---" & T3(I).ValueAsString
Next
On Error GoTo 0
Err.Clear

Debug.Print "--- end strat attributes ---"

End Sub


Sub GetToolAttri()

Dim PD As ProcessDocument
Set PD = CATIA.ActiveDocument

Dim sel As Selection
Set sel = PD.Selection

'Dim T1 As ManufacturingTool, T2()
Dim T1 As ManufacturingToolAssembly, T2()
Dim DumT1 As Variant

Set T1 = sel.Item2(1).Value
Set DumT1 = T1

ReDim T2(T1.NumberOfAttributes - 1)

Call DumT1.GetListOfAttributes(T2)

Dim T3() As Variant
ReDim T3(UBound(T2))

Dim I As Integer
On Error Resume Next
For I = 1 To UBound(T2)
Set T3(I) = T1.GetAttribute(CStr(T2(I)))
Next
On Error GoTo 0
Err.Clear

On Error Resume Next
For I = 0 To UBound(T2)
Debug.Print T2(I) & "-----" & T3(I).ValueAsString
Next

End Sub

 

 

Dana Fiorucci

RE: SetFeedSpeedAutoUpdate
(in response to Josh Bender)

Hi Josh,

Thanks for the info very elegant solution and great information for the future to solve problems.

I ended up just using the parameter name and counted to the second time that it came up on the tool motion which in turn gave me the handle for the Spindle Auto checkbox.

Thanks,

Dana