It happens with any add-in I am testing, but just at some point. For some reason I cannot attach the code so here it is below. Sorry for the format.
#Author-
#Description-
import adsk.core, adsk.fusion, adsk.cam, traceback
import math as m
# import calcium_generator as cg
length_mm = 3
angle_deg = 180
thickness_mm = 1
depth_mm = 4
stenosis_percentage = 0.4
healthy_artery_r_mm = 1.5
stenosed_radius_mm = healthy_artery_r_mm*m.sqrt(1-stenosis_percentage)
length = 0.1 * length_mm
angle = angle_deg * 3.14/180
thickness = 0.1 * thickness_mm
depth = 0.1 * depth_mm
stenosed_radius = stenosed_radius_mm * 0.1
h = healthy_artery_r_mm * 0.1
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
ui.messageBox('Hello script')
doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
rootComp = design.rootComponent
sketches = rootComp.sketches
sketch = sketches.add(rootComp.xYConstructionPlane)
arcs = sketch.sketchCurves.sketchArcs
extrudes = rootComp.features.extrudeFeatures
centerPoint = adsk.core.Point3D.create(0,0,0)
beta = m.atan(1/(1+2*(h+depth)/thickness))
sweepAngle = (angle-2*beta)
startPoint_inner = adsk.core.Point3D.create((h+depth)*m.sin(sweepAngle/2),(h+depth)*m.cos(sweepAngle/2),0)
startPoint_outer = adsk.core.Point3D.create((h+depth+thickness)*m.sin(sweepAngle/2), (h+depth+thickness)*m.cos(sweepAngle/2),0)
inner = arcs.addByCenterStartSweep(centerPoint, startPoint_inner, sweepAngle)
outer = arcs.addByCenterStartSweep(centerPoint, startPoint_outer, sweepAngle)
middle_point_right = adsk.core.Point3D.create((h+depth+thickness/2)*m.sin(angle/2),(h+depth+thickness/2)*m.cos(angle/2),0)
middle_point_left = adsk.core.Point3D.create(-(h+depth+thickness/2)*m.sin(angle/2),(h+depth+thickness/2)*m.cos(angle/2),0)
end_arc_right = arcs.addByThreePoints(inner.startSketchPoint,middle_point_right, outer.startSketchPoint)
end_arc_left = arcs.addByThreePoints(inner.endSketchPoint,middle_point_left, outer.endSketchPoint)
constraints = sketch.geometricConstraints
constraints.addTangent(outer,end_arc_right)
constraints.addTangent(inner,end_arc_right)
constraints.addTangent(outer,end_arc_left)
constraints.addTangent(inner,end_arc_left)
inner.isFixed = True
outer.isFixed = True
end_arc_left.isFixed = True
end_arc_right.isFixed = True
prof = sketch.profiles.item(0)
distance = adsk.core.ValueInput.createByReal(length)
extrude1 = extrudes.addSimple(prof, distance, adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))