DEV Community

yunkaipx
yunkaipx

Posted on • Edited on

1

The latest version of Chrome browser enable the solidWorks 3D ActiveX control

Background

SolidWorks Composer Player is a free application that allows content creators to distribute Composer content to any end user. Composer Player, like Composer, has high performance. Composer Player is not just a simple viewer, as content users can gain a deep interactive experience within the product's deliverables.
The allWebPlugin middleware is a middleware product that provides users with secure, reliable, and convenient browser plugin services, dedicated to re applying browser plugins to all browsers. It not only enables the use of ActiveX controls on modern browsers, but also has very simple and convenient integration.you can get it from github.

Operation effect

SolidWorks ActiveX On Edge

SolidWorks ActiveX On Chrome

Integrated code

function init(){   
    var installPackageUrl = "http://127.0.0.1:6651/install/allwebPlugin_x86_v2.0.1.16_20240806.exe";
    var installPackageVersion = "2.0.0.28"; 
    if(awp_IsInstall(installPackageVersion,installPackageUrl)){
        awp_CreatePlugin("SWPlayAPI","{410B702D-FCFC-46B7-A954-E876C84AE4C0}");
        if(SWPlayAPI){
            SWPlayAPI.FileName = "D:\\Users\\LK\\Desktop\\close.svg";
            SWPlayAPI.Password = "";
            SWPlayAPI.AutoPlay = true;
            SWPlayAPI.ShowViewBar = true;
            SWPlayAPI.ShowDiapoBar = true;  //ShowMarkerBar;ShowStandardToolBar;ShowRenderToolBar;ShowCameraToolBar
                                            //ShowTimelineBar;ShowStatusBar;ShowRedlineToolBar;ShowAnnotationToolBar;
                                            //ShowCuttingPlaneToolBar;ShowCollabToolBar;ShowGeometryToolBar;
                                            //ShowMain3DToolBar;ShowCameraViewToolBar;ShowVisibilityToolBar;
                                            //ShowPropertyBar;ShowMeasurementToolBar;ShowTreesBar;ShowViewBar
                                            //ShowBOMTreeBar;ShowAssemblyTreeBar;ShowCollabTreeBar;
                                            //ShowInformationBar;

            }
    }
}

function openFile()
{
    if(SWPlayAPI){
        var pluginUtilityObj = awp_getPluginUtility();
            pluginUtilityObj.GetLocalOpenDialog("smg文件(*.smg);;所有文件(*.*)").then(function(varFile){
                console.log(varFile);
                if(varFile != "")
                    SWPlayAPI.Password = "";
                    SWPlayAPI.FileName = varFile;
            });
    }
}
function Print(){
    if(SWPlayAPI){
        SWPlayAPI.Print();
    }
}
function openWebFile()
{
    if(SWPlayAPI){
        var pluginUtilityObj = awp_getPluginUtility();
        var httpclientObj = awp_getHttpClient();
        httpclientObj.Clear();
        if (httpclientObj.Open(0, "https://local.zsignyun.com:6652/doc/test.smg", false)) {
            httpclientObj.Send().then(function(data){
                if (httpclientObj.GetStatus() == 200) {
                    var varTempPath = pluginUtilityObj.GetTempPath();
                    var varFile = pluginUtilityObj.GetTempFileName(varTempPath,"zso") + ".smg";
                    httpclientObj.ResponseSaveToFile(varFile);
                    SWPlayAPI.Open(varFile);
                }
                else{
                    var httpStatus = httpclientObj.GetStatus();
                    if(httpclientObj.GetStatus() == 0)
                    {
                        alert("LoadFile test.jt Error:" + httpclientObj.GetErrorText());
                    }else{
                        alert("LoadFile test.jt Status:" + httpStatus + ",请确保安装目录下web\doc目录存在test.jt");
                    }
                }
                httpclientObj.Close();
            }); 
         }
    }
}
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay