-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdemo.scad
115 lines (104 loc) · 3.56 KB
/
demo.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// QR code purpose (configure the section depending on the type you choose here)
qrcode_type = "text"; // [text:"Text/URL", wifi:"Wi-Fi", phone:"Phone Number", vcard:"Contact Info (VCard)", vevent:"Event Info (VEvent)"]
/* [Text/URL] */
// Content of the QR code
text = "some text or url";
/* [Wi-Fi] */
// SSID wifi network name
ssid = "wifi_network";
// Wi-Fi password
psk = "1234";
// Autentication type
auth = "WPA";// [WPA:"WPA/WPA2 (password protected)", nopass:"open network (no password)", WEP:"WEP (obsolete password protection)"]
// Whether network is hidden
hidden = 0; // [ 0:false, 1:true ]
/* [Phone] */
// Phone number
phone = "0123456789";
/* [Contact Info] */
// Last name
vc_lastname = "Doe";
// First name
vc_firstname = "John";
// Middle names
vc_middlenames = "";
// Honorary prefixes
vc_nameprefixes = "Dr.";
// Honorary suffixes
vc_namesuffixes = "";
// Full name (blank for auto)
vc_customfullname = "";
// Email address
vc_email = "[email protected]";
// URL (e.g. website)
vc_url = "https://johndoe.example.com";
// Phone number
vc_phone = "0123456789";
// Street address
vc_address = "123 Example St.";
// Extended address (e.g. apartment or suite number)
vc_ext_address = "";
// City
vc_city = "New York";
// Region (e.g. state or province)
vc_region = "NY";
// Postal code
vc_postalcode = "10002";
// Country
vc_country = "United States";
/* [Event Info] */
// Short event description
ve_summary = "Summary";
// Event description
ve_description = "Description of the event";
// Location
ve_location = "John's house";
// Start year (UTC)
ve_start_year = 2024; // [2000:2100]
// Start month (UTC)
ve_start_month = 6; // [1:12]
// Start day (UTC)
ve_start_day = 16; // [1:31]
// Start hour (UTC)
ve_start_hour = 18; // [0:23]
// Start minute (UTC)
ve_start_minute = 30; // [0:59]
// End year (UTC)
ve_end_year = 2024; // [2000:2100]
// End month (UTC)
ve_end_month = 6; // [1:12]
// End day (UTC)
ve_end_day = 16; // [1:31]
// End hour (UTC)
ve_end_hour = 20; // [0:23]
// End minute (UTC)
ve_end_minute = 30; // [0:59]
/* [Dimensions] */
// Width of the QR code
width = 100; // [1:1000]
// Height of the QR code
height = 100; // [1:1000]
// Thickness of the QR code or 0 for 2D
thickness = 5; // [0:20]
// Place the QR code in the center
center = 0; // [0:false, 1:true]
/* [QR code parameters (advanced)] */
// Error correction level
error_correction = "L"; // [L:"Low (~7%)", M:"Medium (~15%)", Q: "Quartile (~25%)", H: "High (~30%)"]
// Mask pattern
mask_pattern = 0; // [0:"000: (y + x)%2=0", 1:"001: y % 2=0", 2:"010: x % 3=0", 3:"011: (y + x)%3=0", 4:"100: (y/2 + x/3)%2=0", 5:"101: (y*x)%2+(y*x)%3=0", 6:"110: ((y*x)%3+y*x)%2=0", 7:"111: ((y*x)%3+y+x)%2=0"]
// Character encoding
encoding = "UTF-8"; // [ UTF-8:"UTF-8 (Unicode)", Shift_JIS:"Shift JIS (Shift Japanese International Standards)"]
include <qr.scad>
content =
qrcode_type == "wifi" ? qr_wifi(ssid, psk, auth, hidden) :
qrcode_type == "phone" ? qr_phone_call(phone) :
qrcode_type == "vcard" ? qr_vcard(vc_lastname, vc_firstname, vc_middlenames, vc_nameprefixes, vc_namesuffixes, vc_customfullname, vc_email, vc_url, vc_phone, vc_address, vc_ext_address, vc_city, vc_region, vc_postalcode, vc_country) :
qrcode_type == "vevent" ? qr_vevent(
ve_summary, ve_description, ve_location,
qr_vevent_datetime(ve_start_year, ve_start_month, ve_start_day, ve_start_hour, ve_start_minute, 0),
qr_vevent_datetime(ve_end_year, ve_end_month, ve_end_day, ve_end_hour, ve_end_minute, 0)
) :
text;
color("black")
qr(content, error_correction, width, height, thickness, center, mask_pattern, encoding);