Cancel
Showing results for 
Search instead for 
Did you mean: 

message window

Pioneer
Pioneer

Hello all,

 

When i usually show the messges in message window using API, it ends up like the following..

 

4 TIEROD_690 0.00

100 TIEROD_1695 0.00

 

is it possible to align like the following using feappmessage function

 

4         TIEROD_690       0.00

100     TIEROD_1695     0.00

 

Thank you

KR

8 REPLIES

Re: message window

Phenom
Phenom

Hi,

 

There are many functions for string formatting in VB.

Have a look at RSet and LSet. Here's an example:

 

    Dim s1 As String*20, s2 As String*20, s3 As String*20
    RSet s1 = CStr(4)
    RSet s2 = "TIEROD_" & CStr(690)
    RSet s3 = "0.00"
    App.feAppMessage(FCM_NORMAL,s1 & s2 & s3)

 

LSet does the same but aligns on the left.

 

Of course you can do this "by hand" using VB string functions such as Space, Len...etc...

 

For number formatting have a look at the VB "Format" function. And for advanced NASTRAN formatting have a look at FEMAP's "feFormatReal" function.

 

AP

Re: message window

Siemens Genius Siemens Genius
Siemens Genius

You can change to the listing font by starting and stopping listing:

 

    App.feAppMessageStartListing()

    App.feAppMessage( FCM_NORMAL, "Hello World" )

    App.feAppMessageEndListing()

 

Anything you print out between listing start and listing end will use the listing font set in preferences. By default, it's a fixed width font, so that should accomplish what you're looking for. A few things to note:

 

  • You'll still be responsible for setting up the formatting, all listing does is change the font used. You can make use of the Format$() instruction in VBA to help with that
  • If you start listing, you must end listing as well; during listing, drawing to the message window is disabled to improve performance. Otherwise, nothing will print anymore until feAppMessageEndListing is called
  • During listing, the enum for color is ignored

Hope that helps.

 

Patrick

Re: message window

Valued Contributor
Valued Contributor

or simply add the Chr(9) to add tabs to your strings

 

example:

 

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

             msg = "Look out " & Chr(9) & "its a tab!"
     rc = App.feAppMessage( FCM_NORMAL, Msg )
Maarten Elings | Mechanical Engineer

Re: message window

Pioneer
Pioneer

Thank you AP. Your suggestion along with Patrick startlisting(), endlisting() worked out great.

But one quick question...The listing in window is perfect except for a space between the messages. This is from start, endlisting(). Is there a way to get rid of it.

 

1                   property1           0.00
 
2                   property2           0.00
 
3                   property3         -74.61

Re: message window

Pioneer
Pioneer

Patrick, your idea worked out to be great. However, using start, end listing adds an empty row between the messages as shown below. Is there a way to get rid of it?

 

1                   property1           0.00
 
2                   property2           0.00
 
3                   property3         -74.61

 

Thank you

KR

Re: message window

Pioneer
Pioneer
Just to be clear. I meant empty row between the messages when i space between the messages.

Re: message window

Siemens Genius Siemens Genius
Siemens Genius

The extra line breaks come every time you have a pair of feAppMessageStartListing / feAppMessageEndListing() calls.

 

To avoid the line breaks, you need to avoid putting start/end listing inside of a loop.

 

This code:

    App.feAppMessage( FCM_NORMAL, "Not Listing Yet" )
    For i = 0 To 2 Step 1
        App.feAppMessageStartListing()
        App.feAppMessage( FCM_NORMAL, Str$( i ) )
        App.feAppMessageEndListing()
    Next
    App.feAppMessage( FCM_NORMAL, "Done listing" )

Prints this:

 

Play (F5)

Not Listing Yet

0

 

1

 

2

 

Done listing

 

 

Whereas, this code:

 

    App.feAppMessage( FCM_NORMAL, "Not Listing Yet" )
    App.feAppMessageStartListing()
    For i = 0 To 2 Step 1
        App.feAppMessage( FCM_NORMAL, Str$( i ) )
    Next
    App.feAppMessageEndListing()
    App.feAppMessage( FCM_NORMAL, "Done listing" )

 

Prints this:

 

Play (F5)

Not Listing Yet

0

1

2

 

Done listing

 

 

 

Re: message window

Pioneer
Pioneer

That was very helpful. Thanks