Grasshopper

algorithmic modeling for Rhino

Can I execute a DOS command from within Grasshopper's VB script function?

If not, can it be done in Rhinoscript? Could you point me to the code.
Thanks,
Jeff

Views: 503

Replies to This Discussion

You can start processes with the System.Diagnostics.Process.Start method. See, for examples, this page.

If you need to start the DOS command line, its executable is named cmd.exe. It is located in the system32 folder. To get to that folder, you could use the special folders enumeration.

Example:

Dim path As String
path = (System.Environment.GetFolderPath(System.Environment.SpecialFolder.System)) & "\cmd.exe"
Print(path)

Dim proc As System.Diagnostics.Process = System.Diagnostics.Process.Start(path)
proc.WaitForExit()
proc.Close()


There is a more complex example (in C#) by Dimitrie, on his blog. In general, this is a bit of a hack to run some code, because of the security repercussions this operation carries, and because there is a need of constantly keeping the file in a specific folder, which the definition can find. (Additionally, some systems have different root names, like C: or D: , so opening the file on another system might not work in any case. The special folder enumeration might help to fix this.)
hey giulio, there was sometime ago somebody complaining that "access was denied" on the qhull link def - didn't find any references to how bypass this (probably) security-related error, nor could i reproduce it. any clues?
It might be because qhull.exe is still being quarantined by Vista (see pic. Loosely translated: "The file comes from another computer. To facilitate protection, it could be blocked"). Otherwise, what happens if the user is not an administrator? That could be a cause as well, particularly on some very-safe systems.

thanks a bunch - it's good to know, and i'll try and keep this in mind.
by the way, any attempts at cgal?
hi dimitrie

we tried some attempts to integrate cgal with the scilab 4.1 which is something like mathematica but it wasn't really a success but with some more hours it would maybe work but it has not all classes integrated in the scilab-link dotnet for cgal

maybe another workaround.....
Thanks, works like charm.

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