jfcorbett Posted January 5, 2011 Posted January 5, 2011 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
jfcorbett Posted January 5, 2011 Posted January 5, 2011 Is it because I'm trying to insert from a .tab file and now an .owc file? .tab files are all I have...
Duncan Posted January 5, 2011 Posted January 5, 2011 Tab files should be OK. Have you previously used that variable hmowc?You could also try thisSet hmOwc = Ins.Execute(tabpath, Nothing)If that works, I'll explain why, but I hope that's not needed.
jfcorbett Posted January 6, 2011 Posted January 6, 2011 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!
Duncan Posted January 10, 2011 Posted January 10, 2011 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now