0% found this document useful (0 votes)
0 views1 page

GRASP Python (4)

The document outlines a VBA script for creating a structural analysis input form, utilizing dictionaries to store material properties and section types. It includes predefined materials like Steel, Concrete, and Aluminum, along with section types such as Rectangular and I-Beam. The form features controls for analysis options and structure components, allowing users to input parameters for structural analysis.

Uploaded by

Le Fondateur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views1 page

GRASP Python (4)

The document outlines a VBA script for creating a structural analysis input form, utilizing dictionaries to store material properties and section types. It includes predefined materials like Steel, Concrete, and Aluminum, along with section types such as Rectangular and I-Beam. The form features controls for analysis options and structure components, allowing users to input parameters for structural analysis.

Uploaded by

Le Fondateur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

' Use dictionaries for materials and sections

Set materials = New Dictionary


Set sections = New Dictionary

' Populate materials


materials.Add "Steel", Array(200000000000#, 0.3, 7850, "Isotropic")
materials.Add "Concrete", Array(25000000000#, 0.2, 2400, "Isotropic")
materials.Add "Aluminum", Array(69000000000#, 0.33, 2700, "Isotropic")
materials.Add "CarbonFiber", Array(70000000000#, 0.28, 1600,
"Orthotropic")

' Populate sections


sections.Add "Rectangular", Array("Rectangular", 0.2, 0.3)
sections.Add "Circular", Array("Circular", 0.25)
sections.Add "I-Beam", Array("I-Beam", 0.2, 0.3, 0.02, 0.015)
sections.Add "Pipe", Array("Pipe", 0.25, 0.02)

' Set default analysis options


analysisType = "2D"
solverType = "direct"
deformationScale = 50
End Sub

Sub CreateEnhancedInputForm()
Dim frm As Object
Set frm = ThisWorkbook.VBProject.VBComponents.Add(vbext_ct_MSForm)
With frm
.Properties("Caption") = "Enhanced Structural Analysis"
.Properties("Width") = 800
.Properties("Height") = 650
End With

' Add enhanced controls


AddControl frm, "Frame", "fraMain", "", 10, 10, 770, 590

' Analysis options frame


AddControl frm, "Frame", "fraOptions", "Analysis Options", 520, 20, 250,
120)
AddControl frm, "Label", "lblAnalysisType", "Analysis Type:", 530, 50,
80, 20)
AddControl frm, "ComboBox", "cboAnalysisType", "", 620, 50, 140, 20)
AddControl frm, "Label", "lblSolver", "Solver:", 530, 80, 80, 20)
AddControl frm, "ComboBox", "cboSolver", "", 620, 80, 140, 20)
AddControl frm, "Label", "lblDefScale", "Deformation Scale:", 530, 110,
80, 20)
AddControl frm, "TextBox", "txtDefScale", "", 620, 110, 50, 20)

' Structure components frame


AddControl frm, "Frame", "fraComponents", "Structure Components", 20, 20,
480, 250)
AddControl frm, "CommandButton", "btnAddNode", "Add Node", 30, 50, 80,
25)
AddControl frm, "CommandButton", "btnAddElement", "Add Element", 120, 50,
80, 25)
AddControl frm, "CommandButton", "btnAddLoad", "Add Load", 210, 50, 80,
25)

P a g e 52 | 62

You might also like