Non-linear Spring Support (API)

Non-linear Spring Support (API)

jimmykhual
Participant Participant
404 Views
3 Replies
Message 1 of 4

Non-linear Spring Support (API)

jimmykhual
Participant
Participant

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.

jimmykhual_2-1734512516143.png                            jimmykhual_1-1734512458596.png

Much appreciated!

 

0 Likes
Accepted solutions (1)
405 Views
3 Replies
Replies (3)
Message 2 of 4

rsousa_
Advocate
Advocate
Accepted solution

Hi, 

 

What type of structure do you have in your model? (Menu Geometry--> Structure Type)

You should have a 3D model, in order to have 6 degrees of freedom on each node. If you have a 2D model, you will have 3 degrees of freedom. 

 

Difference in code supports indicate that you have a 2D structure type and your vba code is intended for 3D model.

 

Regards

Message 3 of 4

Stephane.kapetanovic
Mentor
Mentor

hi @jimmykhual 

If the code is the same and you don't get an identical result, can you send us the data? 

Best Regards

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
Message 4 of 4

jimmykhual
Participant
Participant

Hi,

Thank you for pointing this out. It works now! I just had to change my model type to 3D, it was 2D initially. 

Appreciate it!