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:
It should return the full path to the opened file…
Compare it to the [full-]path you are using with the
Because you haven’t given us an example of your code, we can’t comment much further…
With Ruby API
result = Sketchup.open_file("C:\\aa.skp") p Sketchup.active_model.path .... ![image|690x438](upload://tBbYDkElF7KSlbP7lmPIgd8vxDj.png) **Directly open the file with SU software.** ![image|690x485](upload://qBsmJk5Lxj3jGJKh6tfJDwU6uad.png) It can be seen there is difference between the two open methods. With Ruby method, something is missing. I have check the file directory carefully.
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…
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.
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.)