Hi @john.demello .
I have never used fscad before, but I was able to create a slider joint by doing the following.
# Fusion360API Python script
import adsk.core, adsk.fusion, adsk.cam, traceback
from .fscad import *
def my_design():
# define a box (extruded square)
box = Box(3,3,5)
box.place(~box == 0,~box == 0,-box == 0)
# define a cyliinder
cylinder = Cylinder(5,1)
cylinder.place(~cylinder == 0,~cylinder == 0,-cylinder == 0)
# define box with cylindrical hole
tube = Difference(box,cylinder)
# # create occurrences of cylinder and box with cylindrical hole
occBox = tube.create_occurrence(create_children=False)
occCyl = cylinder.create_occurrence()
# define as-built joint between tube and cylinder
geoBox = createJointGeo(occBox.bRepBodies[0])
geoCyl = createJointGeo(occCyl.bRepBodies[0])
app :adsk.core.Application = adsk.core.Application.get()
des :adsk.fusion.Design = app.activeProduct
root :adsk.fusion.Component = des.rootComponent
joints = root.joints
jointInput = joints.createInput(geoBox, geoCyl)
jointInput.setAsSliderJointMotion(
adsk.fusion.JointDirections.ZAxisJointDirection)
joints.add(jointInput)
def createJointGeo(body):
def getCylinderFace(faces):
for face in faces:
if face.geometry.objectType == 'adsk::core::Cylinder':
return face
return None
face = getCylinderFace(body.faces)
if not face:
return
return adsk.fusion.JointGeometry.createByNonPlanarFace(
face,
adsk.fusion.JointKeyPointTypes.StartKeyPoint)
def run(context):
# This is an fscad helper function to set up a new document that will be populated by this script. It will call
# the specified function (my_design) after creating and setting up a fresh document.
run_design(my_design, message_box_on_error=False, document_name=__name__)
Given that the wrapper doesn't include the joint, isn't it assumed that the assembly is not used?