HyperWorks桌面自定义简介.docx

上传人:夺命阿水 文档编号:1462761 上传时间:2024-06-29 格式:DOCX 页数:20 大小:63.87KB
返回 下载 相关 举报
HyperWorks桌面自定义简介.docx_第1页
第1页 / 共20页
HyperWorks桌面自定义简介.docx_第2页
第2页 / 共20页
HyperWorks桌面自定义简介.docx_第3页
第3页 / 共20页
HyperWorks桌面自定义简介.docx_第4页
第4页 / 共20页
HyperWorks桌面自定义简介.docx_第5页
第5页 / 共20页
点击查看更多>>
资源描述

《HyperWorks桌面自定义简介.docx》由会员分享,可在线阅读,更多相关《HyperWorks桌面自定义简介.docx(20页珍藏版)》请在课桌文档上搜索。

1、TableofContentsIntroductiontoHyperWorksDesktopCustomizationChaPter1:IntrOdUCtiOntoTC1.7AbOInTC1.7AbOiJtTk8BascTelSVnlaX8TC1.COmrnandOVefVteW8TkBaSiCCOmmandS23ChaPter2:HVPerWOrkSDeSktOPEnVironment29TheHyDerWorkSDeSktoD29TheCommand1.aVer31EXerCiSe2.1ChanQinQIheClientTVDeUSingtheCB1U11andWindowPraCtiCa

2、lEXerCiSeS4243ChaPter3:TheCOmmand1.aYerEXPIOredCommanClCateaOrieS43BaSiCCOmmandS44WOrkIntlWithHandIeS46EXerCiSe3BaSiCCommandSandWorkinqWimHandleS49PraCtiCalExercises54ChaPter4:TheAnirnatiOnClient55AnimauOnWindow55EXerCiSe4.11.OaClinaaModelandReSUltSFiIe59MOdelObieCt61EXerCiSe4.2WorkinQWlththeModelOb

3、ect67PraCtiCalEXerCiSeS71ChaPter5:ReSUltSandQUerV73ADDlYinaReSUltS73EXereiSe5.1ContourinaReSUItSandContOUnnabySeIeCtiOn77Res,s81EXerCiSe5.2QUeryinqCOnK)UredReSiJhSandCreatinga1.iStOfReSUItS84PraCHCalEXerCiSeS88ChaPter6:ThePlOtUnaCIient91ThePIOttinQWindOW91DefininqCurvesfromDataFiles92DefiningClJrVeS

4、fromMathEXPreSSiOnS94AddinqNOteStoaPlOt95IntrodUCUontoTemPIeXStatementS97EXerCiSe6.1CreatinqPIotSandNQteSWimTemDleXinsideIheNQteS98PraCtiCalExercises106ChaDter7:TheMotiOnVieWModelClient109MOdelWindOW109SolUtiOnSForEXerCiSeS113GUIsquickly.Itprovedsopopularthatitnowshipswithalldistributionsof7cl.Tksha

5、resmanyconceptswithotherwindowingtoolkits,butyoudonotneedtoknowmuchaboutgraphicaluserinterfacestogetstartedwithTk.Tkaddsabout35Tclcommandsthatletyoucreateandmanipulatewidgetsinagraphicaluserinterface.AWldgetisawindowinagraphicaluserinterfacethathasaparticularappearanceandbehavior.Thetermswidgetandwi

6、ndowareoftenusedinterchangeably.Widgettypesincludebuttons,scrollbars,menus,andtextwindows.Tkalsohasageneral-purposedrawingWIdgetcalledacanvasthatletsyoucreatelighter-weightitemssuchaslines,boxes,andbitmaps.TclandTkarehighlyportable,runningonessentiallyallflavorsofUnix(1.inux,Solaris.IRIX1AIX.*BSD,th

7、elistgoesonandon),Windows.Macintosh,andmore.SomebasicTkcommandswillbediscussedlater.Foradditionalinformation,pleaserefertothemanual.BasicTclSyntax Firstitemofacommandlineisammandname. Thewordsinthemmandlineareseparatedbyoneormorespaces. Wordscanbegroupedwithdoublequotesorcrlybaces. Commandsaretermin

8、atedwithnewlineorsemi-lon. Awordstartingwithadollarsign($)mustbeavariablename.Thestringwillbereplacedbythevalueolthevariable. WordsenclosedwithinsquarebracketsmustbealegalIclcommand.Thestringswouldbereplacedbytheresultsofevaluatingthecommand.TC1.CommandOverviewInthefollowingmmandoverviewitisrecommen

9、dthatthestudentstrytheexamplesthemselves.1.TextOutputPrintingoutastringusingTclisdoneusingtheputscommand.Asingleunitoftextaftertheputscommandwillbeoutput.Example1.1putsHyperWorksOutput:HyperWorksIfthestringismorethanoneword,thestringmustbeenclosedineitherdoublequotes(b*)orbraces().Manycommands,inclu

10、dingtheputscommand,acceptmultiplearguments.Ifthestringisnotenclosedinquotesorbraces,theindividualwordsareconsideredarguments.Asetofwordsenclosedinquotesorbraceswilltreatedasasingleunit.Thetwooptionsofquotesorbracesbehavedifferentlyandthedifferenceswillbediscussedinthenextsection.OutputAlbanyTheCapit

11、olofNewYorkis:TheCapitolofNewYorkis:AlbanyTheCapltolofNewYorkIs:$ZWhendefiningastring,iftherearemultiplewordsinthestringwehavelearnedthatwecaneitherusedoublequotesorbraces.Thedifferencebetweenthesetwooptionsishowtheytreatvariablesthatareintheirstrings.Example 2.3: puts$ZJ1.ABE1.puts$Z_1.ABE1.OutputT

12、heCapitolofNewYorkis:Albany$Z_1.ABE1.$ZExample2.3showshowusingthedoublebraceactuallydisablesthesubstitutionofvariableswithinthebraces.Notethatbraceshavethiseffectonlywhentheyareusedtorgrouping(i.e.atthebeginningandendofasequenceofwords).Ifastringisalreadygrouped,eitherwrthquotesorbraces,andbracesocc

13、urinthemiddleofthegroupedstring(i.e.foobar),thenthebracesaretreatedasregularcharacterswithnospecialmeaning.Ifthestringisgroupedwithquotes,substitutionswilloccurwithinthequotedstring,evenbetweenthebraces.Example 2.4:setmonth2setday3setyear09setdateSroonth:$day:$yearputs$dateOutput:2:3:09Herevariables

14、ubstitutionisusedinseveralplaces:Thevaluesofthevariablesmonth,day,andyeararesubstitutedinthesetcommandthatassignsthevalueofthedate*variable,andthevalueofthedatevariableisthensubstitutedinthelinethatdisplaystheoutput.Example 2.5:stfooputshi,eval$fooOutput:hiInthisexample,thevariablefooholdsanother(sm

15、all)Tclscriptthatsimplyprintsthewordhi.Thevalueofthevariablefoo,issubstitutedintoanevalcommand.Theevalmmandtakesoneormoreargumentsv/hichtogethercompriseaTclscriptandpassesittotheTclinterpreter.3. ExpressionsExamples3.1and3.2illustratetheuseofrelationalexpressionswiththeeprcommand.Thefirstexpressione

16、valuatesto0(false)since0doesnotequal1,whereasthesecondexpressionevaluatesto1(true),since,obviously.1doesequal1Therelationaloperator三三isusedtodothecomparison.Example 1.3:epr4+5Output:9Example3.3showshowtousetheOXPrstatementtoevaluateanarithmeticexpression.Heretheresultissimplythesumof4and5.Tclsupport

17、sthefollowingmathematicalfunctionsinexpressions:abscoshIOgsqrtacosdoubleIoglOsrandasinexppowtanatanfloorrandtanhatan2fmodroundwideceilhypotsincosintsinhInadditiontothesepredefinedfunctions,applicationsmaydefineadditionalfunctionsusingTclCreateMathFuncO.Example 1.4:exptsin(2)Output:0.909297Thisexampl

18、eshowsthattheprstatementcanbeusedtoevaluatetheresultofamathematicalfunction,inthiscase,thesineofanangle.4. CommandSubstitutionJustasvariablesubstitutionisusedtosubstitutethevalueofavariableintoaTclscript,commandsubstitutioncanbeusedtoreplaceaTclcommandwiththeresultthatitreturns.Considerthefollowinge

19、xample:Example 4.1:putsIamep10*2yeasold,andmyI.Q.isexpr100-25Output:Iam20yearsold,andmyI.Q.is75Asthisexampleshows,squarebracketsareusedtoachievecommandsubstitution.ThetextbetweenthesquarebracketsisevaluatedasaTclscript,anditsresultisthensubstitutedinitsplace.Inthiscase,commandsubstitutionisusedtopla

20、cetheresultsoftwomathematicalexpressionsintoastring.Commandsubstitutionisoftenusedinconjunctionwithvariablesubstitution,asshowninExample4.2:Example 4.2:setmy.height6.0putsIfIwas2inchestaller,Iwouldbeexpr$my_height+(2.0/12.0)feettallOutput:Iflwas2inchestaller,Iwouldbe6.16667feettallInthisexample,thev

21、alueofthevariablemy-height*issubstitutedinsidethesquarebracketsbeforethecommandisevaluated.Thisisagoodillustrationoflclsone-passrecursiveparsingmechanism.Whenevaluatingastatement,theTclinterpreter,makesonepassoverit,andindoingsomakesallthenecessarysubstitutions.Oncethisisdone,theinterpreterthenevalu

22、atestheresultingexpression.If.duringitspassovertheexpression,theinterpreterencounterssquarebracketsindicatingthatcommandsubstitutionistobeperformed),itrecursivelyparsesthescriptinsidethesquarebracketsinthesamemanner.5. Comparisonsand1.oopsInallbutthesimplestscripts,somemechanismisneededtocontrolthef

23、lowolexecution.Tcloffersdecision-makingconstructs(if-elseandswitchstatements)aswellasloopingconstructs(while,for,andforeachstatements),bothofwhichcanaltertheflowofexecutioninresponsetosomendition.Thefollowingexamplesservetoillustratetheseconstructs.Example5.1:setk35if$k=35(putsHandlingisgood.)elseif

24、($k20)(putsRideisgood.,)else(putsIamnotsureofthequalityofrideorhandling.Output:Handlingisgood.Example5.1usestheifstatement.Itsetsthevalueofthevariable-k,to35,andthenusesanifstatementtochoosewhichstatementtoprint.Thegeneralsyntaxoftheifstatementisasfollows:iftestlbodyl7elseiftest2body2elseif.?elsebod

25、yn?Ifthetstiexpressionevaluatestoatruevalue,thenbodylisexecuted.Ifnot.thenifthereareanyelseifclausespresent,theirtestexpressionsareevalutatedand.iftrue,theirbodiesareexecuted.Ifanyoneofthetestsismadesuccessfully,afteritscorrespondingbodyisexecuted,theifstatementterminates,anddoesnotmakeanyfurthercom

26、parisons.Ifthereisanelseclausepresent,itsbodyisexecutedifnoothertestsucceeds.inadditionlamodelhandle.ThisiswhytheresultoftheAddMOdeIcommandwasassignedtotheidvariable.5. Inordertoloadtheresultsintothesession,theSetResuitcommandisusedonthemodelhandle:my_modSetResultbezel.h3d6. Finally,thelaststepneede

27、distodrawthegraphicsagainandtoclosethestacktoreleasethehandles:animDrawhwiCloseStack5.115.12ModelObjectSofar,weloadedamodelandattachedresultstoitinananimationwindow.Onceamodelisloaded,wecangetamodelhandleandstartexploringwhatelsewecando.Infact,ifyoulistallmethodsavailableinthemodelhandle,youwillgeta

28、listofabout100methods.Thisofcoursemeansthatthereissomuchyoucandousingthemodelobject.Thefigurebelowshowsapartoftheobjecthierarchy,whichshowsallobjectsthatthemodelobjecthasaccessto.NoticethatthisisforpolModelv/hichistheHyperVieworanimationmodelobject.ThereisalsoamdllModelwhichistheMotionViewmodelobjec

29、t.ipolMod1IpolSlct1onSMpoltytmPolPartpolRsultCV1polOuryC!dPolExplosionClKpolAsmbfPolContourCtrlIPOlF1.DCtrlPOfTracingCtrlporakIngSystetnpolloV3luCtri1pofTnorCtr1-jpolclCrlIPoicollisionCMporvctorO11IpolComplxCV1ModelObjectTheseobjectsincludetheResultControl,QueryControlSelectionSetsandmanyotherobject

30、s.Also,theResultControlprovidesaccesstoContour.Tensor,andVectorcontrolsalongwithotherresulttypeinformationandfeatures.results.Theresultcontrolhandleallowsyoutoqueryinformationsuchasloadcases,simulationstepsanddatatypes.Italsoallowsyoutoapplyresultssuchascontour,tensorandvectorplotsandotherfeatures.I

31、nthefollowingexamplewearegoingtogetalistofdatatypesforthecurrentloadcase(alsoreferredtoassubcase).hwiOpenStackhwiGetSessionHandlesessionlsessionlGetProjectHandleprojectlprojectlGetPageHandlepagel1pagelGetWindowHandlewnl1wnlGetClintHandleanimanimGetHodelHandlemy_modelanimGetActiveModelmy_modelGetResu

32、ltCtrlHandlemy_resultsetcurrent(my_resultGetCurrentSubcasesetdata-typesmy_resultGetDataType1.ist$currenthwiCloseStackHyoulookatthedocumentationforGetDataType1.istcommand,youwillnoticethatitacceptsanadditionaloptionalargument,ntx.Thisargumentishelpfultogetasubsetofdatatypes(scalar,tensororvector)inst

33、eadthewholelist.Forexample,ifyouareonlyinterestedwiththetensordatatypes,thenyoucanspecifytheoptionalarguments.Goingbacktotheaboveexample,thstatementwouldbe:setdatatypesmy_resultGetDataType1.ist$currenttensorThiswillreturnalistoftensordatatypesonly,whichisthesamelistavailableinthtensorpanelinsideHype

34、rView.YoushouldneverassumethatloadcaseIDsstartat1.ItispossibletohaveoneloadcaseanditsIDisnot1,ormultipleloadcaseswitharbitraryIDslike14.22,200etc.5.12.3QueryControlThequerycontrolallowsyoutoqueryorgetinformationforallentitytypesinthemodel.Theinformationisthesamethatsavailableinthequerypanel.Asidefor

35、mbasicinformationyoucanalsoqueryresults,suchasstressvalues,displacements,etc.Ibstartworkingwiththequerycontrol,youneedtogetahandleandthenperformthedesiredquery.Whenworkingwfththequerycontrolyouhavetorememberthefollowing:Choosetheentitytype(i.e.node,element,componentorsystem)Specifytherequest(i.e.nod

36、e.id,ntour.valueetc.)Specifyasetofentitiesthatyouneedinformationfor(i.e.allnodes,orIDs100-200,orallentitiesabove/belowacertaincontourvalue,etc.)OutputthedatatoafileoranyotherchannelInthefollowingexample,wearegoingtoassumethatWehavebumper.h3dloadedandwehaveamodelhandlenamedmy_model.Wewillgetthecoordi

37、natesforasetofnodesrangingfrom1to100;wwilloutputthedatatoafilenamedout.t.myemodelGetQueryCtrlHandlemy_qury# createanodeStandaddids1-100setset_idmy_modelAddSelectionSetnodemyemodelGetsolectionSetHandlenodt$set_idnode-setAdd,id41anxDrawO(animation)42ay_modGetMeshModenone(animation)43Thisreturnsthevalu

38、eofnone.Theotheroptionsavailableareedges,features,ormeshlines.2. IntheCommandWindow,usetheSetMeshModecommandwiththemodelhandle:my_modSetMeshModemeshlinesNotithatthegraphicsdoesntupdateanddrawthemeshlines.ThisisbecausetheDrawmmandisneededagain.3. RefreshthegraphicsareausingtheDraWcommand:animDrawStep

39、5:Usingtheresultcontrolhandle,getthesubcaselistandthengetthesubcasetypeforthefirstsubcase.1. Togetthelistofsubcases,WefirsthavetogettheResuItCtrIhandle.Usethefollowinglinetodothis:my_modGetResultCtrlHandlemy_resUsingthemodelhandle.my_mod,wewereabletogeltheResuItCtrIhandle.my_res.2. NowthatwehavetheResuItCtrIhandle,v/ecangeneratealistofsubcases.ThisisdoneusingtheGetSubcase1.istcommandontheResuItCtrIhandle.Wecanassig

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 在线阅读 > 生活休闲


备案号:宁ICP备20000045号-1

经营许可证:宁B2-20210002

宁公网安备 64010402000986号