Damian Dad
Damian Dad
2016
FEProgramming
[Contact][Consultancy][FreeFiniteElementAnalysisSoftware][FiniteElementProgramming]
[FemapProgramming][NastranPre&Post][Tutorials][Disclaimer]
ASimpleFemapAPIProgramTutorial:toautomaticallycreateaFemaploadsetandapplysomenodalforces.
Step1:Followtutorial4tocreatethepatchofelementshownbelow:
thenodelabelsareshownandrangefrom1to121
2)Createanewworkbookandaddacommandbuttononsheet1asdemonstratedintutorial1.Fillcolumns1to4
withdummynodeid,Fx,Fy,Fzvaluestoapplyfornodes1to121asillustratedbelow:
3)TheCode:
OptionExplicit
PrivateSubCommandButton1_Click()
DimgfemapAsObject
DimLoadSetAsObject
DimLoadAsObject
DimlLsetIDAsLong
DimiAsInteger
DimlNIDAsLong
DimdFxAsDouble
DimdFyAsDouble
DimdFzAsDouble
DimiRowAsInteger
DimWSAsWorksheet
SetWS=ThisWorkbook.Worksheets(1)
iRow=2'startrowofourdatainExcel
http://m3d.org.uk/Example10.htm
1/2
12.01.2016
FEProgramming
Setgfemap=GetObject(,"femap.model")'Theopenfemapsession
SetLoadSet=gfemap.feLoadSet'SetloadSettoanewfemapfeLoadSetobject
SetLoad=gfemap.feLoadMesh()'setloadtoafemaploadmeshobjectwhichwillholdthe
'theforcevaluesataparticularnode
'Createthenewloadsetinfemap
lLsetID=LoadSet.NextEmptyID'GetauniqueIDfortheloadset
LoadSet.Title="DummyLSet"'Nameit
LoadSet.Put(lLsetID)'PutitintoFemap
'loopthroughallthedataontheworksheet
DoUntilWS.Cells(iRow,1)=""
lNID=WS.Cells(iRow,1)'Thenodeidfortheforce
dFx=WS.Cells(iRow,2)'Theforcevaluestoapplyatthisnode
dFy=WS.Cells(iRow,3)
dFz=WS.Cells(iRow,4)
Load.meshID=lNID'thenodeIDforthisload
Load.Type=1'loadoftypeforce
Load.Load(0)=dFx'settheforcevalues
Load.Load(1)=dFy
Load.Load(2)=dFz
Load.XOn=True'makethisdofactive
Load.YOn=True
Load.ZOn=True
Load.SetID=lLsetID'attachthisforcetotheloadsetwecreated
Load.Put(Load.NextEmptyID)'puttheloadintofemap
iRow=iRow+1'nextrow
Loop
EndSub
4)DoaregeninFemapandactivatetheloadsetcreated,illustratedbelow:
[Home][Up]
http://m3d.org.uk/Example10.htm
2/2