Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, I am trying to find the coordinates of the intersection points between two ellipses, that are in different sketches, as you can see in the picture:
I used an example found in a forum post:
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 19 16:53:42 2016
@author: DINODESK
"""
import adsk.core, adsk.fusion, traceback, math
def run(context):
ui = None
try:
app = adsk.core.Application.get()
ui = app.userInterface
design = adsk.fusion.Design.cast(app.activeProduct)
sketch1 = design.rootComponent.sketches.item(0)
sketch2 = design.rootComponent.sketches.item(1)
# collection of points
sketchPoints2 = sketch2.sketchPoints
coll1 = adsk.core.ObjectCollection.create()
for curve in sketch1.sketchCurves:
coll1.add(curve)
coll2 = adsk.core.ObjectCollection.create()
for curve in sketch2.sketchCurves:
coll2.add(curve)
projectedcurves = adsk.core.ObjectCollection.create()
for curve in sketch1.sketchCurves:
results = sketch2.project(curve)
for resultcurve in results:
projectedcurves.add(resultcurve)
intersectedsplines = adsk.core.ObjectCollection.create()
for curve in projectedcurves:
result, intersectionresults, intersectionpts = curve.intersections(coll1)
if result:
for intersectionresult in intersectionresults:
intersectedsplines.add(intersectionresult)
for i in range(0,intersectionpts.count):
sketchPoints2.add(intersectionpts.item(i))
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
but the result is not what I exspected. This is what happen:
There is someone who can give me a hint or some code examples.
Thanks
Dino
Solved! Go to Solution.
