Scripts for Daydream Home, ready to paste into Script Editor. Each one works on the house in the front window.
The basics
- Everything hangs off current design, the house that is open.
- Lengths are in metres and angles in degrees, whatever units the app is showing. One foot is 0.3048 m.
- A point on the plan is a pair, {x, y}. X runs east and Y runs north.
- A script’s values are used exactly as written. Nothing snaps.
- The rules that protect your house still apply. A sofa will not go through a wall, and a door that cannot fit its wall is refused. A refusal is a real error with a message.
- Every change is one step of Undo.
To see everything Daydream Home understands, open Script Editor, choose File ▸ Open Dictionary… and pick Daydream Home.
Look at a house
tell application "Daydream Home"
set d to current design
get name of d
get count of elements of d
get name of every element of floor 1 of d
get area of every room of floor 1 of d -- square metres
end tell
catalog of current design lists every piece that place accepts, and summary of current design returns the whole house as text.
Draw a room to exact sizes
A room 4.2 m by 3.6 m, with a window in the north wall and a door in the south wall. The room appears when the fourth wall closes it.
tell application "Daydream Home"
set south to draw wall from {0, 0} to {4.2, 0}
draw wall from {4.2, 0} to {4.2, 3.6}
set north to draw wall from {4.2, 3.6} to {0, 3.6}
draw wall from {0, 3.6} to {0, 0}
-- "at" runs from 0 to 1 along the wall
set win to add opening north kind "window" at 0.5 width 1.5
set sill height of win to 0.9
add opening south kind "door" at 0.25 width 0.9
set name of (find room at {2.1, 1.8}) to "Study"
end tell
Place and move furniture
tell application "Daydream Home"
set d to current design
set desk to place "Desk" at {2.1, 3.0} angle 0
set width of desk to 1.6
place "Chair" at {2.1, 2.3} angle 180
-- move a piece you can already see, by name
set sofa to first element of floor 1 of d whose name is "Sofa"
set x position of sofa to 2.4384 -- exactly 8 feet
set angle of sofa to 90
select sofa
end tell
Lights and doors
tell application "Daydream Home"
set d to current design
-- every lamp off
set enabled of (every element of floor 1 of d whose kind is "lamp") to false
-- the first door on wall 1, half open
set percent open of opening 1 of wall 1 of floor 1 of d to 0.5
end tell
Time of day and the look
tell application "Daydream Home"
set d to current design
set sun time of d to 7.25 -- 7:15 in the morning
set render style of d to "dreamy" -- or "realtor", "moody", "cinematic"
set exposure of d to 1.2
set depth of field of d to true
set focus distance of d to 3.5
end tell
Pictures
Go to a saved view and save a picture of it:
tell application "Daydream Home"
go to view "Kitchen"
export photo to POSIX file "/Users/Shared/kitchen.png"
end tell
One picture for every hour from 7 in the morning to 7 at night:
tell application "Daydream Home"
set d to current design
repeat with h from 7 to 19
set sun time of d to h
export photo to POSIX file ("/Users/Shared/house-" & h & ".png")
end repeat
end tell
Plans, models and timelapses
tell application "Daydream Home"
export plan to POSIX file "/Users/Shared/plan.svg"
export model to POSIX file "/Users/Shared/house.dae" -- for SketchUp
export model to POSIX file "/Users/Shared/house.usda" -- USD
-- the day from 6 in the morning to 8 at night, as a 4 second video
export timelapse starting 6 ending 20 duration 4 to POSIX file "/Users/Shared/day.mp4"
end tell
A second floor
tell application "Daydream Home"
set upstairs to add floor called "First Floor" ceiling height 2.5
draw wall from {0, 0} to {4.2, 0} -- drawn on the new floor
end tell
Location
tell application "Daydream Home"
set d to current design
import surroundings "350 Fifth Avenue, New York, NY"
set north offset of d to 15 -- turn the house 15° from north
end tell
Opening and saving
tell application "Daydream Home"
open design POSIX file "/Users/Shared/Home.daydreamhome"
set sun time of current design to 12
save design
save design in POSIX file "/Users/Shared/Home at noon.daydreamhome"
end tell
Tips
- Name a piece by what it is (first element whose name is "Sofa") or by its place in the list (element 3 of floor 1).
- Wall numbers can change as you draw, because walls split where they meet. Keep the value draw wall gives back, as the room example does, when you need a wall again.
- Rooms are numbered too, and the numbers shift as walls are added. find room at {x, y} always finds the room around a point.
- Text values such as looks and kinds are written in quotes: "moody", "window".
- If a script goes wrong, undo takes back one step at a time.