Message 1 of 16
Not applicable
07-02-2013
05:45 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Tony,
Have fun (these code copies hinges from robot kernel to Robot but it will give you idea how to access data):
Public Sub NonLinFunctionsHandle(ByVal r As RobotOM.RobotApplication, ByVal k As KernelOM.RobotKernel)
FormMain.ProgressBarInit(1, "nonlinear functions")
FormMain.log.AddComment("definition of nonlinear functions")
Dim KnlL As KernelOM.RobotNonlinearLink
Dim nlLP As RobotOM.IRobotNonlinearLinkParams
Dim nlL As RobotOM.RobotNonlinearLink
Dim i As Integer
Dim j As Integer
Dim q As Integer
Dim f_ As Integer
Dim t_ As Integer
For i = 1 To r.Project.Structure.Nodes.NonlinearLinks.Count
nlL = r.Project.Structure.Nodes.NonlinearLinks.Get(i)
KnlL = k.Structure.Nodes.NonlinearLinks.Create(nlL.Name)
KnlL.ModelType = nlL.ModelType
If nlL.Symetry Then
f_ = RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_ANY
t_ = RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_ANY
Else
f_ = RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_POSITIVE
t_ = RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_NEGATIVE
End If
For j = f_ To t_
nlLP = nlL.GetParams(j)
KnlL.SetCurveType(nlLP.CurveType, j)
If nlLP.CurveType = RobotOM.IRobotNonlinearLinkCurveType.I_NLCT_B_LINEAR Then
Dim KnnLP As KernelOM.RobotNonlinearLinkParamsBLinear
Dim nllP_ As RobotOM.RobotNonlinearLinkParamsBLinear
KnnLP = KnlL.GetParams(j)
nllP_ = nlL.GetParams(j)
KnnLP.K1 = nllP_.K1
KnnLP.K2 = nllP_.K2
KnnLP.d1 = nllP_.d1
KnlL.SetParams(KnnLP)
ElseIf nlLP.CurveType = RobotOM.IRobotNonlinearLinkCurveType.I_NLCT_CUSTOM Then
Dim KnnLP As KernelOM.RobotNonlinearLinkParamsCustom
Dim nllP_ As RobotOM.RobotNonlinearLinkParamsCustom
KnnLP = KnlL.GetParams(j)
nllP_ = nlL.GetParams(j)
For q = 1 To nllP_.Count
Dim seg As RobotOM.RobotNonlinearLinkParamsCustomSegment
Dim Kseg As KernelOM.RobotNonlinearLinkParamsCustomSegment
seg = nllP_.Get(q)
Kseg = KnnLP.[New]()
Kseg.Constant = seg.Constant
Kseg.Expression = seg.Expression
Kseg.OriginPoint = seg.OriginPoint
KnnLP.Set(q, Kseg)
Next
KnlL.SetParams(KnnLP)
ElseIf nlLP.CurveType = RobotOM.IRobotNonlinearLinkCurveType.I_NLCT_GAP_HOOK Then
Dim KnnLP As KernelOM.RobotNonlinearLinkParamsGapHook
Dim nllP_ As RobotOM.RobotNonlinearLinkParamsGapHook
KnnLP = KnlL.GetParams(j)
nllP_ = nlL.GetParams(j)
KnnLP.K = nllP_.K
KnnLP.D = nllP_.D
KnlL.SetParams(KnnLP)
ElseIf nlLP.CurveType = RobotOM.IRobotNonlinearLinkCurveType.I_NLCT_LINEAR Then
Dim KnnLP As KernelOM.RobotNonlinearLinkParamsLinear
Dim nllP_ As RobotOM.RobotNonlinearLinkParamsLinear
KnnLP = KnlL.GetParams(j)
nllP_ = nlL.GetParams(j)
KnnLP.K = nllP_.K
KnlL.SetParams(KnnLP)
ElseIf nlLP.CurveType = RobotOM.IRobotNonlinearLinkCurveType.I_NLCT_PARABOLIC Then
Dim KnnLP As KernelOM.RobotNonlinearLinkParamsParabolic
Dim nllP_ As RobotOM.RobotNonlinearLinkParamsParabolic
KnnLP = KnlL.GetParams(j)
nllP_ = nlL.GetParams(j)
KnnLP.Dlim = nllP_.Dlim
KnnLP.Dmax = nllP_.Dmax
KnnLP.Flim = nllP_.Flim
KnnLP.K = nllP_.K
KnlL.SetParams(KnnLP)
ElseIf nlLP.CurveType = RobotOM.IRobotNonlinearLinkCurveType.I_NLCT_PARABOLIC_EC2 Then '?
Dim KnnLP As KernelOM.RobotNonlinearLinkParamsParabolic
Dim nllP_ As RobotOM.RobotNonlinearLinkParamsParabolic
KnnLP = KnlL.GetParams(j)
nllP_ = nlL.GetParams(j)
KnnLP.Dlim = nllP_.Dlim
KnnLP.Dmax = nllP_.Dmax
KnnLP.Flim = nllP_.Flim
KnnLP.K = nllP_.K
KnlL.SetParams(KnnLP)
ElseIf nlLP.CurveType = RobotOM.IRobotNonlinearLinkCurveType.I_NLCT_PERFECTLY_PLASTIC Then
Dim KnnLP As KernelOM.RobotNonlinearLinkParamsPlastic
Dim nllP_ As RobotOM.RobotNonlinearLinkParamsPlastic
KnnLP = KnlL.GetParams(j)
nllP_ = nlL.GetParams(j)
KnnLP.Dlim = nllP_.Dlim
KnnLP.Flim = nllP_.Flim
KnnLP.W = nllP_.W
KnnLP.K = nllP_.K
KnlL.SetParams(KnnLP)
ElseIf nlLP.CurveType = RobotOM.IRobotNonlinearLinkCurveType.I_NLCT_PLASTIC_WITH_HARDENING Then
Dim KnnLP As KernelOM.RobotNonlinearLinkParamsPlasticHardening
Dim nllP_ As RobotOM.RobotNonlinearLinkParamsPlasticHardening
KnnLP = KnlL.GetParams(j)
nllP_ = nlL.GetParams(j)
KnnLP.Dlim = nllP_.Dlim
KnnLP.Flim = nllP_.Flim
KnnLP.W = nllP_.W
KnnLP.K0 = nllP_.K0
KnnLP.K1 = nllP_.K1
KnlL.SetParams(KnnLP)
Else
'not handled
End If
Next
Next
'non-linear hinge functions
Dim nlHP As RobotOM.RobotNonlinearHingeModelAxisParams
Dim KnlHP As KernelOM.RobotNonlinearHingeModelAxisParams
Dim KnlHM As KernelOM.RobotNonlinearHingeModelPoints
Dim nlHM As RobotOM.RobotNonlinearHingeModelPoints
Dim nlH As RobotOM.RobotNonlinearHingeModel
Dim KnlH As KernelOM.RobotNonlinearHingeModel
For i = 1 To r.Project.Structure.Bars.NonlinearHingeModels.Count
nlH = r.Project.Structure.Bars.NonlinearHingeModels.Get(i)
KnlH = k.Structure.Bars.NonlinearHingeModels.Create(nlH.Name)
If nlH.Symetry Then
f_ = RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_ANY
t_ = RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_ANY
Else
f_ = RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_POSITIVE
t_ = RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_NEGATIVE
End If
KnlH.ModelType = nlH.ModelType
KnlH.UnloadingMethod = nlH.UnloadingMethod
If KnlH.UnloadingMethod = KernelOM.IRobotNonlinearHingeModelUnloadingType.I_NHMUT_MIXED Then
KnlH.MixedUnloadingValue = nlH.MixedUnloadingValue
End If
KnlH.LimitCoordX = nlH.LimitCoordX
If KnlH.LimitCoordX Then
KnlH.LimitCoordXValue = nlH.LimitCoordXValue
End If
KnlH.LimitCoordY = nlH.LimitCoordY
If KnlH.LimitCoordY Then
KnlH.LimitCoordYValue = nlH.LimitCoordYValue
End If
For j = f_ To t_
nlHP = nlH.GetAxisParams(j)
KnlHP = KnlH.GetAxisParams(j)
KnlHP.ImmediateOccupancy = nlHP.ImmediateOccupancy
KnlHP.LifeSafety = nlHP.LifeSafety
KnlHP.StructuralStability = nlHP.StructuralStability
KnlH.SetAxisParams(j, KnlHP)
KnlHM = KnlH.GetPoints(j)
nlHM = nlH.GetPoints(j)
For q = 1 To KnlHM.Count
Dim Kgp2d As KernelOM.RobotGeoPoint2D
Kgp2d = k.CmpntFactory.Create(KernelOM.IRobotComponentType.I_CT_GEO_POINT_2D)
Kgp2d.Set(nlHM.Get(j).X, nlHM.Get(j).Y)
KnlHM.Set(q, Kgp2d)
Next
Next
Next
FormMain.ProgressBarNextStep()
End Sub
'non-linear hinge functions
Dim nlHP As RobotOM.RobotNonlinearHingeModelAxisParams
Dim KnlHP As KernelOM.RobotNonlinearHingeModelAxisParams
Dim KnlHM As KernelOM.RobotNonlinearHingeModelPoints
Dim nlHM As RobotOM.RobotNonlinearHingeModelPoints
Dim nlH As RobotOM.RobotNonlinearHingeModel
Dim KnlH As KernelOM.RobotNonlinearHingeModel
For i = 1 To r.Project.Structure.Bars.NonlinearHingeModels.Count
nlH = r.Project.Structure.Bars.NonlinearHingeModels.Get(i)
KnlH = k.Structure.Bars.NonlinearHingeModels.Create(nlH.Name)
If nlH.Symetry Then
f_ = RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_ANY
t_ = RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_ANY
Else
f_ = RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_POSITIVE
t_ = RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_NEGATIVE
End If
KnlH.ModelType = nlH.ModelType
KnlH.UnloadingMethod = nlH.UnloadingMethod
If KnlH.UnloadingMethod = KernelOM.IRobotNonlinearHingeModelUnloadingType.I_NHMUT_MIXED Then
KnlH.MixedUnloadingValue = nlH.MixedUnloadingValue
End If
KnlH.LimitCoordX = nlH.LimitCoordX
If KnlH.LimitCoordX Then
KnlH.LimitCoordXValue = nlH.LimitCoordXValue
End If
KnlH.LimitCoordY = nlH.LimitCoordY
If KnlH.LimitCoordY Then
KnlH.LimitCoordYValue = nlH.LimitCoordYValue
End If
For j = f_ To t_
nlHP = nlH.GetAxisParams(j)
KnlHP = KnlH.GetAxisParams(j)
KnlHP.ImmediateOccupancy = nlHP.ImmediateOccupancy
KnlHP.LifeSafety = nlHP.LifeSafety
KnlHP.StructuralStability = nlHP.StructuralStability
KnlH.SetAxisParams(j, KnlHP)
KnlHM = KnlH.GetPoints(j)
nlHM = nlH.GetPoints(j)
For q = 1 To KnlHM.Count
Dim Kgp2d As KernelOM.RobotGeoPoint2D
Kgp2d = k.CmpntFactory.Create(KernelOM.IRobotComponentType.I_CT_GEO_POINT_2D)
Kgp2d.Set(nlHM.Get(j).X, nlHM.Get(j).Y)
KnlHM.Set(q, Kgp2d)
Next
Next
Next
Private Function NLHinge(ByRef Klab As KernelOM.RobotLabel, ByVal lab As RobotOM.RobotLabel) As KernelOM.RobotLabel
'todo - nl function def
Dim KnlhData As KernelOM.RobotNonlinearHingeData
Dim nlhData As RobotOM.RobotNonlinearHingeData
KnlhData = Klab.Data
nlhData = lab.Data
KnlhData.NormalStress = nlhData.NormalStress
If nlhData.IsActive(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_FX) Then
KnlhData.SetModel(KernelOM.IRobotNonlinearHingeComponentType.I_NHCT_FX, nlhData.GetModel(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_FX))
End If
If nlhData.IsActive(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_FY) Then
KnlhData.SetModel(KernelOM.IRobotNonlinearHingeComponentType.I_NHCT_FY, nlhData.GetModel(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_FY))
End If
If nlhData.IsActive(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_FZ) Then
KnlhData.SetModel(KernelOM.IRobotNonlinearHingeComponentType.I_NHCT_FZ, nlhData.GetModel(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_FZ))
End If
If nlhData.IsActive(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_MX) Then
KnlhData.SetModel(KernelOM.IRobotNonlinearHingeComponentType.I_NHCT_MX, nlhData.GetModel(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_MX))
End If
If nlhData.IsActive(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_MY) Then
KnlhData.SetModel(KernelOM.IRobotNonlinearHingeComponentType.I_NHCT_MY, nlhData.GetModel(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_MY))
End If
If nlhData.IsActive(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_MZ) Then
KnlhData.SetModel(KernelOM.IRobotNonlinearHingeComponentType.I_NHCT_MZ, nlhData.GetModel(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_MZ))
End If
If nlhData.IsActive(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_SX) Then
KnlhData.SetModel(KernelOM.IRobotNonlinearHingeComponentType.I_NHCT_SX, nlhData.GetModel(RobotOM.IRobotNonlinearHingeComponentType.I_NHCT_SX))
End If
NLHinge = Klab
End Function

Nonlinear Support example
Private Function Support(ByRef Klab As KernelOM.RobotLabel, ByVal lab As RobotOM.RobotLabel) As KernelOM.RobotLabel
Dim supData As RobotOM.RobotNodeSupportData
Dim KsupData As KernelOM.RobotNodeSupportData
KsupData = Klab.Data
supData = lab.Data
KsupData.UX = supData.UX
KsupData.UY = supData.UY
KsupData.UZ = supData.UZ
KsupData.RX = supData.RX
KsupData.RY = supData.RY
KsupData.RZ = supData.RZ
KsupData.HX = supData.HX
KsupData.HY = supData.HY
KsupData.HZ = supData.HZ
KsupData.KX = supData.KX
KsupData.KY = supData.KY
KsupData.KZ = supData.KZ
KsupData.AX = supData.AX
KsupData.AY = supData.AY
KsupData.AZ = supData.AZ
KsupData.BX = supData.BX
KsupData.BY = supData.BY
KsupData.BZ = supData.BZ
KsupData.GlobalCoordSystem = supData.GlobalCoordSystem
KsupData.Alpha = supData.Alpha
KsupData.Beta = supData.Beta
KsupData.Gamma = supData.Gamma
KsupData.Advanced.B = supData.Advanced.B
KsupData.Advanced.D = supData.Advanced.D
KsupData.Advanced.H = supData.Advanced.H
KsupData.Advanced.Type = supData.Advanced.Type
If supData.Advanced.IsEquivalentElasticity Then
KsupData.Advanced.EquivalentElasticity.E = supData.Advanced.EquivalentElasticity.E
KsupData.Advanced.EquivalentElasticity.E = supData.Advanced.EquivalentElasticity.PoissonRatio
End If
KsupData.ElasticLinear = supData.ElasticLinear
KsupData.ElasticSurface = supData.ElasticSurface
KsupData.SetOneDir(KernelOM.IRobotNodeSupportFixingDirection.I_NSFD_UX, supData.GetOneDir(RobotOM.IRobotNodeSupportFixingDirection.I_NSFD_UX))
KsupData.SetOneDir(KernelOM.IRobotNodeSupportFixingDirection.I_NSFD_UY, supData.GetOneDir(RobotOM.IRobotNodeSupportFixingDirection.I_NSFD_UY))
KsupData.SetOneDir(KernelOM.IRobotNodeSupportFixingDirection.I_NSFD_UZ, supData.GetOneDir(RobotOM.IRobotNodeSupportFixingDirection.I_NSFD_UZ))
KsupData.SetOneDir(KernelOM.IRobotNodeSupportFixingDirection.I_NSFD_RX, supData.GetOneDir(RobotOM.IRobotNodeSupportFixingDirection.I_NSFD_RX))
KsupData.SetOneDir(KernelOM.IRobotNodeSupportFixingDirection.I_NSFD_RY, supData.GetOneDir(RobotOM.IRobotNodeSupportFixingDirection.I_NSFD_RY))
KsupData.SetOneDir(KernelOM.IRobotNodeSupportFixingDirection.I_NSFD_RZ, supData.GetOneDir(RobotOM.IRobotNodeSupportFixingDirection.I_NSFD_RZ))
If supData.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_UX) Then
KsupData.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_UX, supData.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_UX))
End If
If supData.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_UY) Then
KsupData.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_UY, supData.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_UY))
End If
If supData.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_UZ) Then
KsupData.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_UZ, supData.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_UZ))
End If
If supData.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_RX) Then
KsupData.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_RX, supData.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_RX))
End If
If supData.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_RY) Then
KsupData.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_RY, supData.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_RY))
End If
If supData.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_RZ) Then
KsupData.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_RZ, supData.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_RZ))
End If
Support = Klab
End Function

Nonlinear Release example
Private Function Release(ByRef Klab As KernelOM.RobotLabel, ByVal lab As RobotOM.RobotLabel) As KernelOM.RobotLabel
Dim KrelData As KernelOM.RobotBarReleaseData
Dim relData As RobotOM.RobotBarReleaseData
KrelData = Klab.Data
relData = lab.Data
KrelData.StartNode.AX = relData.StartNode.AX
KrelData.StartNode.AY = relData.StartNode.AY
KrelData.StartNode.AZ = relData.StartNode.AZ
KrelData.StartNode.BX = relData.StartNode.BX
KrelData.StartNode.BY = relData.StartNode.BY
KrelData.StartNode.BZ = relData.StartNode.BZ
KrelData.StartNode.HX = relData.StartNode.HX
KrelData.StartNode.HY = relData.StartNode.HY
KrelData.StartNode.HZ = relData.StartNode.HZ
KrelData.StartNode.KX = relData.StartNode.KX
KrelData.StartNode.KY = relData.StartNode.KY
KrelData.StartNode.KZ = relData.StartNode.KZ
KrelData.StartNode.RX = relData.StartNode.RX
KrelData.StartNode.RY = relData.StartNode.RY
KrelData.StartNode.RZ = relData.StartNode.RZ
KrelData.StartNode.UX = relData.StartNode.UX
KrelData.StartNode.UY = relData.StartNode.UY
KrelData.StartNode.UZ = relData.StartNode.UZ
KrelData.EndNode.AX = relData.EndNode.AX
KrelData.EndNode.AY = relData.EndNode.AY
KrelData.EndNode.AZ = relData.EndNode.AZ
KrelData.EndNode.BX = relData.EndNode.BX
KrelData.EndNode.BY = relData.EndNode.BY
KrelData.EndNode.BZ = relData.EndNode.BZ
KrelData.EndNode.HX = relData.EndNode.HX
KrelData.EndNode.HY = relData.EndNode.HY
KrelData.EndNode.HZ = relData.EndNode.HZ
KrelData.EndNode.KX = relData.EndNode.KX
KrelData.EndNode.KY = relData.EndNode.KY
KrelData.EndNode.KZ = relData.EndNode.KZ
KrelData.EndNode.RX = relData.EndNode.RX
KrelData.EndNode.RY = relData.EndNode.RY
KrelData.EndNode.RZ = relData.EndNode.RZ
KrelData.EndNode.UX = relData.EndNode.UX
KrelData.EndNode.UY = relData.EndNode.UY
KrelData.EndNode.UZ = relData.EndNode.UZ
If relData.StartNode.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_RX) Then
KrelData.StartNode.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_RX, relData.StartNode.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_RX))
End If
If relData.StartNode.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_RY) Then
KrelData.StartNode.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_RY, relData.StartNode.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_RY))
End If
If relData.StartNode.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_RZ) Then
KrelData.StartNode.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_RZ, relData.StartNode.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_RZ))
End If
If relData.StartNode.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_UX) Then
KrelData.StartNode.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_UX, relData.StartNode.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_UX))
End If
If relData.StartNode.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_UY) Then
KrelData.StartNode.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_UY, relData.StartNode.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_UY))
End If
If relData.StartNode.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_UZ) Then
KrelData.StartNode.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_UZ, relData.StartNode.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_UZ))
End If
If relData.EndNode.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_RX) Then
KrelData.EndNode.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_RX, relData.EndNode.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_RX))
End If
If relData.EndNode.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_RY) Then
KrelData.EndNode.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_RY, relData.EndNode.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_RY))
End If
If relData.EndNode.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_RZ) Then
KrelData.EndNode.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_RZ, relData.EndNode.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_RZ))
End If
If relData.EndNode.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_UX) Then
KrelData.EndNode.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_UX, relData.EndNode.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_UX))
End If
If relData.EndNode.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_UY) Then
KrelData.EndNode.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_UY, relData.EndNode.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_UY))
End If
If relData.EndNode.NonlinearModel.IsDefined(RobotOM.IRobotDegreeOfFreedom.I_DOF_UZ) Then
KrelData.EndNode.NonlinearModel.Set(KernelOM.IRobotDegreeOfFreedom.I_DOF_UZ, relData.EndNode.NonlinearModel.Get(RobotOM.IRobotDegreeOfFreedom.I_DOF_UZ))
End If
Release = Klab
End Function

I saw your code and at last made a function that enters the release functions into robot.
But they get jerky and Robot doesen´t calculate correctly. Tryed iterating more values but still wrong values at calculate.
Any ideas on what I am missing?
Dim segments As Integer
Dim segment(15, 2) As Double
Dim i As Integer
Dim n As Integer
Dim vinkel(15) As Double
Dim värdet(15) As Double
Dim KnlL As RobotOM.RobotNonlinearLink
Dim KnnLP As RobotOM.RobotNonlinearLinkParamsCustom
Dim Kseg As RobotOM.RobotNonlinearLinkParamsCustomSegment
Const I_NLCT_CUSTOM = 8
robapp.Project.Structure.Nodes.NonlinearLinks.Remove(robapp.Project.Structure.Nodes.NonlinearLinks.Find("AHMyD"))
KnlL = robapp.Project.Structure.Nodes.NonlinearLinks.Create("AHMyD")
KnlL.SetCurveType(I_NLCT_CUSTOM, RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_ANY)
KnlL.ModelType = RobotOM.IRobotNonlinearLinkModelType.I_NLMT_MOMENT_ROTATION
KnnLP = KnlL.GetParams(RobotOM.IRobotNonlinearLinkSemiAxisType.I_NLSAT_ANY)
n = 0
segments = 5
värdet(1) = 0
vinkel(1) = 0.0257
värdet(2) = 0.375
vinkel(2) = 0.0463
värdet(3) = 0.465
vinkel(3) = 0.0515
värdet(4) = 0.555
vinkel(4) = 0.0582
värdet(5) = 0.629
vinkel(5) = 0.0654
For i = 1 To segments - 1
For j = 1 To 1
Kseg = KnnLP.[New]()
Kseg.Expression = Str$((värdet(i) + (värdet(i + 1) - värdet(i)) / 10 * j) * 1000)
Kseg.OriginPoint = (vinkel(i) + (vinkel(i + 1) - vinkel(i)) / 10 * j)
n = n + 1
KnnLP.Set(n, Kseg)
KnlL.SetParams(KnnLP, IRobotNonlinearLinkSemiAxisType.I_NLSAT_ANY)
Next
Next
KnlL = Nothing
KnnLP = Nothing
Kseg = Nothing
And this is what i get 😞

I am expecting a curve that robot uses. like when i input the values manually and not from api
Kseg.Constant = False
then :

Super, many thanks!
Hi All
I need to create a nonlinear release in a excel sheet to simulate headed studs in a composite beam but I'm not succeeding in...
I am not an advance programmer, and these codes are a little bit confused for me.
I tried to copie yours codes into my excel but they didn't work. When i 'm setting the curve type the line code stays red and it shows a worning saying :"Expected :="
What i'm doing wrong?
Hi All Again,
I've been trying some codes and the best was this one:
Dim RLabel As RobotLabel
Dim relData As RobotBarReleaseData
Dim EndData As RobotBarEndReleaseData
Dim KnlL As RobotNonlinearLink
Dim KnnLP As RobotNonlinearLinkParamsBLinear
Set KnlL = str.Nodes.NonlinearLinks.Create("ConectorBiLinear")
Const I_NLCT_B_LINEAR = 2
KnlL.ModelType = IRobotNonlinearLinkModelType.I_NLMT_FORCE_DISPLACEMENT
KnlL.SetCurveType (I_NLCT_B_LINEAR)
Set KnnLP = KnlL.GetParams(I_NLSAT_POSITIVE)
KnnLP.d1 = 1
KnnLP.K1 = 54000
KnnLP.K2 = 10000
Set RLabel = str.labels.Create(I_LT_BAR_RELEASE, "CONECTOR")
Set relData = RLabel.Data
' Set EndData = relData.StartNode
' EndData.UX = I_BERV_NONLINEAR
' EndData.UX = I_BERV_STD
Set EndData = relData.EndNode
EndData.UX = I_BERV_NONLINEAR
EndData.UX = I_BERV_STD
str.labels.Store RLabel
str.Bars.SetLabel selectionBars, I_LT_BAR_RELEASE, "CONECTOR"
By the way, when i try to set the parameters d1 K1 and K2, the code doesn't assume that.
What i'm doing wrong?
1. Try set params after definition
KnlL.SetParams KnnLP
and
2. Assign nonlinear model to desired direction
EndData.NonlinearModel.Set I_DOF_UX, "ConectorBiLinear"
fuul code:
Dim robapp As RobotApplication
Set robapp = New RobotApplication
Dim RLabel As RobotLabel
Dim relData As RobotBarReleaseData
Dim EndData As RobotBarEndReleaseData
Dim KnlL As RobotNonlinearLink
Dim KnnLP As RobotNonlinearLinkParamsBLinear
Set KnlL = robapp.Project.Structure.Nodes.NonlinearLinks.Create("ConectorBiLinear")
Const I_NLCT_B_LINEAR = 2
KnlL.ModelType = IRobotNonlinearLinkModelType.I_NLMT_FORCE_DISPLACEMENT
KnlL.SetCurveType (I_NLCT_B_LINEAR)
Set KnnLP = KnlL.GetParams(I_NLSAT_POSITIVE)
KnnLP.d1 = 1
KnnLP.K1 = 54000
KnnLP.K2 = 10000
KnlL.SetParams KnnLP
Set RLabel = robapp.Project.Structure.Labels.Create(I_LT_BAR_RELEASE, "CONECTOR")
Set relData = RLabel.Data
Set EndData = relData.StartNode
EndData.UX = I_BERV_NONLINEAR
EndData.NonlinearModel.Set I_DOF_UX, "ConectorBiLinear"
EndData.UX = I_BERV_STD
Set EndData = relData.EndNode
EndData.UX = I_BERV_NONLINEAR
EndData.UX = I_BERV_STD
robapp.Project.Structure.Labels.Store RLabel
I tried to copie yours codes into my excel but they didn't work. When i 'm setting the curve type the line code stays red and it shows a worning saying :"Expected :="
What i'm doing wrong?
Try without brackets
Thank you very much!
It works fine..