Creating a loft that is tangent to the surface profile

Creating a loft that is tangent to the surface profile

Anonymous
Not applicable
1,807 Views
5 Replies
Message 1 of 6

Creating a loft that is tangent to the surface profile

Anonymous
Not applicable

Is there any way in the API to make my loft be tangent to the profile section? In the UI, if a face is selected as a profile for a loft, I have the option to make the loft through that section "Connected (G0)", "Tangent (G1)", or "Curvature (G2)". I cannot find any way to change these options in the API. 

Accepted solutions (1)
1,808 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

I also have a very similar problem, just posted my question then I saw yours! There definitely is a solution, but I couldn't implement it. hope to get some answers!:)

Message 3 of 6

marshaltu
Autodesk
Autodesk
Accepted solution

Hello,

 

Please refer to the following sample how to set end condition.

 

Thanks,

Marshal

 

import adsk.core, adsk.fusion, traceback

def run(context):
  ui = None
  try:
    app = adsk.core.Application.get()
    ui  = app.userInterface
    
    design = adsk.fusion.Design.cast(app.activeProduct)
    root = design.rootComponent
    
    plane = adsk.fusion.BRepFace.cast(ui.activeSelections.item(0).entity)
    edgesOnPlane = adsk.core.ObjectCollection.create()
    for item in plane.edges:
        edgesOnPlane.add(item)
    path1 = adsk.fusion.Path.create(edgesOnPlane, adsk.fusion.ChainedCurveOptions.noChainedCurves)
    cylinder = adsk.fusion.BRepFace.cast(ui.activeSelections.item(1).entity)
    edgesOnCylinder = adsk.core.ObjectCollection.create()
    for item in cylinder.edges:
        edgesOnCylinder.add(item)
    path2 = adsk.fusion.Path.create(edgesOnCylinder, adsk.fusion.ChainedCurveOptions.noChainedCurves)
    
    lofts = root.features.loftFeatures
    input = lofts.createInput(adsk.fusion.FeatureOperations.JoinFeatureOperation)
    
    section1 = input.loftSections.add(path1)
    section1.setTangentEndCondition(adsk.core.ValueInput.createByReal(1.0))
    section2 = input.loftSections.add(path2)
    section2.setSmoothEndCondition(adsk.core.ValueInput.createByReal(1.0))
    
    lofts.add(input)

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

loft1.png

 

loft2.png



Marshal Tu
Fusion Developer
>
Message 4 of 6

Anonymous
Not applicable

Marshall,

 

Thanks for the help! That is exactly what I needed, except for some reason it will not let me make one of the profiles tangent. I have a body that I mirrored, then I am trying to loft the ends together. I don't know what the difference is but it will only let me apply a tangent geometry to one of the two faces (it's always the same face too, even though I am grabbing the faces the same way for both. 

 

I can send code if that is easier, but it is kind of a lengthy script. TangentLoftFail.PNG

0 Likes
Message 5 of 6

marshaltu
Autodesk
Autodesk

Hello,

 

Please send me (marshal dot me at autodesk dot com) sample codes and the design to reproduce the issue. 

 

Thanks,

Marshal



Marshal Tu
Fusion Developer
>
0 Likes
Message 6 of 6

Anonymous
Not applicable

I will send you my code. Thank you again!

0 Likes