Grasshopper

algorithmic modeling for Rhino

Hi everybody,

With a friend, we are trying to deal with the connection between excel and GH. 
We followed this tutorial on youtube: https://www.youtube.com/watch?v=7Cb4NuF2wcw
(thx Damien)

When we tried at home it worked with excel 2003. Unfortunatly, at my office we only have excel 2007 and we get the following result:

Error:  old format or the library type is not valide. (exception HRESULT: 0x80028018 (TYPE_E_INVDATAREAD)) (line:0)
(I tranlsated from french)

We tried to change :

xlApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application")

by

xlApp = Marshal.GetActiveObject("Excel.Application")

But it doesn't work

It seems that it comes from the region setting and the language used by the software. This explanation was found on microsoft forum but we did not find the solution.

Does anybody has a clue to solve this problem but still in GH?

thx in advance


Views: 2121

Replies to This Discussion

I've looked into this, but haven't been able to test it since I don't have excel 2007 on my laptop here. There seams to be a small handful of errors that tend to pop up (yours being one of them) and they all appear to be a context/culture issue. So installs with languages other than english will cause tend to cause these errors (another reason why I've had a hard time repeating them here). Anyway, changing the culture to a "generic" english one should help out. Take a look at the following link from MSDN as to how to do that. Personally, I'd go with the second option they suggestion of changing the culture prior to opening excel.

http://support.microsoft.com/default.aspx?scid=kb;en-us;320369
hi damien and minh

i tried to solve that problem andfor me i ended up with that solution:



Dim xlApp As Object
' override language
Dim oldCI As System.Globalization.CultureInfo = system.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US")
'Grab a running instance of Excel
xlApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application")

//// variables and values you want to stream ////

System.Threading.Thread.CurrentThread.CurrentCulture = oldCI


hope it works for you let me know

best to]
To],

Thanks a lot, it works now. That is the best solution so far.

Now this is solved, there is something weird happening. When I changed the excel sheet and I rebuild the solution. The set of points changed referring to the excel file but the polyline keep the old inputs. Rebuild or disabled and enable the box does not refresh, I have to reconnect the vb box.

Do you know why?

m
hi minh

could you post a screenshot of your solution?
than i can narrow down your problem
thanks
Here is the .ghx file (from Damien's tutorial)

thanks
Attachments:
hi minh

finally i had time to check your problem
so there are two solutions for your problem

first:
connect a timer component to your vb component and it will refresh the solution every time value typed into the timer component (standard 1ms)

second:
if you want to refresh the canvas manually with F5 then insert into the vb compnent

....

End If

A = ptList

owner.ExpireSolution(False)
System.Threading.Thread.CurrentThread.CurrentCulture = oldCI
Thanks To]

It works quite fine, I got a bunch of error message which does not affect the definition (for the moment). Do you have them too?
hi minh

yeah with the second version i got also a bunch of errors but just check the "don't show me again" ;)

but if you just use the timer component you have no errors
It is true, the timer is enough, but I was wondering about the second one. Sometime the solution is easier than it looks like.

Anyway, thanks again.
thanks for letting us know! Works very well. Hopefully I tighten down the OpenOffice version to clean itself up. Some tests to my class came back about 75% successful with some Vista Machines having some real issues!
Doesn't the file parser make it much simpler? Does that script provide any added functionality that the file parser cannot?
It is simpler but it might not be as interactive as we would like.
But I may not use it in its full potential, can you change coordinates of points and having them refreshing in GH?

Doest it work only with csv file?

thx

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service