PDA

View Full Version : Syntax of revit journals?



asusca
2006-01-05, 11:06 PM
I'm trying to use journals to automate some iterative operations in revit. Journals appear as sort of VB scripts: aren't they? Is this a good idea (the idea of using journals)? If so, is there a guide/tutorial to write routines in journal-like files to run like the well known "upgrade_RFA.txt". Let me know, please.

aaronrumple
2006-01-05, 11:13 PM
Journal files are not intended for automating or programing Revit. (...however some have done some simple things with these files.) The journal file syntax is unsupported and may change from release to release.

You should really look at the Revit API and VB.Net for you tasks.

James.Lupton
2006-01-05, 11:36 PM
Antonio

It depends on what you are trying to do

the API can be used to manipulate or alter the information in the model however as it in enabled as an external command from a user defined menu item, it will not run if another command is in operation.

The API however is a supported feature and is documented in the SDK included in the installation CD's You will also find that there is a separate forum on AUGI for Revit API

Aaron is therefore correct in advising you to look at the API first.

If however you want to process a repeating command such as exporting an image then moving the view location and exporting another image then this is not possible in the API (although a good number of users have indicated they would like to see this).

This type of operation is possible using a for-next loop within a journal file however, you must remember to save your model before you run any such command since this type of use of the API is not supported and could corrupt your file.

The use of the journal is not documented although if you interrogate a typical journal file you can usually develop an understanding for how it works.

A lot of the commands in a journal file can be cut out and sometimes the script files can become quite simple.

asusca
2006-01-09, 09:26 AM
Thank you for your tips. I've read/reviewed a typical journal file: can someone from AutoDESK tell me what are the methods, properties ... (i bag your pardon if i don't use the exact words, but i'm not a professional programmer) and so on of the object CrsJournalScript.

aaronrumple
2006-01-09, 02:39 PM
I doubt you'll get a direct response from adsk since this is unsupported. Maybe if you detail exactly what you want to do, some of the users that have worked with these can help out.

asusca
2006-01-09, 03:48 PM
Well, i would like to know if there is any possibility into the body of a script; i'm trying, before upgrading to revit 8.1 (i'm a subscriber, but i still use revit 7.0, because, in my opinion there weren't reasons to upgrade to revit 8.0, and the localised last release of revit has been sent to me before christmas), to create a script to upgrade to the last file format and, in the same time, purging and formatting according to the my needs my own families, which i ended to upgrade and expand from release 6.1 in the middle of summer. I'm trying to increase the functionalities of «upgrade_RFA.TXT». That's my version:


'UPGRADE & PURGE (Versione 1.10 del 05/01/2006)

Dim Jrn
Set Jrn = CrsJournalScript
Dim fname, filex

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("famList.txt", 1)

Jrn.Command "Menu" , "Specifica le varie opzioni dell'applicazione , 33195 , ID_OPTIONS"
Jrn.ComboBox "Page , Generale , 1983 , IDC_PARTITIONS_HISTORY_GRID" _
, "2330 , IDC_TOOLTIP_ASSISTANCE_DROPLIST" _
, "Select" , "Nessuno"
Jrn.PushButton "Modal , Opzioni , 0 , 0" _
, "OK, 1 , IDOK"

Do While f.AtEndOfStream <> True
fname = f.ReadLine
set filex = fso.getfile(fname)
file = filex.name
upgrade fname, file
Loop

Jrn.Command "Menu" , "Specifica le varie opzioni dell'applicazione , 33195 , ID_OPTIONS"
Jrn.ComboBox "Page , Generale , 1983 , IDC_PARTITIONS_HISTORY_GRID" _
, "2330 , IDC_TOOLTIP_ASSISTANCE_DROPLIST" _
, "Select" , "Normale"
Jrn.PushButton "Modal , Opzioni , 0 , 0" _
, "OK, 1 , IDOK"

Jrn.Command "Quit the application; prompts to save projects , 57665 , ID_APP_EXIT"

Sub upgrade (namepath, file)

Jrn.Command "Menu", "Open an existing project , 57601 , ID_FILE_OPEN"
Jrn.Data "File Name" _
, "IDOK", namepath

Jrn.Command "Menu" , "Elimina le famiglie e i tipi inutilizzati , 33780 , ID_PURGE_UNUSED"
Jrn.PushButton "Modal , Elimina inutilizzati , 1008 , IDC_TYPE" _
, "&Seleziona tutto, 2353 , IDC_CHECK_ALL"
Jrn.PushButton "Modal , Elimina inutilizzati , 1008 , IDC_TYPE" _
, "OK, 1 , IDOK"
Jrn.Data "Transaction Successful" _
, "Elimina inutilizzati"

Jrn.Command "Menu" , "Save the active project with a new name , 57604 , ID_FILE_SAVE_AS"
Jrn.Data "File Name" , "IDOK", namepath

Jrn.Command "Menu" , "Close the active project , 57602 , ID_FILE_CLOSE"

End Sub

Well, when managing a family, if this family has something to purge, the iterative cycle goes on; but, if the family has been already purged, the cycle stops and Revit gives me an error into the journal file; the error is:

' 09-Jan-2006 16:41:44; L'esecuzione di Revit non corrisponde alla sequenza registrata nel Journal.

'At line number 60 of source journal

'JournalData "Transaction Successful" from file was skipped
' 09-Jan-2006 16:41:44; aborted at line 60 journal file playback

What i need to know is if i can insert conditional expressions referred to the journal command:

Jrn.Data "Transaction Successful" _
, "Elimina inutilizzati"

and, if so, how? That is also the reason why i asked for the methods sopporte by the object «CrsJournalScript».

James.Lupton
2006-01-09, 11:25 PM
Antonio

I don't think you can do what you are trying to do in the journal file,

Since the journal file is a file normally created when the revit is under normal use, it represents a series of commands which revit can succesfully perform in sequence

Therefore if Revit encouters a line which it can not understand it will do one of 2 things.

1. Terminate and report a command is not understood.

2. Hang in a loop and do nothing ( in these cases Revit needs to be stopped using the task manager).

Perhaps you should simply perform the upgrade with no purge then make file purging part of your normal workflow to be performed at regular intervals.

An alternative approach may be to load a family into the project then delete the family and then perform the purge that way you should always have something to purge.

HTH

asusca
2006-01-16, 06:00 PM
Thanks. Done! I attach for your use the script i created/modified compressed in the zippede archive purgeRFA.ZIP. Read Readme.TXT for more details. Enjoy!

James.Lupton
2006-01-16, 11:31 PM
Antonio

I'm glad you got it working

For more control on Revit families I suggest you look into the API as Aaron suggested

The following ling will take you to the API forum

http://forums.augi.com/forumdisplay.php?f=218

asusca
2006-01-17, 12:33 PM
Thank you: if you want, you can test the files i've attacched before, in order to discover if there is a different behaviour among different localized revit installations.