- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
[ENGLISH]
Hi,
I create a VBA macro "Test_Charge" to apply linear acceleration and angular acceleration ("Two functions") on structural element. When i run my application, Robot create the load but don't apply on the selection. In the debug, "Debug.Print rec.Objects.Count" and "Debug.Print rec.Objects.ToText" give me the right selection.
Could you help me to understand.
I attach Load table picture.
(Note : I m on Autodesk Robot 2013)
[FRENCH]
Bonjour,
J 'ai crée une macro VB "Test_charge" pour appliquer un vecteur d'accélération linéaire et / angulaire sur des parties de structure. La création fonctionne hormis pour l'affectation aux éléments. La case est vide. Quand je vérifie pendant l'execution du programme le nombre et la selection des éléments, j'ai les bonnes valeurs.
Pouvez vous m'aider ?
Ci-joint la copie d'ecran de robot 2013
Option Explicit
'***********************************
'
' Déclaration des variables
'
'***********************************
'Déclaration de l'objet Application Robot
Dim Robapp As IRobotApplication
Function Linear_acc(smpl_cas As IRobotSimpleCase, ByVal AccX As Double, ByVal AccY As Double, ByVal AccZ As Double, ByVal descriptionLR As String, ByVal SelectionObject As String)
Dim selectionB As RobotSelection
Dim rec As RobotLoadRecord
Set rec = smpl_cas.Records.Create(89) '89 = Force d'inertie
'Texte de description
rec.Description = descriptionLR
'Charge appliqué à la selection
rec.ObjectType = I_OT_BAR
rec.Objects.Clear
Set selectionB = Robapp.Project.Structure.Selections.Create(I_OT_BAR)
selectionB.FromText (SelectionObject)
rec.Objects.Add selectionB
Debug.Print rec.Objects.Count
Debug.Print rec.Objects.ToText
'paramètre de la charge d'inertie
rec.SetValue 0, AccX
rec.SetValue 1, AccY
rec.SetValue 2, AccZ
rec.SetValue 12, 0 '(Masse = 1 ou Objet = 0)
rec.SetValue 13, 0 '(Relative = 1 ou abolue = 0)
'INERTIE 3:EXP / forces d'inertie / AX=0.0 AY=0.0 AZ=0,0 / objets_masses / absolues / MEMO :
Set selectionB = Nothing
Set rec = Nothing
End Function
Function Angular_acc(smpl_cas As IRobotSimpleCase, ByVal AccX As Double, ByVal AccY As Double, ByVal AccZ As Double, ByVal CoordX As Double, ByVal CoordY As Double, ByVal CoordZ As Double, ByVal descriptionLR As String, ByVal SelectionObject As String)
Dim selectionB As RobotSelection
Dim rec As RobotLoadRecord
Set rec = smpl_cas.Records.Create(90) '90 = Force centrifuge
'Texte de description
rec.Description = descriptionLR
rec.SetValue 12, 0 '(Masse = 1 ou Objet = 0)
Set selectionB = Robapp.Project.Structure.Selections.Get(I_OT_BAR)
selectionB.FromText (SelectionObject)
'Charge appliqué à la selection
rec.ObjectType = I_OT_BAR
rec.Objects.Clear
rec.Objects.FromText SelectionObject
Debug.Print rec.Objects.Count
Debug.Print rec.Objects.ToText
'paramètre de la charge d'inertie
rec.SetValue 0, 0 'VX=0.0
rec.SetValue 1, 0 'VY=0.0
rec.SetValue 2, 0 'VZ=0.0
rec.SetValue 3, AccX 'AX=0.0
rec.SetValue 4, AccY 'AY=0.0
rec.SetValue 5, AccZ 'AZ=0.0
rec.SetValue 6, CoordX 'X=0.0
rec.SetValue 7, CoordY 'Y=0.0
rec.SetValue 8, CoordZ 'Z=0.0
'ACCELERATION ANGULAIRE / 3:EXP / forces centrifuges et accélération angulaire / VX=0.0 VY=0.0 VZ=0.0 AX=0.0 AY=0.0 AZ=0.0 / X=0.0 Y=0.0 Z=0.0 / objets_masses / MEMO :
Set selectionB = Nothing
Set rec = Nothing
End Function
Sub Test_Charge()
Dim Cas As IRobotCase
Dim CaseNumber As Long
Dim Simple_cas As IRobotSimpleCase
Set Robapp = New RobotApplication
CaseNumber = 3
Set Cas = Robapp.Project.Structure.Cases.Get(CaseNumber)
If Cas.Type = I_CT_SIMPLE Then
Set Simple_cas = Cas
Angular_acc Simple_cas, 0, 0, 10, 0, 0, 0, "Force centrifuge", "1501"
Linear_acc Simple_cas, 1.2, 0, -15.3, "Force d'inertie", "Tous"
End If
Set Cas = Nothing
Set Simple_cas = Nothing
Set Robapp = Nothing
End Sub
Solved! Go to Solution.
