Skip to content

Resolve "Create Shape class"

Lucas POLO-LOPEZ requested to merge 11-create-shape-class into develop

Closes #11 (closed)

Methods to implement

addBrick(self, xMin, xMax, yMin, yMax, zMin, zMax, name, component, material)

VBA string

vba = (
	'With Brick\n' +
	'.Reset\n' +
	'.Name "{}"\n'.format(name) +
	'.Component "{}"\n'.format(component) +
	'.Material "{}"\n'.format(material) +
	'.XRange "{}", "{}"\n'.format(geomParams["xMin"], geomParams["xMax"]) +
	'.YRange "{}", "{}"\n'.format(geomParams["yMin"], geomParams["yMax"]) +
	'.ZRange "{}", "{}"\n'.format(geomParams["zMin"], geomParams["zMax"]) +
	'.Create\n' +
	'End With'
)

addCylinder(self, xMin, xMax=0.0, yMin, yMax=0.0, zMin, zMax=0.0, extRad, intRad, name, component, material, orientation, nSegments=0)

VBA string

vba = (
	'With Cylinder\n' +
        '.Reset\n' +
        '.Name "{}"\n'.format(name) +
        '.Component "{}"\n'.format(component) +
        '.Material "{}"\n'.format(material) +
        '.OuterRadius "{}"\n'.format(geomParams["extRad"]) +
        '.InnerRadius "{}"\n'.format(geomParams["intRad"]) +
        '.Axis "{}"\n'.format(orientation)
    )
    
if orientation == "x":
    vbaAux = (
        '.Xrange "{}", "{}"\n'.format(geomParams["xMin"], geomParams["xMax"]) +
        '.Ycenter "{}"\n'.format(geomParams["y"]) +
        '.Zcenter "{}"\n'.format(geomParams["z"]) +
        '.Segments "{}"\n'.format(geomParams["nSegments"]) +
        '.Create\n' +
        'End With'
        )
    
elif orientation == "y":
    vbaAux = (
        '.Yrange "{}", "{}"\n'.format(geomParams["yMin"], geomParams["yMax"]) +
        '.Xcenter "{}"\n'.format(geomParams["x"]) +
        '.Zcenter "{}"\n'.format(geomParams["z"]) +
        '.Segments "{}"\n'.format(geomParams["nSegments"]) +
        '.Create\n' +
        'End With');
    
elif orientation == "z":
    vbaAux = (
        '.Zrange "{}", "{}"\n'.format(geomParams["zMin"], geomParams["zMax"]) +
        '.Xcenter "{}"\n'.format(geomParams["x"]) +
        '.Ycenter "{}"\n'.format(geomParams[y"]) "+
        '.Segments "{}"\n'.format(geomParams["nSegments"]) +
        '.Create\n' +
        'End With'
        )
else:
    raise ValueError()

vba = vba + vbaAux

addSphere(self, xCen, yCen, zCen, cenRad, topRad, botRad, name, component, material, orientation="z", nSegments=0)

VBA string

vba = (
        'With Sphere\n' +
        '.Reset \n' +
        '.Name "{}"\n'.format(name) +
        '.Component "{}"\n'.format(component) +
        '.Material "{}"\n'.format(material) +
        '.Axis "{}"\n'.format(orientation) +
        '.CenterRadius "{:f}"\n'.format(cenRad) +
        '.TopRadius "{:f}"\n'.format(topRad) +
        '.BottomRadius "{:f}"\n'.format(botRad) +
        '.Center "{}", "{}", "{}"\n'.format(geomParams["xCen"], geomParams["yCen"], geomParams["zCen"]) +
        '.Segments "{}"\n'.format(geomParams["nSegments"]) +
        '.Create\n' +
        'End With'
    )

addPolygonBlock(points,height,name,component,material, zMin = 0.0)

VBA string

VBA = (
        'With Extrude\n' +
        '.Reset\n' +
        '.Name "{}"\n'.format(name) +
        '.Component "{}"\n'.format(component) +
        '.Material "{}"\n'.format(material) +
        '.Mode "pointlist"\n' +
        '.Height "{}"\n'.format(geomParams["height"]) +
        '.Twist "0.0"\n' +
        '.Taper "0.0"\n' +
        '.Origin "0.0", "0.0", "{}"\n'.format(geomParams["zMin"]) +
        '.Uvector "1.0", "0.0", "0.0"\n' +
        '.Vvector "0.0", "1.0", "0.0"\n' +
        '.Point "{:f}", "{:f}"\n'.format(points[0][0], points[0][1])
    )

vbaAux = ''
for ii in range(len(points)):
    vbaAux = vbaAux + '.LineTo "{:f}", "{:f}"\n'.format(points[ii][1], points [ii][2]);

vba = vba + vbaAux + '.create\nEnd With'
Edited by Lucas POLO-LOPEZ

Merge request reports

Loading