VBA Robot

VBA Robot

Anonymous
Not applicable
1,223 Views
5 Replies
Message 1 of 6

VBA Robot

Anonymous
Not applicable

Bonjour,

 

J'aimerais ouvrir un fichier de données en format text avec Robot. J'ai lu le manuel Robot Open Standard (version 3.0) mais je ne parviens pas à utiliser l'objet VBA :

 

OpenExtFile (file_path : string, format : IRobotExternalFileFormat, ignore_warnings : bool) : bool

 

Mon fichier texte est sous le format str et se trouve dans W:\Metiers\Ingenieurs\mcorbin\Lgv-BPL\3_LOGICIELS\ROBOT\voute PRA 1197\poussées symétriques k-0.5\don.fic1.str.

 

Voilà ma macro :

 

Sub robot_voute()


' ouverture de robot, la session s'appellera robappSet robapp = New RobotApplicationrobapp.Visible = Truerobapp.Interactive = Truerobapp.UserControl = True

' ouverture du fichier textrobapp.OpenExtFile "W:\Metiers\Ingenieurs\XXX\AAA\3_LOGICIELS\ROBOT\voute\poussées symétriques k-0.5\don.fic1.str"


End Sub

 

Pouvez-vous me la corriger ou me dire comment l'écrire ?

 

0 Likes
Accepted solutions (1)
1,224 Views
5 Replies
Replies (5)
Message 2 of 6

Artur.Kosakowski
Autodesk Support
Autodesk Support

Try to use:

 

Sub OpenStrFile()

    Dim robApp As New RobotApplication

    robApp.Visible = 1

    robApp.Interactive = 1

    robApp.UserControl = True

    robApp.Project.OpenExtFile "c:\don.fic1.str", I_EFF_STR, 1

End Sub

 

If you find your post answered press the Accept as Solution button please. This will help other users to find solutions much faster. Thank you.



Artur Kosakowski
Message 3 of 6

Anonymous
Not applicable

Ok thank you,

 

but I have still a problem,

 

It's opening a project but it's writing me a error of syntaxt :

 

Erreur      :Syntaxe incorrecte - ligne ignorée

 

I don't undestand because when I open it with the application it's working.

 

That's the begining of my file text :

ROBOT LGV PRAVBA1197 Pou sym K=0.5             OWN WEIGHT 

PORTIQUE PLAN

NUMérotation DIScontinue 

NOEUD 45 ELEMENT 46 

UNITES 

L=M F=kN DEP=MM 

NOEUDS 8   -4.3   -1.888

 

I've attached the text file, (just change extension .txt to .str)

 

Do you have any idea ?

0 Likes
Message 4 of 6

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution

Hi

 

Try attached file.

(French e with accent replaced by e)

 

Movie attached



Rafal Gaweda
0 Likes
Message 5 of 6

Anonymous
Not applicable

Ok thanks a lot

 

I would like a last thing. 

 

I want to quit robot without saving.

 

Can you give the code in VBA ?

0 Likes
Message 6 of 6

Artur.Kosakowski
Autodesk Support
Autodesk Support

    Dim robApp As New RobotApplication

    robApp.Quit I_QO_DISCARD_CHANGES

 

If you find your post answered press the Accept as Solution button please. This will help other users to find solutions much faster. Thank you.



Artur Kosakowski
0 Likes