DEV Community

yunkaipx
yunkaipx

Posted 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

Imagine monitoring actually built for developers

Billboard image

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

Top comments (0)

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay