Problem in using Sketchup.open_file method

I want to open a skp file with Ruby Sketchup.open_file method. But the opened file is not the same as the file directly opened from SU software. I don’t know why this happened.

Well of course it should be !
In the opened SKP open the Ruby Console and type:

p Sketchup.active_model.path;puts

It should return the full path to the opened file…

Compare it to the [full-]path you are using with the Sketchup.open_file method…
Because you haven’t given us an example of your code, we can’t comment much further…

result = Sketchup.open_file(“C:\aa.skp”)
p Sketchup.active_model.path

Can you share a sample file so we can test whether we get the same issue and maybe find the cause?

can you explain the second ‘method’ you are using…

john

You haven’t given the results of the Ruby Console tests in the two models opened in different ways…
Type [or copy] it into the Ruby Console after each of the SKPs opens.

p Sketchup.active_model.path;puts

Having the SKP at the base the C: drive is ill advised anyway - permissions are likely to be unexpected.
Also remember that in the string you enter for the path you always need to ‘escape’ the \ OR use a /, OR change “…” for ‘…’

Please read and post code correctly in forums …

Ok ,I have modified the text with the suggestion.

Thanks, I found that the phenomenon was happened because of loading an extension when starting SU .The extension has loaded an unexpected SKP file .

You put too much into the code block.
(There are only 2 lines of code, but you put the whole post mesage into the code block.)