RunScript to open igs file failed


#1
I need using RunScript to open igs file,but it's failed.

the code like this:

ON_wString script;
    script.Format( L"_-Open “%s” _Enter _Enter Enter", filename );
    //script.Format( L"
-Open “%s”", filename );
    bool rt=RhinoApp().RunScript(script,0);

file.rar (19.3 KB) attachment is the whole test codes and test file.


(Dale Fugier) #2

Let me know if this helps:


#3

dale:
I have readed this article before,and it’t not helps.'
maybe you can try my test codes and test file in the attachment
and help me to see what the problem of my codes.
thanks


(Dale Fugier) #4

How about this:

https://github.com/mcneel/Rhino5Samples_CPP/blob/master/SampleCommands/cmdSampleOpenIges.cpp


#5

thanks dale,
this can open succcess sometimes ,but will failed sometimes too (just the same file)
when failed I see the return value of RunScript function returned,it always true.


(Dale Fugier) #6

RunScript return true of the command was run. It does not return the whether or not the command worked (the IGES file was opened in this case).

Can I repeat the problem by using the above sample command and your IGES file? If so, can you send me the IGES file (dale@mcneel.com)?


#7

you can’t repeat the problem by using the above sample command,because this problem just can repeat in my own plugin,my plugin is very large ,but The open igs files codes just the same as the codes you provided,maybe I think the other codes of my plugin cacese the problem,but I have no idea to find which codes has problem. this problem not happend erery time.
maybe my other codes has out ot memery error,and chang rhino obecjet’s memory


#8

dale:
I solve this problem now.

m_doc.SetModifiedFlag( FALSE );

this code should be called in the
CRhinoEventWatcher::OnBeginOpenDocument callback function