cancel
Showing results for 
Search instead for 
Did you mean: 

Projected Area value retrieve

Creator
Creator

Hello everyone.

I am trying to calculate the area of a face projection over a plane.

I am using the "CalculateAreaBuilder" and it works fine but it just prints out the Area value on the ListingWindow.

 

I have tried to reroute the data on a text file by doing a 

theSession.ListingWindow.SelectDevice(NXOpen.ListingWindow.DeviceType.File, "c:\\TEMP\\NXOPENTemp.txt");

right before the

calculateAreaBuilder1.Commit();

 

 

 

It does not work.

 

Any hint is very very very welcome!

 

Thanks.

 

MR

 

Any hint is very very welcome

12 REPLIES

Re: Projected Area value retrieve

Siemens Phenom Siemens Phenom
Siemens Phenom

See the online help for ListingWindow:

 

ListingWindow

 

When the device is set to file, the buffer is not flushed until the device is changed again

 

Changes where the listing window output is sent. The listing window output can be sent to the Information window of the Unigraphics session, to a file, or to both. Note: file output is buffered. If file output is used, the buffer will not be flushed until the output device is changed again. E.g. 
 
        ListingWindow.SelectDevice(File, "log.txt")
        ListingWindow.Open()
        ListingWindow.WriteLine("output")
        ListingWindow.Close()
        ' buffer is not flushed yet
        ListingWindow.SelectDevice(Window, "")
        ' now the buffer is flushed

Re: Projected Area value retrieve

Creator
Creator

Hello Jim,

thank you so much for your prompt answer.

The line

 

theSession.ListingWindow.SelectDevice(NXOpen.ListingWindow.DeviceType.Window, "");

 

if correctly flushing a text line to the external file but I still cannot get the result of the

 

nXObject1 = calculateAreaBuilder1.Commit();

  

written out to the file...

 

Am I doing something wrong?

 

Thanks again.

 

MR

Re: Projected Area value retrieve

Siemens Phenom Siemens Phenom
Siemens Phenom

If you do not try to change devices to the file, does the information from the Commit get written as expected to the listing window?

 

Re: Projected Area value retrieve

Creator
Creator

Yes it Does: no matter if I specify the line

 

the commit writes to the listing window while the string goes to the external file.

 

Hereafter the chunk of code (I still hope I can get the projected area in some manner)

 

...

//specify the output file
theSession.ListingWindow.SelectDevice(NXOpen.ListingWindow.DeviceType.File,"c:\\TEMP\\NXOPENTemp.txt");

theSession.ListingWindow.Open();

 

//commit the face projected area calculation 
NXObject nXObject1;
nXObject1 = calculateAreaBuilder1.Commit();

 

//write a text message (this goes to the external file as expected!!)
theSession.ListingWindow.WriteLine("try try try");
theSession.ListingWindow.Close();

 

//Flush following Jim's suggestion
theSession.ListingWindow.SelectDevice(NXOpen.ListingWindow.DeviceType.Window, "");

 

 

Thanks again for  your help!

 

MR 

Re: Projected Area value retrieve

Siemens Phenom Siemens Phenom
Siemens Phenom

The only thing I can think of is to switch the listingWindow device before instantiating the calculateAreaBuilder1 object rather than just prior to calling Commit().

Re: Projected Area value retrieve

Phenom
Phenom

As an alternative, I'd try extruding an zero thickness sheet body from the projected curves; then use the "measure face" tool to get the area, perimeter, etc. The sheet body could then be deleted after getting the required information.

Re: Projected Area value retrieve

Creator
Creator

Just tried: no way. Commit just deals with the NX popup listingwindow...

Re: Projected Area value retrieve

Creator
Creator

Cowski, thanks to you too. At this point I think I shoudl try something like that... I have been trying to avoid this kind of complication but I do not see anything else I can do with the mold stuff.

 

Regards,

 

MR

Re: Projected Area value retrieve

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Did you try to switch the device to text file before creating the builder, as Jim proposed ?

 

Thanks.