- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I am trying to use a Post processor on my cloud library for use in the PostProcessInput class. The
PostProcessInput class wants the post configuration to be a string path to the post, but I dont understand how to give it a post that is located in my Cloud Library.
import adsk.core, adsk.cam
app = adsk.core.Application.get()
ui = app.userInterface
def getPost(targetPostName:str):
camManager = adsk.cam.CAMManager.get()
libraryManager = camManager.libraryManager
postLibraries = libraryManager.postLibrary
cloudFolder = postLibraries.urlByLocation(adsk.cam.LibraryLocations.CloudLibraryLocation)
cloudPostlibrary = postLibraries.childAssetURLs(cloudFolder)
# Get Templates
for cloudPost in cloudPostlibrary:
postName = cloudPost.toString()
if targetPostName in postName:
postUrl = adsk.core.URL.create(postName)
# postConfiguration = postLibraries.postConfigurationAtURL(postUrl)
return postUrl.toString()
# Error if not found
ui.messageBox(f"Could not find Postprocessor {targetPostName}")
def postProcess():
cam:adsk.cam.CAM = app.activeDocument.products.itemByProductType("CAMProductType")
setups = cam.setups
setup = setups.item(0)
# specify the program name, post configuration to use and a folder destination for the nc file
programName = '1010'
postConfig = getPost("Dumper.cps")
outputFolder = cam.temporaryFolder
units = adsk.cam.PostOutputUnitOptions.DocumentUnitsOutput
# create the postInput object
postInput = adsk.cam.PostProcessInput.create(programName, postConfig, outputFolder, units)
postInput.isOpenInEditor = False
cam.postProcess(setup, postInput)
Here I am searching my cloud library for the post with the name Dumper.cps, then I am getting the URL to that post as a string, which looks like this: "cloud://Dumper.cps"
I pass that to the PostProcessInput class, but it is returning:
"RuntimeError: 3 : The input configuration file does not exist."
Is it possible to use cloud posts?
Solved! Go to Solution.