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

API - set active property for feMeshClosestLink

Hi everyone,

 

In order to use the mesh closest link command with line elements, I need to set an active propery (or at least I think I need to). The feMeshClosestLink doesn't support a direct reference to a property.

 

The problem is that I cannot seem to make any particular property active. Does anyone know a solution?

 

I've tried:

Dim Femview As femap.View = app.feView
Dim FemProp As femap.Prop = app.feProp

Femview.Get(Femview.Active)
FemProp.Active = 3
Femview.Put(Femview.Active)

6 REPLIES

Re: API - set active property for feMeshClosestLink

Dear Michael,

 

 

Try to use this one. 

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

    App.Info_ActiveID(FT_PROP) = 3

 

Yarko

Re: API - set active property for feMeshClosestLink

Hi Yarko,

 

Thank you for your quick response. Unfortunately, this does not work (see picture below). The property seems active, but apparently isn't.

 

The strange thing is, for output sets or groups I can easily set the active set. Just not for the property (and maybe others).

 

Re: API - set active property for feMeshClosestLink

Can you share the code where you use closest link function?

 

Yarko

Re: API - set active property for feMeshClosestLink

app.feMeshClosestLink(CurveSet1.ID, CurveSet2.ID, 3, MeshVectorY, 0, False) 'API-530

 

Where CurveSet1 and CurveSet2 are two sets of nodes (selected by line)

Solution
Solution
Accepted by topic author Michael684
‎02-22-2016 09:31 AM

Re: API - set active property for feMeshClosestLink

I think all the advice listed is correct however there could be another issue that is causing it not to work for you. In addition to setting the active property ID, you have to also set the active element type... something like...

 

App.Info_ActiveID(FT_PROP) = 33

App.Info_ActiveType( FT_ELEM ) = FET_L_BAR

App.feMeshClosestLink(CurveSet1.ID, CurveSet2.ID, 3, MeshVectorY, 0, False)

 

assuming that Property 33 was a Bar Property, if not then set the type to whatever type it is.

Solution
Solution
Accepted by topic author Michael684
‎02-22-2016 09:30 AM

Re: API - set active property for feMeshClosestLink

Thanks! Setting the active element type was the solution. The code that worked for me was:

 

'Set current property
Dim FemProp As femap.Prop = app.feProp
Dim FemElement As femap.Elem = app.feElem

app.Info_ActiveID(zDataType.FT_PROP) = 3 'rod element under property number three
app.Info_ActiveType(zDataType.FT_ELEM) = zElementType.FET_L_ROD 'rod element

'Create closest link
Dim NodeSet1 As femap.Set = app.feSet
Dim NodeID1 As Integer = NodeSet1.ID
NodeSet1.Select(zDataType.FT_NODE, False, "Select nodes bottom") 'zDataType.FT_CURVE, False, "Select Curves on side 1")

Dim NodeSet2 As femap.Set = app.feSet
Dim NodeID2 As Integer = NodeSet2.ID
NodeSet2.Select(zDataType.FT_NODE, False, "Select nodes top") 'zDataType.FT_CURVE, False, "Select Curves on side 2")

Dim MeshVectorY() As Double = {0, 1, 0}
app.feMeshClosestLink(NodeSet1.ID, NodeSet2.ID, 3, MeshVectorY, 0, False) 'API-530

app.feViewAutoscaleAll(1, True)
app.feViewRegenerate(0)