Parallel lines

Parallel lines

brad.bylls
Collaborator Collaborator
457 Views
2 Replies
Message 1 of 3

Parallel lines

brad.bylls
Collaborator
Collaborator

Is it possible to tell if two lines in two different sketches on two different planes are parallel? 

Brad Bylls
0 Likes
Accepted solutions (1)
458 Views
2 Replies
Replies (2)
Message 2 of 3

MichaelT_123
Advisor
Advisor

Yes, Mr. Brad.Bylls,

 

 ... cross product of two parallel vectors equals 0

If there is a tolerance involved consider finding an angle between vectors.

Regards

MichaelT

MichaelT
Message 3 of 3

kandennti
Mentor
Mentor
Accepted solution

@brad.bylls -San.

 

There are several ways to get Vector3D from SketchLine, and this is one example.

# Fusion360API Python script

import traceback
import adsk.core as core
import adsk.fusion as fusion

def run(context):
    ui: core.UserInterface = None
    try:
        app: core.Application = core.Application.get()
        ui = app.userInterface
        des: fusion.Design = app.activeProduct
        root: fusion.Component = des.rootComponent

        line1: fusion.SketchLine = root.sketches[0].sketchCurves.sketchLines[0]
        line2: fusion.SketchLine = root.sketches[1].sketchCurves.sketchLines[0]

        vector1: core.Vector3D = line1.geometry.asInfiniteLine().direction
        vector2: core.Vector3D = line2.geometry.asInfiniteLine().direction

        print(f"is Paralle : {vector1.isParallelTo(vector2)}")

    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

 

The Vector3D object has a method to determine parallelism.

https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-1767ab3d-f6a0-4537-9a8f-90aded44f115 

0 Likes