Tuesday, February 07, 2012
Save As for each view -- how 2 wait for SE !
Last Post 15 Sep 2010 12:43 AM by Jason Newell. 4 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
solid81User is Offline
New Member
New Member
Posts:38

--
24 Aug 2010 04:09 AM  

One Big Problem, googled, searched in forum - nothing found !

I'd like to save each drawing view with the "saveas" method to iges,

it works if I make a breakpoint on save as !!!, because SE needs some time to open the view

with the StartCommand, (haven't found any mathod for opening the view into viewedit).

So how can i find out SE is busy?

 

 Dim views As SolidEdgeDraft.DrawingViews = DraftDoc.ActiveSheet.DrawingViews
        For i As Integer = 1 To views.Count

            Dim view As SolidEdgeDraft.DrawingView = views.Item(i)

            Dim NewFullName As String = IgesPath & FileName & "_" & i & ".igs"
            If System.IO.File.Exists(NewFullName) = True Then
                System.IO.File.Delete(NewFullName)
            End If

            Dim ActiveWindowName As String = SE_App.ActiveWindow.Caption
            'OpenView
            view.Select()
            SE_App.StartCommand(40037)

            'SE fnished??

            'Save Iges
            DraftDoc.SaveAs(NewFullName) 'BREAK

            'CloseView
            SE_App.ActiveWindow.close()
            DraftDoc.SelectSet.RemoveAll()
        Next

ErWoUser is Offline
New Member
New Member
Posts:37

--
25 Aug 2010 03:28 AM  
You could try to use Events.

Try to find out (using Solid Egde Spy) which events are fired, and when. If one of this events is usefull to you, you can use this to set for instance a pulic Boolean. In your code you check this Boolean (via a do-while or so), and if the Boolean is set to true by the event your code can continue.

You can read about working with events in the SE programming guide.

Good luck
JRUser is Offline
New Member
New Member
Posts:91

--
27 Aug 2010 03:27 AM  

Hi,

the Idea of ErWo is good. But you can do this without events, like this:

Dim test As String = SE_App.ActiveEnvironment
Do While test <> "DrawingViewEdit" 'was the environment changed?
test = SE_App.ActiveEnvironment
Loop

and after closeView (window):

Do While test <> "Detail" 'back?
test = SE_App.ActiveEnvironment
Loop

Jason NewellUser is Offline
Site Owner
Advanced Member
Advanced Member
Posts:895
Avatar

--
08 Sep 2010 02:35 AM  

I have a hunch that it will work as expected if you call Application.DoIdle() after calling Application.StartCommand().

Give it a try and let us know.

Jason Newell
Applications Architect
www.jasonnewell.net
Jason NewellUser is Offline
Site Owner
Advanced Member
Advanced Member
Posts:895
Avatar

--
15 Sep 2010 12:43 AM  
The answer to waiting for a command to finish after calling StartCommand() is to sink the ApplicationEvents and watch for the command to come through AfterCommandRun event.
Jason Newell
Applications Architect
www.jasonnewell.net
You are not authorized to post a reply.

Active Forums 4.2
Copyright © 2011 JasonNewell.NET