西安理工大学硕士学位论文基于SolidWorks的机构运动仿真研究姓名:韩锐申请学位级别:硕士专业:机械设计及理论指导教师:郗向儒20040301ISolidWorks____________()____________20043SolidWorksVisualC++SolidWorksMATLABC++AccessSolidWorksAPIVC++6.0SolidWorksMATLABSolidWorksVisualC++DLLMATLABIResearchofMechanismMovementSimulationBasedonSolidWorksSpecialityMechanicalDesign&TheoryCandidate:HanRuisignature:_______Supervisor:XiXiangrusignature:_______ArgumentdateMar.2004ABSTRACTBasedontherequestmechanismkinematicsinnovationdesign,thisthesisstudiesthemethodofmovementsimulationontheplatformofSolidWorks.DiscusseskeytechniquesonhowtorealizethemovementsimulationsystemwithVisualC++.Thesetechniquesincludesolidmassmodeling,database,dataprocessing,chartoutputandmovementsimulationonscreen.Themovementsimulationofsolidmechanismisrealized.FirstlyThemethodofparameterizedsolidmodelingontheSolidWorksplatformisstudied.Twodifferencemethodsofparameterizedsolidmodelingarecompared;oneofthemethodsisstrictintroduced.Thethree-dimensionalparameterizeddesignofsimplepartisrealized.Itsimplifiesthemodelingprocessandraisesthemodelingefficiency.SecondlyThreealgorithmsispresentedtodealwithdifferentmechanism,basedonit,amethodofusingtheC++MathLibraryofMATLABispresentedtosimplifythesolvingprocessinthedataprocessing.Theparametersofposition,velocityandaccelerationarecalculatedbyusingthemethod.AnAccessdatabaseisbuildtomanagethedate,andalloftheparametersaresavedindatabase.ThirdlyIntegratedkinematicsanalysiswithSolidWorkssoftware.PerformtheseconddevelopmentonSolidWorks2001+byVC++6.0andAPIinterface.Thethree-dimensionalsolidkinematicssimulationofsimplemechanismandmulti-mechanismisachieved.IIAtlastTheresultofkinematicsanalysisisprocessedandvisualizedbyusingthedisplayfunctionofMatlab.Theresultsoftheapplicationareveryfavorable.KeyWordsSolidWorks;MovementSimulation;VisualC++;DLL;SecondaryDevelopment;MATLAB111.1----,VR(VirtualReality)21(CAE)CAD/FEA231.2208010VR3OpenGLCAD&CGJPEGUGSolidWorksCAD4(1).4ADAMS(2).OpenGL3DSOpenGLOpenGraphicsLib100OpenGL3DS,(3).AutoCAD()UGPro/ESolidWorksAutoCADSolidWorks(1).SolidWorksNT/WindowsCAD(2).,,(3).,(4).AutoCAD,AutoCAD(5).,VBVC++(6).51.31.3.1SolidWorks56SolidWorks1.3.2AccessSolidWorks6WindowsVisualC++6.0SolidWorks2001plusSolidWorksSolidWorks1.3.3MatlabMathLibraryDLLDLLDLLMatlabAccessMatlabWord72SolidWorks2.1SolidWorks2.1.1SolidWorks5SolidWorksWindowsWindowsSolidWorksSolidWorksWindowsSolidWorks(API)VisualBasicVisualC++OLESolidWorksCAD8SolidWorksWindowsOLEOLE2.0APICAD/CAE/CAMSolidWorks,19952.1.2SolidWorks6SolidWorksOLESolidWorksAPIOLEVBVBACVC++SolidWorksSolidWorksAPISolidWorksVC6.0,SolidWorksSWizard.awx,C:\MicrosoftVisualStudio\Common\MSDev98\TemplateVCDLL*.dllC:\ProgramFiles\SolidWorks\samplestestappuserdllcomuserdllSolidWorksSolidWorksSolidWorksAPIDispatchCOM9OLEDispatchCOMDLL:COMDLLWindowsSolidWorks,DLLSolidWorksDLLDLLSWizard.awxDLLDispatchDLLSolidWorksDLLDLLSolidWorksDispatchDLLSolidWorkstestappuserdllDLLDispatchSolidWorksSolidWorksAPISolidWorksAPISolidWorksAPISolidWorksDLLSolidWorks2.2SolidWorksadd-inVC++SolidWorksVCSolidWorksSolidWorksSolidWorksSolidWorks10123452.2.1SolidWorksSolidWorksLoadMappedBitmapAddToolbarAddToolbarCommandShowToolbarSolidWorksAPISolidWorksAPIhelpVC++SolidWorksAPIAddToolbar16163232IDR_TOOLBAR_SMALLIDR_TOOLBAR_BIGHINSTANCECurrentResource=AfxGetResourceHandle();//HINSTANCENewInstance=LoadLibrary(_T(TestApp.dll));//TestApp.dllAfxSetResourceHandle(NewInstance);//m_SmallToolbar.LoadMappedBitmap(IDR_TOOLBAR_SMALL);HBITMAPhbmSmallImageWell=(HBITMAP)m_SmallToolbar.GetSafeHandle();m_LargeToolbar.LoadMappedBitmap(IDR_TOOLBAR_BIG);11HBITMAPhbmLargeImageWell=(HBITMAP)m_LargeToolbar.GetSafeHandle();m_ToolbarId=m_pSolidWorks-AddToolbar(_T(TestApp),_T(TestToolbar),(long)hbmSmallImageWell,(long)hbmLargeImageWell);m_pSolidWorks-AddToolbarCommand(_T(TestApp),m_ToolbarId,0,_T(ToolCB0@ToolbarUpdate0,));//ToolCB0m_pSolidWorks-AddToolbarCommand(_T(TestApp),m_ToolbarId,1,_T(ToolCB1@ToolbarUpdate0,));//ToolCB1//m_pSolidWorks-ShowToolbar(_T(TestApp),m_ToolbarId);//FreeLibrary(NewInstance);//AfxSetResourceHandle(CurrentResource);//5SolidWorksTestApp.dll,2-12.2.2SolidWorksSolidWorksVC++IDD_DIALOG1C++CexchangDialog*.cpp#includeExchangDialog.hHINSTANCECurrentResource=AfxGetResourceHandle();//2-1SolidWorks12HINSTANCENewInstance=LoadLibrary(_T(TestApp.dll));//TestApp.dllAfxSetResourceHandle(NewInstance);//CExchangDialogdlg;//dlgdlg.DoModal();//FreeLibrary(NewInstance);//AfxSetResourceHandle(CurrentResource);//SolidWorks2-22.3SolidWorks2-2132.3.1SolidWorksAPISolidWorksAPISolidWorksVBscriptVC++VBscriptSolidWorksAPISolidWorksAPI2.3.214API2-4LAPIOpenDoc4()roddg1.SLDPRT2-5L150mmD14@1API2-52-41550mmLPDISPATCHretval=UserApp-getSWApp()-ActivateDoc(_T(roddg1));//LPDISPATCHmodDisp=UserApp-getSWApp()-GetActiveDoc();IModelDocm_pMod(modDisp);//IModelDocm_pModIPartDocpart1(modDisp);//IPartDocpart1LPDISPATCHpDim=m_pMod.Parameter(D14@1);//IDimensionDime(pDim);//IDimensionDimeDime.SetValue(RodLength/1000);//D14RodLength=50part1.EditRebuild();//m_pMod.WindowRedraw();//“roddg1”D14@1RlengthSetValue()mRlength10