Cancel
Showing results for 
Search instead for 
Did you mean: 

Batch Rename Entities

Pioneer
Pioneer

Is there a way to batch rename entities?

 

For example, I am working with a complex machined part and having to parse it into smaller portions for effective meshing. At this point, I have a few hundred new solids entitled "Sliced Body". I would like to be able to rename whole blocks of these to keep better track of them. I realize I could have just renamed them as they were created, but this would have taken the same amount of time overall to just doing it after the fact.

 

4 REPLIES

Re: Batch Rename Entities

Siemens Phenom Siemens Phenom
Siemens Phenom

I wrote an API that renames the selected solids by prompting for a prefix name and it will take all the selected solids and append ": n" title, where n starts at 1.

 

The HTML Clipboard

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

    Dim rc As Long

    Dim ss As femap.Set     'Set of selected solids
    Set ss = App.feSet
    Dim s As femap.Solid
    Set s = App.feSolid
    Dim sid As Long
    Dim sname As String

    rc = ss.Select ( FT_SOLID, True, "Select Solids for Renaming" )
    If rc = 2 Or ec = 4 Or ss.Count = 0 Then
        App.feAppMessage ( FCM_HIGHLIGHT, "No solids selected")
        GoTo EndMacro
    End If

    Begin Dialog UserDialog 300,140,"Title for Selected Solid(s)" ' %GRID:10,7,1,1
        text 20,20,260,25,"Enter Title or Title Prefix for Solid(s)",.solidName_Text,2
        TextBox 20,60,260,20,.solidTitle_TextBox
        OKButton 20,100,100,30
        CancelButton 180,100,100,30
    End Dialog
    Dim dlg As UserDialog
    Dialog dlg

    sname = dlg.solidTitle_TextBox

    ss.Reset
    sid = ss.First
    For i = 0 To ss.Count-1
        s.Get ( sid )
        s.title = sname + ":" + Str$(i+1)
        s.Put ( sid )
        sid = ss.Next
    Next


    EndMacro:
    App.feViewRegenerate ( 0 )
    
End Sub

Best Regards,
Chip Fricke
Principal Applications Engineer - Femap Product Development

Re: Batch Rename Entities

Pioneer
Pioneer

That's fantastic! Thanks, Chip! It's exactly what I was looking for.

Re: Batch Rename Entities

Legend
Legend

Hello,

 

I think the 12. row must be corrected as follow:

 

If rc = 2 Or rc = 4 Or ss.Count = 0 Then

 

Best regards,

 

Peter Kaderasz

Re: Batch Rename Entities

Siemens Phenom Siemens Phenom
Siemens Phenom

Thanks!  Nice catch!

Best Regards,
Chip Fricke
Principal Applications Engineer - Femap Product Development