Make me Flow charts in pdf

I'll read the PDF skill first, then extract the content from the attached PDF to create flowcharts.
Reading File
Now let me extract the content from the uploaded PDF:
Running Command

cd /home/daytona/workspace && python3 -c " import pdfplumber with pdfplumber.open('attachments/e93075ad-6052-4b7d-a218-b9ae1cc3e60d/Circulatory system.pdf') as pdf: print(f'Pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages): print(f'--- PAGE {i+1} ---') text = page.extract_text() if text: print(text[:3000]) print() "

I have all the content. Now I'll create a multi-page PDF with well-designed flowcharts covering all the key topics from the document.
Running Command

mkdir -p /home/daytona/workspace/circulatory-flowcharts && python3 << 'PYEOF' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.units import cm, mm from reportlab.pdfgen import canvas from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle from reportlab.platypus import Paragraph from reportlab.lib.enums import TA_CENTER, TA_LEFT import math W, H = A4 # 595.27, 841.89 # ─── Color Palette ──────────────────────────────────────────────────────────── RED = colors.HexColor("#C0392B") DARK_RED = colors.HexColor("#922B21") BLUE = colors.HexColor("#2980B9") DARK_BLUE = colors.HexColor("#1A5276") GREEN = colors.HexColor("#27AE60") DARK_GREEN= colors.HexColor("#1E8449") PURPLE = colors.HexColor("#8E44AD") DARK_PURP = colors.HexColor("#6C3483") ORANGE = colors.HexColor("#E67E22") DARK_ORAN = colors.HexColor("#BA6006") TEAL = colors.HexColor("#16A085") DARK_TEAL = colors.HexColor("#0E6655") BG = colors.HexColor("#F8F9FA") LIGHT_GRAY= colors.HexColor("#ECF0F1") DARK_GRAY = colors.HexColor("#2C3E50") WHITE = colors.white ARROW_CLR = colors.HexColor("#555555") def draw_rounded_box(c, x, y, w, h, fill_color, stroke_color, radius=8, label=None, sub=None, font_size=9, sub_size=7.5, text_color=WHITE): c.setFillColor(fill_color) c.setStrokeColor(stroke_color) c.setLineWidth(1.5) c.roundRect(x, y, w, h, radius, fill=1, stroke=1) if label: c.setFillColor(text_color) c.setFont("Helvetica-Bold", font_size) lines = label.split('\n') total_h = len(lines) * (font_size + 2) start_y = y + h/2 + total_h/2 - font_size if sub: start_y += 5 for i, line in enumerate(lines): c.drawCentredString(x + w/2, start_y - i*(font_size+2), line) if sub: c.setFont("Helvetica", sub_size) c.setFillColor(colors.HexColor("#DDDDDD")) sub_lines = sub.split('\n') sub_start = y + h/2 - total_h/2 - 2 for i, sl in enumerate(sub_lines): c.drawCentredString(x + w/2, sub_start - i*(sub_size+1.5), sl) def draw_diamond(c, cx, cy, w, h, fill_color, stroke_color, label=None, font_size=8): pts = [cx, cy+h/2, cx+w/2, cy, cx, cy-h/2, cx-w/2, cy] path = c.beginPath() path.moveTo(pts[0], pts[1]) path.lineTo(pts[2], pts[3]) path.lineTo(pts[4], pts[5]) path.lineTo(pts[6], pts[7]) path.close() c.setFillColor(fill_color) c.setStrokeColor(stroke_color) c.setLineWidth(1.5) c.drawPath(path, fill=1, stroke=1) if label: c.setFillColor(WHITE) c.setFont("Helvetica-Bold", font_size) lines = label.split('\n') for i, line in enumerate(lines): c.drawCentredString(cx, cy + (len(lines)-1)/2*(font_size+1) - i*(font_size+1), line) def arrow(c, x1, y1, x2, y2, color=ARROW_CLR, label=None, label_offset=(0,4)): c.setStrokeColor(color) c.setLineWidth(1.4) c.line(x1, y1, x2, y2) # arrowhead angle = math.atan2(y2-y1, x2-x1) asz = 6 for da in [0.4, -0.4]: ax = x2 - asz*math.cos(angle - da) ay = y2 - asz*math.sin(angle - da) c.line(x2, y2, ax, ay) if label: mx, my = (x1+x2)/2 + label_offset[0], (y1+y2)/2 + label_offset[1] c.setFillColor(DARK_GRAY) c.setFont("Helvetica", 7) c.drawCentredString(mx, my, label) def page_title(c, title, subtitle=None): # header bar c.setFillColor(DARK_GRAY) c.rect(0, H-50, W, 50, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 16) c.drawCentredString(W/2, H-32, title) if subtitle: c.setFont("Helvetica", 9) c.setFillColor(colors.HexColor("#BDC3C7")) c.drawCentredString(W/2, H-44, subtitle) # footer c.setFillColor(DARK_GRAY) c.rect(0, 0, W, 18, fill=1, stroke=0) c.setFillColor(colors.HexColor("#BDC3C7")) c.setFont("Helvetica", 7) c.drawCentredString(W/2, 5, "Source: THIEME Atlas of Anatomy – General Anatomy and Musculoskeletal System") # ══════════════════════════════════════════════════════════════════════════════ out = "/home/daytona/workspace/circulatory-flowcharts/Circulatory_System_Flowcharts.pdf" c = canvas.Canvas(out, pagesize=A4) # ══════════════════════════════════════════════════════════════════════════════ # PAGE 1 – OVERVIEW OF THE CIRCULATORY SYSTEM # ══════════════════════════════════════════════════════════════════════════════ c.setFillColor(BG) c.rect(0, 0, W, H, fill=1, stroke=0) page_title(c, "THE CIRCULATORY SYSTEM – OVERVIEW", "THIEME Atlas of Anatomy | Sections 6.1 – 6.3") bw, bh = 200, 36 lm = (W - bw) / 2 # Box helper def box(label, y, fc, sc, sub=None): draw_rounded_box(c, lm, y, bw, bh, fc, sc, label=label, sub=sub, font_size=9) # Flow boxes top → bottom rows = [ (780, "CIRCULATORY SYSTEM", DARK_GRAY, colors.HexColor("#1A252F"), None), (730, "Central Pump: HEART", DARK_RED, RED, None), ] for y, lbl, fc, sc, sub in rows: box(lbl, y, fc, sc, sub) arrow(c, W/2, 780, W/2, 766) arrow(c, W/2, 730, W/2, 716) # Three components branching out bw3 = 155; bh3 = 36; gap = 18 total3 = 3*bw3 + 2*gap lx3 = (W - total3)/2 y3 = 680 boxes3 = [ ("Vascular System\n(Arteries, Capillaries, Veins)", RED, colors.HexColor("#7B241C")), ("Heart\n(Central Pump)", BLUE, DARK_BLUE), ("Lymphatic System\n(Parallel to veins)", GREEN, DARK_GREEN), ] cx_list = [] for i,(lbl,fc,sc) in enumerate(boxes3): bx = lx3 + i*(bw3+gap) cx_list.append(bx + bw3/2) draw_rounded_box(c, bx, y3, bw3, bh3, fc, sc, label=lbl, font_size=8) # arrows from heart centre box hcx = W/2 for cx in cx_list: arrow(c, hcx, 716, cx, y3+bh3) # Arrow rule box ry = 630 c.setFillColor(colors.HexColor("#FEF9E7")) c.setStrokeColor(colors.HexColor("#F39C12")) c.setLineWidth(1.2) c.roundRect(50, ry, W-100, 38, 8, fill=1, stroke=1) c.setFillColor(colors.HexColor("#7D6608")) c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(W/2, ry+24, "KEY RULE:") c.setFont("Helvetica", 8) c.drawCentredString(W/2, ry+11, "Arteries = vessels AWAY from heart | Veins = vessels TOWARD heart (regardless of O₂ content)") # Two circuits side by side arrow(c, W/2, ry, W/2, ry-14) y4 = 560; bw4=200; bh4=44; gap4=30 lx4 = (W - 2*bw4 - gap4)/2 # Pulmonary draw_rounded_box(c, lx4, y4, bw4, bh4, RED, DARK_RED, label="PULMONARY\nCIRCULATION", sub="Right side of heart → Lungs", font_size=10, sub_size=7.5) # Systemic draw_rounded_box(c, lx4+bw4+gap4, y4, bw4, bh4, BLUE, DARK_BLUE, label="SYSTEMIC\nCIRCULATION", sub="Left side of heart → Body", font_size=10, sub_size=7.5) for dx in [lx4+bw4/2, lx4+bw4+gap4+bw4/2]: arrow(c, W/2, ry-14, dx, y4+bh4) # sub boxes pulmonary sy = 490; sbw=170; sbh=32 # pulmonary path psteps=[("Deoxygenated blood from body",RED), ("Superior/Inferior Vena Cava → Right Atrium",RED), ("Right Ventricle → Pulmonary Arteries",RED), ("Lungs: O₂ received",colors.HexColor("#E74C3C"))] for i,(txt,fc) in enumerate(psteps): by = sy - i*40 draw_rounded_box(c, lx4+(bw4-sbw)/2, by, sbw, sbh, fc, colors.HexColor("#7B241C"), label=txt, font_size=7) if i < len(psteps)-1: arrow(c, lx4+bw4/2, by, lx4+bw4/2, by-8) # systemic path ssteps=[("Oxygenated blood from lungs",BLUE), ("Pulmonary Veins → Left Atrium",BLUE), ("Left Ventricle → Aorta",BLUE), ("Body Tissues + Portal Circulation",colors.HexColor("#1F618D"))] rx = lx4+bw4+gap4 for i,(txt,fc) in enumerate(ssteps): by = sy - i*40 draw_rounded_box(c, rx+(bw4-sbw)/2, by, sbw, sbh, fc, DARK_BLUE, label=txt, font_size=7) if i < len(ssteps)-1: arrow(c, rx+bw4/2, by, rx+bw4/2, by-8) # arrows from circuit header to first sub box arrow(c, lx4+bw4/2, y4, lx4+bw4/2, sy+sbh) arrow(c, rx+bw4/2, y4, rx+bw4/2, sy+sbh) # Portal note pnote_y = 300 c.setFillColor(colors.HexColor("#EAF2F8")) c.setStrokeColor(BLUE) c.setLineWidth(1) c.roundRect(50, pnote_y, W-100, 52, 8, fill=1, stroke=1) c.setFillColor(DARK_BLUE) c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(W/2, pnote_y+39, "PORTAL CIRCULATION (Special Sub-Circuit)") c.setFont("Helvetica", 7.5) c.setFillColor(DARK_GRAY) c.drawCentredString(W/2, pnote_y+25, "Venous blood from stomach, bowel, pancreas, spleen") c.drawCentredString(W/2, pnote_y+13, "→ Portal Vein → Liver (filtration & metabolism) → Hepatic Veins → Inferior Vena Cava") # Figure-of-8 note fn_y = 245 c.setFillColor(colors.HexColor("#FDFEFE")) c.setStrokeColor(DARK_GRAY) c.setLineWidth(0.8) c.roundRect(50, fn_y, W-100, 32, 8, fill=1, stroke=1) c.setFillColor(DARK_GRAY) c.setFont("Helvetica-Oblique", 8) c.drawCentredString(W/2, fn_y+19, "Postnatal human circulation can be illustrated as a figure-of-eight (∞),") c.drawCentredString(W/2, fn_y+7, "with the HEART at the intersection of the two circuits.") c.showPage() # ══════════════════════════════════════════════════════════════════════════════ # PAGE 2 – BLOOD VESSEL STRUCTURE # ══════════════════════════════════════════════════════════════════════════════ c.setFillColor(BG) c.rect(0, 0, W, H, fill=1, stroke=0) page_title(c, "STRUCTURE OF BLOOD VESSELS", "Three-Layer Wall Architecture | Section 6.2") # Central vessel label cv_y = 730 draw_rounded_box(c, (W-220)/2, cv_y, 220, 40, DARK_GRAY, colors.HexColor("#1A252F"), label="BLOOD VESSEL WALL", font_size=12) arrow(c, W/2, cv_y, W/2, cv_y-14) # Three layers ly = cv_y - 70 layers = [ ("TUNICA INTIMA\n(Innermost Layer)", RED, DARK_RED, "• Endothelial cells (spindle-shaped)\n• Basement membrane\n• Subendothelial connective tissue\n• Internal elastic membrane\n (in muscular arteries)\nFUNCTION: Gas, fluid & substance exchange"), ("TUNICA MEDIA\n(Middle Layer)", ORANGE, DARK_ORAN, "• Smooth muscle cells (circular)\n• Elastic & collagenous fibers\n• Proteoglycans\n• External elastic membrane\n (in muscular arteries)\nFUNCTION: Regulates blood flow"), ("TUNICA ADVENTITIA\n(Outermost Layer)", GREEN, DARK_GREEN, "• Longitudinal connective tissue\n• Smooth muscle (in veins)\n• Autonomic nerves\n• Vasa vasorum (large vessels)\nFUNCTION: Integration into\nsurrounding tissue"), ] bw_l = 155; bh_l = 40 total_l = 3*bw_l + 2*18 lx_l = (W-total_l)/2 cx_layers = [] for i,(lbl,fc,sc,_) in enumerate(layers): bx = lx_l + i*(bw_l+18) cx_layers.append(bx + bw_l/2) draw_rounded_box(c, bx, ly, bw_l, bh_l, fc, sc, label=lbl, font_size=8) arrow(c, W/2, cv_y-14, bx+bw_l/2, ly+bh_l) # Detail boxes dy = ly - 130 for i,(lbl,fc,sc,detail) in enumerate(layers): bx = lx_l + i*(bw_l+18) bxd = bx - 5 c.setFillColor(colors.HexColor("#FDFEFE")) c.setStrokeColor(fc) c.setLineWidth(1.2) c.roundRect(bxd, dy, bw_l+10, 120, 6, fill=1, stroke=1) # colored top bar c.setFillColor(fc) c.roundRect(bxd, dy+108, bw_l+10, 14, 4, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 7) c.drawCentredString(bx+bw_l/2, dy+113, lbl.split('\n')[0]) # content c.setFillColor(DARK_GRAY) c.setFont("Helvetica", 7) for j, line in enumerate(detail.split('\n')): c.drawString(bxd+6, dy+100 - j*13, line) arrow(c, cx_layers[i], ly, cx_layers[i], dy+120) # Artery vs Vein comparison comp_y = 280 c.setFillColor(DARK_GRAY) c.rect(0, comp_y+30, W, 22, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 11) c.drawCentredString(W/2, comp_y+37, "ARTERY vs. VEIN – Structural Differences") bwc = 210; bhc = 90; gapc = 30 lxc = (W - 2*bwc - gapc)/2 # Artery box c.setFillColor(colors.HexColor("#FDEDEC")) c.setStrokeColor(RED) c.setLineWidth(1.5) c.roundRect(lxc, comp_y-70, bwc, bhc, 8, fill=1, stroke=1) c.setFillColor(RED) c.roundRect(lxc, comp_y-70+bhc-18, bwc, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 9) c.drawCentredString(lxc+bwc/2, comp_y-70+bhc-6, "ARTERIES") details_a = ["• Thick, dense smooth muscle (media)", "• Prominent internal elastic membrane", "• High-pressure system (~100 mmHg)", "• Carry blood AWAY from heart"] c.setFont("Helvetica", 7.5) c.setFillColor(DARK_GRAY) for j, d in enumerate(details_a): c.drawString(lxc+8, comp_y-70+bhc-30 - j*14, d) # Vein box rxc = lxc+bwc+gapc c.setFillColor(colors.HexColor("#EAF2F8")) c.setStrokeColor(BLUE) c.setLineWidth(1.5) c.roundRect(rxc, comp_y-70, bwc, bhc, 8, fill=1, stroke=1) c.setFillColor(BLUE) c.roundRect(rxc, comp_y-70+bhc-18, bwc, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 9) c.drawCentredString(rxc+bwc/2, comp_y-70+bhc-6, "VEINS") details_v = ["• More connective tissue (loose structure)", "• Lacks conspicuous elastic membrane", "• Low-pressure system (< 20 mmHg)", "• Carry blood TOWARD heart"] c.setFont("Helvetica", 7.5) c.setFillColor(DARK_GRAY) for j, d in enumerate(details_v): c.drawString(rxc+8, comp_y-70+bhc-30 - j*14, d) # Pressure systems table tbl_y = 130 c.setFillColor(DARK_GRAY) c.rect(40, tbl_y+28, W-80, 22, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 10) c.drawCentredString(W/2, tbl_y+35, "FUNCTIONAL PRESSURE SYSTEMS") rows_t = [("High-Pressure System","~100 mmHg","Supply function","Arteries, arterioles", DARK_RED, colors.HexColor("#FDEDEC")), ("Low-Pressure System","< 20 mmHg","Reservoir function","Veins, lungs (holds ~80% blood vol.)", DARK_BLUE, colors.HexColor("#EAF2F8"))] col_ws = [130,80,100,175] col_xs = [40, 170, 250, 350] row_h = 30 for ri,(sys,pres,role,comp,hdr_c,bg_c) in enumerate(rows_t): ry2 = tbl_y - ri*row_h c.setFillColor(bg_c) c.rect(40, ry2-row_h+8, W-80, row_h, fill=1, stroke=0) c.setStrokeColor(colors.HexColor("#C0C0C0")) c.setLineWidth(0.5) c.rect(40, ry2-row_h+8, W-80, row_h, fill=0, stroke=1) vals = [sys, pres, role, comp] c.setFont("Helvetica-Bold" if ri==0 else "Helvetica", 8) c.setFillColor(hdr_c) c.drawString(col_xs[0]+4, ry2-row_h+16, vals[0]) c.setFillColor(DARK_GRAY) for ci in range(1,4): c.drawString(col_xs[ci]+4, ry2-row_h+16, vals[ci]) c.showPage() # ══════════════════════════════════════════════════════════════════════════════ # PAGE 3 – MICROCIRCULATION & STARLING FORCES # ══════════════════════════════════════════════════════════════════════════════ c.setFillColor(BG) c.rect(0, 0, W, H, fill=1, stroke=0) page_title(c, "MICROCIRCULATION & STARLING FORCES", "Terminal Vascular Bed | Section 6.3") # Title banner c.setFillColor(TEAL) c.rect(40, 770, W-80, 28, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 11) c.drawCentredString(W/2, 779, "TERMINAL VASCULAR BED – 3 Limbs of Microcirculation") # Three limbs limb_y = 700; limb_bw=140; limb_bh=44; limb_gap=25 total_limb = 3*limb_bw + 2*limb_gap lx_limb = (W-total_limb)/2 limbs = [ ("AFFERENT\nARTERIAL LIMB", RED, DARK_RED, "Precapillary\narterioles"), ("CAPILLARY BED\n(Exchange Zone)", TEAL, DARK_TEAL, "5–15 μm diameter\nendothelium only"), ("EFFERENT\nVENOUS LIMB", BLUE, DARK_BLUE, "Postcapillary\nvenules"), ] cx_limbs=[] for i,(lbl,fc,sc,sub) in enumerate(limbs): bx = lx_limb + i*(limb_bw+limb_gap) cx_limbs.append(bx+limb_bw/2) draw_rounded_box(c, bx, limb_y, limb_bw, limb_bh, fc, sc, label=lbl, sub=sub, font_size=9, sub_size=7) # Arrows between limbs arrow(c, cx_limbs[0]+limb_bw/2, limb_y+limb_bh/2, cx_limbs[1]-limb_bw/2, limb_y+limb_bh/2, label="blood flow →", label_offset=(0,6)) arrow(c, cx_limbs[1]+limb_bw/2, limb_y+limb_bh/2, cx_limbs[2]-limb_bw/2, limb_y+limb_bh/2, label="blood flow →", label_offset=(0,6)) # Capillary detail cd_y = 600 c.setFillColor(colors.HexColor("#E8F8F5")) c.setStrokeColor(TEAL) c.setLineWidth(1.2) c.roundRect(40, cd_y, W-80, 75, 8, fill=1, stroke=1) c.setFillColor(DARK_TEAL) c.setFont("Helvetica-Bold", 9) c.drawCentredString(W/2, cd_y+60, "CAPILLARY KEY FACTS") cap_facts = [ "• Diameter: 5–15 μm | Wall: endothelium + basal lamina only (+ pericytes)", "• Cross-section: ~800× larger than aorta → Blood flow slows from 50 cm/s → 0.05 cm/s", "• Average capillary length 0.5 mm → ~1 second available for metabolic exchange", "• Precapillary sphincters regulate entry; at rest only 25–35% of capillaries perfused", "• Arteriovenous anastomoses (shunts) allow direct artery → vein bypass", ] c.setFont("Helvetica", 7.5) c.setFillColor(DARK_GRAY) for j,f in enumerate(cap_facts): c.drawString(50, cd_y+48 - j*12, f) # Starling Forces sf_y = 540 c.setFillColor(DARK_GRAY) c.rect(40, sf_y, W-80, 24, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 11) c.drawCentredString(W/2, sf_y+8, "STARLING FORCES – Fluid Exchange at Capillaries") # Arterial end ae_x = 55; ae_y = 430; ae_w=200; ae_h=95 c.setFillColor(colors.HexColor("#FDEDEC")) c.setStrokeColor(RED) c.setLineWidth(1.5) c.roundRect(ae_x, ae_y, ae_w, ae_h, 8, fill=1, stroke=1) c.setFillColor(RED) c.roundRect(ae_x, ae_y+ae_h-18, ae_w, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(ae_x+ae_w/2, ae_y+ae_h-6, "ARTERIAL END") c.setFont("Helvetica", 8) c.setFillColor(DARK_GRAY) for j,t in enumerate(["Hydrostatic pressure = 35 mmHg", "Colloid osmotic pressure = 25 mmHg", "Net pressure = +10 mmHg outward", "→ Fluid FILTERED OUT", " into surrounding tissue"]): c.drawString(ae_x+8, ae_y+ae_h-30 - j*13, t) # Venous end ve_x = W-55-ae_w; ve_y=ae_y c.setFillColor(colors.HexColor("#EAF2F8")) c.setStrokeColor(BLUE) c.setLineWidth(1.5) c.roundRect(ve_x, ve_y, ae_w, ae_h, 8, fill=1, stroke=1) c.setFillColor(BLUE) c.roundRect(ve_x, ve_y+ae_h-18, ae_w, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(ve_x+ae_w/2, ve_y+ae_h-6, "VENOUS END") c.setFont("Helvetica", 8) c.setFillColor(DARK_GRAY) for j,t in enumerate(["Hydrostatic pressure = 15 mmHg", "Colloid osmotic pressure = 25 mmHg", "Net pressure = -10 mmHg inward", "→ Fluid REABSORBED", " back into capillary"]): c.drawString(ve_x+8, ve_y+ae_h-30 - j*13, t) # Capillary tube graphic cap_mx = W/2; cap_y_c = ae_y+ae_h/2 draw_rounded_box(c, cap_mx-50, cap_y_c-12, 100, 24, TEAL, DARK_TEAL, label="CAPILLARY", font_size=8) arrow(c, ae_x+ae_w, cap_y_c, cap_mx-50, cap_y_c, DARK_RED, label="blood flows →") arrow(c, cap_mx+50, cap_y_c, ve_x, cap_y_c, DARK_BLUE, label="→") # Excess fluid → Lymph lf_y = 370 c.setFillColor(colors.HexColor("#F9EBEA")) c.setStrokeColor(colors.HexColor("#C0392B")) c.setLineWidth(1) c.roundRect(120, lf_y, W-240, 46, 8, fill=1, stroke=1) c.setFillColor(colors.HexColor("#922B21")) c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(W/2, lf_y+32, "EXCESS FLUID NOT REABSORBED") c.setFont("Helvetica", 8) c.setFillColor(DARK_GRAY) c.drawCentredString(W/2, lf_y+18, "→ Collected by lymphatic capillaries") c.drawCentredString(W/2, lf_y+6, "→ Returned to venous system via lymphatic vessels") # Capillary types table ct_y = 310 c.setFillColor(DARK_GRAY) c.rect(40, ct_y+20, W-80, 22, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 10) c.drawCentredString(W/2, ct_y+27, "TYPES OF CAPILLARY ENDOTHELIUM") types = [ ("Type I", "Continuous – no fenestrations, no gaps", "Nervous system", colors.HexColor("#D5F5E3")), ("Type II", "Continuous – pinocytotic vesicles", "Cardiac & skeletal muscle", colors.HexColor("#D6EAF8")), ("Type III","Fenestrated with diaphragm", "Gastrointestinal tract", colors.HexColor("#FDEBD0")), ("Type IV","Discontinuous – intercellular gaps", "Liver (sinusoids)", colors.HexColor("#F5EEF8")), ] row_h2=22; col2=[40,100,290,450] c.setFont("Helvetica-Bold", 8) c.setFillColor(DARK_GRAY) for ci,hdr in enumerate(["Type","Structure","Location",""]): c.drawString(col2[ci]+4, ct_y+8, hdr) for ri,(t,s,loc,bg) in enumerate(types): ry3 = ct_y - ri*row_h2 c.setFillColor(bg) c.rect(40, ry3-row_h2, W-80, row_h2, fill=1, stroke=0) c.setStrokeColor(colors.HexColor("#C0C0C0")) c.rect(40, ry3-row_h2, W-80, row_h2, fill=0, stroke=0.5) c.setFont("Helvetica-Bold", 8) c.setFillColor(DARK_GRAY) c.drawString(col2[0]+4, ry3-row_h2+7, t) c.setFont("Helvetica", 7.5) c.drawString(col2[1]+4, ry3-row_h2+7, s) c.drawString(col2[2]+4, ry3-row_h2+7, loc) c.showPage() # ══════════════════════════════════════════════════════════════════════════════ # PAGE 4 – LYMPHATIC SYSTEM & EMBRYONIC CIRCULATION # ══════════════════════════════════════════════════════════════════════════════ c.setFillColor(BG) c.rect(0, 0, W, H, fill=1, stroke=0) page_title(c, "LYMPHATIC SYSTEM & EMBRYONIC CIRCULATION", "Sections 6.1 & 1.6 | THIEME Atlas of Anatomy") # ── LYMPHATIC SYSTEM ────────────────────────────────────────── c.setFillColor(GREEN) c.rect(40, 770, W-80, 28, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 12) c.drawCentredString(W/2, 779, "LYMPHATIC SYSTEM FLOWCHART") lymph_steps = [ ("INTERSTITIAL FLUID\n(Excess not reabsorbed by capillaries)", GREEN, DARK_GREEN), ("LYMPHATIC CAPILLARIES\n(Blind-ended; originate in capillary region)", colors.HexColor("#1E8449"), colors.HexColor("#196F3D")), ("COLLECTING LYMPHATIC VESSELS\n(Progressively larger; with valves)", colors.HexColor("#239B56"), colors.HexColor("#1D8348")), ("LYMPH NODES\n(Biological filtration of lymph)", colors.HexColor("#2ECC71"), colors.HexColor("#27AE60")), ("THORACIC DUCT / RIGHT LYMPH DUCT\n(Main collecting ducts)", colors.HexColor("#27AE60"), colors.HexColor("#1E8449")), ("VENOUS SYSTEM\n(Returned at subclavian veins)", TEAL, DARK_TEAL), ] lbw=280; lbh=36; lx_l2=(W-lbw)/2 for i,(lbl,fc,sc) in enumerate(lymph_steps): by = 730 - i*52 draw_rounded_box(c, lx_l2, by, lbw, lbh, fc, sc, label=lbl, font_size=8.5) if i < len(lymph_steps)-1: arrow(c, W/2, by, W/2, by-16) # Note ny = 730 - (len(lymph_steps)-1)*52 - 54 c.setFillColor(colors.HexColor("#EAFAF1")) c.setStrokeColor(GREEN) c.setLineWidth(1) c.roundRect(50, ny, W-100, 36, 8, fill=1, stroke=1) c.setFont("Helvetica-Bold", 8) c.setFillColor(DARK_GREEN) c.drawCentredString(W/2, ny+23, "KEY FUNCTION") c.setFont("Helvetica", 7.5) c.setFillColor(DARK_GRAY) c.drawCentredString(W/2, ny+11, "The lymphatic system collects extracellular fluid and returns it to the blood,") c.drawCentredString(W/2, ny+0, "running parallel to the venous system and filtering lymph through lymph nodes.") # ── EMBRYONIC CIRCULATION ────────────────────────────────────── emb_banner_y = ny - 40 c.setFillColor(PURPLE) c.rect(40, emb_banner_y, W-80, 28, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 12) c.drawCentredString(W/2, emb_banner_y+8, "EARLY EMBRYONIC CIRCULATORY SYSTEM (3–4 Weeks)") # Central pump ep_y = emb_banner_y - 50 draw_rounded_box(c, (W-200)/2, ep_y, 200, 36, PURPLE, DARK_PURP, label="2-CHAMBERED EMBRYONIC HEART\n(Well-functioning pump)", font_size=8.5) # Three circuits branching ec_y = ep_y - 70 bwe3=145; bhe3=44; gape3=15 total_e = 3*bwe3 + 2*gape3 lxe = (W-total_e)/2 emb_circuits=[ ("INTRAEMBRYONIC\nSYSTEMIC CIRC.", "Ventral & dorsal aorta\nBranchial/aortic arches\nCardinal veins", RED, DARK_RED), ("EXTRAEMBRYONIC\nVITELLINE CIRC.", "Omphalomesenteric\narteries & veins", ORANGE, DARK_ORAN), ("PLACENTAL\nCIRCULATION", "Umbilical arteries\n& umbilical veins\n(vein → O₂-rich blood)", BLUE, DARK_BLUE), ] for i,(lbl,detail,fc,sc) in enumerate(emb_circuits): bx = lxe + i*(bwe3+gape3) draw_rounded_box(c, bx, ec_y, bwe3, bhe3, fc, sc, label=lbl, font_size=8) arrow(c, W/2, ep_y, bx+bwe3/2, ec_y+bhe3) # detail box below dbx_y = ec_y - 60 c.setFillColor(colors.HexColor("#FDFEFE")) c.setStrokeColor(fc) c.setLineWidth(1) c.roundRect(bx, dbx_y, bwe3, 52, 6, fill=1, stroke=1) c.setFillColor(fc) c.setFont("Helvetica-Bold", 7) c.drawCentredString(bx+bwe3/2, dbx_y+43, "Components:") c.setFont("Helvetica", 7) c.setFillColor(DARK_GRAY) for j, line in enumerate(detail.split('\n')): c.drawString(bx+6, dbx_y+32 - j*12, line) arrow(c, bx+bwe3/2, ec_y, bx+bwe3/2, dbx_y+52) # Symmetry note sy_y = ec_y - 130 c.setFillColor(colors.HexColor("#F3E5F5")) c.setStrokeColor(PURPLE) c.setLineWidth(1) c.roundRect(50, sy_y, W-100, 44, 8, fill=1, stroke=1) c.setFillColor(DARK_PURP) c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(W/2, sy_y+31, "DEVELOPMENTAL NOTE") c.setFont("Helvetica", 7.5) c.setFillColor(DARK_GRAY) c.drawCentredString(W/2, sy_y+18, "Early embryo: largely symmetrical vascular arrangement.") c.drawCentredString(W/2, sy_y+6, "With development: symmetry lost → left-sided preponderance") c.drawCentredString(W/2, sy_y-6, "(e.g., left 4th aortic arch → becomes the definitive aortic arch)") c.showPage() # ══════════════════════════════════════════════════════════════════════════════ # PAGE 5 – POSITIONAL PRESSURE CHANGES # ══════════════════════════════════════════════════════════════════════════════ c.setFillColor(BG) c.rect(0, 0, W, H, fill=1, stroke=0) page_title(c, "POSITIONAL PRESSURE CHANGES IN CIRCULATION", "Hydrostatic Effects | THIEME Atlas of Anatomy") c.setFillColor(DARK_ORAN) c.rect(40, 770, W-80, 28, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 12) c.drawCentredString(W/2, 779, "RECUMBENT → STANDING POSITION") # Diamond decision draw_diamond(c, W/2, 730, 200, 44, ORANGE, DARK_ORAN, label="POSITION\nCHANGE?", font_size=9) arrow(c, W/2, 708, W/2, 694) draw_rounded_box(c, (W-260)/2, 660, 260, 34, ORANGE, DARK_ORAN, label="~500 mL blood shifts to LOWER LIMB VEINS", font_size=8.5) arrow(c, W/2, 660, W/2, 646) # Two effects eff_y = 600 bwe2=195; bhe2=90; gape2=20 lxeff=(W-2*bwe2-gape2)/2 # Lower body c.setFillColor(colors.HexColor("#FDEDEC")) c.setStrokeColor(RED) c.setLineWidth(1.5) c.roundRect(lxeff, eff_y-bhe2, bwe2, bhe2, 8, fill=1, stroke=1) c.setFillColor(RED) c.roundRect(lxeff, eff_y-18, bwe2, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(lxeff+bwe2/2, eff_y-6, "LOWER BODY") c.setFont("Helvetica", 8) c.setFillColor(DARK_GRAY) for j,t in enumerate(["• Pressure RISES sharply", "• Venous transmural pressure ↑", "• Veins distend (pooling)", "• Risk of oedema if prolonged"]): c.drawString(lxeff+8, eff_y-32-j*13, t) arrow(c, W/2, 646, lxeff+bwe2/2, eff_y) # Upper body rxeff=lxeff+bwe2+gape2 c.setFillColor(colors.HexColor("#EAF2F8")) c.setStrokeColor(BLUE) c.setLineWidth(1.5) c.roundRect(rxeff, eff_y-bhe2, bwe2, bhe2, 8, fill=1, stroke=1) c.setFillColor(BLUE) c.roundRect(rxeff, eff_y-18, bwe2, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(rxeff+bwe2/2, eff_y-6, "UPPER BODY") c.setFont("Helvetica", 8) c.setFillColor(DARK_GRAY) for j,t in enumerate(["• Pressure DECREASES", "• Head/neck veins may collapse", "• Compensatory reflexes activated", "• Possible orthostatic hypotension"]): c.drawString(rxeff+8, eff_y-32-j*13, t) arrow(c, W/2, 646, rxeff+bwe2/2, eff_y) # Indifference level ind_y = 450 draw_rounded_box(c, (W-300)/2, ind_y, 300, 36, colors.HexColor("#7F8C8D"), colors.HexColor("#566573"), label="HYDROSTATIC INDIFFERENCE LEVEL\n(Just below diaphragm – pressure unchanged)", font_size=8.5) c.setFillColor(DARK_GRAY) c.setFont("Helvetica", 8) c.drawCentredString(W/2, ind_y-16, "The point where pressure remains unchanged regardless of body position.") for cx2 in [lxeff+bwe2/2, rxeff+bwe2/2]: arrow(c, cx2, eff_y-bhe2, W/2, ind_y+36) # Artery type flowchart atype_y = 370 c.setFillColor(DARK_GRAY) c.rect(40, atype_y, W-80, 24, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 11) c.drawCentredString(W/2, atype_y+8, "ARTERY TYPES BY LOCATION & FUNCTION") at_data=[ ("ELASTIC-TYPE ARTERIES\n(Near heart – e.g. Aorta)", "• Expand during systole to accommodate ejected blood\n• Elastic recoil during diastole\n• Convert intermittent pumping → continuous blood flow", RED, DARK_RED), ("MUSCULAR-TYPE ARTERIES\n(Distant from heart)", "• Can vasodilate and vasoconstrict\n• Control vascular resistance\n• Regulate local blood flow distribution", ORANGE, DARK_ORAN), ("VEINS\n(Capacitance vessels)", "• Hold ~80% of total blood volume\n• Act as blood reservoir\n• Low-pressure compliant walls", BLUE, DARK_BLUE), ] atbw=160; atbh=85; atgap=10 total_at=3*atbw+2*atgap; lxat=(W-total_at)/2 for i,(lbl,detail,fc,sc) in enumerate(at_data): bx=lxat+i*(atbw+atgap) by=atype_y-atbh-14 c.setFillColor(colors.HexColor("#FDFEFE")) c.setStrokeColor(fc) c.setLineWidth(1.5) c.roundRect(bx, by, atbw, atbh, 8, fill=1, stroke=1) c.setFillColor(fc) c.roundRect(bx, by+atbh-18, atbw, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 7.5) for k,ll in enumerate(lbl.split('\n')): c.drawCentredString(bx+atbw/2, by+atbh-8-k*9, ll) c.setFont("Helvetica", 7) c.setFillColor(DARK_GRAY) for j2,dl in enumerate(detail.strip().split('\n')): c.drawString(bx+6, by+atbh-32-j2*12, dl) c.showPage() c.save() print("PDF saved successfully!") PYEOF

The issue is with stroke=0.5 in the rect call. ReportLab only accepts integer 0 or 1. Let me fix that:
Running Command

python3 << 'PYEOF' from reportlab.lib.pagesizes import A4 from reportlab.lib import colors from reportlab.lib.units import cm, mm from reportlab.pdfgen import canvas import math W, H = A4 RED = colors.HexColor("#C0392B") DARK_RED = colors.HexColor("#922B21") BLUE = colors.HexColor("#2980B9") DARK_BLUE = colors.HexColor("#1A5276") GREEN = colors.HexColor("#27AE60") DARK_GREEN= colors.HexColor("#1E8449") PURPLE = colors.HexColor("#8E44AD") DARK_PURP = colors.HexColor("#6C3483") ORANGE = colors.HexColor("#E67E22") DARK_ORAN = colors.HexColor("#BA6006") TEAL = colors.HexColor("#16A085") DARK_TEAL = colors.HexColor("#0E6655") BG = colors.HexColor("#F8F9FA") DARK_GRAY = colors.HexColor("#2C3E50") WHITE = colors.white ARROW_CLR = colors.HexColor("#555555") def draw_rounded_box(c, x, y, w, h, fill_color, stroke_color, radius=8, label=None, sub=None, font_size=9, sub_size=7.5, text_color=WHITE): c.setFillColor(fill_color) c.setStrokeColor(stroke_color) c.setLineWidth(1.5) c.roundRect(x, y, w, h, radius, fill=1, stroke=1) if label: c.setFillColor(text_color) c.setFont("Helvetica-Bold", font_size) lines = label.split('\n') total_h = len(lines) * (font_size + 2) start_y = y + h/2 + total_h/2 - font_size if sub: start_y += 5 for i, line in enumerate(lines): c.drawCentredString(x + w/2, start_y - i*(font_size+2), line) if sub: c.setFont("Helvetica", sub_size) c.setFillColor(colors.HexColor("#DDDDDD")) sub_lines = sub.split('\n') sub_start = y + h/2 - total_h/2 - 2 for i, sl in enumerate(sub_lines): c.drawCentredString(x + w/2, sub_start - i*(sub_size+1.5), sl) def draw_diamond(c, cx, cy, w, h, fill_color, stroke_color, label=None, font_size=8): path = c.beginPath() path.moveTo(cx, cy+h/2) path.lineTo(cx+w/2, cy) path.lineTo(cx, cy-h/2) path.lineTo(cx-w/2, cy) path.close() c.setFillColor(fill_color) c.setStrokeColor(stroke_color) c.setLineWidth(1.5) c.drawPath(path, fill=1, stroke=1) if label: c.setFillColor(WHITE) c.setFont("Helvetica-Bold", font_size) lines = label.split('\n') for i, line in enumerate(lines): c.drawCentredString(cx, cy + (len(lines)-1)/2*(font_size+1) - i*(font_size+1), line) def arrow(c, x1, y1, x2, y2, color=ARROW_CLR, label=None, label_offset=(0,4)): c.setStrokeColor(color) c.setLineWidth(1.4) c.line(x1, y1, x2, y2) angle = math.atan2(y2-y1, x2-x1) asz = 6 for da in [0.4, -0.4]: ax = x2 - asz*math.cos(angle - da) ay = y2 - asz*math.sin(angle - da) c.line(x2, y2, ax, ay) if label: mx, my = (x1+x2)/2 + label_offset[0], (y1+y2)/2 + label_offset[1] c.setFillColor(DARK_GRAY) c.setFont("Helvetica", 7) c.drawCentredString(mx, my, label) def bordered_box(c, x, y, w, h, fill_color, stroke_color, lw=1.0): """Safe bordered rect with integer fill/stroke.""" c.setFillColor(fill_color) c.setStrokeColor(stroke_color) c.setLineWidth(lw) c.rect(x, y, w, h, fill=1, stroke=1) def page_header(c, title, subtitle=None): c.setFillColor(DARK_GRAY) c.rect(0, H-50, W, 50, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", 16) c.drawCentredString(W/2, H-32, title) if subtitle: c.setFont("Helvetica", 9) c.setFillColor(colors.HexColor("#BDC3C7")) c.drawCentredString(W/2, H-44, subtitle) c.setFillColor(DARK_GRAY) c.rect(0, 0, W, 18, fill=1, stroke=0) c.setFillColor(colors.HexColor("#BDC3C7")) c.setFont("Helvetica", 7) c.drawCentredString(W/2, 5, "Source: THIEME Atlas of Anatomy – General Anatomy and Musculoskeletal System") def color_banner(c, y, h, fc, title, font_size=11): c.setFillColor(fc) c.rect(40, y, W-80, h, fill=1, stroke=0) c.setFillColor(WHITE) c.setFont("Helvetica-Bold", font_size) c.drawCentredString(W/2, y + h/2 - font_size/2 + 2, title) out = "/home/daytona/workspace/circulatory-flowcharts/Circulatory_System_Flowcharts.pdf" c = canvas.Canvas(out, pagesize=A4) # ═══════════════════════════════════════════════════════ # PAGE 1 – CIRCULATORY SYSTEM OVERVIEW # ═══════════════════════════════════════════════════════ c.setFillColor(BG); c.rect(0,0,W,H,fill=1,stroke=0) page_header(c, "THE CIRCULATORY SYSTEM – OVERVIEW", "THIEME Atlas of Anatomy | Sections 6.1 – 6.3") bw=210; bh=36; lm=(W-bw)/2 draw_rounded_box(c, lm, 780, bw, bh, DARK_GRAY, colors.HexColor("#1A252F"), label="CIRCULATORY SYSTEM", font_size=12) arrow(c, W/2, 780, W/2, 766) draw_rounded_box(c, lm, 730, bw, bh, DARK_RED, RED, label="Central Pump: HEART", font_size=11) arrow(c, W/2, 730, W/2, 716) # 3 components bw3=152; bh3=38; gap3=16; total3=3*bw3+2*gap3; lx3=(W-total3)/2; y3=677 boxes3=[ ("Vascular System\n(Arteries, Capillaries, Veins)", RED, DARK_RED), ("Heart\n(Central Pump)", BLUE, DARK_BLUE), ("Lymphatic System\n(Parallel to veins)", GREEN, DARK_GREEN), ] cxs3=[] for i,(lbl,fc,sc) in enumerate(boxes3): bx=lx3+i*(bw3+gap3); cxs3.append(bx+bw3/2) draw_rounded_box(c, bx, y3, bw3, bh3, fc, sc, label=lbl, font_size=8) arrow(c, W/2, 716, bx+bw3/2, y3+bh3) # Key rule ry=630 c.setFillColor(colors.HexColor("#FEF9E7")); c.setStrokeColor(colors.HexColor("#F39C12")); c.setLineWidth(1.2) c.roundRect(50, ry, W-100, 38, 8, fill=1, stroke=1) c.setFillColor(colors.HexColor("#7D6608")); c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(W/2, ry+24, "KEY RULE:") c.setFont("Helvetica", 8); c.setFillColor(DARK_GRAY) c.drawCentredString(W/2, ry+11, "Arteries = vessels AWAY from heart | Veins = vessels TOWARD heart") c.drawCentredString(W/2, ry+1, "(regardless of oxygen content – e.g. umbilical vein carries O₂-rich blood)") arrow(c, W/2, ry, W/2, ry-14) # Two circuits y4=550; bw4=200; bh4=44; gap4=28; lx4=(W-2*bw4-gap4)/2 draw_rounded_box(c, lx4, y4, bw4, bh4, RED, DARK_RED, label="PULMONARY\nCIRCULATION", sub="Right heart → Lungs", font_size=10, sub_size=7.5) draw_rounded_box(c, lx4+bw4+gap4, y4, bw4, bh4, BLUE, DARK_BLUE, label="SYSTEMIC\nCIRCULATION", sub="Left heart → Body", font_size=10, sub_size=7.5) for dx in [lx4+bw4/2, lx4+bw4+gap4+bw4/2]: arrow(c, W/2, ry-14, dx, y4+bh4) # Pulmonary steps sbw=165; sbh=30; psteps=[ "Deoxygenated blood from body", "Sup./Inf. Vena Cava → Right Atrium", "Right Ventricle → Pulmonary Arteries", "Lungs: O₂ received", ] for i,txt in enumerate(psteps): by=490-i*38 draw_rounded_box(c, lx4+(bw4-sbw)/2, by, sbw, sbh, RED, DARK_RED, label=txt, font_size=7.5) if i<len(psteps)-1: arrow(c, lx4+bw4/2, by, lx4+bw4/2, by-8) arrow(c, lx4+bw4/2, y4, lx4+bw4/2, 490+sbh) # Systemic steps ssteps=[ "Oxygenated blood from lungs", "Pulmonary Veins → Left Atrium", "Left Ventricle → Aorta", "Body Tissues", ] rx4=lx4+bw4+gap4 for i,txt in enumerate(ssteps): by=490-i*38 draw_rounded_box(c, rx4+(bw4-sbw)/2, by, sbw, sbh, BLUE, DARK_BLUE, label=txt, font_size=7.5) if i<len(ssteps)-1: arrow(c, rx4+bw4/2, by, rx4+bw4/2, by-8) arrow(c, rx4+bw4/2, y4, rx4+bw4/2, 490+sbh) # Portal note pn_y=290 c.setFillColor(colors.HexColor("#EAF2F8")); c.setStrokeColor(BLUE); c.setLineWidth(1) c.roundRect(50, pn_y, W-100, 52, 8, fill=1, stroke=1) c.setFillColor(DARK_BLUE); c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(W/2, pn_y+38, "PORTAL CIRCULATION (Special Sub-Circuit)") c.setFont("Helvetica", 7.5); c.setFillColor(DARK_GRAY) c.drawCentredString(W/2, pn_y+25, "Venous blood from stomach, bowel, pancreas, spleen") c.drawCentredString(W/2, pn_y+13, "→ Portal Vein → Liver (filtration & metabolism)") c.drawCentredString(W/2, pn_y+1, "→ Hepatic Veins → Inferior Vena Cava") # Figure-of-8 note fn_y=240 c.setFillColor(colors.HexColor("#FDFEFE")); c.setStrokeColor(DARK_GRAY); c.setLineWidth(0.8) c.roundRect(50, fn_y, W-100, 32, 8, fill=1, stroke=1) c.setFillColor(DARK_GRAY); c.setFont("Helvetica-Oblique", 8) c.drawCentredString(W/2, fn_y+19, "Postnatal human circulation forms a figure-of-eight (∞),") c.drawCentredString(W/2, fn_y+7, "with the HEART at the intersection of the two circuits.") c.showPage() # ═══════════════════════════════════════════════════════ # PAGE 2 – BLOOD VESSEL STRUCTURE # ═══════════════════════════════════════════════════════ c.setFillColor(BG); c.rect(0,0,W,H,fill=1,stroke=0) page_header(c, "STRUCTURE OF BLOOD VESSELS", "Three-Layer Wall Architecture | Section 6.2") draw_rounded_box(c, (W-230)/2, 755, 230, 40, DARK_GRAY, colors.HexColor("#1A252F"), label="BLOOD VESSEL WALL", font_size=13) arrow(c, W/2, 755, W/2, 741) # Three layers ly=700; bwl=155; bhl=40; gapl=18; total_l=3*bwl+2*gapl; lxl=(W-total_l)/2 layers=[ ("TUNICA INTIMA\n(Innermost)", RED, DARK_RED, ["Endothelial cells (spindle-shaped)","Basement membrane","Subendothelial connective tissue", "Internal elastic membrane (muscular a.)","FUNCTION: Exchange of gases & substances"]), ("TUNICA MEDIA\n(Middle)", ORANGE, DARK_ORAN, ["Smooth muscle cells (circular)","Elastic & collagenous fibers","Proteoglycans", "External elastic membrane (muscular a.)","FUNCTION: Regulates blood flow"]), ("TUNICA ADVENTITIA\n(Outermost)", GREEN, DARK_GREEN, ["Longitudinal connective tissue","Smooth muscle in veins","Autonomic nerves to wall muscle", "Vasa vasorum (larger vessels)","FUNCTION: Integration into surrounding tissue"]), ] cxl=[] for i,(lbl,fc,sc,_) in enumerate(layers): bx=lxl+i*(bwl+gapl); cxl.append(bx+bwl/2) draw_rounded_box(c, bx, ly, bwl, bhl, fc, sc, label=lbl, font_size=8) arrow(c, W/2, 741, bx+bwl/2, ly+bhl) # Detail boxes dy=545 for i,(lbl,fc,sc,details) in enumerate(layers): bx=lxl+i*(bwl+gapl); bxd=bx-5 c.setFillColor(colors.HexColor("#FDFEFE")); c.setStrokeColor(fc); c.setLineWidth(1.2) c.roundRect(bxd, dy, bwl+10, 130, 6, fill=1, stroke=1) c.setFillColor(fc); c.roundRect(bxd, dy+116, bwl+10, 14, 4, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 7) c.drawCentredString(bx+bwl/2, dy+121, lbl.split('\n')[0]) c.setFont("Helvetica", 7); c.setFillColor(DARK_GRAY) for j,line in enumerate(details): bold = line.startswith("FUNCTION") c.setFont("Helvetica-Bold" if bold else "Helvetica", 7) c.setFillColor(fc if bold else DARK_GRAY) c.drawString(bxd+5, dy+108-j*14, line) arrow(c, cxl[i], ly, cxl[i], dy+130) # Artery vs Vein c.setFillColor(DARK_GRAY); c.rect(0, 510, W, 26, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 11) c.drawCentredString(W/2, 519, "ARTERY vs. VEIN – Structural Differences") bwc=210; bhc=88; gapc=28; lxc=(W-2*bwc-gapc)/2 # Artery c.setFillColor(colors.HexColor("#FDEDEC")); c.setStrokeColor(RED); c.setLineWidth(1.5) c.roundRect(lxc, 410, bwc, bhc, 8, fill=1, stroke=1) c.setFillColor(RED); c.roundRect(lxc, 410+bhc-18, bwc, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 9) c.drawCentredString(lxc+bwc/2, 410+bhc-6, "ARTERIES") details_a=["• Thick, dense smooth muscle in media","• Prominent internal elastic membrane", "• High-pressure system (~100 mmHg)","• Carry blood AWAY from heart"] c.setFont("Helvetica", 8); c.setFillColor(DARK_GRAY) for j,d in enumerate(details_a): c.drawString(lxc+8, 410+bhc-32-j*14, d) # Vein rxc=lxc+bwc+gapc c.setFillColor(colors.HexColor("#EAF2F8")); c.setStrokeColor(BLUE); c.setLineWidth(1.5) c.roundRect(rxc, 410, bwc, bhc, 8, fill=1, stroke=1) c.setFillColor(BLUE); c.roundRect(rxc, 410+bhc-18, bwc, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 9) c.drawCentredString(rxc+bwc/2, 410+bhc-6, "VEINS") details_v=["• More connective tissue (looser structure)","• Lacks conspicuous elastic membrane", "• Low-pressure system (< 20 mmHg)","• Carry blood TOWARD heart"] c.setFont("Helvetica", 8); c.setFillColor(DARK_GRAY) for j,d in enumerate(details_v): c.drawString(rxc+8, 410+bhc-32-j*14, d) # Pressure table c.setFillColor(DARK_GRAY); c.rect(40, 385, W-80, 24, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 10) c.drawCentredString(W/2, 393, "FUNCTIONAL PRESSURE SYSTEMS") tbl_rows=[ ("High-Pressure System","~100 mmHg","Supply function","Arteries, arterioles", colors.HexColor("#FDEDEC"), RED), ("Low-Pressure System","< 20 mmHg","Reservoir function","Veins & lungs (holds ~80% blood vol.)", colors.HexColor("#EAF2F8"), BLUE), ("Capillary Region","varies","Exchange function","Terminal vascular bed (metabolic exchange)", colors.HexColor("#E8F8F5"), TEAL), ] col_xs=[42,172,252,352]; col_ws=[128,78,98,170]; rh=26 c.setFillColor(colors.HexColor("#BDC3C7")); c.rect(40, 359, W-80, rh, fill=1, stroke=0) c.setFillColor(DARK_GRAY); c.setFont("Helvetica-Bold", 8) for ci,hdr in enumerate(["System","Pressure","Role","Components"]): c.drawString(col_xs[ci]+3, 367, hdr) for ri,(sys,pres,role,comp,bg,sc) in enumerate(tbl_rows): ry=333-ri*rh c.setFillColor(bg); c.rect(40, ry, W-80, rh, fill=1, stroke=0) c.setStrokeColor(colors.HexColor("#C0C0C0")); c.setLineWidth(0.5) c.rect(40, ry, W-80, rh, fill=0, stroke=1) c.setFillColor(sc); c.setFont("Helvetica-Bold", 7.5) c.drawString(col_xs[0]+3, ry+9, sys) c.setFillColor(DARK_GRAY); c.setFont("Helvetica", 7.5) for ci,val in enumerate([pres,role,comp]): c.drawString(col_xs[ci+1]+3, ry+9, val) # Vein capacitance note vn_y=265 c.setFillColor(colors.HexColor("#EAF2F8")); c.setStrokeColor(BLUE); c.setLineWidth(1) c.roundRect(50, vn_y, W-100, 36, 8, fill=1, stroke=1) c.setFillColor(DARK_BLUE); c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(W/2, vn_y+23, "VEINS AS CAPACITANCE VESSELS") c.setFont("Helvetica", 7.5); c.setFillColor(DARK_GRAY) c.drawCentredString(W/2, vn_y+11, "Veins accommodate ~80% of total blood volume and serve as a blood reservoir.") c.drawCentredString(W/2, vn_y+0, "Elastic arteries convert the heart's intermittent pumping into continuous blood flow.") c.showPage() # ═══════════════════════════════════════════════════════ # PAGE 3 – MICROCIRCULATION & STARLING FORCES # ═══════════════════════════════════════════════════════ c.setFillColor(BG); c.rect(0,0,W,H,fill=1,stroke=0) page_header(c, "MICROCIRCULATION & STARLING FORCES", "Terminal Vascular Bed | Section 6.3") color_banner(c, 760, 28, TEAL, "TERMINAL VASCULAR BED – 3 Limbs of Microcirculation") # Three limbs lbw=145; lbh=44; lbg=22; total_lb=3*lbw+2*lbg; lxlb=(W-total_lb)/2; limb_y=700 limbs=[ ("AFFERENT ARTERIAL LIMB", RED, DARK_RED, "Precapillary arterioles"), ("CAPILLARY BED\n(Exchange Zone)", TEAL, DARK_TEAL, "5–15 μm; endothelium + basal lamina"), ("EFFERENT VENOUS LIMB", BLUE, DARK_BLUE, "Postcapillary venules"), ] cxlb=[] for i,(lbl,fc,sc,sub) in enumerate(limbs): bx=lxlb+i*(lbw+lbg); cxlb.append(bx+lbw/2) draw_rounded_box(c, bx, limb_y, lbw, lbh, fc, sc, label=lbl, sub=sub, font_size=8.5, sub_size=7) # horizontal arrows for i in range(2): x1=lxlb+i*(lbw+lbg)+lbw; x2=lxlb+(i+1)*(lbw+lbg) arrow(c, x1, limb_y+lbh/2, x2, limb_y+lbh/2, label="→ blood flow →", label_offset=(0,6)) # Capillary facts cf_y=620 c.setFillColor(colors.HexColor("#E8F8F5")); c.setStrokeColor(TEAL); c.setLineWidth(1.2) c.roundRect(40, cf_y, W-80, 68, 8, fill=1, stroke=1) c.setFillColor(DARK_TEAL); c.setFont("Helvetica-Bold", 9) c.drawCentredString(W/2, cf_y+55, "CAPILLARY KEY FACTS") cap_facts=["• Diameter: 5–15 μm | Wall: only endothelium + basal lamina (+ pericytes attached)", "• Cross-section ~800× larger than aorta → blood flow slows: 50 cm/s → 0.05 cm/s in capillaries", "• Average capillary length 0.5 mm → ~1 second available for metabolic exchange", "• Precapillary sphincters regulate entry; at rest only 25–35% of capillaries are perfused", "• Arteriovenous anastomoses (shunts) allow direct artery-to-vein bypass"] c.setFont("Helvetica", 7.5); c.setFillColor(DARK_GRAY) for j,f in enumerate(cap_facts): c.drawString(50, cf_y+44-j*12, f) # Starling forces header c.setFillColor(DARK_GRAY); c.rect(0, 590, W, 24, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 11) c.drawCentredString(W/2, 598, "STARLING FORCES – Fluid Exchange at Capillaries") # Arterial end box ae_x=50; ae_w=195; ae_h=90; ae_y=480 c.setFillColor(colors.HexColor("#FDEDEC")); c.setStrokeColor(RED); c.setLineWidth(1.5) c.roundRect(ae_x, ae_y, ae_w, ae_h, 8, fill=1, stroke=1) c.setFillColor(RED); c.roundRect(ae_x, ae_y+ae_h-18, ae_w, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 9) c.drawCentredString(ae_x+ae_w/2, ae_y+ae_h-6, "ARTERIAL END") for j,t in enumerate(["Hydrostatic P = 35 mmHg", "Colloid osmotic P = 25 mmHg", "Net = +10 mmHg (outward)", "→ Fluid FILTERED OUT", " into surrounding tissue"]): c.setFont("Helvetica-Bold" if "→" in t else "Helvetica", 8) c.setFillColor(DARK_RED if "→" in t else DARK_GRAY) c.drawString(ae_x+8, ae_y+ae_h-32-j*13, t) # Venous end box ve_x=W-50-ae_w; ve_y=ae_y c.setFillColor(colors.HexColor("#EAF2F8")); c.setStrokeColor(BLUE); c.setLineWidth(1.5) c.roundRect(ve_x, ve_y, ae_w, ae_h, 8, fill=1, stroke=1) c.setFillColor(BLUE); c.roundRect(ve_x, ve_y+ae_h-18, ae_w, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 9) c.drawCentredString(ve_x+ae_w/2, ve_y+ae_h-6, "VENOUS END") for j,t in enumerate(["Hydrostatic P = 15 mmHg", "Colloid osmotic P = 25 mmHg", "Net = -10 mmHg (inward)", "→ Fluid REABSORBED", " back into capillary"]): c.setFont("Helvetica-Bold" if "→" in t else "Helvetica", 8) c.setFillColor(DARK_BLUE if "→" in t else DARK_GRAY) c.drawString(ve_x+8, ve_y+ae_h-32-j*13, t) # Capillary tube between cap_cx=W/2; cap_cy=ae_y+ae_h/2 draw_rounded_box(c, cap_cx-52, cap_cy-14, 104, 28, TEAL, DARK_TEAL, label="CAPILLARY", font_size=9) arrow(c, ae_x+ae_w, cap_cy, cap_cx-52, cap_cy, DARK_RED, label="blood flows →", label_offset=(0,7)) arrow(c, cap_cx+52, cap_cy, ve_x, cap_cy, DARK_BLUE, label="→", label_offset=(0,7)) # Excess fluid note ef_y=430 c.setFillColor(colors.HexColor("#F9EBEA")); c.setStrokeColor(RED); c.setLineWidth(1) c.roundRect(120, ef_y, W-240, 40, 8, fill=1, stroke=1) c.setFillColor(DARK_RED); c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(W/2, ef_y+27, "EXCESS FLUID NOT REABSORBED") c.setFont("Helvetica", 8); c.setFillColor(DARK_GRAY) c.drawCentredString(W/2, ef_y+14, "→ Collected by lymphatic capillaries") c.drawCentredString(W/2, ef_y+2, "→ Returned to venous system via lymphatic vessels") # Capillary types table c.setFillColor(DARK_GRAY); c.rect(40, 400, W-80, 24, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 10) c.drawCentredString(W/2, 408, "TYPES OF CAPILLARY ENDOTHELIUM") cap_types=[ ("Type I", "Continuous – closed, no fenestrations, continuous basal lamina", "Nervous system", colors.HexColor("#D5F5E3")), ("Type II", "Continuous – closed, with pinocytotic vesicles", "Cardiac & skeletal muscle",colors.HexColor("#D6EAF8")), ("Type III","Fenestrated – pores covered by a diaphragm", "Gastrointestinal tract", colors.HexColor("#FDEBD0")), ("Type IV", "Discontinuous – intercellular gaps, no continuous basal lamina", "Liver (sinusoids)", colors.HexColor("#F5EEF8")), ] col3=[42,95,310,455]; rh3=22 # header row c.setFillColor(colors.HexColor("#BDC3C7")); c.rect(40, 378, W-80, rh3, fill=1, stroke=0) c.setFillColor(DARK_GRAY); c.setFont("Helvetica-Bold", 7.5) for ci,hdr in enumerate(["Type","Structure","Location",""]): c.drawString(col3[ci]+3, 385, hdr) for ri,(t,s,loc,bg) in enumerate(cap_types): ry=356-ri*rh3 c.setFillColor(bg); c.rect(40, ry, W-80, rh3, fill=1, stroke=0) c.setStrokeColor(colors.HexColor("#C0C0C0")); c.setLineWidth(0.5) c.rect(40, ry, W-80, rh3, fill=0, stroke=1) c.setFont("Helvetica-Bold", 7.5); c.setFillColor(DARK_GRAY) c.drawString(col3[0]+3, ry+7, t) c.setFont("Helvetica", 7.5) c.drawString(col3[1]+3, ry+7, s) c.drawString(col3[2]+3, ry+7, loc) # Precapillary sphincter note ps_y=280 c.setFillColor(colors.HexColor("#FEF9E7")); c.setStrokeColor(ORANGE); c.setLineWidth(1) c.roundRect(50, ps_y, W-100, 56, 8, fill=1, stroke=1) c.setFillColor(DARK_ORAN); c.setFont("Helvetica-Bold", 9) c.drawCentredString(W/2, ps_y+43, "PRECAPILLARY SPHINCTERS") c.setFont("Helvetica", 8); c.setFillColor(DARK_GRAY) for j,t in enumerate(["• Circular muscle cells at junction of metarterioles and capillaries", "• Contraction closes branching capillaries; at rest only 25–35% perfused", "• Arterioles and venules may be interconnected by arteriovenous anastomoses (shunts)"]): c.drawString(60, ps_y+31-j*12, t) c.showPage() # ═══════════════════════════════════════════════════════ # PAGE 4 – LYMPHATIC SYSTEM & EMBRYONIC CIRCULATION # ═══════════════════════════════════════════════════════ c.setFillColor(BG); c.rect(0,0,W,H,fill=1,stroke=0) page_header(c, "LYMPHATIC SYSTEM & EMBRYONIC CIRCULATION", "Sections 6.1 & 1.6 | THIEME Atlas of Anatomy") color_banner(c, 762, 28, GREEN, "LYMPHATIC SYSTEM") lymph_steps=[ ("INTERSTITIAL FLUID\n(Excess fluid from capillary filtration)", GREEN, DARK_GREEN), ("BLIND-ENDED LYMPHATIC CAPILLARIES\n(Originate in the capillary region)", colors.HexColor("#1E8449"), colors.HexColor("#196F3D")), ("COLLECTING LYMPHATIC VESSELS\n(With valves; progressively larger)", colors.HexColor("#239B56"), colors.HexColor("#1D8348")), ("LYMPH NODES\n(Biological filtration of lymph along the pathway)", colors.HexColor("#27AE60"), colors.HexColor("#1E8449")), ("THORACIC DUCT / RIGHT LYMPH DUCT\n(Main collecting ducts)", colors.HexColor("#2ECC71"), colors.HexColor("#27AE60")), ("VENOUS SYSTEM\n(Returned at subclavian veins → back to blood)", TEAL, DARK_TEAL), ] lbw2=300; lbh2=36; lxl2=(W-lbw2)/2 for i,(lbl,fc,sc) in enumerate(lymph_steps): by=720-i*50 draw_rounded_box(c, lxl2, by, lbw2, lbh2, fc, sc, label=lbl, font_size=8.5) if i<len(lymph_steps)-1: arrow(c, W/2, by, W/2, by-14) # Lymph note ln_y=420 c.setFillColor(colors.HexColor("#EAFAF1")); c.setStrokeColor(GREEN); c.setLineWidth(1) c.roundRect(50, ln_y, W-100, 40, 8, fill=1, stroke=1) c.setFillColor(DARK_GREEN); c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(W/2, ln_y+27, "LYMPHATIC SYSTEM KEY FUNCTIONS") c.setFont("Helvetica", 7.5); c.setFillColor(DARK_GRAY) c.drawCentredString(W/2, ln_y+15, "Collects extracellular fluid deposited in interstitium and returns it to venous blood.") c.drawCentredString(W/2, ln_y+3, "Runs parallel to the venous system | Lymph nodes provide immune surveillance and filtration.") # Embryonic header eb_y=380 color_banner(c, eb_y, 28, PURPLE, "EARLY EMBRYONIC CIRCULATORY SYSTEM (3–4 Weeks)") draw_rounded_box(c, (W-240)/2, 328, 240, 38, PURPLE, DARK_PURP, label="2-CHAMBERED EMBRYONIC HEART\n(Well-functioning pump at 3–4 weeks)", font_size=8.5) arrow(c, W/2, 328, W/2, 315) bwe=145; bhe=42; gape=14; total_e=3*bwe+2*gape; lxe=(W-total_e)/2; ec_y=255 emb_circ=[ ("INTRAEMBRYONIC\nSYSTEMIC CIRC.", "Ventral & dorsal aorta\nBranchial/aortic arches\nAnterior & posterior cardinal veins", RED, DARK_RED), ("EXTRAEMBRYONIC\nVITELLINE CIRC.", "Omphalomesenteric\narteries & veins\n(connects to yolk sac)", ORANGE, DARK_ORAN), ("PLACENTAL\nCIRCULATION", "Umbilical arteries (deoxygenated)\nUmbilical vein (O₂-rich blood)\n→ still called 'vein' (toward heart)", BLUE, DARK_BLUE), ] for i,(lbl,detail,fc,sc) in enumerate(emb_circ): bx=lxe+i*(bwe+gape) draw_rounded_box(c, bx, ec_y, bwe, bhe, fc, sc, label=lbl, font_size=8) arrow(c, W/2, 315, bx+bwe/2, ec_y+bhe) # detail box dbx_y=ec_y-66 c.setFillColor(colors.HexColor("#FDFEFE")); c.setStrokeColor(fc); c.setLineWidth(1) c.roundRect(bx, dbx_y, bwe, 58, 6, fill=1, stroke=1) c.setFillColor(fc); c.roundRect(bx, dbx_y+46, bwe, 12, 3, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 6.5) c.drawCentredString(bx+bwe/2, dbx_y+50, "Vessels:") c.setFont("Helvetica", 7); c.setFillColor(DARK_GRAY) for j,line in enumerate(detail.split('\n')): c.drawString(bx+5, dbx_y+36-j*12, line) arrow(c, bx+bwe/2, ec_y, bx+bwe/2, dbx_y+58) # Development note dn_y=148 c.setFillColor(colors.HexColor("#F3E5F5")); c.setStrokeColor(PURPLE); c.setLineWidth(1) c.roundRect(50, dn_y, W-100, 50, 8, fill=1, stroke=1) c.setFillColor(DARK_PURP); c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(W/2, dn_y+37, "DEVELOPMENTAL ASYMMETRY") c.setFont("Helvetica", 7.5); c.setFillColor(DARK_GRAY) c.drawCentredString(W/2, dn_y+24, "Early embryo: largely SYMMETRICAL vascular arrangement.") c.drawCentredString(W/2, dn_y+12, "With development: symmetry is lost in favor of left-sided preponderance.") c.drawCentredString(W/2, dn_y+0, "Example: left 4th aortic arch → becomes the definitive aortic arch in adults.") c.showPage() # ═══════════════════════════════════════════════════════ # PAGE 5 – POSITIONAL PRESSURE & ARTERY TYPES # ═══════════════════════════════════════════════════════ c.setFillColor(BG); c.rect(0,0,W,H,fill=1,stroke=0) page_header(c, "POSITIONAL PRESSURE CHANGES & ARTERY TYPES", "Hydrostatic Effects | THIEME Atlas of Anatomy") color_banner(c, 762, 28, ORANGE, "RECUMBENT → STANDING: Pressure Redistribution") draw_diamond(c, W/2, 730, 210, 46, ORANGE, DARK_ORAN, label="POSITION CHANGE\n(Recumbent → Standing)", font_size=8.5) arrow(c, W/2, 707, W/2, 695) draw_rounded_box(c, (W-280)/2, 660, 280, 35, ORANGE, DARK_ORAN, label="~500 mL blood SHIFTS to lower limb veins", font_size=9) arrow(c, W/2, 660, W/2, 647) # Two effects bwe2=200; bhe2=90; gape2=24; lxe2=(W-2*bwe2-gape2)/2 # Lower body c.setFillColor(colors.HexColor("#FDEDEC")); c.setStrokeColor(RED); c.setLineWidth(1.5) c.roundRect(lxe2, 545, bwe2, bhe2, 8, fill=1, stroke=1) c.setFillColor(RED); c.roundRect(lxe2, 545+bhe2-18, bwe2, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 9) c.drawCentredString(lxe2+bwe2/2, 545+bhe2-6, "LOWER BODY") for j,t in enumerate(["• Pressure RISES sharply","• Venous transmural pressure ↑", "• Veins distend (blood pooling)","• Risk of oedema if prolonged"]): c.setFont("Helvetica", 8); c.setFillColor(DARK_GRAY) c.drawString(lxe2+8, 545+bhe2-32-j*14, t) arrow(c, W/2, 647, lxe2+bwe2/2, 545+bhe2) # Upper body rxe2=lxe2+bwe2+gape2 c.setFillColor(colors.HexColor("#EAF2F8")); c.setStrokeColor(BLUE); c.setLineWidth(1.5) c.roundRect(rxe2, 545, bwe2, bhe2, 8, fill=1, stroke=1) c.setFillColor(BLUE); c.roundRect(rxe2, 545+bhe2-18, bwe2, 18, 4, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 9) c.drawCentredString(rxe2+bwe2/2, 545+bhe2-6, "UPPER BODY (Head & Neck)") for j,t in enumerate(["• Pressure DECREASES","• Head/neck veins may collapse", "• Compensatory reflexes activate","• Orthostatic hypotension risk"]): c.setFont("Helvetica", 8); c.setFillColor(DARK_GRAY) c.drawString(rxe2+8, 545+bhe2-32-j*14, t) arrow(c, W/2, 647, rxe2+bwe2/2, 545+bhe2) # Indifference point draw_rounded_box(c, (W-310)/2, 495, 310, 40, colors.HexColor("#7F8C8D"), colors.HexColor("#566573"), label="HYDROSTATIC INDIFFERENCE LEVEL\n(Just below the diaphragm – pressure unchanged)", font_size=8.5) for cx in [lxe2+bwe2/2, rxe2+bwe2/2]: arrow(c, cx, 545, W/2, 495+40) # Artery types section c.setFillColor(DARK_GRAY); c.rect(0, 458, W, 26, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 11) c.drawCentredString(W/2, 467, "ARTERY TYPES BY LOCATION & FUNCTION") at_data=[ ("ELASTIC-TYPE\nARTERIES\n(Near heart – e.g. Aorta)", ["Expand during systole","Elastic recoil in diastole","Convert intermittent pumping","→ continuous blood flow"], RED, DARK_RED), ("MUSCULAR-TYPE\nARTERIES\n(Distant from heart)", ["Can vasodilate / vasoconstrict","Control vascular resistance","Regulate local blood flow","Active smooth muscle layer"], ORANGE, DARK_ORAN), ("VEINS\n(Capacitance vessels)\n(All sizes)", ["Hold ~80% total blood volume","Act as blood reservoir","Low-pressure, compliant walls","Loose connective tissue structure"], BLUE, DARK_BLUE), ] atbw=160; atbh=100; atgap=10; total_at=3*atbw+2*atgap; lxat=(W-total_at)/2 for i,(lbl,details,fc,sc) in enumerate(at_data): bx=lxat+i*(atbw+atgap); by=340 c.setFillColor(colors.HexColor("#FDFEFE")); c.setStrokeColor(fc); c.setLineWidth(1.5) c.roundRect(bx, by, atbw, atbh, 8, fill=1, stroke=1) c.setFillColor(fc); c.roundRect(bx, by+atbh-22, atbw, 22, 4, fill=1, stroke=0) c.setFillColor(WHITE); c.setFont("Helvetica-Bold", 7.5) for k,ll in enumerate(lbl.split('\n')): c.drawCentredString(bx+atbw/2, by+atbh-9-k*9, ll) c.setFont("Helvetica", 7.5); c.setFillColor(DARK_GRAY) for j,dl in enumerate(details): c.drawString(bx+6, by+atbh-46-j*13, dl) # Summary box sum_y=290 c.setFillColor(colors.HexColor("#FDFEFE")); c.setStrokeColor(DARK_GRAY); c.setLineWidth(1) c.roundRect(40, sum_y, W-80, 36, 8, fill=1, stroke=1) c.setFillColor(DARK_GRAY); c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(W/2, sum_y+23, "PRESSURE GRADIENT SUMMARY") c.setFont("Helvetica", 8) c.drawCentredString(W/2, sum_y+11, "High-pressure arteries (~100 mmHg) → Capillary exchange zone → Low-pressure veins (< 20 mmHg)") c.drawCentredString(W/2, sum_y+0, "Blood flows DOWN the pressure gradient from arteries to veins via capillaries.") # End note en_y=245 c.setFillColor(colors.HexColor("#EAF2F8")); c.setStrokeColor(BLUE); c.setLineWidth(1) c.roundRect(40, en_y, W-80, 30, 8, fill=1, stroke=1) c.setFillColor(DARK_BLUE); c.setFont("Helvetica-Bold", 8.5) c.drawCentredString(W/2, en_y+18, "THE CIRCULATORY SYSTEM – KEY TAKEAWAY") c.setFont("Helvetica", 7.5); c.setFillColor(DARK_GRAY) c.drawCentredString(W/2, en_y+6, "A closed, pressure-driven system maintaining continuous delivery of O₂, nutrients, and removal of waste to every cell in the body.") c.showPage() c.save() print("PDF saved successfully at:", out) PYEOF

You've run out of free credits. Sign up for a free account to continue using Orris.
This is a shared conversation. Sign in to Orris to start your own chat.