Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How did QT Create Solidworks Plugin program?
Forum Updated to NodeBB v4.3 + New Features

How did QT Create Solidworks Plugin program?

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • pyuxingP Offline
    pyuxingP Offline
    pyuxing
    wrote on last edited by pyuxing
    #1

    I did like this explained:activeqt-container
    #1 I have used dumpcpp.exe to Generating a C++ Namespace,and the file is 13.46MB(The IDE was BROKEN and has many complie error,so I give up this way.
    0_1544083767133_a9e04f6d-0702-48ec-931a-91723d684159-image.png

    #2 Then I tried Call-by-Name. But When I called FeatureBoss like this

    modelDoc->dynamicCall("FeatureBoss(bool,bool,bool,int,double,double,bool,bool,bool,bool,bool,double,double,bool,bool)",1,0,0,0,0,0.012,0.012,0,0,0,0,2,2,0,0);
    

    There are errors because of we can just input <=8 para to dynamicCall()

    So how can I do a plugin for Solidworks by QT???
    Thanks for your reply!

    #include "mainwindow.h"
    #include <QApplication>
    #include <ActiveQt/QAxObject>
    #include <QString>
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        MainWindow w;
        w.show();
    
        QAxObject *swApp=new QAxObject("SldWorks.Application",0);
        if(!swApp->isNull())
        {
           swApp->dynamicCall("SetVisible(bool)",true);
           swApp->dynamicCall("NewPart()");
    
           QAxObject *modelDoc = swApp->querySubObject("ActiveDoc");
           QAxObject *sketchManager = modelDoc->querySubObject("SketchManager");
    
           sketchManager->dynamicCall("CreateCircleByRadius(double,double,double,double",0,0,0,200);
           sketchManager->dynamicCall("Insert3DSketch(bool)",true);
           sketchManager->dynamicCall("Insert3DSketch(bool)",false);
           modelDoc->dynamicCall("SelctByID(QString,QString,double,double,double)",QString("Circle1"),QString("SKETCHSEGMENT"),0,0,0);
           modelDoc->dynamicCall("FeatureBoss(bool,bool,bool,int,double,double,bool,bool,bool,bool,bool,double,double,bool,bool)",1,0,0,0,0,0.012,0.012,0,0,0,0,2,2,0,0);
        }
        return a.exec();
    }
    
    JonBJ 1 Reply Last reply
    0
    • pyuxingP pyuxing

      I did like this explained:activeqt-container
      #1 I have used dumpcpp.exe to Generating a C++ Namespace,and the file is 13.46MB(The IDE was BROKEN and has many complie error,so I give up this way.
      0_1544083767133_a9e04f6d-0702-48ec-931a-91723d684159-image.png

      #2 Then I tried Call-by-Name. But When I called FeatureBoss like this

      modelDoc->dynamicCall("FeatureBoss(bool,bool,bool,int,double,double,bool,bool,bool,bool,bool,double,double,bool,bool)",1,0,0,0,0,0.012,0.012,0,0,0,0,2,2,0,0);
      

      There are errors because of we can just input <=8 para to dynamicCall()

      So how can I do a plugin for Solidworks by QT???
      Thanks for your reply!

      #include "mainwindow.h"
      #include <QApplication>
      #include <ActiveQt/QAxObject>
      #include <QString>
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          MainWindow w;
          w.show();
      
          QAxObject *swApp=new QAxObject("SldWorks.Application",0);
          if(!swApp->isNull())
          {
             swApp->dynamicCall("SetVisible(bool)",true);
             swApp->dynamicCall("NewPart()");
      
             QAxObject *modelDoc = swApp->querySubObject("ActiveDoc");
             QAxObject *sketchManager = modelDoc->querySubObject("SketchManager");
      
             sketchManager->dynamicCall("CreateCircleByRadius(double,double,double,double",0,0,0,200);
             sketchManager->dynamicCall("Insert3DSketch(bool)",true);
             sketchManager->dynamicCall("Insert3DSketch(bool)",false);
             modelDoc->dynamicCall("SelctByID(QString,QString,double,double,double)",QString("Circle1"),QString("SKETCHSEGMENT"),0,0,0);
             modelDoc->dynamicCall("FeatureBoss(bool,bool,bool,int,double,double,bool,bool,bool,bool,bool,double,double,bool,bool)",1,0,0,0,0,0.012,0.012,0,0,0,0,2,2,0,0);
          }
          return a.exec();
      }
      
      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @pyuxing
      I have no idea. But if you're asking about your code:

             modelDoc->dynamicCall("SelctByID(QString,QString,double,double,double)",QString("Circle1"),QString("SKETCHSEGMENT"),0,0,0);
      

      Try making the last 3 arguments you are passing doubles instead of ints?

             modelDoc->dynamicCall("FeatureBoss(bool,bool,bool,int,double,double,bool,bool,bool,bool,bool,double,double,bool,bool)",1,0,0,0,0,0.012,0.012,0,0,0,0,2,2,0,0);
      

      Try counting your arguments against your string of argument types. There are the right number but not in the right positions? We shouldn't have to do that for you, you should take the time to get this right yourself....

      pyuxingP 1 Reply Last reply
      1
      • JonBJ JonB

        @pyuxing
        I have no idea. But if you're asking about your code:

               modelDoc->dynamicCall("SelctByID(QString,QString,double,double,double)",QString("Circle1"),QString("SKETCHSEGMENT"),0,0,0);
        

        Try making the last 3 arguments you are passing doubles instead of ints?

               modelDoc->dynamicCall("FeatureBoss(bool,bool,bool,int,double,double,bool,bool,bool,bool,bool,double,double,bool,bool)",1,0,0,0,0,0.012,0.012,0,0,0,0,2,2,0,0);
        

        Try counting your arguments against your string of argument types. There are the right number but not in the right positions? We shouldn't have to do that for you, you should take the time to get this right yourself....

        pyuxingP Offline
        pyuxingP Offline
        pyuxing
        wrote on last edited by
        #3

        @JonB maybe I will try another way. Thank you very much!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved