您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > 28revit-可视化编程插件Dynamo使用手册
DynamoLanguageManual1.LanguageBasics2.GeometryBasics3.GeometricPrimitives4.VectorMath5.RangeExpressions6.Collections7.Functions8.Math9.Curves:InterpretedandControlPoints10.Translation,Rotation,andOtherTransformations11.ConditionalsandBooleanLogic12.Looping13.ReplicationGuides14.CollectionRankandJaggedCollections15.Surfaces:Interpreted,ControlPoints,Loft,Revolve16.GeometricParameterization17.IntersectionandTrim18.GeometricBooleansA-1.Appendix1:PythonPointGeneratorsContentsProgramminglanguagesarecreatedtoexpressideas,usuallyinvolvinglogicandcalculation.Inadditiontotheseobjectives,theDynamotextuallanguage(formerlyDesignScript)hasbeencreatedtoexpressdesignintentions.Itisgenerallyrecognizedthatcomputationaldesigningisexploratory,andDynamotriestosupportthis:wehopeyoufindthelanguageflexibleandfastenoughtotakeadesignfromconcept,throughdesigniterations,toyourfinalform.Thismanualisstructuredtogiveauserwithnoknowledgeofeitherprogrammingorarchitecturalgeometryfullexposuretoavarietyoftopicsinthesetwointersectingdisciplines.Individualswithmoreexperiencedbackgroundsshouldjumptotheindividualsectionswhicharerelevanttotheirinterestsandproblemdomain.Eachsectionisself-contained,anddoesn’trequireanyknowledgebesidestheinformationpresentedinpriorsections.TextblocksinsetintheConsolasfontshouldbepastedintoaCodeBlocknode.TheoutputoftheCodeBlockshouldbeconnectedintoaWatchnodetoseetheintendedresult.Imagesareincludedintheleftmarginillustratingthecorrectoutputofyourprogram.IntroductionThisdocumentdiscussestheDynamotextualprogramminglanguage,usedinsideoftheDynamoeditor(sometimesreferredtoas“DynamoSandbox”).TocreateanewDynamoscript,opentheDynamoeditor,andselectthe“New”buttoninthe“FILES”group:ThiswillopenablankDynamograph.TowriteaDynamotextscript,doubleclickanywhereinthecanvas.Thiswillbringupa“CodeBlock”node.Inordertoeasilyseetheresultsofourscripts,attacha“Watch”nodetotheoutputofyourCodeBlocknode,asshownhere:Everyscriptisaseriesofwrittencommands.Someofthesecommandscreategeometry;otherssolvemathematicalproblems,writetextfiles,orgeneratetextstrings.Asimple,onelineprogramwhichgeneratesthequote“Lessismore.”lookslikethis:TheWatchnodeontheleftshowstheoutputofthescript.Lessismore.;1:LanguageBasicsThecommandgeneratesanewStringobject.StringsinDynamoaredesignatedbytwoquotationmarks(),andtheenclosedcharacters,includingspaces,arepassedoutofthenode.CodeBlocknodesarenotlimitedtogeneratingStrings.ACodeBlocknodetogeneratethenumber5420lookslikethis:EverycommandinDynamoisterminatedbyasemicolon.Ifyoudonotincludeone,theEditorwilladdoneforyou.Alsonotethatthenumberandcombinationofspaces,tabs,andcarriagereturns,calledwhitespace,betweentheelementsofacommanddonotmatter.Thisprogramproducestheexactsameoutputasthefirstprogram:Naturally,theuseofwhitespaceshouldbeusedtohelpimprovethereadabilityofyourcode,bothforyourselfandfuturereaders.Commentsareanothertooltohelpimprovethereadabilityofyourcode.InDynamo,asinglelineofcodeis“commented”withtwoforwardslashes,//.Thismakesthenodeignoreeverythingwrittenaftertheslashes,uptoacarriagereturn(theendoftheline).Commentslongerthanonelinebeginwithaforwardslashasterisk,/*,andendwithanasteriskforwardslash,*/.5420;LessIsMore.;SofartheCodeBlockargumentshavebeen‘literal’values,eitheratextstringoranumber.Howeveritisoftenmoreusefulforfunctionargumentstobestoredindatacontainerscalledvariables,whichbothmakecodemorereadable,andeliminateredundantcommandsinyourcode.Thenamesofvariablesareuptoindividualprogrammerstodecide,thougheachvariablenamemustbeunique,startwithaloweroruppercaseletter,andcontainonlyletters,numbers,orunderscores,_.Spacesarenotallowedinvariablenames.Variablenamesshould,thougharenotrequired,todescribethedatatheycontain.Forinstance,avariabletokeeptrackoftherotationofanobjectcouldbecalledrotation.Todescribedatawithmultiplewords,programmerstypicallyusetwocommonconventions:separatethewordsbycapitalletters,calledcamelCase(thesuccessivecapitallettersmimicthehumpsofacamel),ortoseparateindividualwordswithunderscores.Forinstance,avariabletodescribetherotationofasmalldiskmightbenamedsmallDiskRotationorsmall_disk_rotation,dependingontheprogrammer’sstylisticpreference.Tocreateavariable,writeitsnametotheleftofanequalsign,followedbythevalueyouwanttoassigntoit.Forinstance:Besidesmakingreadilyapparentwhattheroleofthetextstringis,variablescanhelpreducetheamountofcodethatneedsupdatingifdatachangesinthefuture.Forinstancethetextofthefollowingquoteonlyneedstobechangedinoneplace,despiteitsappearancethreetimesintheprogram.//Thisisasinglelinecomment/*Thisisamultiplelinecomment,whichcontinuesformultiplelines.*///Allofthesecommentshavenoeffecton//theexecutionoftheprogram//ThislineprintsaquotebyMiesvanderRoheLessIsMore;quote=Lessismore.;HerewearejoiningaquotebyMiesvanderRohethreetimes,withspacesbetweeneachphrase.Noticetheuseofthe+operatorto‘concatenate’thestringsandvariablestogethertoformonecontinuousoutput.//Myfavoritearchitecturequotequote=Lessismore.;quote++quote++quote;//MyNEWfavoritearchitecturequotequote=Lessisabore.;quote++quote++quote;Thesimplestgeo
本文标题:28revit-可视化编程插件Dynamo使用手册
链接地址:https://www.777doc.com/doc-4457385 .html