How did QT Create Solidworks Plugin program?
-
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.
#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(); }
-
@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
double
s instead ofint
s?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....