# Geometry Creation ## Points and Lines Point and lines can be easily created in Python code. As each item, points need a command to be created (createPoint), these are reflected in the Script Manual for each item. Example: create a point at (0,0,0), named "Point". ```{code-block} createPoint("Point",[0,0,0]) ``` Lines can be created by coordinates given or reference points already created: ```{code-block} createLine("Line1",[0,0,0],[5,0,0]) createLine("Line2","Point1","Point2") ``` You can also create groups of points or lines in a few lines of code using loops. This example shows how to create 50 points and 49 lines in reference to these points: ```{code-block} Dim = 50 Point = [] Line = [] for i in range(Dim): Point.append("Point" + str(i+1)) createPoint(Point[i],[i+10,0,i+15]) for j in range(Dim-1): Line.append("Line" + str(j+1)) createLine(Line[j],Point[j],Point[j+1]) ``` ## Surfaces and Volumes Surfaces and volumes are geometric shapes easy to create using Python code. There are different surfaces and different ways to create them as well as volumes, each one belongs to a command, which is listed in the Script Manual. Examples below: To create a quadrilateral surface, is needed 4 points, giving its coordinates or reference points already created ("P1","P2","P3","P4"): ```{code-block} createQuad("Quad",(0,0,0),(1,0,0),(1,1,0),(0,1,0)) createQuad("Quad","P1","P2","P3","P4") ``` CivilFEM has certain primitive volumes, such as cones, spheres and boxes. For example the cone needs a central point of the cone base, axis, radius of the lower base, upper radius, height and angle to truncate, shown as follows: ```{code-block} createCone("Cone",(0,0,0),[0,0,1],1,0,1,360) ``` You can also change arguments units on code with the basic type "Double": ```{code-block} createCone("Cone",(0,0,0),[0,0,1],Double(1,"m"),0,Double(1,"m"),Double(360,"Deg")) ``` ## Import and Export Geometry CivilFEM gives the option of import or export geometry and that option is available in Python too. There are three different options: - **Import**: let you import geometry from other model in igs, iges, stp, step, x_t or dxf extensions, giving the path. ```{code-block} importGeom(".\folder\geometry.igs") ``` - ***Export selected***: Exports the selected geometry to an external file in igs, iges, stp, step, x_t or dxf extensions, giving the entities and the path. ```{code-block} exportSelect([geom1,geom2,geom3],".\geometry.igs") ``` - ***Export all***: Exports all geometry to an external file in igs, iges, stp, step, x_t or dxf extensions, giving the path. ```{code-block} exportAll(".\export_geometry.igs") ```