Joel Pegg
Aerospace
- Dec 11, 2020
- 1
Hi, I have been working in my free time in excel to create a database of materials that I can sort and quickly add to femap to save time. I accomplished this part pretty quickly and it has saved me and my colleagues quite a bit of time. Now I've grown tired of creating properties for screws and I'm trying to automate that as well. I've got everything working except it won't compute the shape properties. I'm new to femap and only have 3 months of experience I'm thinking the computestdshape is what I need but when I try to use it (note I'm doing everything from excel) it gives an error that it expects and an equal sign. any ideas would be helpful. code is below.
Public Sub Fastener()
Dim femap As Object
Dim tbl As ListObject
Set femap = GetObject(, "femap.model")
Set tbl = ActiveSheet.ListObjects("Fasteners")
Set tbl2 = Worksheets("Materials").ListObjects("Mats")
Dim feMatl As Object
Set feMatl = femap.feMatl
Dim feProp As Object
Set feProp = femap.feProp
Dim v As Variant
Dim i As Integer
Dim t As Variant
Dim j As Variant
Dim d As Double
tbl2.Range.AutoFilter _
Field:=2, _
Criteria1:="4340"
For i = 1 To tbl2.ListRows.Count
If tbl2.ListRows(i).Range.RowHeight > 0 Then
v = feMatl.mmat
feMatl.Title = tbl2.DataBodyRange(i, 1) & "-" & tbl2.DataBodyRange(i, 2) & " " & tbl2.DataBodyRange(i, 3)
v(49) = tbl2.DataBodyRange(i, 5)
v(0) = tbl2.DataBodyRange(i, 6)
v(6) = tbl2.DataBodyRange(i, 7)
v(52) = tbl2.DataBodyRange(i, 8)
v(85) = tbl2.DataBodyRange(i, 9)
v(84) = tbl2.DataBodyRange(i, 11)
feMatl.mmat = v
v = feMatl.imat
v(2) = 3
feMatl.imat = v
feMatl.Put (feMatl.NextEmptyID)
End If
Next i
tbl2.AutoFilter.ShowAllData
For i = 1 To tbl.ListRows.Count
If tbl.ListRows(i).Range.RowHeight > 0 Then
d = tbl.DataBodyRange(i, 3)
feProp.Title = "Fastener #" & tbl.DataBodyRange(i, 1) & tbl.DataBodyRange(i, 2) & " in Dia"
feProp.matlID = feMatl.ID
feProp.Type = 2
feProp.flagI(1) = 5
feProp.pval(40) = d
here is where i expect feProp.computestdshape needs to go but it doesn't want to work
feProp.Put (feProp.NextEmptyID)
End If
Next i
tbl.AutoFilter.ShowAllData
End Sub
Public Sub Fastener()
Dim femap As Object
Dim tbl As ListObject
Set femap = GetObject(, "femap.model")
Set tbl = ActiveSheet.ListObjects("Fasteners")
Set tbl2 = Worksheets("Materials").ListObjects("Mats")
Dim feMatl As Object
Set feMatl = femap.feMatl
Dim feProp As Object
Set feProp = femap.feProp
Dim v As Variant
Dim i As Integer
Dim t As Variant
Dim j As Variant
Dim d As Double
tbl2.Range.AutoFilter _
Field:=2, _
Criteria1:="4340"
For i = 1 To tbl2.ListRows.Count
If tbl2.ListRows(i).Range.RowHeight > 0 Then
v = feMatl.mmat
feMatl.Title = tbl2.DataBodyRange(i, 1) & "-" & tbl2.DataBodyRange(i, 2) & " " & tbl2.DataBodyRange(i, 3)
v(49) = tbl2.DataBodyRange(i, 5)
v(0) = tbl2.DataBodyRange(i, 6)
v(6) = tbl2.DataBodyRange(i, 7)
v(52) = tbl2.DataBodyRange(i, 8)
v(85) = tbl2.DataBodyRange(i, 9)
v(84) = tbl2.DataBodyRange(i, 11)
feMatl.mmat = v
v = feMatl.imat
v(2) = 3
feMatl.imat = v
feMatl.Put (feMatl.NextEmptyID)
End If
Next i
tbl2.AutoFilter.ShowAllData
For i = 1 To tbl.ListRows.Count
If tbl.ListRows(i).Range.RowHeight > 0 Then
d = tbl.DataBodyRange(i, 3)
feProp.Title = "Fastener #" & tbl.DataBodyRange(i, 1) & tbl.DataBodyRange(i, 2) & " in Dia"
feProp.matlID = feMatl.ID
feProp.Type = 2
feProp.flagI(1) = 5
feProp.pval(40) = d
here is where i expect feProp.computestdshape needs to go but it doesn't want to work
feProp.Put (feProp.NextEmptyID)
End If
Next i
tbl.AutoFilter.ShowAllData
End Sub