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

1 / 57
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功