Jump to content

Inserting an Observed Wind Climate in a Met station


Recommended Posts

Posted
I've been struggling to insert an OWC from a .tab file into a Met station. I've tried my best to figure out how insertions work, but I'm stumped.

Would you have sample code that does this?

I tried:
    tabpath="C:\M1_Mat60_M2.tab"
Set MetStation = WindAtlas.MetStation
Set Insertions = MetStation.AsIHierarchyMember.Insertions
Set Ins = Insertions.FromFile.ByClassID(ehmcObservedWindClimate)
Set hmOwc = Ins.Execute(tabpath)

But this last line gives me a Type Mismatch error:
Script control reported the error: 
Type mismatch: 'Ins.Execute'

The last execution line attempt was for line number: 90, which reads:

Set hmOwc = Ins.Execute(tabpath)

Cheers,
Jean-François
Posted
Tab files should be OK. Have you previously used that variable hmowc?

You could also try this

Set hmOwc = Ins.Execute(tabpath, Nothing)

If that works, I'll explain why, but I hope that's not needed.
Posted
It does work with the Nothing argument! Could this this a programming error in WAsP? It looks like the default value for the optional FileFilter argument should have been Nothing instead of zero, which isn't a valid value for type IRveaFileFilter.

 [ByVal FileFilter As IRveaFileFilter = 0]

Perhaps a historical leftover... The same type mismatch occurs in three other methods in Rvea0134Interfaces. This would explain why you hoped this wouldn't be necessary :-)

In any case, this is no big deal for the scripting user, just have to remember Nothing.

Thanks for your help!
Posted
Hi. Yes this is supposed to be an optional argument, but for some reason you sometimes need to pass explicitly "Nothing". It's not a programming error in WAsP, it's some kind of mix-up in the COM interfaces. You get the same problems if you invoke methods like this from Delphi or C# client languages.

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...