Hi all,
I am trying to create a Non-linear Model Definition of type force-displacement as “Example_function” shows, see figure below.
The parameters of the model must be type function, see figure below.
The function needs two inputs, Origin and Expression.
We want to create the script with CPython3, but it s not working properly. The script works until setting the model type to force-displacement. But, when setting Parameters it is not defining the Type: function, The Origin, and Expression.
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
from System import Environment
user = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
clr.AddReference(user+r"\Dynamo\Dynamo Core\2.11\packages\Structural Analysis for Dynamo\bin\RSA\Interop.RobotOM.dll")
from RobotOM import *
from System import Object
#The inputs to this node will be stored as a list in the IN variables.
#Define input
nodeSupportName = IN[0]
Model_name = IN[1]
C1= IN[2]
E1 = IN[3]
OP1 = IN[4]
nodeSupportData = IN[5]
application = RobotApplicationClass()
project = application.Project
structure = project.Structure
labels = structure.Labels
lab_serv=IRobotLabel
for i in range(len(nodeSupportName)):
KNLL = structure.Nodes.NonlinearLinks.Create(Model_name[i])
KNLL.ModelType = IRobotNonlinearLinkModelType.I_NLMT_FORCE_DISPLACEMENT
KNLL.SetCurveType(IRobotNonlinearLinkCurveType.I_NLCT_CUSTOM)
#KNLL.SetAxisParams(IRobotNonlinearLinkSemiAxisType.I_NLSAT_ANY)
KnnLP = IRobotNonlinearLinkParamsCustomSegment(KNLL.SetAxisParams(IRobotNonlinearLinkSemiAxisType.I_NLSAT_ANY))
KnnLP.Constant = C1[i]
KnnLP.Expression = E1[i]
KnnLP.OriginPoint = OP1[i]
KNLL.SetParams(KnnLP)
lab_serv=IRobotLabelServer
node = IRobotLabel(labels.Create(IRobotLabelType.I_LT_NODE_SUPPORT, nodeSupportName[i]))
#node = robapp.Project.Structure.Labels.Create(IRobotLabelType.I_LT_NODE_SUPPORT, nodeSupportName[i]))
relData = IRobotNodeSupportData(node.Data)
relData.NonlinearModel.Set(IRobotDegreeOfFreedom.I_DOF_UX, KNLL.Name)
relData.NonlinearModel.Set(IRobotDegreeOfFreedom.I_DOF_UY, KNLL.Name)
relData.UZ = nodeSupportData[0]
relData.RX = nodeSupportData[1]
relData.RY = nodeSupportData[2]
relData.RZ = nodeSupportData[3]
labels.Store(node)
application.Visible = True
application.Interactive = True
application.Project.ViewMngr.Refresh()
OUT = node
The file with input values is uploaded in Autodesk forum:
https://forums.autodesk.com/t5/robot-structural-analysis-forum/non-linear-model-definition-type-function-cpython3/m-p/11436044#M93009
Could you help me to check what is wrong with the script?
@sanzoghenzo @c.poupin @Jonathan.Olesen
Thank you in advance for your help.
Best regards,
Stefany