Chap3•IntroductiontoCommandScripts•MoreCommandInterfacefeatures•ASAPUser-definedMacros•ASAPPre-definedMacros•SourceApodization•MoreAbouttheBOUNDSCommand•RaySplittingandFresnelReflections•AComprehensiveExerciseASAPCommandScriptsMotivationWhynotjustusetheBuilderanddrop-downmenus?VirtuesoftheASAPBuilder•Context-sensitivecolumnheadingshelpusentercommandparameters.•Cut,paste,drag-anddropandeaseofmodifyingparametersmakeeditingeasy•ManyBuildercommandsprovideaworkingexampleofthefeature.•Thepreviewfeatureoffersbuilt-ingeometryverification.•ThespreadsheetformatmatchesbasicASAPgeometryandsourcefeaturesverywell.•Manyusersaremorecomfortableagraphicaluserinterfacethanacommandlevelinterface.MotivationWhynotjustusetheBuilderanddrop-downmenus?LimitationsoftheASAPBuilderandpull-downmenus•TheBuilderincludesbasicgeometry,sources,ray-traceandanalysisfunctions,butcansometimesbemoretime-consumingtoeditamodel•ExecutionofafileisveryslightlyslowerintheBuilderandsometimesmoredifficulttoedit.•ThePreviewislessusefulwhenmorethanGeometryisincludedintheBuilderfile.•Intensiveuseofthedrop-downmenus(whencombinedwiththeuseoftheBuilder)forrepetitivetaskscanbecometediousandinefficient.ASAPCommandScripts?WhatcanASAPscriptsofferus?AdvandatesofASAPCommandScripts•Allgeometry,source-building,ray-tracing,andanalysiscommandsandfeaturesareavailableinthecommandlanguage(exceptASAP-implementTolerancing,currently)•AsinglescriptcanincludeallfourelementsofanASAPproject:systemgeometry,sources,ray-traceoptions,andanalysis;orseparatescriptscanhandlecombinationsoftheelements.•AllofthepoweroftheASAPmacrolanguageisavailablewithincommandscripts,givingusallthebasicfeaturesofaprogramminglanguage.•Manyusersaremorecomfortablewithacommandlevelinterfacethanagraphicaluserinterface.TheFour-StepProcess1.BuildtheSystem:Defineandverifythegeometryandopticalpropertiesofeachcomponentinyouropticalsystem2.Createsources:Defineandverifyasetofraysthataccuratelysimulatestheopticalcharacteristics(spatial,angular,powerdistribution,andcoherence)ofyourradiationsources.3.Tracetherays:Allowtheraystomovethroughyoursystem.4.PerformtheAnalysis:Calculatepower,irradiance,intensity,orothercharacteristicsatplaceswithinyoursystem.•BuildaSystem•CreateSources•TraceRays•PerformAnalysisOpeninganASAPEditorWindowOpenaneweditorwindowOpenanexistingscript.Choosefilesoftype*.inr.EditingScriptFiles•ASAPcommandscriptsaretext-onlyfiles,soanytexteditorcanbeused.•TheASAPeditorisafull-featurededitorthatincludesFind/Replace,blockcopying,anddrag-and-dropediting.•TheASAPeditoralsoallowsusto“step”throughaprogram,hascolor-codedcommands,andotherfeaturesofmodernprogrammingenvironments.AQuickTour•Commentlinesstartwith“!!”andarecodedgreen.•Keywords(basicASAPcommandsandoptions)areblue.•AllcommandsandoptionsareinUPPERCASE.•Mostoftheotherstringsandnumericalargumentsareblack.•Operatorslike+-areinred.•Whitespacecanbeusedtomakethescripteasiertoreadandnavigate.TheEditortoolbarGettingStarted•1)Openaneweditorwindow.•2)ClicktheImportTemplatebutton,andselectBasicTemplate•3)SavethefileusingtheFilemenu,ortheSaveasbutton.ImportTemplateBasicTemplateSystemSourceTraceAnalysisSYSTEMNEWdeletesallgeometryandsystemdatabaseinformationRESETdeletesallexistingraysandresetsseveralsystemcharacteristicstotheirdefaultvalues.(UseRAYS0iftheonlyrequirementistothrowawayallrays.)ThesetwocommandsincombinationaresimilartoclickingtheENDbutton.(ENDalsoreleasesallvariablespace.)1.BuildtheSystemLetASAPcalculatethecoatingpropertiesusingtheFresnelequations.•Systemunitsandwavelengthunitsapplytotheentireproject.•Systemunitsmustbedefinedbeforewavelengthunits.DefiningUnits,Wavelengths,MediaandCoatings•BuildaSystem•CreateSources•TraceRays•PerformAnalysis•Namesgoinsinglequoteswheretheyaredefined,butnoquotes(ordoublequotes)whentheyareusedlater•Additionalmediaandcoatingdefinitionsgoonsubsequentlines.ININCHESMMMILLIMETEYDYARDSFTFEETMIMILESMMETERSKMKILOMETERSMILMILSUMMICRONSCMCENTIMETERSUINMICROINCHESAANGSTROMSNMNANOMETERSUMMICRONSMMMILLIMETERSCMCENTIMETERSMMETERSN„NAME‟DefiningGeometryWiththedefaultBuildersettings,entitiesbecomeobjectsautomatically.InthecommandlanguageanadditionalstepmayberequiredtoturnageometricalentityintoanobjectUsetheENTOBJcommandtoavoidtheextrastep.ExtrudedEdgesCreateanOBJECTfromentitiesbecomesatwo-linecommandNotethedifferencebetweenOBJECTiAndOBJECTiMakeanobjectfromEntityiRecallOBJECTIformodificationObjectModifiersObjectmodifiersappearbelowtheOBJECTcommandTwowaystodefineaninterface(Notethattherearenosinglequotesusedoncoatingormedianames.)Otherobjectmodifierscanappearinanyorder.Someexamplesinclude:•FACETS•BOUNDS•SHIFT•SCALE•PLACE•MATRIX•REDEFINECOLOR•FRESNELNewOption!2.CreateSources•BuildaSystem•CreateSources•TraceRays•PerformAnalysis3.TracingRays(withGraphics)•BuildaSystem•CreateSources•TraceRays•PerformAnalysisStartingthe3DViewer(Internallydefinedmacro)•TRACEallraysfromobject0(thesource)toobject2(thelensback)•LISTpositionaldataabouteveryfourthrayateachsurface•PLOTeveryfourthray•OVERLAYthenextplotinthissamewindow•COLORStheraysredinthisplot•SeeOn-lin