- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am trying to create a non-linear spring support for my wall submerged in soil using VBA. I adopted an existing code from one of the tools we use in office. Attached below is the code.
VBA Start:
Spring1=WS.Cells(a, 1).Value
Spring2=WS.Cells(a, 2).Value
Dim NL As RobotNonlinearLink
Dim mynlm2positive As RobotNonlinearLinkParamsLinear
Dim mynlm2negative As RobotNonlinearLinkParamsLinear
Dim mynlmCS As RobotNonlinearLinkParamsCustomSegment
Set NL = robapp.Project.Structure.Nodes.NonlinearLinks.Create(Round(Spring1) & " " & Round(Spring2))
NL.SetCurveType I_NLCT_LINEAR
Set mynlm2negative = NL.GetParams(2)
Set mynlm2positive = NL.GetParams(1)
NL.SetParams mynlm2negative, 2 'in order to set symetry to false
mynlm2positive.k = Spring2 * 1000
mynlm2negative.k = Spring1 * 1000
NL.SetParams mynlm2positive, 1
NL.SetParams mynlm2negative, 2
Set rbSupport1 = robapp.Project.Structure.Labels.Create(I_LT_SUPPORT, Spring)
Set rbSupportData1 = rbSupport1.Data
Dim rbNonlinearModel As RobotNonlinearLinkMngr
Set rbNonlinearModel = rbSupportData1.NonlinearModel
rbNonlinearModel.Set I_DOF_UX, Round(Spring1) & " " & Round(Spring2)
rbSupportData1.SetFixed I_NSFD_UX, 1
rbSupportData1.SetFixed I_NSFD_UY, 1
rbSupportData1.SetFixed I_NSFD_UZ, 0
rbSupportData1.SetFixed I_NSFD_RX, 0
rbSupportData1.SetFixed I_NSFD_RY, 0
rbSupportData1.SetFixed I_NSFD_RZ, 0
robapp.Project.Structure.Labels.Store rbSupport1
VBA End here:
In the existing tool, the code creates a spring with support code 'nxffff' and the support appears like in first image below where as the code now creates a spring with support code 'nff' and appearance as second image below. Since the code is the same and the condition to execute the code is also the same, please help solve why the same code is creating different types of spring support.
Much appreciated!
Solved! Go to Solution.