Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to programmatically create a 3-point construction plane, using points that are in three different sketches. Doing it manually in Fusion works fine, but via the API I get an InternalValidationError. Here's some sample non-working code:
import adsk.core, adsk.fusion def run(context): ui = None try: app = adsk.core.Application.get() design = app.activeProduct rootComp = design.rootComponent sketches = rootComp.sketches planes = rootComp.constructionPlanes planeInput = planes.createInput() #Convenience functions planeXY = rootComp.xYConstructionPlane realVal = adsk.core.ValueInput.createByReal point3D = adsk.core.Point3D.create #Point 1 sketch = sketches.add(rootComp.xYConstructionPlane) sp = sketch.sketchPoints sp1 = sp.add(point3D(1, 1, 0)) #Point 2 planeInput.setByOffset(planeXY, realVal(1)) plane = planes.add(planeInput) sketch = sketches.add(plane) sp = sketch.sketchPoints sp2 = sp.add(point3D(1.25, 1.25, 0)) #Point 3 planeInput.setByOffset(planeXY, realVal(2)) plane = planes.add(planeInput) sketch = sketches.add(plane) sp = sketch.sketchPoints sp3 = sp.add(point3D(1.5, 1.5, 0)) planeInput.setByThreePoints(sp1, sp2, sp3) plane = planes.add(planeInput) except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc())) else: raise
If I change the code so that sp2 and sp3 are defined instead as:
sketch = sketches.add(rootComp.xYConstructionPlane) sp = sketch.sketchPoints sp1 = sp.add(point3D(1, 1, 0)) sp2 = sp.add(point3D(1, 1, 1)) sp3 = sp.add(point3D(1.5, 1.5, 2))
it works without the InternalValidationError.
Solved! Go to Solution.