Skip to content

CheatSheet

Ben Gruver edited this page Feb 17, 2019 · 2 revisions

Starter script

import adsk.core, adsk.fusion
from fscad import *

def design():
    sphere = Sphere(1)
    sphere.create_occurrence(True, scale=.1)

def run(_):
    run_design(design, message_box_on_error=False, document_name=__name__)

2D

3D

Boolean Operations

Placement

Component.place(x, y, z)

Operators:

  • - minimum
  • ~ middle
  • + maximum

Usage:

  •    component1.place(~component1 == ~component2, # align the midpoint of component 1 with the midpoint of component 2 in the x axis
                     -component1 == -component2, # align the min point of component 1 with the min point of component 2 in the y axis
                     +component1 == +component2) # align the max point (top) of component 1 with the max point of component 2 in the z axis
    
  • with offsets

      component1.place((~component1 == ~component2) + 10, # align the midpoints, with an additional offset of 10
                       (-component1 == -component2) - 2, # align the min points, with an additional offset of -2
                       (+component1 == +component2) + 1) # align the max points, with an additional offset of 1
    
  • place at a specific numeric location

      component1.place(~component1 == 10, # place the mid x point at x=10
                       -component1 == 5, # place the min y point at y=5
                       +component1 == -10) # place the max z point at z=-10
    
  • and of course, you can mix and match operators

      component1.place(~component1 == +component2,
                       -component1 == ~component2,
                       +component1 == -component2)
    

Transformations