我目前正在打开Rhino,并在外部python脚本中使用subprocess.call()运行Rhino命令行。
rhinoPath = "C:\\Program Files (x86)\\Rhinoceros 5\\System\\Rhino4.exe"
rhinoCommandFilePath = "Z:\\Arkangus\\2019\\RhinoCommand.txt"
scriptCall = "_-ReadCommandFile {0}".format(rhinoCommandFilePath)
callScript = '"{0}" /nosplash /runscript="{1}" /runscript="_-Exit"'.format(rhinoPath, scriptCall)
subprocess.call(callScript)然而,这意味着每次我运行脚本时都会打开Rhino,然后关闭它。
是否有一种方法可以检查犀牛是否已经打开并直接在犀牛中运行RhinoCommand文件(如果是这样的话)?
我不是在找Rhino和Python之间的管道。
谢谢!
发布于 2019-03-20 13:40:22
检查犀牛是否已经打开(注:这只是对我的问题的部分回答):
Checking if program is running programatically
import psutil
def is_rhino_open():
for pid in psutil.pids():
p = psutil.Process(pid)
if p.name() == "Rhino5.exe":
print ("Rhino5 is running!")其他方式:直接从Python内部使用Rhino的计算函数(不需要打开Rhino)和CPython3.x模块rhino3dm和compute_rhino3d。
https://stackoverflow.com/questions/55238627
复制相似问题