Closed 13704017891 closed 4 years ago
Hi, sure, you can just import SKP files using the library and translate to unity. Do you want to implement this yourself?
I'm doing it on my own, and I've seen some initial results, but now I have two problems. 1.Triangles vertex indices, whether both clockwise and counterclockwise?Because the unity will be removed, so counter-clockwise Triangles will not see, so how to solve 2.How to get map UV?
That's how I get uv:SUTextureWriterGetFrontFaceUVCoords. But the UV does look like this (-11.4824665805793,-0.431334139639832). This doesn't look like a UV coordinate. It's the way I did it? Can I get your contact information? My problem is urgent?
Those are UV Coordinates, see description of the method: Given an array of vertex positions, retrieves the corresponding UV coordinates of the front face texture of a face object that has been loaded into the given texture writer object. https://en.wikipedia.org/wiki/UV_mapping What exactly are you looking for?
C++/CLI not supported by unity causing to mono. P/invoke is the only way.
@13704017891 any update on this? otherwise I will close this.
Hi,
I am just trying to import a Sketchup model at runtime in Unity3D. Could you please help me? I have copied the dll's and compiled them and then tried to write a basic script to call the model but couldn't succeed. Any help will be very helpful for me.
This is my script:
using System; using UnityEngine; using System.Runtime.InteropServices; public class API : MonoBehaviour { public string modelFilePath; const string LIB = "SketchUpAPI";
[DllImport(LIB,EntryPoint = "SUInitialize")]
static extern void SUInitialize();
[DllImport(LIB, EntryPoint = "SUTerminate")]
public static extern void SUTerminate();
[DllImport(LIB, EntryPoint = "SUModelCreateFromFile")]
public static extern SUResult SUModelCreateFromFile(ref IntPtr model,[MarshalAs(UnmanagedType.LPUTF8Str)]string file_path);
public void Start()
{
SUInitialize();
var modelPtr = IntPtr.Zero;
SUModelCreateFromFile(ref modelPtr, modelFilePath);
SUTerminate();
}
}
can you share your error you are experiencing? sure the Dll Import Path is correct?
The error was like SUResult could not be found, are you missing an assembly reference.
Is there a basic workflow or script to import Sketchup Model into Unity at runtime? Thank you for your fast response and support.
@thinklikeanarchitect sorry for getting back so late about this. can you describe your setup in more detail please? OS / versions, etc?
WinOS-desktop platform, using Unity 2019.2.9f1. I am just trying to import skp model to Unity at runtime, that's it.
but from your code it doesn't look like you are using my library. in your case you'll have to import SUResult as well, because it's going to be a response.
I wanted to compile this library into unity, but now I'm having trouble.ask for help