Exemple #1
0
def _GetDoc(docPath):

    docMgr = app.Modules.Get("Document Manager")
    doc = docMgr.DocumentList.Fetch(docPath)

    # make unique dir and file under the application temprorary dir
    dir = Path.Combine(DssPath.GetTemporaryDirectory(),
                       Path.GetRandomFileName())
    Directory.CreateDirectory(dir)
    filename = Path.Combine(dir, doc.Name)

    docMgr.DocumentList.Export(doc, filename, True)

    return filename
Exemple #2
0
def ExecuteDynamoScript(uiapp, dynamoScriptFilePath, showUI=False):
    externalCommandResult = None
    # NOTE: The temporary copy of the Dynamo script file is created in same folder as the original so
    # that any relative paths in the script won't break.
    tempDynamoScriptFilePath = Path.Combine(
        Path.GetDirectoryName(dynamoScriptFilePath), Path.GetRandomFileName())
    File.Copy(dynamoScriptFilePath, tempDynamoScriptFilePath)
    try:
        SetDynamoScriptRunType(tempDynamoScriptFilePath,
                               DYNAMO_RUNTYPE_AUTOMATIC)
        externalCommandResult = ExecuteDynamoScriptInternal(
            uiapp, tempDynamoScriptFilePath, showUI)
    finally:
        File.Delete(tempDynamoScriptFilePath)
    return externalCommandResult
def GetUnknownProjectUniqueFolderName():
    return Path.GetRandomFileName().Replace(".", str.Empty).ToUpper()