[{"data":1,"prerenderedAt":436},["ShallowReactive",2],{"branding":3,"navigation":11,"social":38,"\u002Fdocs\u002Foverview\u002Ffirst-steps":57,"\u002Fdocs\u002Foverview\u002Ffirst-steps-python":348,"\u002Fdocs\u002Foverview\u002Ffirst-steps-surround":349,"docs-navigation":358},{"id":4,"title":5,"description":6,"extension":7,"meta":8,"stem":9,"__hash__":10},"branding\u002Fbranding.yml","COMPAS","The Progressive Python Framework for AEC","yml",{},"branding","RZe_zlUXQhPN3ap5X6d0zUmiqalxe1ZFVRnIsmTB9VU",{"id":12,"title":13,"extension":7,"items":14,"meta":35,"stem":36,"__hash__":37},"navigation\u002Fnavigation.yml","Main Navigation",[15,19,23,27,31],{"label":16,"icon":17,"to":18},"Docs","i-heroicons-book-open","\u002Fdocs\u002Foverview\u002Fintroduction",{"label":20,"icon":21,"to":22},"Packages","i-heroicons-puzzle-piece","\u002Fpackages",{"label":24,"icon":25,"to":26},"Association","i-heroicons-users","\u002Fassociation",{"label":28,"to":29,"icon":30},"News","\u002Fnews","i-heroicons-newspaper",{"label":32,"icon":33,"to":34},"Forum","i-heroicons-chat-bubble-left-right","https:\u002F\u002Fforum.compas-framework.org\u002F",{},"navigation","0jaKadsuS1w-R-2CifQeF-7No6HqrVyF7jIP80oFYoM",{"id":39,"title":40,"extension":7,"items":41,"meta":54,"stem":55,"__hash__":56},"social\u002Fsocial.yml","Social Media",[42,46,50],{"label":43,"to":44,"icon":45},"GitHub","https:\u002F\u002Fgithub.com\u002Fcompas-dev","i-simple-icons-github",{"label":47,"to":48,"icon":49},"X","https:\u002F\u002Fx.com\u002Fcompas_dev","i-simple-icons-x",{"label":51,"to":52,"icon":53},"LinkedIn","https:\u002F\u002Fwww.linkedin.com\u002Fcompany\u002Fcompas-association","i-simple-icons-linkedin",{},"social","495juwkNU0wtE_8lwERDZNWQES5uWYuMK_Wa6cQ9Wxg",{"id":58,"title":59,"body":60,"description":340,"extension":341,"headline":342,"meta":343,"navigation":102,"path":344,"seo":345,"stem":346,"__hash__":347},"docs\u002Fdocs\u002F1.overview\u002F3.first-steps.md","First Steps",{"type":61,"value":62,"toc":333},"minimark",[63,76,81,145,148,152,185,188,192,251,258,262,286,289,293,326,329],[64,65,66,67,71,72,75],"p",{},"These snippets run in any Python session that has COMPAS installed. Save them in a file and run it with ",[68,69,70],"code",{},"python",", or ",[68,73,74],{},"uv run"," if you installed with uv.",[77,78,80],"h2",{"id":79},"points-and-vectors","Points and vectors",[82,83,87],"pre",{"className":84,"code":85,"language":70,"meta":86,"style":86},"language-python shiki shiki-themes github-dark","from compas.geometry import Point, Vector\n\na = Point(0, 0, 0)\nb = Point(1, 2, 3)\nv = b - a\n\nprint(v)           # Vector(x=1.0, y=2.0, z=3.0)\nprint(v.length)    # 3.7416...\nprint(a + v == b)  # True\n","",[68,88,89,97,104,110,116,122,127,133,139],{"__ignoreMap":86},[90,91,94],"span",{"class":92,"line":93},"line",1,[90,95,96],{},"from compas.geometry import Point, Vector\n",[90,98,100],{"class":92,"line":99},2,[90,101,103],{"emptyLinePlaceholder":102},true,"\n",[90,105,107],{"class":92,"line":106},3,[90,108,109],{},"a = Point(0, 0, 0)\n",[90,111,113],{"class":92,"line":112},4,[90,114,115],{},"b = Point(1, 2, 3)\n",[90,117,119],{"class":92,"line":118},5,[90,120,121],{},"v = b - a\n",[90,123,125],{"class":92,"line":124},6,[90,126,103],{"emptyLinePlaceholder":102},[90,128,130],{"class":92,"line":129},7,[90,131,132],{},"print(v)           # Vector(x=1.0, y=2.0, z=3.0)\n",[90,134,136],{"class":92,"line":135},8,[90,137,138],{},"print(v.length)    # 3.7416...\n",[90,140,142],{"class":92,"line":141},9,[90,143,144],{},"print(a + v == b)  # True\n",[64,146,147],{},"Subtracting two points gives a vector, and adding a vector to a point gives a point.",[77,149,151],{"id":150},"frames","Frames",[82,153,155],{"className":84,"code":154,"language":70,"meta":86,"style":86},"from compas.geometry import Frame\n\nframe = Frame([1, 0, 0], [1, 0, 0], [0, 1, 0])\n\nprint(frame.point)   # Point(x=1.0, y=0.0, z=0.0)\nprint(frame.zaxis)   # Vector(x=0.0, y=0.0, z=1.0)\n",[68,156,157,162,166,171,175,180],{"__ignoreMap":86},[90,158,159],{"class":92,"line":93},[90,160,161],{},"from compas.geometry import Frame\n",[90,163,164],{"class":92,"line":99},[90,165,103],{"emptyLinePlaceholder":102},[90,167,168],{"class":92,"line":106},[90,169,170],{},"frame = Frame([1, 0, 0], [1, 0, 0], [0, 1, 0])\n",[90,172,173],{"class":92,"line":112},[90,174,103],{"emptyLinePlaceholder":102},[90,176,177],{"class":92,"line":118},[90,178,179],{},"print(frame.point)   # Point(x=1.0, y=0.0, z=0.0)\n",[90,181,182],{"class":92,"line":124},[90,183,184],{},"print(frame.zaxis)   # Vector(x=0.0, y=0.0, z=1.0)\n",[64,186,187],{},"A frame is a local coordinate system: an origin and two axes. COMPAS uses frames to place geometry.",[77,189,191],{"id":190},"a-box","A box",[82,193,195],{"className":84,"code":194,"language":70,"meta":86,"style":86},"import math\nfrom compas.geometry import Box, Frame, Rotation, Translation\n\nbox = Box(1, 2, 3, frame=Frame.worldXY())\n\nT = Translation.from_vector([5, 0, 0])\nR = Rotation.from_axis_and_angle([0, 0, 1], math.radians(45))\nbox.transform(T * R)\n\nprint(box.frame.point)  # Point(x=5.0, y=0.0, z=0.0)\nprint(box.volume)       # 6.0\n",[68,196,197,202,207,211,216,220,225,230,235,239,245],{"__ignoreMap":86},[90,198,199],{"class":92,"line":93},[90,200,201],{},"import math\n",[90,203,204],{"class":92,"line":99},[90,205,206],{},"from compas.geometry import Box, Frame, Rotation, Translation\n",[90,208,209],{"class":92,"line":106},[90,210,103],{"emptyLinePlaceholder":102},[90,212,213],{"class":92,"line":112},[90,214,215],{},"box = Box(1, 2, 3, frame=Frame.worldXY())\n",[90,217,218],{"class":92,"line":118},[90,219,103],{"emptyLinePlaceholder":102},[90,221,222],{"class":92,"line":124},[90,223,224],{},"T = Translation.from_vector([5, 0, 0])\n",[90,226,227],{"class":92,"line":129},[90,228,229],{},"R = Rotation.from_axis_and_angle([0, 0, 1], math.radians(45))\n",[90,231,232],{"class":92,"line":135},[90,233,234],{},"box.transform(T * R)\n",[90,236,237],{"class":92,"line":141},[90,238,103],{"emptyLinePlaceholder":102},[90,240,242],{"class":92,"line":241},10,[90,243,244],{},"print(box.frame.point)  # Point(x=5.0, y=0.0, z=0.0)\n",[90,246,248],{"class":92,"line":247},11,[90,249,250],{},"print(box.volume)       # 6.0\n",[64,252,253,254,257],{},"Transformations are 4x4 matrices. Combine them with ",[68,255,256],{},"*","; the right-hand one applies first.",[77,259,261],{"id":260},"from-shape-to-mesh","From shape to mesh",[82,263,265],{"className":84,"code":264,"language":70,"meta":86,"style":86},"mesh = box.to_mesh()\n\nprint(mesh.number_of_vertices())  # 8\nprint(mesh.number_of_faces())     # 6\n",[68,266,267,272,276,281],{"__ignoreMap":86},[90,268,269],{"class":92,"line":93},[90,270,271],{},"mesh = box.to_mesh()\n",[90,273,274],{"class":92,"line":99},[90,275,103],{"emptyLinePlaceholder":102},[90,277,278],{"class":92,"line":106},[90,279,280],{},"print(mesh.number_of_vertices())  # 8\n",[90,282,283],{"class":92,"line":112},[90,284,285],{},"print(mesh.number_of_faces())     # 6\n",[64,287,288],{},"Shapes convert to meshes, which are what CAD tools and viewers display.",[77,290,292],{"id":291},"save-and-load","Save and load",[82,294,296],{"className":84,"code":295,"language":70,"meta":86,"style":86},"import compas\n\ncompas.json_dump(box, \"box.json\")\nsame_box = compas.json_load(\"box.json\")\n\nprint(same_box.volume)  # 6.0\n",[68,297,298,303,307,312,317,321],{"__ignoreMap":86},[90,299,300],{"class":92,"line":93},[90,301,302],{},"import compas\n",[90,304,305],{"class":92,"line":99},[90,306,103],{"emptyLinePlaceholder":102},[90,308,309],{"class":92,"line":106},[90,310,311],{},"compas.json_dump(box, \"box.json\")\n",[90,313,314],{"class":92,"line":112},[90,315,316],{},"same_box = compas.json_load(\"box.json\")\n",[90,318,319],{"class":92,"line":118},[90,320,103],{"emptyLinePlaceholder":102},[90,322,323],{"class":92,"line":124},[90,324,325],{},"print(same_box.volume)  # 6.0\n",[64,327,328],{},"Every COMPAS object serializes to JSON and comes back as the same type. This is how data moves between Python, Rhino, Grasshopper and Blender.",[330,331,332],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":86,"searchDepth":99,"depth":99,"links":334},[335,336,337,338,339],{"id":79,"depth":99,"text":80},{"id":150,"depth":99,"text":151},{"id":190,"depth":99,"text":191},{"id":260,"depth":99,"text":261},{"id":291,"depth":99,"text":292},"The COMPAS Hello World.","md","Overview",{},"\u002Fdocs\u002Foverview\u002Ffirst-steps",{"title":59,"description":340},"docs\u002F1.overview\u002F3.first-steps","Z6kqs2UMoO1WgNLgE8tcGDiA49PtZUtqzN1Glb53oKQ",null,[350,354],{"title":351,"path":352,"stem":353,"children":-1},"Installation","\u002Fdocs\u002Foverview\u002Finstallation","docs\u002F1.overview\u002F2.installation",{"title":355,"path":356,"stem":357,"children":-1},"What's Next","\u002Fdocs\u002Foverview\u002Fwhats-next","docs\u002F1.overview\u002F4.whats-next",[359],{"title":16,"path":360,"stem":361,"children":362,"page":378},"\u002Fdocs","docs",[363,379,409,426],{"title":342,"icon":364,"path":365,"stem":366,"children":367,"page":378},"i-heroicons-play","\u002Fdocs\u002Foverview","docs\u002F1.overview",[368,371,372,373,374],{"title":369,"path":18,"stem":370},"Introduction","docs\u002F1.overview\u002F1.introduction",{"title":351,"path":352,"stem":353},{"title":59,"path":344,"stem":346},{"title":355,"path":356,"stem":357},{"title":375,"path":376,"stem":377},"Ecosystem","\u002Fdocs\u002Foverview\u002Fecosystem","docs\u002F1.overview\u002F5.ecosystem",false,{"title":380,"icon":381,"path":382,"stem":383,"children":384,"page":378},"Features","i-heroicons-sparkles-solid","\u002Fdocs\u002Ffeatures","docs\u002F2.features",[385,389,393,397,401,405],{"title":386,"path":387,"stem":388},"Robust Geometry Kernel","\u002Fdocs\u002Ffeatures\u002Fgeometry","docs\u002F2.features\u002F1.geometry",{"title":390,"path":391,"stem":392},"Flexible Data Models","\u002Fdocs\u002Ffeatures\u002Fdata","docs\u002F2.features\u002F2.data",{"title":394,"path":395,"stem":396},"Interoperability Across Tools","\u002Fdocs\u002Ffeatures\u002Finterop","docs\u002F2.features\u002F3.interop",{"title":398,"path":399,"stem":400},"Cross Platform","\u002Fdocs\u002Ffeatures\u002Fcross-platform","docs\u002F2.features\u002F4.cross-platform",{"title":402,"path":403,"stem":404},"Modular Extension Ecosystem","\u002Fdocs\u002Ffeatures\u002Fextensions","docs\u002F2.features\u002F5.extensions",{"title":406,"path":407,"stem":408},"Developer-Friendly Foundation","\u002Fdocs\u002Ffeatures\u002Fdevelopers","docs\u002F2.features\u002F6.developers",{"title":410,"icon":411,"path":412,"stem":413,"children":414,"page":378},"Examples","i-heroicons-beaker","\u002Fdocs\u002Fexamples","docs\u002F3.examples",[415,419,422],{"title":416,"path":417,"stem":418},"Making a box","\u002Fdocs\u002Fexamples\u002Fbox","docs\u002F3.examples\u002F1.box",{"title":80,"path":420,"stem":421},"\u002Fdocs\u002Fexamples\u002Fpoints-and-vectors","docs\u002F3.examples\u002F2.points-and-vectors",{"title":423,"path":424,"stem":425},"Planes and frames","\u002Fdocs\u002Fexamples\u002Fplanes-and-frames","docs\u002F3.examples\u002F3.planes-and-frames",{"title":427,"icon":428,"path":429,"stem":430,"children":431,"page":378},"Cite & Credit","i-heroicons-academic-cap","\u002Fdocs\u002Fcite","docs\u002F4.cite",[432],{"title":433,"path":434,"stem":435},"Show it on your project","\u002Fdocs\u002Fcite\u002Fshow-it-on-your-project","docs\u002F4.cite\u002F1.show-it-on-your-project",1791766075901]