
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to run a script that I have found on the forums here (https://forums.autodesk.com/t5/fusion-360-design-validate/parts-list-with-dimensions/td-p/6989386) The post shows that the Add-in is no longer valid or has been removed. Later down the list, there's a hand written script that someone posted to print dimensions to console.
I copied that code, the launch coding to run the script, created a new script, and then saved the coding.
After some debugging and google searches, I'm at a spot where I need some advice and guidance.
Below is the coding:
import adsk.core, adsk.fusion
def run(context):
app = adsk.core.Application.get()
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
# Get the root component of the active design.
rootComp = design.rootComponent
# Get occurences from root
occurrences = rootComp.occurrences
for idx in range(0, occurrences.count):
occ = occurrences.item(idx)
subcomp = occ.component
for bidx in range(0, subcomp.bRepBodies.count):
body = subcomp.bRepBodies.item(bidx)
dimvector = body.boundingBox.minPoint.vectorTo(body.boundingBox.maxPoint).asPoint()
dims=sorted(dimvector.asArray())
formx = product.unitsManager.formatInternalValue(dims[0])
formy = product.unitsManager.formatInternalValue(dims[1])
formz = product.unitsManager.formatInternalValue(dims[2])
print (f'{idx},{body.name}, {formx}, {formy}, {formz}\r')
subcomp.description=f'{formx} x {formy} x {formz}'
Below is the Run command
import neu_dev; neu_dev.run_script(r"C:\Users\jon\AppData\Roaming\Autodesk\Autodesk Fusion 360\API\Scripts\partsizes.py")
when I paste this into the Console and hit enter it reads out:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NeutronPythonException.TextCmdException: script file does not exist!
I can physically see the .py file at the location, yet Fusion says that the script does not exist.
Any help in making this work or pointing me in the direction of something similar to this would be greatly appreciated.
Thank you!
Solved! Go to Solution.