Message 1 of 6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have a problem with proper setting radius of circle when:
- circle is tangent to arcs
- Z coordinate of those arcs and circle is different than 0
I checked it for lines and then it works. I use newest version of Fusion for Windows, monthly subscription.
Code:
import adsk.core, adsk.fusion
def run(context):
app = adsk.core.Application.get()
product = app.activeProduct
design = adsk.fusion.Design.cast(product)
rootComponent = design.rootComponent
design.designType = adsk.fusion.DesignTypes.DirectDesignType
sketch = rootComponent.sketches.add(rootComponent.xYConstructionPlane)
# Lines - z=0 OK, radius of circle is 1
z = 0
p11 = adsk.core.Point3D.create(2, 1, z)
p12 = adsk.core.Point3D.create(5, 1.5, z)
p21 = adsk.core.Point3D.create(1, 1, z)
p22 = adsk.core.Point3D.create(2.6, 6, z)
line1 = sketch.sketchCurves.sketchLines.addByTwoPoints(p11, p12)
line2 = sketch.sketchCurves.sketchLines.addByTwoPoints(p21, p22)
circle1 = sketch.sketchCurves.sketchCircles.addByCenterRadius(adsk.core.Point3D.create(4, 4, z), 1)
# Make circle tangent to lines
line1.isFixed = True
line2.isFixed = True
sketch.geometricConstraints.addTangent(circle1, line1)
sketch.geometricConstraints.addTangent(circle1, line2)
# Lines - z=5 OK, radius of circle is 1
z = 5
p11 = adsk.core.Point3D.create(2, 1, z)
p12 = adsk.core.Point3D.create(5, 1.5, z)
p21 = adsk.core.Point3D.create(1, 1, z)
p22 = adsk.core.Point3D.create(2.6, 6, z)
line1 = sketch.sketchCurves.sketchLines.addByTwoPoints(p11, p12)
line2 = sketch.sketchCurves.sketchLines.addByTwoPoints(p21, p22)
circle1 = sketch.sketchCurves.sketchCircles.addByCenterRadius(adsk.core.Point3D.create(4, 4, z), 1)
# Make circle tangent to lines
line1.isFixed = True
line2.isFixed = True
sketch.geometricConstraints.addTangent(circle1, line1)
sketch.geometricConstraints.addTangent(circle1, line2)
# Arcs - z=0 OK, radius of circle is 1
z = 0
p1s = adsk.core.Point3D.create(12, 1, z)
p1e = adsk.core.Point3D.create(15, 1.5, z)
p1m = adsk.core.Point3D.create(13.5, 1.4, z)
p2s = adsk.core.Point3D.create(11, 1, z)
p2e = adsk.core.Point3D.create(12.6, 6, z)
p2m = adsk.core.Point3D.create(11.5, 3.8, z)
p1sSketch = sketch.sketchPoints.add(p1s)
p1eSketch = sketch.sketchPoints.add(p1e)
arc1 = sketch.sketchCurves.sketchArcs.addByThreePoints(p1sSketch, p1m, p1eSketch)
p2sSketch = sketch.sketchPoints.add(p2s)
p2eSketch = sketch.sketchPoints.add(p2e)
arc2 = sketch.sketchCurves.sketchArcs.addByThreePoints(p2sSketch, p2m, p2eSketch)
circle2 = sketch.sketchCurves.sketchCircles.addByCenterRadius(adsk.core.Point3D.create(14, 4, z), 1)
arc1.isFixed = True
arc2.isFixed = True
sketch.geometricConstraints.addTangent(circle2, arc1)
sketch.geometricConstraints.addTangent(circle2, arc2)
circle2.radius = 1
# Arcs - z=5 WRONG, radius of circle is not 1
z = 5
p1s = adsk.core.Point3D.create(12, 1, z)
p1e = adsk.core.Point3D.create(15, 1.5, z)
p1m = adsk.core.Point3D.create(13.5, 1.4, z)
p2s = adsk.core.Point3D.create(11, 1, z)
p2e = adsk.core.Point3D.create(12.6, 6, z)
p2m = adsk.core.Point3D.create(11.5, 3.8, z)
p1sSketch = sketch.sketchPoints.add(p1s)
p1eSketch = sketch.sketchPoints.add(p1e)
arc1 = sketch.sketchCurves.sketchArcs.addByThreePoints(p1sSketch, p1m, p1eSketch)
p2sSketch = sketch.sketchPoints.add(p2s)
p2eSketch = sketch.sketchPoints.add(p2e)
arc2 = sketch.sketchCurves.sketchArcs.addByThreePoints(p2sSketch, p2m, p2eSketch)
circle2 = sketch.sketchCurves.sketchCircles.addByCenterRadius(adsk.core.Point3D.create(14, 4, z), 1)
arc1.isFixed = True
arc2.isFixed = True
sketch.geometricConstraints.addTangent(circle2, arc1)
sketch.geometricConstraints.addTangent(circle2, arc2)
circle2.radius = 1
Solved! Go to Solution.