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

Combine Curves Command

I want to add the combine curves feature as a button on a custom toolbar, but I can't seem to find that equivalent function anywhere in the standard command menus. It looks like my only option is to write a script that will perform the same thing and create a button for that script. I tried writing one, but it doesn't seem to work. Can someone tell me what I'm doing wrong?

 

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

    Dim rc As Long

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

    Dim crv As femap.Curve
    Set crv = App.feCurve

    Dim numCurves As Long
    Dim crvList As Variant

    rc = cSet.Select(FT_CURVE, True, "Select curves to combine...") = FE_CANCEL
    If rc = FE_NOT_EXIST Then
        App.feAppMessage(FCM_ERROR, "Selected curves do not exist.")
    ElseIf rc = FE_CANCEL Then
        Exit Sub
    End If

    numCurves = cSet.Count()

    cSet.GetArray(numCurves, crvList)
    crv.CombineCurves(cSet.Count(), crvList)

End Sub
4 REPLIES
Solution
Solution
Accepted by topic author andyperez
2 weeks ago

Re: Combine Curves Command

[ Edited ]

Andy,

 

All you're missing is a Put() command. Adding one line to the end of your script will make this work as desired. Something like :

 

The HTML Clipboard

crv.Put(crv.NextEmptyID)

 

specifying whichever ID you want to give to the new curve (next empty is always a safe approach). Always remember to use a Put() call when you're attempting to place an Object into FEMAP.

 

Check out the Help for the limitations on the CombineCurves() call, as a number of things can cause it to fail. Consider storing rc for this call and printing formatted messages accordingly, as you have done after the Select() call. 

 

Best,

Nick

Re: Combine Curves Command

Perfect! Thanks!

Re: Combine Curves Command

So, I've been working with this script and I've noticed that sometimes it works and sometimes it doesn't. I suspect that it's an issue with the order of the curves. Is there any way to easily sort the curves to the appropriate order as required by the CombineCurves() method?

Re: Combine Curves Command

Hello Andyperez,

 

I tested your code, and found, that sometimes CombineCurves method doesn't work. I changed a line in your code:

rc=crv.CombineCurves(cSet.Count(), crvList)

I got many times rc = -1 as return code (FE_OK), but nothing happend, new combined curve isn't created. I tested with two curves too, I couldn't create combined curves with this method, but with Meshing Toolbox I could from the same curves.

 

I think this issue can be corrected only by Siemens.

 

Best regards

 

Peter Kaderasz