Beispiel #1
0
def make_jigs(b, diam, bdiam):
    jig_base_height = 4. / 12
    jig_clearance = .25 / 12

    #	for s in [b.tof[i] for i in [0,2,5,7]]:
    for s in b.tof:
        r = 90

        width = 5 * b.deckString.thickness
        height = s.keel_hab + 2 * b.deckString.width + jig_base_height
        p = [s.section, 0, 0]
        rect = x_rectangle_cut_out(
            p, width, height, b.deckString.thickness + 2 * jig_clearance,
            height - jig_base_height + jig_clearance + b.deckString.width)
        rect = [rs.MoveObject(rect, [0, 0, -jig_base_height])]
        plane = rs.PlaneFromNormal([s.section, 0, 0], [1, 0, 0])
        holes = [
            rs.MoveObject(rs.AddCircle(plane, diam / 2), [
                0, 1.5 * b.deckString.thickness,
                s.keel_hab + b.deckString.width
            ])
        ]
        holes.extend(rs.MirrorObjects(holes, p, ss(p, [1, 0, 0]), copy=True))
        bhole = rs.MoveObject(rs.AddCircle(plane, bdiam / 2),
                              [0, 0, 47. / 64 / 12 - jig_base_height])
        holes.extend([bhole, rs.CopyObject(bhole, [0, 0, 1.5 / 12])])
        rs.RotateObjects(rect + holes, p, 90, [0, 1, 0])
Beispiel #2
0
def draw_chine(b):
    objs = []
    for i in range(len(b.tof) - 1):
        p1 = [b.tof[i].section, b.tof[i].chine_hb, b.tof[i].chine_hab]
        p2 = [
            b.tof[i + 1].section, b.tof[i + 1].chine_hb, b.tof[i + 1].chine_hab
        ]
        objs.append(rs.AddLine(p1, p2))
    h = (b.tof[0].chine_hab - b.tof[1].chine_hab) * (
        b.tof[0].section - b.chine) / (b.tof[1].section -
                                       b.tof[0].section) + b.tof[0].chine_hab
    p1 = [b.chine, 0, h]
    objs.append(
        rs.AddLine(p1,
                   [b.tof[0].section, b.tof[0].chine_hb, b.tof[0].chine_hab]))
    objs.append(rs.AddLine([0, 0, b.bow], p1))
    h = (b.tof[-1].chine_hab -
         b.tof[-2].chine_hab) * (b.loa - b.aft - b.tof[-1].section) / (
             b.tof[-1].section - b.tof[-2].section) + b.tof[-1].chine_hab
    p2 = [b.loa - b.aft, 0, h]
    objs.append(
        rs.AddLine(
            p2, [b.tof[-1].section, b.tof[-1].chine_hb, b.tof[-1].chine_hab]))
    objs.append(rs.AddLine([b.loa, 0, b.stern], p2))
    rs.MirrorObjects(objs, [0, 0, 0], [1, 0, 0], copy=True)
    return lengths(objs)
Beispiel #3
0
def draw_frame(s):
    objs = []
    objs.append(
        rs.AddLine([s.section, 0, s.keel_hab],
                   [s.section, s.chine_hb, s.chine_hab]))
    objs.append(
        rs.AddLine([s.section, s.chine_hb, s.chine_hab],
                   [s.section, s.gunwale_hb, s.gunwale_hab]))
    objs.append(
        rs.AddLine([s.section, s.gunwale_hb, s.gunwale_hab],
                   [s.section, s.deckridge_hb, s.deckridge_hab]))
    if (s.deckridge_hb != 0):
        objs.append(
            rs.AddLine([s.section, s.deckridge_hb, s.deckridge_hab],
                       [s.section, 0., s.deckridge_hab]))
    rs.MirrorObjects(objs, [0, 0, 0], [1, 0, 0], copy=True)
Beispiel #4
0
def x_rectangle_cut_out(p, width, height, w_i, h_i):
    objs = []
    objs.append(rs.AddLine(p, ss(p, [0, .5 * width, 0])))
    objs.append(
        rs.AddLine(ss(p, [0, .5 * width, 0]), ss(p, [0, .5 * width, height])))
    objs.append(
        rs.AddLine(ss(p, [0, .5 * width, height]), ss(p,
                                                      [0, .5 * w_i, height])))
    objs.append(
        rs.AddLine(ss(p, [0, .5 * w_i, height]),
                   ss(p, [0, .5 * w_i, height - h_i])))
    objs.append(
        rs.AddLine(ss(p, [0, .5 * w_i, height - h_i]),
                   ss(p, [0, 0, height - h_i])))
    objs.extend(rs.MirrorObjects(objs, p, ss(p, [1, 0, 0]), copy=True))
    return rs.JoinCurves(objs, delete_input=True)
Beispiel #5
0
def draw_gunwale(b):
    objs = []
    bf = 0
    for i in range(len(b.tof) - 1):
        p1 = [b.tof[i].section, b.tof[i].gunwale_hb, b.tof[i].gunwale_hab]
        p2 = [
            b.tof[i + 1].section, b.tof[i + 1].gunwale_hb,
            b.tof[i + 1].gunwale_hab
        ]
        objs.append(rs.AddLine(p1, p2))
    objs.append(
        rs.AddLine(
            [0, 0, b.bow],
            [b.tof[0].section, b.tof[0].gunwale_hb, b.tof[0].gunwale_hab]))
    objs.append(
        rs.AddLine(
            [b.loa, 0, b.stern],
            [b.tof[-1].section, b.tof[-1].gunwale_hb, b.tof[-1].gunwale_hab]))
    rs.MirrorObjects(objs, [0, 0, 0], [1, 0, 0], copy=True)
    return lengths(objs)
Beispiel #6
0
def add_tickmarks(rect, len, offset):

    c, _ = rs.CurveAreaCentroid(rect)
    mirror_v = [c, rs.PointAdd(c, [0, 10, 0])]
    mirror_h = [c, rs.PointAdd(c, [10, 0, 0])]

    pts = rs.CurvePoints(rect)
    if not pts:
        return "ERROR"
    pts = rs.SortPoints(pts)
    # print pts

    t_0 = rs.CopyObject(pts[0], [offset, offset, 0])
    t_1 = rs.CopyObject(t_0, [len, 0, 0])
    t_2 = rs.CopyObject(t_0, [0, len, 0])

    tick = rs.AddPolyline([t_1, t_0, t_2])
    rs.DeleteObjects([t_0, t_1, t_2])
    tick_2 = rs.MirrorObject(tick, mirror_v[0], mirror_v[1], True)
    ticks_3 = rs.MirrorObjects([tick, tick_2], mirror_h[0], mirror_h[1], True)
    rs.ObjectLayer([tick, tick_2] + ticks_3, LCUT_NAMES[3])
    tick_list = [tick, tick_2] + ticks_3
    return tick_list
Beispiel #7
0
def draw_frame_layout(s, keel_str, chine_str, gunwale_str, deck_str, diam,
                      bdiam):
    objs = []
    t = [0, 2 * s.gunwale_hb, 0]
    r = 90
    #	t = [0,0,0]
    #	r = 0

    objs.append(
        rs.AddLine([s.section, 0, s.keel_hab],
                   [s.section, s.chine_hb, s.chine_hab]))
    objs.append(
        rs.AddLine([s.section, s.chine_hb, s.chine_hab],
                   [s.section, s.gunwale_hb, s.gunwale_hab]))
    objs.append(
        rs.AddLine([s.section, s.gunwale_hb, s.gunwale_hab],
                   [s.section, s.deckridge_hb, s.deckridge_hab]))
    if (s.deckridge_hb != 0):
        objs.append(
            rs.AddLine([s.section, s.deckridge_hb, s.deckridge_hab],
                       [s.section, 0., s.deckridge_hab]))
    objs.extend(rs.MirrorObjects(objs, [0, 0, 0], [1, 0, 0], copy=True))
    objs = rs.JoinCurves(objs, delete_input=True)

    #ins = rs.OffsetCurve(objs,[s.section,0,.5*s.deckridge_hab],s.width + .75*deck_str.width,normal=[1,0,0])
    #	if not ins: ins = []
    ins = []
    rs.DeleteObjects(objs)

    chine_edge = make_chine_edge([s.section, s.chine_hb, s.chine_hab],
                                 [s.section, s.gunwale_hb, s.gunwale_hab],
                                 chine_str.thickness, gunwale_str.thickness,
                                 chine_str.width, gunwale_str.width,
                                 [s.section, s.deckridge_hb, s.deckridge_hab])
    keel_edge = make_keel_edge([s.section, 0, s.keel_hab],
                               [s.section, s.chine_hb, s.chine_hab],
                               keel_str.thickness, keel_str.width,
                               [s.section, s.gunwale_hb, s.gunwale_hab])
    deck_edge = make_deck_edge([s.section, s.gunwale_hb, s.gunwale_hab],
                               [s.section, s.deckridge_hb, s.deckridge_hab],
                               deck_str.thickness, gunwale_str.thickness,
                               deck_str.width,
                               [s.section, s.chine_hb, s.chine_hab],
                               s.deck_string_place)

    edges = chine_edge + keel_edge + deck_edge
    edges.extend(rs.MirrorObjects(edges, [0, 0, 0], [1, 0, 0], copy=True))
    edges = rs.JoinCurves(edges, delete_input=True)
    edges.extend(
        rs.OffsetCurve(edges, [s.section, 0, .5 * s.deckridge_hab],
                       s.width,
                       normal=[1, 0, 0],
                       style=3))
    g = rs.AddGroup()
    rs.AddObjectsToGroup(edges, g)

    #	if s.num-1 in [0,2,5,7]:
    if 1:
        p = [s.section, 0, 0]
        plane = rs.PlaneFromNormal(p, [1, 0, 0])
        holes = [
            rs.MoveObject(
                rs.AddCircle(plane, diam / 2),
                [0, 1.5 * deck_str.thickness, s.keel_hab + deck_str.width])
        ]
        holes.extend(rs.MirrorObjects(holes, p, ss(p, [1, 0, 0]), copy=True))
    else:
        holes = []

    rs.MoveObjects(
        rs.RotateObjects(ins + edges + holes, [s.section, 0, s.keel_hab], r,
                         [0, 1, 0]), t)
Beispiel #8
0
def quad_mirror_object(object_id):
    _mirror = rss.MirrorObject(object_id, (0, -1, 0), (0, 1, 0), copy=True)
    return [object_id, _mirror] + rss.MirrorObjects((object_id, _mirror), (-1, 0, 0), (1, 0, 0), copy=True)