HyperWorks桌面自定义简介.docx
TableofContentsIntroductiontoHyperWorksDesktopCustomizationChaPter1:IntrOdUCtiOntoTC1.7AbOInTC1.7AbOiJtTk8Bas>cTelSVnlaX8TC1.COmrnandOVefVteW8TkBaSiCCOmmandS23ChaPter2:HVPerWOrkSDeSktOPEnVironment29TheHyDerWorkSDeSktoD29TheCommand1.aVer31EXerCiSe2.1ChanQinQIheClientTVDeUSingtheCB1U11andWindowPraCtiCalEXerCiSeS4243ChaPter3:TheCOmmand1.aYerEXPIOredCommanClCateaOrieS43BaSiCCOmmandS44WOrkIntlWithHandIeS46EXerCiSe3BaSiCCommandSandWorkinqWimHandleS49PraCtiCalExercises54ChaPter4:TheAnirnatiOnClient55AnimauOnWindow55EXerCiSe4.11.OaClinaaModelandReSUltSFiIe59MOdelObieCt61EXerCiSe4.2WorkinQWlththeModelObect67PraCtiCalEXerCiSeS71ChaPter5:ReSUltSandQUerV73ADDlYinaReSUltS73EXereiSe5.1ContourinaReSUItSandContOUnnabySeIeCtiOn77Res,s81EXerCiSe5.2QUeryinqCOnK)UredReSiJhSandCreatinga1.iStOfReSUItS84PraCHCalEXerCiSeS88ChaPter6:ThePlOtUnaCIient91ThePIOttinQWindOW91DefininqCurvesfromDataFiles92DefiningClJrVeSfromMathEXPreSSiOnS94AddinqNOteStoaPlOt95IntrodUCUontoTemPIeXStatementS97EXerCiSe6.1CreatinqPIotSandNQteSWimTemDleXinsideIheNQteS98PraCtiCalExercises106ChaDter7:TheMotiOnVieWModelClient109MOdelWindOW109SolUtiOnSForEXerCiSeS113GUIsquickly.Itprovedsopopularthatitnowshipswithalldistributionsof7cl.Tksharesmanyconceptswithotherwindowingtoolkits,butyoudonotneedtoknowmuchaboutgraphicaluserinterfacestogetstartedwithTk.Tkaddsabout35Tclcommandsthatletyoucreateandmanipulatewidgetsinagraphicaluserinterface.AWldgetisawindowinagraphicaluserinterfacethathasaparticularappearanceandbehavior.Thetermswidgetandwindowareoftenusedinterchangeably.Widgettypesincludebuttons,scrollbars,menus,andtextwindows.Tkalsohasageneral-purposedrawingWIdgetcalledacanvasthatletsyoucreatelighter-weightitemssuchaslines,boxes,andbitmaps.TclandTkarehighlyportable,runningonessentiallyallflavorsofUnix(1.inux,Solaris.IRIX1AIX.*BSD,thelistgoesonandon),Windows.Macintosh,andmore.SomebasicTkcommandswillbediscussedlater.Foradditionalinformation,pleaserefertothemanual.BasicTclSyntax Firstitemofacommandlineisammandname. Thewordsinthemmandlineareseparatedbyoneormorespaces. Wordscanbegroupedwithdoublequotesorcrlyb<aces. Commandsareterminatedwithnewlineorsemi-lon. Awordstartingwithadollarsign($)mustbeavariablename.Thestringwillbereplacedbythevalueolthevariable. WordsenclosedwithinsquarebracketsmustbealegalIclcommand.Thestringswouldbereplacedbytheresultsofevaluatingthecommand.TC1.CommandOverviewInthefollowingmmandoverviewitisrecommendthatthestudentstrytheexamplesthemselves.1.TextOutputPrintingoutastringusingTclisdoneusingtheputscommand.Asingleunitoftextaftertheputscommandwillbeoutput.Example1.1putsHyperWorksOutput:HyperWorksIfthestringismorethanoneword,thestringmustbeenclosedineitherdoublequotes(b*)orbraces().Manycommands,includingtheputscommand,acceptmultiplearguments.Ifthestringisnotenclosedinquotesorbraces,theindividualwordsareconsideredarguments.Asetofwordsenclosedinquotesorbraceswilltreatedasasingleunit.Thetwooptionsofquotesorbracesbehavedifferentlyandthedifferenceswillbediscussedinthenextsection.OutputAlbanyTheCapitolofNewYorkis:TheCapitolofNewYorkis:AlbanyTheCapltolofNewYorkIs:$ZWhendefiningastring,iftherearemultiplewordsinthestringwehavelearnedthatwecaneitherusedoublequotesorbraces.Thedifferencebetweenthesetwooptionsishowtheytreatvariablesthatareintheirstrings.Example 2.3: puts"$ZJ1.ABE1.puts$Z_1.ABE1.OutputTheCapitolofNewYorkis:Albany$Z_1.ABE1.$ZExample2.3showshowusingthedoublebraceactuallydisablesthesubstitutionofvariableswithinthebraces.Notethatbraceshavethiseffectonlywhentheyareusedtorgrouping(i.e.atthebeginningandendofasequenceofwords).Ifastringisalreadygrouped,eitherwrthquotesorbraces,andbracesoccurinthemiddleofthegroupedstring(i.e."foobar"),thenthebracesaretreatedasregularcharacterswithnospecialmeaning.Ifthestringisgroupedwithquotes,substitutionswilloccurwithinthequotedstring,evenbetweenthebraces.Example 2.4:setmonth2setday3setyear09setdate"Sroonth:$day:$year"puts$dateOutput:2:3:09Herevariablesubstitutionisusedinseveralplaces:Thevaluesofthevariables"month","day",and'year"aresubstitutedinthesetcommandthatassignsthevalueofthe"date*variable,andthevalueofthe"date"variableisthensubstitutedinthelinethatdisplaystheoutput.Example 2.5:stfoo"putshi,eval$fooOutput:hiInthisexample,thevariable"foo"holdsanother(small)Tclscriptthatsimplyprintstheword"hi".Thevalueofthevariable"foo,issubstitutedintoanevalcommand.Theevalmmandtakesoneormoreargumentsv/hichtogethercompriseaTclscriptandpassesittotheTclinterpreter.3. ExpressionsExamples3.1and3.2illustratetheuseofrelationalexpressionswiththeeprcommand.Thefirstexpressionevaluatesto0(false)since0doesnotequal1,whereasthesecondexpressionevaluatesto1(true),since,obviously.1doesequal1Therelationaloperator"三三"isusedtodothecomparison.Example 1.3:e×pr4+5Output