Message 1 of 3

Not applicable
11-23-2019
05:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, everyone.
I'm quite new to Fusion 360 environment, I'm trying to use the API to draw a large number of circles around 10.000, I have a file that contains the coordinates and the radius of each circle where the script reads the inputs for circle drawing, the problem is that I'm running out of memory then the software crash, so I'm looking for a better way to do it.
thank you 🙂
import adsk.core, adsk.fusion, traceback, csv def run(context): ui = None try: app = adsk.core.Application.get() ui = app.userInterface doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType) design = app.activeProduct # Get the root component of the active design. rootComp = design.rootComponent # Create a new sketch on the xy plane. sketches = rootComp.sketches xyPlane = rootComp.xYConstructionPlane sketch = sketches.add(xyPlane) circles = sketch.sketchCurves.sketchCircles #Open the File with open('C:\\the\pathl\SampleXYandR.csv', 'r') as f: content = csv.reader(f) for line in content: x=float(line[0]) y=float(line[1]) z=float(line[2]) r=float(line[3]) # Draw some circles. circle1 = circles.addByCenterRadius(adsk.core.Point3D.create(y, z, 0), r) except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
Solved! Go to Solution.