Beispiel #1
0
    else:
        world = rs.WorldXYPlane()
        xform1 = rs.XformChangeBasis(world,basePlane)
        xform2 = rs.XformChangeBasis (targetPlane,world)
        xform_final = rs.XformMultiply(xform2,xform1)
        transform = rs.TransformObjects(objects,xform_final,copy)
        return transform

def create_cut_sht(stockOutline,array,features,partSpacing,margin):
    """ """
    numParts = len(array)
    basePlanes = generate_base_planes_from_array(array)
    targetPlanes = create_cut_sht_targets(stockOutline,array,margin,partSpacing)
    if targetPlanes == None:
        return None
    else:
        # converts GH branch to python list for a set of features
        features = [item for item in features.Branches]
        cut_sht = []
        for i in range(numParts):
            objects = [array[i]]
            for item in features[i]:
                objects.append(item)
            cutPart = reorient_objects(objects,basePlanes[i],targetPlanes[i])
            cut_sht.append(cutPart)
    return cut_sht
    
###############################################################################
a = trees.list_to_tree(generate_base_planes_from_array(array))
b = create_cut_sht_targets(stockOutline,array,margin,partSpacing)
c = trees.list_to_tree(create_cut_sht(stockOutline,array,features,partSpacing,margin))
Beispiel #2
0
        xform_final = rs.XformMultiply(xform2, xform1)
        transform = rs.TransformObjects(objects, xform_final, copy)
        return transform


def create_cut_sht(stockOutline, array, features, partSpacing, margin):
    """ """
    numParts = len(array)
    basePlanes = generate_base_planes_from_array(array)
    targetPlanes = create_cut_sht_targets(stockOutline, array, margin,
                                          partSpacing)
    if targetPlanes == None:
        return None
    else:
        # converts GH branch to python list for a set of features
        features = [item for item in features.Branches]
        cut_sht = []
        for i in range(numParts):
            objects = [array[i]]
            for item in features[i]:
                objects.append(item)
            cutPart = reorient_objects(objects, basePlanes[i], targetPlanes[i])
            cut_sht.append(cutPart)
    return cut_sht


###############################################################################
a = trees.list_to_tree(generate_base_planes_from_array(array))
b = create_cut_sht_targets(stockOutline, array, margin, partSpacing)
c = trees.list_to_tree(
    create_cut_sht(stockOutline, array, features, partSpacing, margin))
Beispiel #3
0
            slots.append((partIndex, slot))
            ## create neighbor slot
            testPoint = rs.CurveEndPoint(line[1])
            distance = rs.Distance(startPoint, testPoint)
            if distance != 0:
                startPoint = testPoint
            else:
                startPoint = rs.CurveStartPoint(line[1])
            slot = rs.AddLine(startPoint, endPoint)
            slots.append((line[0], slot))
    return slots


#=============================================================================
def create_all_slots(array):
    """Creates slots for all srfs. in an array. Returns a 2D list with 
       slots grouped by part."""
    numItems = len(array)
    slotCollection = [[] for i in range(numItems)]

    for i in xrange(numItems):
        currentSlots = create_slots(array, i)
        if currentSlots != None:
            for slot in currentSlots:
                slotCollection[slot[0]].append(slot[1])
    return slotCollection


######################################################
slots = trees.list_to_tree(create_all_slots(array))
Beispiel #4
0
            slot = rs.AddLine(startPoint,endPoint)
            slots.append((partIndex,slot))
            ## create neighbor slot
            testPoint = rs.CurveEndPoint(line[1])
            distance = rs.Distance(startPoint,testPoint)
            if distance != 0:
                startPoint = testPoint
            else:
                startPoint = rs.CurveStartPoint(line[1])
            slot = rs.AddLine(startPoint,endPoint)
            slots.append((line[0],slot))
    return slots

#=============================================================================
def create_all_slots (array):
    """Creates slots for all srfs. in an array. Returns a 2D list with 
       slots grouped by part."""
    numItems = len(array)
    slotCollection =[[] for i in range(numItems)]
    
    for i in xrange (numItems):
        currentSlots = create_slots(array,i)
        if currentSlots != None:
            for slot in currentSlots:
                slotCollection[slot[0]].append(slot[1])
    return slotCollection

######################################################
slots = trees.list_to_tree(create_all_slots (array))