What is the way to write the api document of SketchUp
Today, the editor will take you to understand how to write SketchUp's api documents. The knowledge points in the article are introduced in great detail. Friends who think it is helpful can browse the content of the article together with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Let's follow the editor to learn more about how to write SketchUp api documents.
There are users asking for help in the MixLab group. The key to the code about casts_shadows is to correctly understand how to write the api document of SketchUp:
1. = > indicates the returned value
# casts_shadows? ⇒ Boolean
2. = (casts) indicates the parameter to be passed into casts_shadows
# casts_shadows= (casts) ⇒ Boolean
This involves methods that end with an equal sign in the ruby language. In ruby, methods that end with an equal sign are special. Ruby allows them to be called in the syntax of an assignment operation. Practice:
# define a class, and the mixLab class has the method name=, to set the name property of the class.
Class mixLab def name= (aName) @ name= aName endendm= mixLab.new ()
# equivalent writing method m shadow' mixLab.newm.name = ('shadow') p m # equivalent writing method m.name =' shadow' p m
Ps: P is an abbreviation for puts.
Go back and practice the code related to cast_shadows:
Model = Sketchup.active_modelselections = model.selectionputs selections [0] .typenameselections [0] .casts _ shadows=true
Status= (selections [0] .casts _ shadows=false) # p is short for puts p selections [0] .casts _ shadows?
A short exercise to understand the end of the ruby equal sign ~
Thank you for your reading, the above is the whole content of "what is the writing of SketchUp api documents?" learn friends to hurry up to operate it. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!