Showing results for 
Search instead for 
Did you mean: 

Fast loop through result vectors for pictures?




Is there a fast way to loop through multiple result vectors within one or two output sets?


To loop through sets and produce pictures, we've already have the following macro, however I can get a grasp how to loop through vectors.


	While feOutputSet.Next
		feView.OutputSet = feOutputSet.ID
		rc = feView.Put(ViewID)
		rc = feView.Redraw
		rc = App.feViewRegenerate(0)
		fullpath = STR_PATH & feOutputSet.title '"LC" & CStr(feOutputSet.ID)

Any help is much appreciated!




Re: Fast loop through result vectors for pictures?


Hi CRensen,


here is an API to save JPGs or GIFs from modal analysis. I used it a few year ago to save all results.


Best regards,


Peter Kaderasz

Re: Fast loop through result vectors for pictures?

Siemens Genius Siemens Genius
Siemens Genius

You're close with your code. You just need to add a secondary loop to loop through all the output vectors.


The HTML Clipboard

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

    Dim fos As femap.OutputSet
    Dim fov As femap.Output
    Dim fv As femap.View

    Set fos = App.feOutputSet
    Set fov = App.feOutput
    Set fv = App.feView

    Dim nVu As Long
    Dim fName As String

    App.feAppGetActiveView( nVu )

    fv.Get( nVu )

    While fos.Next()
        fov.setID = fos.ID

        While fov.Next()
            fv.OutputSet = fos.ID
            fv.DeformData = fov.ID
            fv.ContourData = fov.ID
            fv.Put( fv.ID )
            App.feViewRegenerate( fv.ID )
            fName = Trim$( Str$( fos.ID ) ) + "-" + Trim$( Str$( fov.ID ) ) + ".jpg"
            App.feFilePictureSave2( False, FPRG_WINDOW, FPM_JPEG, "c:\scratch\" + fName )
            App.feAppMessage( FCM_NORMAL, "Saved " + fName )


End Sub



A couple things to keep in mind though 

- Because not ever output set will have the same output vectors, you need to set the setID property on the output vector BEFORE looping, so you perform the loop in the correct set

- The view needs to be set up with the appropriate orientation beforehand

- Don't forget to call Reset() on the interior loop to move the pointer back to the beginning of the list

- This code includes setting both the contour and deformed vectors. You can also do one or the other if you want

- This will loop through ALL the output sets and set deformed plots and contour plots that may not make sense (ie deformation plot of nodal stresses). You need to make sure that you're only getting what you want. You could do that with a set object that collects output vector IDs and only looping on that set rather than all the vectors

- Finally, unless you limited the output via case control, this is likely to dump out a lot of data. In most cases, there's a good chunk of it that may not be useful. Refer back to my previous comment.