# How to draw a cube?

Draw a cube, ABCDA1B1C1D1, with the length of the edge as 1. How to draw this cube and establish a space rectangular coordinate system at the same time. Point A on the bottom is the origin of the coordinate system, the line AB is on the x-axis, the line AD is on the y-axis, and the line AA1 is on the z-axis.

• There is a builtin function Cube represents a regular cube centered at the origin with unit edge length. that does this, You can use it and show the Axes. Give it a try and if you get stick show what you tried and where you had problem. Jan 29 at 10:22
• Graphics3D[Cube[]]Use this command to draw a cube with an edge length of 1. How to mark the corresponding letter at the vertex? Jan 29 at 10:30
• Please ask well-formed questions. It is not a good idea to morph questions after they have been answered. Thanks.
– Syed
Jan 29 at 13:46

Here is something to get you started. You can add more labels as shown. Basically you use the Text command to place labels where you want them. Check the Text command options for finer control.

Graphics3D[{
{Opacity[.1], Cuboid[{0, 0, 0}]},
Text["A", {-.1, 0, 0}, {-1, 0}],
Text["B", {1, -.1, 0}, {-1, 0}],
Text["D", {0, 1.1, 0}, {-1, 0}],
Text["A1", {0, 0, 1.1}, {-1, 0}]
},
AxesOrigin -> {0, 0, 0},
PlotRange -> {{-.2, 1.4}, {-.2, 1.4}, {-.2, 1.4}},
Axes -> True, PreserveImageOptions -> False,
AxesLabel -> {"x", "y", "z"},
Ticks -> None, Boxed -> False]

• After drawing the image, can we automatically write the coordinates of vector AB and vector AB1? How to calculate the vector coordinates formed by any two points in the graph? Jan 29 at 12:29
• That is to say, after establishing a coordinate system for a solid figure, you want to write out the vector coordinates between any two points in the figure Jan 29 at 12:33
Graphics3D[
{FaceForm[None],
Cuboid[{0, 0, 0}],
PointSize[Large],
{Point[#1], Text[Style[#2, Large], #1, {-1, -1}]} & @@@
{{{0, 0, 0}, "A"},
{{1, 0, 0}, "B"},
{{1, 1, 0}, "C"},
{{0, 1, 0}, "D"},
{{0, 0, 1}, "A2"},
{{1, 0, 1}, "B2"},
{{1, 1, 1}, "C2"},
{{0, 1, 1}, "D2"}}},
Boxed -> False]


One can also use labeling with ListPointPlot3D but in this case it's more hassle than necessary.

• After drawing the image, can we automatically write the coordinates of vector AB and vector AB1? How to calculate the vector coordinates formed by any two points in the graph? Jan 29 at 12:29
• That is to say, after establishing a coordinate system for a solid figure, you want to write out the vector coordinates between any two points in the figure Jan 29 at 12:33
• @cns899 for this sort of labelling, I'd suggest creating a mesh region of the cube with BoundaryMeshRegion[Cube[]], and using HighlightMesh to label cells of different dimensions according to your interest. Anyway, this labelling, be it on a mesh region or Graphics3D construct tends to mostly involve manual work of specifying vertices, edges, etc. and finding aesthetic layouts for labels. Jan 29 at 12:44