Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Importing CAD-Files dynamically in WebGL with JTUnityPlugin

Discussion in 'Code Editors & IDEs' started by DavidSchaefer, Apr 4, 2022.

  1. DavidSchaefer

    DavidSchaefer

    Joined:
    Mar 3, 2022
    Posts:
    4
    Hi,

    I am trying to import CAD files dynamically in a running Unity-Web environment.
    I already tested the JT-Unity Plugin from Simens, which converts .jt files into .json. After that I am able to load the converted files into my running Unity-Windows Application.

    If i try to compile it with WebGl i get this error messages:

    • Assets\JTModelLoader\JTLoader.cs(11,7): error CS0246: The type or namespace name 'JTForUnity' could not be found (are you missing a using directive or an assembly reference?)
    • Assets\JTModelLoader\JTLoader.cs(20,25): error CS0246: The type or namespace name 'JTLoaderInternal' could not be found (are you missing a using directive or an assembly reference?)
    • Build completed with a result of 'Failed' in 2 seconds (2091 ms) UnityEngine.GUIUtility:processEvent (int,intptr,bool&)
    • UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002d8] in <db8aad8fcedd4e11ba6ba696cb8802a7>:0 at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <db8aad8fcedd4e11ba6ba696cb8802a7>:0 UnityEngine.GUIUtility:processEvent (int,intptr,bool&)

    The file exists inside the folder and has the folling includes which are not working:

    Code (CSharp):
    1. // @<COPYRIGHT>@
    2. // ==================================================
    3. // Copyright 2017.
    4. // Siemens Product Lifecycle Management Software Inc.
    5. // All Rights Reserved.
    6. // ==================================================
    7. // @<COPYRIGHT>@
    8.  
    9. using UnityEngine;
    10. //using JTParser;
    11. using JTForUnity;
    12. //using JTTools;
    13. #if UNITY_EDITOR_64
    14. using UnityEditor;
    15. #endif
    16.  
    17. /// <summary>
    18. /// Unity Behavior that does the conversion.  Also contains boilerplate code to configure the application environment for any logging and dependency loading.
    19. /// </summary>
    20. public class JTLoader : JTLoaderInternal {

    It looks like its not possible to use the JTUnity Plugin with WebGl or am dooing something wrong?
    Is there any other option to load CAD fieles with WebGL?

    Greetings,
    David