Hi @matthewaudio -San.
It is possible that you have the wrong meaning.
I tried to find a profile with the specified line.
# 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
tlA: core.Point3D = core.Point3D.create(1,2,0)
trA: core.Point3D = core.Point3D.create(3,2,0)
blA: core.Point3D = core.Point3D.create(1,-2,0)
brA: core.Point3D = core.Point3D.create(3,-2,0)
tlB: core.Point3D = core.Point3D.create(5,2,0)
trB: core.Point3D = core.Point3D.create(7,2,0)
blB: core.Point3D = core.Point3D.create(5,-2,0)
brB: core.Point3D = core.Point3D.create(7,-2,0)
mySketch: fusion.Sketch = root.sketches.add(root.xYConstructionPlane)
tltrA = mySketch.sketchCurves.sketchLines.addByTwoPoints(tlA, trA)
tlblA = mySketch.sketchCurves.sketchLines.addByTwoPoints(tlA, blA)
trbrA = mySketch.sketchCurves.sketchLines.addByTwoPoints(trA, brA)
blbrA = mySketch.sketchCurves.sketchLines.addByTwoPoints(blA, brA)
tltrB = mySketch.sketchCurves.sketchLines.addByTwoPoints(tlB, trB)
tlblB = mySketch.sketchCurves.sketchLines.addByTwoPoints(tlB, blB)
trbrB = mySketch.sketchCurves.sketchLines.addByTwoPoints(trB, brB)
blbrB = mySketch.sketchCurves.sketchLines.addByTwoPoints(blB, brB)
prof: fusion.Profile = find_profile_with_line(mySketch, tltrA)
if not prof: return
extrudeFeats: fusion.ExtrudeFeatures = root.features.extrudeFeatures
extrudeFeats.addSimple(
prof,
core.ValueInput.createByReal(1),
fusion.FeatureOperations.NewBodyFeatureOperation
)
mySketch.isLightBulbOn = True
ui.messageBox("Done")
except:
if ui:
ui.messageBox("Failed:\n{}".format(traceback.format_exc()))
def find_profile_with_line(
skt: fusion.Sketch,
sktCrv: fusion.SketchCurve,
) -> fusion.Profile:
if skt.profiles.count < 1: return None
prof: fusion.Profile = None
loop: fusion.ProfileLoop = None
crv: fusion.ProfileCurve = None
for prof in skt.profiles:
for loop in prof.profileLoops:
for crv in loop.profileCurves:
if crv.geometry.isColinearTo(sktCrv.geometry):
return prof
return None