Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

Creating node set using api

I have some problems using AddCoordinate command in Femap Api to create node set, does anyone have some experience using it?

6 REPLIES

Re: Creating node set using api

Hello,

 

It is strictly similar to selection by coordinates (in any selection box, use "method>coordinate..."). In your case entityType = FT_NODE (femap constant which the API will recognise).

You can find the API doc in help>API>4.6.2.14 and 15. There are 2 very similar methods, the first will limit its search to entities visible on screen.

 

AP.

 

 

 

 

Re: Creating node set using api

Thank you for response, but my biggest issue right now is using several coordinates (all X,Y, Z). I have this line in my code:

 

ndSet.AddCoordinate(FT_NODE, 0, vbXYZ[1]=True vbXYZ[2]=True vbXYZ[3]=True, vnMode[1]=4 vnMode[2]=4 vnMode[3]=4, vdMin[1]=16294 vdMin[2]=18859 vdMin[3]=39749, vdMax[1]=16295 vdMax[2]=18861 vdMax[3]=39751)

 

I think something is fundamentally wrong in there.

Re: Creating node set using api

1) Keep in mind the fact that VB6 is 0-based by default, i.e. array begin at index 0. So when the API says "BOOL vbXYZ[3]" you have to dimension it with "Dim vbXYZ(2) as Bollean", and then

vbXYZ(0) = True  'this corresponds to X

vbXYZ(1) = True  'this is Y

vbXYZ(2) = True  'this is Z

If you have specified "Option Base 1" ignore this comment of course...

 

2) vnMode = 4 is "Select at Within tolerance", so, if that is indeed what you want to use then vdMin is the location and vdMax is the tolerance (easy to understand in a selection box, cf below).

Therefore the values you have entered don't seem right, it looks like you either wanted to use max/min (vnmode = 2 or 3) or you thought that vdmax-vdmin gave the tolerance.

 

Re: Creating node set using api

These were really stupid mistakes, but there is new thing. When I use this:

ndSet.AddCoordinate(FT_NODE, 0, vbXYZ(1)=True vbXYZ(1)=True vbXYZ(2)=True, vnMode(0)=3 vnMode(1)=4 vnMode(2)=3, vdMin(0)=16294 vdMin(1)=18859 vdMin(2)=39749, vdMax(0)=16295 vdMax(1)=18861 vdMax(2)=39751)

 

I get error:

API Error (Line 11): Expecting an already dimensioned array.

 

Strange thing is that xbXYZ should be defined as variant according to Object Browser, but in manual it is boolean. Might be this?

Solution
Solution
Accepted by topic author m1hhail
‎08-26-2015 04:32 AM

Re: Creating node set using api

If this is your exact syntax than VB won't accept it. Try something like this instead:

 

    Dim vbXYZ(2) As Boolean
    Dim vnMode(2) As Long
    Dim vdMin(2) As Double, vdMax(2) As Double

    vbXYZ(1)=True : vbXYZ(1)=True  :vbXYZ(2)=True
    vnMode(0)=3 : vnMode(1)=4 : vnMode(2)=3
    vdMin(0)=16294 : vdMin(1)=18859 : vdMin(2)=39749
    vdMax(0)=16295 : vdMax(1)=18861 : vdMax(2)=39751

    ndSet.AddCoordinate(FT_NODE,0,vbXYZ,vnMode,vdMin,vdMax)

Re: Creating node set using api

Thank you very much! It works, but selects multible nodes instead of one.