Jump to content

Scripting in WAsP 9 (2008-08-27)


Recommended Posts

Hi,



I have been doing some scripts for WAsP Engineering to make the post-processing of the data more easy for myself and my colleagues. I would also like to spend a little time doing some scripts for WAsP. I can, however, not find the same documentation for WAsP as for WEng. Will it be possible to obtain this documentation? Otherwise, I will probably miss out on a lot of objects / properties that aren't covered in existing scripts.



Thanks.

--------

Hello,



It's true that we have only made proper scripting 'how-to' documentation for WAsP Engineering. There's no similar resource available for WAsP, and I'm afraid that there are no immediate plans to write one.



The WAsP scripting interface model is in some ways more complicated than WEngs, but in others it's more straightforward. To see the objects and methods available, I suggest that you open a project in Excel's VBA editor and then add a reference to a type library called Rvea0104.tlb. That will give you some idea of the what's there and what can be done.



If you have any specific problems or questions, then post them here and we'll try to help.

--------

I can define the resource grid



Set Projects = CurrentWorkspace.Projects

Set Project = ReportingAssistant.TypeCaster.CastMemberToProject(Projects.FirstMember)

Set ResourceGrid = Project.AsIHierarchyMember.Insertions.New.ByClassID(ehmcResourceGrid).Execute

ResourceGrid.Description = "wrg"



but I can't seem to set the height and nodes. I thought there was a method called GridSpecification. Perhaps I am meant to set the parameters when the resource grid is first instantiated.



Any ideas?



Thanks.



Chris

--------
Link to comment
  • 2 weeks later...
After an extraordinarily long delay (sorry), here's an answer to your question.

When you call 'Execute' on an insertion object, you get a reference to the inserted hierarchy member, but only its generic type: IHierarchyMember, which has the description and other basic properties. To see the resource grid members, you need to typecast your reference. You can use the ReportingAssistant.TypeCaster to do this. The code will look something like this:

Set NewMember = Project.AsIHierarchyMember.Insertions.New.ByClassID(ehmcResourceGrid).Execute

Set ResourceGrid = ReportingAssistant.TypeCaster.CastMemberToResourceGrid(NewMember)

To set up the grid, you need to call the method 'EditGridSpecification', passing in an IRveaGridSpecification object. To get one of those, you can use an object factory in a DLL called Rvea0086 (in WAsP 10 you could use Rvea0138). An example can be found in the Turbine Site Vertical Slice script.

Set Rvea0086Factory = CreateObject("Rvea0086.ObjectFactory")

Set GridSpecification = Rvea0086Factory.CreateGridSpecification(0, 0, CountOfPoints, CountOfVerticalSteps, Resolution, False)

Hope this helps.
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...