ah sorry i had attached the code it must have been removed when i posted it. This is the code which creates the work point.
Friend Function AddWPsByCords(XCord As Double, YCord As Double, ZCord As Double,
Name As String, PartDef As PartComponentDefinition,
_App As Inventor.Application)
Dim WPList = PartDef.WorkPoints
Dim TGPnt = GetiPoint3D(XCord, YCord, ZCord, _App)
For Each WpCheck As WorkPoint In WPList
If WpCheck.Name = Name Then
If WpCheck.Point.X = XCord And WpCheck.Point.Y = YCord And WpCheck.Point.Z = ZCord Then
Return WpCheck
Else
WpCheck.Delete()
' WpCheck.SetByPoint(TGPnt)
End If
End If
Next
Dim Wps = PartDef.WorkPoints.AddFixed(TGPnt)
Wps.Name = Name
Return Wps
End Function
and this is the code which updates the model and places the work point
Friend Sub UpdatePreBuiltForgedBody(Geometry As InventorHeader_Geometry)
With Geometry
UpdateParameterValue("WallThickness", .WallThc, MyPartDef)
UpdateParameterValue("OuterRadius", .OutRad, MyPartDef)
UpdateParameterValue("HeaderLength", .HeaderLength, MyPartDef)
'Previusly the code to add the work point was here
UpdateParameterValue("BeltOuterRadius", .BeltOutRad, MyPartDef)
UpdateParameterValue("BeltLength", .BeltLength, MyPartDef)
UpdateParameterValue("NozzleOD", .ForgedNozzleOD, MyPartDef)
UpdateParameterValue("NozzleID", .ForgedNozzleID, MyPartDef)
UpdateParameterValue("NozzleStandout", .NozzleStandout, MyPartDef)
UpdateParameterValue("OuterFilletRadius", .OuterFilletRadius, MyPartDef)
UpdateParameterValue("InnerFilletRadius", .InnerFilletRadius, MyPartDef)
AddWPsByCords(0, .OutRad, .HeaderLength / 4, "BalloonPoint", MyPartDef, Driver._App)
''TODO:Sort out the weld points for this
CreateWeldPoints()
End With
End Sub
Ive fixed it now by moving where its called. I beleive what was happening was that becasue the parameter changes were incomplete, invalid geometry was created. then by trying to place that work point it was trying to force the model to update which caused the error
HII