<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cloning and moving a profile, while keeping it linked to the original. in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8286165#M15590</link>
    <description>&lt;P&gt;I finally noticed that Matrix3D.setRotationTo has an optional third parameter.&amp;nbsp; It is described as:&amp;nbsp;"The optional axis argument may be used when the two vectors are perpendicular and in opposite directions to specify a specific solution".&amp;nbsp; "perpendicular and opposite directions" is exactly the test case that has been failing.&amp;nbsp; Once I figured out &lt;A href="https://forums.autodesk.com/t5/fusion-360-api-and-scripts/sketch-returns-another-sketch-instead-of-referenceplane/m-p/8281174/highlight/true#M6633" target="_blank"&gt;how to get the normal to the sketch containing the path curves&lt;/A&gt;, my test cases now work without additional input.&amp;nbsp; I still won't claim thorough testing, but I'm happy enough for now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 22 Sep 2018 18:10:13 GMT</pubDate>
    <dc:creator>metd01567</dc:creator>
    <dc:date>2018-09-22T18:10:13Z</dc:date>
    <item>
      <title>Cloning and moving a profile, while keeping it linked to the original.</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8224307#M15580</link>
      <description>&lt;P&gt;I've got a repetitive design task that requires a solution to sweep's "single path/single intersecting profile" restriction.&amp;nbsp; I hacked the Pipe.py script to copy curves from a “reference” profile in place the hardcoded circle.&amp;nbsp; It worked, but the copied profile was not linked to the reference profile, and I’d like to tweak the swept bodies after they’re created.&amp;nbsp; I'm now&amp;nbsp;extruding a thin body from the reference profile; re-orienting it with a MoveFeature; then using the extrusion’s first face as the sweep profile.&amp;nbsp; The swept bodies respond to reference profile changes, so that solves the basic problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The extrude feels clumsy, is there a more elegant way to clone a referenced profile and keep the clone linked to the reference?&amp;nbsp; I’m using the swept bodies as transient cutting tools, so I end up with a clutter of extrusions. I move them by hand into the target component, which helps, but they’re difficult to visually correlate with the cuts.&amp;nbsp; Since a linkage entity is probably needed in any solution, I’d appreciate suggestions on organization.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’ve got a script mashed up from Pype.py and the Command Input API example.&amp;nbsp; I’ll post if you’d like but it’s not pretty.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Aug 2018 12:42:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8224307#M15580</guid>
      <dc:creator>metd01567</dc:creator>
      <dc:date>2018-08-25T12:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: Cloning and moving a profile, while keeping it linked to the original.</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8228723#M15581</link>
      <description>&lt;P&gt;I just tried the same thing&amp;nbsp;from Fusion UI and It looks like reference to original profile is not kept and any modification done on original profile is not reflected in copy profile. I think it might be a deliberate reason. I will update you in case I find more information.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 04:25:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8228723#M15581</guid>
      <dc:creator>goyals</dc:creator>
      <dc:date>2018-08-28T04:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Cloning and moving a profile, while keeping it linked to the original.</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8230893#M15582</link>
      <description>&lt;P&gt;&lt;SPAN style="font-family: 'Tahoma',sans-serif; color: #666666;"&gt;I'm having trouble attaching&amp;nbsp;the script, I'll try in a different post.&amp;nbsp; It&amp;nbsp;presents a&amp;nbsp;dialog&amp;nbsp;with two inputs.&amp;nbsp;The&amp;nbsp;first&amp;nbsp;input is&amp;nbsp;a sketch, which must contain a single "reference" profile (select&amp;nbsp;the sketch from the tree).&amp;nbsp; The&amp;nbsp;second input&amp;nbsp;is&amp;nbsp;a set of "paths" for sweeping, for now you've got to select one and only one curve for each path.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Tahoma',sans-serif; color: #666666;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Tahoma',sans-serif; color: #666666;"&gt;Requiring the user to select&amp;nbsp;a sketch, vs direct selection of the profile may seem odd.&amp;nbsp; The script needs to know the user's intended orientation of the profile at the sweep path's start point.&amp;nbsp; I'm using the&amp;nbsp;origin and orientation of the profile within its sketch.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Tahoma',sans-serif; color: #666666;"&gt;But that isn't reliable.&amp;nbsp; For example, if you select all six paths in the "Slots" sketch, the upper left swept body is flipped relative to the others.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Tahoma',sans-serif; color: #666666;"&gt;This may be&amp;nbsp;why&amp;nbsp;Fusion 360's native Sweep Command supports only one path, and requires the profile to be pre-oriented to&amp;nbsp;that path.&amp;nbsp; Note&amp;nbsp;the infamous Pype.py example sweeps&amp;nbsp;a circle, which is symmetric&amp;nbsp;and requires no interpretation of intent.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 20:52:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8230893#M15582</guid>
      <dc:creator>metd01567</dc:creator>
      <dc:date>2018-08-28T20:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Cloning and moving a profile, while keeping it linked to the original.</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8230897#M15583</link>
      <description>&lt;P&gt;The example file.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 20:33:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8230897#M15583</guid>
      <dc:creator>metd01567</dc:creator>
      <dc:date>2018-08-28T20:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Cloning and moving a profile, while keeping it linked to the original.</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8230903#M15584</link>
      <description>&lt;P&gt;I couldn't attach the script, here it is in-line.&amp;nbsp; I have it in a file named: SweepByReference.py.&lt;/P&gt;&lt;PRE&gt;# -*- coding: utf-8 -*-
"""
Created on Tue Aug 28 07:56:27 2018

@author: metd01567
"""

# TODO: refactor: exception handling needs work, e.g. clean up stray temp body after failure, or avoid creating it until all reasonable validation is done
#     consider adding a validate input method, and move as much validation code into it, and consider if other checks are needed

import adsk.core, adsk.fusion, traceback

# Global set of event handlers to keep them referenced for the duration of the command
_handlers = []

# Event handler that reacts to when the command is destroyed. This terminates the script.
class MyCommandDestroyHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()
    def notify(self, args):
        try:

            app = adsk.core.Application.get()
            ui = app.userInterface
            # When the command is done, terminate the script
            # This will release all globals which will remove all event handlers
            adsk.terminate()
        except:
            if ui:
                ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


# Event handler that reacts when the command definition is executed which
# results in the command being created and this event being fired.
class MyCommandCreatedHandler(adsk.core.CommandCreatedEventHandler):
    def __init__(self):
        super().__init__()
    def notify(self, args):
        try:

            # check workspace, must be in Model

            app = adsk.core.Application.get()
            ui = app.userInterface
            product = app.activeProduct
            design = adsk.fusion.Design.cast(product)
            if not design:
                ui.messageBox('This script is not supported in current workspace, please change to MODEL workspace and try again.')
                return False

            # Get the command that was created.
            cmd = adsk.core.Command.cast(args.command)

            # Connect to the command destroyed event.
            onDestroy = MyCommandDestroyHandler()
            cmd.destroy.add(onDestroy)
            _handlers.append(onDestroy)

            onExecute = MyExecuteHandler()
            cmd.execute.add(onExecute)
            _handlers.append(onExecute)

            # Get the CommandInputs collection associated with the command.
            inputs = cmd.commandInputs

            childInputs = inputs

            ###################################
            # add controls

            # Create a selection input for sketches
            sketchSelectionInput = childInputs.addSelectionInput('sketchSelection', 'Profile Sketch', 'Sketch should have a single profile that intersects x,y: 0,0, sketch origin will be swept along the selected path')
            sketchSelectionInput.setSelectionLimits(1, 1)
            sketchSelectionInput.addSelectionFilter("Sketches")

            # Create a selection input for paths
            pathSelectionInput = childInputs.addSelectionInput('pathSelection', 'Paths', 'select any segment of the path, the complete chain will be used')
            pathSelectionInput.setSelectionLimits(1)
            pathSelectionInput.addSelectionFilter("SketchCurves")

        except:
            if ui:
                ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

def run(context):
    try:
        app = adsk.core.Application.get()
        ui = app.userInterface

        # Get the existing command definition or create it if it doesn't already exist.
        cmdDef = ui.commandDefinitions.itemById('sweepByReference')
        if not cmdDef:
            cmdDef = ui.commandDefinitions.addButtonDefinition('sweepByReference', 'Sweep By Reference', 'Command to sweep a profile from a reference sketch.')

        # Connect to the command created event.
        onCommandCreated = MyCommandCreatedHandler()
        cmdDef.commandCreated.add(onCommandCreated)
        _handlers.append(onCommandCreated)

        # Execute the command definition.
        cmdDef.execute()

        # Prevent this module from being terminated when the script returns, because we are waiting for event handlers to fire.
        adsk.autoTerminate(False)


    except:
        if ui:
            ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))

# Event handler that reacts to any changes the user makes to any of the command inputs.
class MyExecuteHandler(adsk.core.CommandEventHandler):
    def __init__(self):
        super().__init__()
    def notify(self, args):
        try:

            app = adsk.core.Application.get()
            ui = app.userInterface
            doSweeps(args)

            adsk.terminate()

        except:
            if ui:
                ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))


# get the sketch input, and iterate through the selected paths
def doSweeps(args):

    # TODO: refactor, failure of the existence checks would be a software error, and logged vs prompting user

    app = adsk.core.Application.get()
    ui = app.userInterface
    eventArgs = adsk.core.CommandEventArgs.cast(args)
    inputs = eventArgs.command.commandInputs

    ###############################################
    # look for the sketch selection input, and verify that it is a sketch
    sketchSelectionInput = inputs.itemById('sketchSelection')
    if sketchSelectionInput == None:
        ui.messageBox('software error, the sketch selection was lost')
        return
    selectedSketchEntity = sketchSelectionInput.selection(0).entity
    selectedSketch = adsk.fusion.Sketch.cast(selectedSketchEntity)
    if selectedSketch == None:
        ui.messageBox('software error: sketch selection could not be used')
        return

    ###############################################
    # collect path selections
    pathSelectionInput = inputs.itemById('pathSelection')
    if pathSelectionInput == None:
        ui.messageBox('software error, the path selection was lost')
        return

    ###############################################
    # sweep each path

    # TODO: find out why direct iteration of the selection input fails.
    #    The sketch went invisible after first path was swept, and then the second index was not there
    #    Even after disabling "Auto hide sketch on feature creation" in preferences-&amp;gt;General-&amp;gt;Design
    #
    #    If it turns out selection inputs do sometimes change, maybe pulling the entities first is good practice.
    paths = adsk.core.ObjectCollection.create()
    for thisEntity in range(pathSelectionInput.selectionCount):
        paths.add(pathSelectionInput.selection(thisEntity).entity)

    for thisPath in paths:
        selectedPath = adsk.fusion.SketchCurve.cast(thisPath)
        if selectedPath == None:
            ui.messageBox('software error: path selection could not be used')
            return
        doSweep(selectedSketch, selectedPath)

    app.activeViewport.refresh()

# TODO: refactor, function is too big
def doSweep(selectedSketch, selectedPath):

    ###############################################
    # set up infrastructure
    ###############################################
    app = adsk.core.Application.get()
    ui = app.userInterface
    product = app.activeProduct
    design = adsk.fusion.Design.cast(product)
    comp = design.rootComponent

    ###############################################
    #  derive usable entities and parameters, and verify inputs meet requirements
    ###############################################

    ###############################################
    # process path

    # convert the path selection object to a usable path - chained curve will follow connected segments
    feats = comp.features
    chainedOption = adsk.fusion.ChainedCurveOptions.connectedChainedCurves
    if adsk.fusion.BRepEdge.cast(selectedPath):
        chainedOption = adsk.fusion.ChainedCurveOptions.tangentChainedCurves
    path = adsk.fusion.Path.create(selectedPath, chainedOption)
    path = feats.createPath(selectedPath)

    ###############################################
    # process the "reference" sketch containing a single profile

    if selectedSketch.profiles.count != 1:
        ui.messageBox('reference sketch must have a single profile, ' + str(selectedSketch.profiles.count) + ' were found\n\noperation not complete')
        return

    # grab the profile
    refProfile = selectedSketch.profiles[0]

    ###############################################
    # create a thin extrusion and make it normal to the sweep path
    ###############################################

    # extrude a thin body from the reference profile.  thickness is arbitrary, but keep it well above the model's resolution
    thickness = adsk.core.ValueInput.createByReal(0.1)
    extrude = comp.features.extrudeFeatures.addSimple(refProfile, thickness, adsk.fusion.FeatureOperations.NewBodyFeatureOperation)

    # name the body for user convenience
    tempBody = extrude.bodies.item(0)
    if tempBody == None:
        ui.messageBox('temp extrude failed\n\noperation not complete')
        return
    tempBody.name = "generatedSweepProfile"

    ###############################################
    # derive the move transform parameters:
    ###############################################

    # translate from the reference sketch's control point (which must be at 0,0) to the start point of the path
    firstEntity = path.item(0)
    (returnValue, startPoint, endPoint) = firstEntity.curve.evaluator.getEndPoints()
    if not returnValue:
        ui.messageBox('could not fetch start point of path')
        return
    moveVector = adsk.core.Vector3D.create(startPoint.x, startPoint.y, 0)

    # TODO: fixme, User's concept of path orientation isn't known.  additional input required.
    # rotate to the tangent at the path start point
    (returnValue, pathTangent) = firstEntity.curve.evaluator.getTangent(0)
    if not returnValue:
        ui.messageBox('could not fetch path tangent')
        return

    # create the move transform
    transform = adsk.core.Matrix3D.create()
    transform.setToRotateTo(selectedSketch.referencePlane.geometry.normal, pathTangent)
    transform.translation = moveVector

    # move the temp body
    bodies = adsk.core.ObjectCollection.create()
    bodies.add(tempBody)
    moveInput = comp.features.moveFeatures.createInput(bodies, transform)
    comp.features.moveFeatures.add(moveInput)

    ###############################################
    # now perform the sweep
    ###############################################

    # extract the start face
    sweepFace = extrude.startFaces.item(0)
    if sweepFace == None:
        ui.messageBox('extrude has no faces\n\noperation not complete')
        return

    # Set up the sweep operation
    sweepFeats = feats.sweepFeatures
    sweepInput = sweepFeats.createInput(sweepFace, path, adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
    sweepInput.orientation = adsk.fusion.SweepOrientationTypes.PerpendicularOrientationType
    sweepFeats.add(sweepInput)&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Aug 2018 20:35:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8230903#M15584</guid>
      <dc:creator>metd01567</dc:creator>
      <dc:date>2018-08-28T20:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Cloning and moving a profile, while keeping it linked to the original.</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8237880#M15585</link>
      <description>&lt;P&gt;OK, I didn't really expect a simple answer.&amp;nbsp; And at this point I could write the script I'd originally intended.&amp;nbsp; But I'll press on for a while.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've spawned other topics, but technically you can't move a profile without knowing where it goes.&amp;nbsp; So I'll&amp;nbsp;declare myself on-topic and continue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The discussion below assumes the profile is 2D, and&amp;nbsp;each path resides in a 2D plane.&amp;nbsp; 3D will require a bit more work on the users's part.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For a profile that is symmetric about one axis, there are only two choices for orientation: the tangent plane of the path (e.g. returned by ...getTangent on the first PathEntity), or the tangent plane flipped about the axis of asymmetry.&amp;nbsp; The second choice is also the tangent plane of the path, but running in the opposite direction.&amp;nbsp;&amp;nbsp;For a quick test, I accept the tangent plane if multiple paths are selected, but flip&amp;nbsp;it when a single path is selected.&amp;nbsp; I get what I want if I&amp;nbsp;choose the upper left path by itself, then sweep all the rest in a single operation.&amp;nbsp; Here's&amp;nbsp;an x axis flip in doSweep, just to see how it works.&amp;nbsp; "reverseSweep" is determined from the count of the SketchCurve selections in doSweeps.&lt;/P&gt;&lt;PRE&gt;    # create the move transform
    transform = adsk.core.Matrix3D.create()
    transform.setToRotateTo(selectedSketch.referencePlane.geometry.normal, pathTangent)
    if reverseSweep:
        flipTransform = adsk.core.Matrix3D.create()
        axisVector = adsk.core.Vector3D.create(1.0, 0, 0)
        originPoint = adsk.core.Point3D.create(0, 0, 0)
        flipTransform.setToRotation(math.pi, axisVector, originPoint)
        transform.transformBy(flipTransform)
        ui.messageBox("flipping")
    transform.translation = moveVector&lt;/PRE&gt;&lt;P&gt;Rather than trying to automatically determine symmetry, might add a&amp;nbsp;"flip last" checkbox for X and Y in the dialog.&amp;nbsp; If I extend to 3D, I'll need a free rotate option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it's always nice to&amp;nbsp;have a good default.&amp;nbsp; I could bias the orientation assuming the user clicks near the intended start end of the path.&amp;nbsp; Since there is no way for the user to know path direction, I probably need to render the sweep as soon as the user selects (or reselects) a path.&amp;nbsp; I'll experiment with rendering&amp;nbsp;each sweep in an inputChanged handler, to give the user a preview of each sweep's orientation as the selections are made.&amp;nbsp; I could also use red arrows like the 2D Contour CAM dialog, but that probably requires custom graphics and I don't particularly like them anyway.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 13:10:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8237880#M15585</guid>
      <dc:creator>metd01567</dc:creator>
      <dc:date>2018-08-31T13:10:56Z</dc:date>
    </item>
    <item>
      <title>Re: Cloning and moving a profile, while keeping it linked to the original.</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8237910#M15586</link>
      <description>&lt;P&gt;Just to give you a view of the latest problem, here's a view from the upper right corner of the offending sweep:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2018-08-31 at 9.13.03 AM.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/541152iFB889F009CFED4A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2018-08-31 at 9.13.03 AM.png" alt="Screen Shot 2018-08-31 at 9.13.03 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Aug 2018 13:14:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8237910#M15586</guid>
      <dc:creator>metd01567</dc:creator>
      <dc:date>2018-08-31T13:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Cloning and moving a profile, while keeping it linked to the original.</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8239742#M15587</link>
      <description>&lt;P&gt;Geometry can't be denied I was fooling myself.&amp;nbsp; Only the orientation of the tangent plane relative to the profile's frame of reference matters.&amp;nbsp; For the oddball path (upper left),&amp;nbsp;both ends have the same tangent plane&amp;nbsp;orientation.&amp;nbsp; So starting from the opposite end had no effect.&amp;nbsp; The endpoints of all&amp;nbsp;my other paths&amp;nbsp;face the opposite direction, and that's why they happen to turn out as I intended.&amp;nbsp; It's pretty obvious once you think about it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even for a 2D profile and 2D path,&amp;nbsp;I don't think there's a way to&amp;nbsp;anticipate the user's intent.&amp;nbsp; So I'll just let the profile fall as it may, and&amp;nbsp;allow the user to correct as paths are selected.&amp;nbsp; Giving a preview of the completed sweep will be critical.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 01 Sep 2018 17:57:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8239742#M15587</guid>
      <dc:creator>metd01567</dc:creator>
      <dc:date>2018-09-01T17:57:32Z</dc:date>
    </item>
    <item>
      <title>Re: Cloning and moving a profile, while keeping it linked to the original.</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8240240#M15588</link>
      <description>&lt;P&gt;Sorry&amp;nbsp;for thrashing.&amp;nbsp;&amp;nbsp;An even number of wrongs makes something that looks right, until you've done enough testing.&amp;nbsp; You'll notice that the profile in the SlotProfile sketch&amp;nbsp;is oriented oddly, so my test case was skewed (a.k.a. wrong).&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;It should have been draw as if looking&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;along&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;one of the&amp;nbsp;paths, with the slot below rather than to the right.&amp;nbsp;&amp;nbsp;In effect that's what a Fusion 360's user&amp;nbsp;does&amp;nbsp;by&amp;nbsp;creating&amp;nbsp;a "plane along path", then drawing the sweep profile on that construction plane.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I recently read&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://modthemachine.typepad.com/files/mathgeometry.pdf" target="_blank"&gt;Bob Ekin's paper on Inventor math and geometry&lt;/A&gt;, which he says is mostly applicable to Fusion 360.&amp;nbsp;&amp;nbsp;It reminded me about U,V coordinates and that's&amp;nbsp;the way to look at my profile's reference sketch.&amp;nbsp;&amp;nbsp;In effect I create a matrix to map the sketch's curves to the path's&amp;nbsp;start&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;plane.&amp;nbsp; As the method name suggests, the matrix is: set to rotate [the reference plane's z axis vector] to [the path's tangent vector].&lt;/P&gt;&lt;PRE&gt;transform.setToRotateTo(selectedSketch.referencePlane.geometry.normal, pathTangent)&lt;/PRE&gt;&lt;P&gt;Applying that matrix to the sketch curves (or entities derived from them) has the desired effect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It does matter&amp;nbsp;that&amp;nbsp;the sketch's axis of asymmetry&amp;nbsp;is oriented to the path's plane,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;so&amp;nbsp;I can&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;only get&amp;nbsp;reliable&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;defaults&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;when all&amp;nbsp;paths&amp;nbsp;start in&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;a common&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;2D plane.&amp;nbsp; When that's not the case, or the profile is completely asymmetric, additional input&amp;nbsp;may&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;needed for each path.&amp;nbsp; The user must be able to flip and/or rotate the profile independently for each path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is&amp;nbsp;good&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;enough to accomplish my original task.&amp;nbsp; I'll clean things up and test it a bit more before posting the script and sample file again.&amp;nbsp; Hopefully I'll just stop at that point.&lt;/P&gt;</description>
      <pubDate>Sun, 02 Sep 2018 12:03:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8240240#M15588</guid>
      <dc:creator>metd01567</dc:creator>
      <dc:date>2018-09-02T12:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Cloning and moving a profile, while keeping it linked to the original.</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8245177#M15589</link>
      <description>&lt;P&gt;Since the thin extrusion overlaps the swept body, I could just join&amp;nbsp;them.&amp;nbsp; I tried with the user interface after running the script.&amp;nbsp; I end up with a single body that responds to changes in the "reference" profile as desired.&amp;nbsp; Note I intersected to trim the extrusion before joining.&amp;nbsp; Some of my paths start with an arc, and although the extrusion is thin it&amp;nbsp;could deviate slightly.&amp;nbsp; Since they are guaranteed to fully intersect at the start face, I won't loose anything.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not completely satisfied with this approach.&amp;nbsp; &amp;nbsp;The model is clean but the timeline shows the extrusion, intersection and join operations.&amp;nbsp; A user will probably be confused.&amp;nbsp; I don't mind so much that it's messy under the covers,&amp;nbsp;but I don't want to give the user any surprises.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll code this up, but I'm still open to better ideas ...&lt;/P&gt;</description>
      <pubDate>Tue, 04 Sep 2018 23:19:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8245177#M15589</guid>
      <dc:creator>metd01567</dc:creator>
      <dc:date>2018-09-04T23:19:41Z</dc:date>
    </item>
    <item>
      <title>Re: Cloning and moving a profile, while keeping it linked to the original.</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8286165#M15590</link>
      <description>&lt;P&gt;I finally noticed that Matrix3D.setRotationTo has an optional third parameter.&amp;nbsp; It is described as:&amp;nbsp;"The optional axis argument may be used when the two vectors are perpendicular and in opposite directions to specify a specific solution".&amp;nbsp; "perpendicular and opposite directions" is exactly the test case that has been failing.&amp;nbsp; Once I figured out &lt;A href="https://forums.autodesk.com/t5/fusion-360-api-and-scripts/sketch-returns-another-sketch-instead-of-referenceplane/m-p/8281174/highlight/true#M6633" target="_blank"&gt;how to get the normal to the sketch containing the path curves&lt;/A&gt;, my test cases now work without additional input.&amp;nbsp; I still won't claim thorough testing, but I'm happy enough for now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 22 Sep 2018 18:10:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/cloning-and-moving-a-profile-while-keeping-it-linked-to-the/m-p/8286165#M15590</guid>
      <dc:creator>metd01567</dc:creator>
      <dc:date>2018-09-22T18:10:13Z</dc:date>
    </item>
  </channel>
</rss>

