def test_press(self): lego_pack = load_package("lego") lego_pack.load_data() part1 = deepcopy(lego_pack.parts[0]) part2 = deepcopy(lego_pack.parts[0]) options = part1.options(part2) option1 = options[1] press = Press(option1) #is this a valid operation? this is determined by whether or not it is meaningful. tool = Human() #tool = Robot() steps = press.instructions(tool) print steps
#!/usr/bin/python import skdb from skdb import settings, Mate import os #load a screw screw_package = skdb.load_package("screw") screws = screw_package.load(open(os.path.join(settings.package_path("screw"),"data.yaml")),only_classes="<class 'screw.Screw'>") #load from "data.yaml" #print out your screws if you want for screw in screws: assert screw.makes_sense() == True, "the screw must make sense" #the data sucked #load a bearing #the bearing package at the moment is a dummy package and isn't really important bearing_pack = skdb.load_package("bearing") stuff = open(os.path.join(settings.package_path("bearing"),"data.yaml")) bearings = bearing_pack.load(stuff, only_classes="<class 'bearing.Bearing'>") #how can this be simplified? for bearing in bearings: assert bearing.makes_sense() == True, "the bearing must make sense" #the data sucked def visualize_and_pause(result): '''visualize the object and then wait for user input''' raw_input("visualize and pass?") assert False, "not implemented" return #this is actually a dummy object (a dummy process) class Press_Fit(skdb.Process): '''a technique to fit two things together''' def options(self, parts1, parts2): '''we're assuming that it's only a matter of whether or not two interfaces are compatible'''