Setting up a configured joint suppression through the API

Setting up a configured joint suppression through the API

sandy_mader
Observer Observer
193 Views
0 Replies
Message 1 of 1

Setting up a configured joint suppression through the API

sandy_mader
Observer
Observer

I am trying to setup a configured design that has suppression columns for joints using the API. I have successfully setup the configuration I want using the fusion GUI, but when I try to use the API functions to do the same thing I am getting an error. I have a simple code example with a couple of boxes that reproduces the error:

def create_box_component(comp_name,body_name,rootComp):
    # Create the first component (for Box 1)
    comp = rootComp.occurrences.addNewComponent(adsk.core.Matrix3D.create())
    compComponent = comp.component
    compComponent.name = comp_name

    # Create a sketch for Box 1 in Component 1
    sketches = compComponent.sketches
    xyPlane = compComponent.xYConstructionPlane
    box = sketches.add(xyPlane)
    box.name = body_name

    # Draw a rectangle for Box 1
    box.sketchCurves.sketchLines.addTwoPointRectangle(adsk.core.Point3D.create(0, 0, 0), adsk.core.Point3D.create(5, 5, 0))

    # Extrude the rectangle to create the box
    extrudes = compComponent.features.extrudeFeatures
    profile = box.profiles.item(0)
    extrude = extrudes.addSimple(profile, adsk.core.ValueInput.createByString('5 cm'), adsk.fusion.FeatureOperations.NewBodyFeatureOperation)
    box_body = extrude.bodies.item(0)
    joint_vertex = box_body.vertices.item(0)
    joint_origins = compComponent.jointOrigins
    joint_origin_input = joint_origins.createInput(
            adsk.fusion.JointGeometry.createByPoint(joint_vertex)
        )
    joint_origin = joint_origins.add(joint_origin_input)
    joint_origin.name = comp_name+body_name
    return comp
    
def mre_func():
    app = adsk.core.Application.get()
    ui = app.userInterface
    doc = app.documents.add(adsk.core.DocumentTypes.FusionDesignDocumentType)
    design = app.activeProduct
    configuration = design.createConfiguredDesign()
     
    # Create the first box
    rootComp = design.rootComponent

    occurrence1 = create_box_component("comp1","box1",rootComp)
    occurrence2 = create_box_component("comp2","box2",rootComp)

    joint_origins1 = occurrence1.component.jointOrigins
    joint_origins2 = occurrence2.component.jointOrigins
        
    # Select the first joint origin from each component
    joint_origin_1 = joint_origins1.item(0)
    joint_origin_2 = joint_origins2.item(0)
    joint_origin_1 = joint_origin_1.createForAssemblyContext(occurrence1)
    joint_origin_2 = joint_origin_2.createForAssemblyContext(occurrence2)
        
    # Create the Rigid Joint
    joints = rootComp.joints
    joint_input = joints.createInput(joint_origin_1, joint_origin_2)
    joint_input.setAsRigidJointMotion()

    # Add the joint
    joint1 = joints.add(joint_input)

    ui.messageBox('Created two boxes and a joint between them!')

    # now setup a basic configuration
    rows = configuration.rows
    rows.item(0).name = "On"
    rows.add("off")
    
    columns = configuration.columns
    suppress_col = columns.addSuppressColumn(joint1)
 

the error that is produced is:

 suppress_col = columns.addSuppressColumn(joint1)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users/sandy/AppData/Local/Autodesk/webdeploy/production/0d4a490e3a4c20bf204fb2326f1e9779241ce658/Api/Python/packages\adsk\fusion.py", line 17368, in addSuppressColumn
    return _fusion.ConfigurationColumns_addSuppressColumn(self, feature)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: 2 : InternalValidationError : !columnFeatureInfo.empty()

According to this API help page:
https://help.autodesk.com/view/fusion360/ENU/?guid=GUID-11DF4DEB-E6A8-4EA3-9D50-93F7F3E9FE4E

The input to this add column type is a base type which can be modeled features, sketch geometry, construction geometry or joints. 
I realize this is a preview feature in the API, so I am trying to understand whether I have reference the joint incorrectly of if this is a bug/missing functionality in the API.

0 Likes
194 Views
0 Replies
Replies (0)