Message 1 of 2
Internal Validation Error: SetByCenter(Sphere Surface)

Not applicable
06-06-2016
07:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I get an internal validation when using the setByCenter(Spherical Surphace) method to create a construction point at the center of a sphere. I'm trying to use this in order to create an effective project body method in the python API. Can anyone explain this error? I've attached the script below. I'm running a test where there is a rectangular prism body, a cylinder body, and a sphere body, then a construction point that is a distance way from them. The basic cylinder and recangular bodies project correctly, however a sphere will make no projection and I can't get the center in order to create the circular projection.
#Author- #Description- ui = None import adsk.core, adsk.fusion, adsk.cam, traceback def curveProjection(root): # Get the sketch named "ProjectTest" sketches = root.sketches sketch = sketches.itemByName('ProjectTest') bodies = root.bRepBodies points = root.constructionPoints # Get the set of currently selected entities. for body in bodies: for face in body.faces: if face.geometry.surfaceType == 3: centerInput = points.createInput() centerInput.setByCenter(face.geometry) center = points.add(centerInput) radius = face.geometry.radius sketch.sketchCurves.sketchCircles.addByCenterRadius(center,radius) else: sketch.project(face) def run(context): ui = None try: app = adsk.core.Application.get() global ui ui = app.userInterface product = app.activeProduct design = adsk.fusion.Design.cast(product) root = design.rootComponent curveProjection(root) except: if ui: ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))