Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

FEMAP API - feSurfaceRevolve Parameter Help

Status
Not open for further replies.

zanestoy

Structural
Apr 25, 2012
10
I've been working with FEMAP for about 6 years now, and am trying to learn the API to be more efficient. I am trying to create a cylinder from a line using feSurfaceRevolve. I can get the lines drawn using the API, but I can't figure out how to get the revolve to work. I've tried using the curveID with the negative sign in front of it, but that just kicks back an error message that the curve could not be created. Any help would be greatly appreciated. My code is below.

Sub Main
Dim App As femap.model
Set App = feFemap()
Dim Height1, Diameter1 As Double
Height1=150: Diameter1=150:
Dim a2(3), b1(3),c1(3),c2(3) As Double
Dim line1, revolve1 As Integer
c1(0)=Diameter1*0.5: c1(1)=0: c1(2)=0
c2(0)=c1(0): c2(1)=Height1: c2(2)=0
a2(0)=0: a2(1)=Height1: a2(2)=0
b1(0)=0: b1(1)=0: b1(2)=0
line1 = App.feLinePoints(False,c1,c2,True)
revolve1 = App.feSurfaceRevolve(line1,360,b1,a2)
End Sub
 
Replies continue below

Recommended for you

Couple things here. You can use the TrackData object to track what curve(s) you created earlier in the API call, and then add that to a Set object and use that for the surface revolve. Also the vector input for feSurfaceRevolve will have to be a unit vector. Since b1 is already 0,0,0 you can convert a2 to a unit vector and input that into feSurfaceRevolve. Here's an example of this work flow -

Sub Main
Dim App As femap.model
Set App = feFemap()

Dim tData As femap.TrackData
Set tData = App.feTrackData

Dim cSet As femap.Set
Set cSet = App.feSet

Dim unitVec As Variant

Dim Height1, Diameter1 As Double

Height1=150: Diameter1=150:

Dim a2(3), b1(3),c1(3),c2(3) As Double
Dim line1, revolve1 As Integer

c1(0)=Diameter1*0.5: c1(1)=0: c1(2)=0
c2(0)=c1(0): c2(1)=Height1: c2(2)=0


a2(0)=0: a2(1)=1: a2(2)=0


b1(0)=0: b1(1)=0: b1(2)=0

tData.Start(FT_CURVE)

App.feLinePoints(False,c1,c2,True)

tData.Stop(FT_CURVE)

tData.Created(FT_CURVE, cSet.ID, True)

App.feVectorUnit(a2,unitVec)

rc = App.feSurfaceRevolve(-cSet.First,360,b1,unitVec)

App.feViewRegenerate(0)

End Sub
 
Thanks. My copy of FEMAP is having an issue with opening, so I will test this out when I get it open. Thanks again for the help.
 
zanestoy, I guess the main your mistake there, that execution of this method
line1 = App.feLinePoints(False,c1,c2,True)
will give you just return code (rc in TG_eng code example) in the variable "line1". Like -1 if it was done successfully or other return code value if something wrong, but not ID of the newly created line.
So as mentioned TG_eng, you need to get the ID of the new curve somehow, by tracking of created objects (maybe the best solution in this situation) or using some other ways.

Regarding the issue with Femap opening, you can try running it under Administrator Account (sometimes Windows updates can modify OS security settings).
 
I finally got a chance to reinstall FEMAP and start playing with this again.

TG_eng
Thanks for the help. Your code worked great. I had to make a few modifications for what I was trying to do.

ship_sftwr_dev
Thanks for the heads up on the return codes. I will take that into account in the future.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor