File: prefs.py

package info (click to toggle)
pythoncad 0.1.23-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 3,044 kB
  • ctags: 3,568
  • sloc: python: 54,867; sh: 100; makefile: 39
file content (579 lines) | stat: -rw-r--r-- 16,005 bytes parent folder | download
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
#
# This file stores the global PythonCAD preferences, and
# is written itself in Python. Copy this file to the file
# '/etc/pythoncad/prefs.py' and it will be loaded and used
# to store global preferences for the program. Whenever
# a new image is opened, that image will use the global
# preferences for setting itself up. Each drawing window
# can then adjust these preferences by using the Preferences
# menus.
#
# When PythonCAD starts, a set of default values for the
# various options any image may set is stored, then the
# '/etc/pythoncad/prefs.py' file is searched for. If it
# is found, the values in the file will override the initial
# set of defaults. Variables defined in this file can
# therefore be commented out without problem.
#
# Any user can copy this file to their home directory and
# store it in a '.pythoncad' directory if they choose. By
# modifying their local preference file the user can add
# new linestyles, new dimension styles, or tailor the
# default configuration of the program to whatever works
# best.
#
# When defining a string value, the string can be in
# any case: 'UPPER', 'lower', or 'MiXeD'. The program will
# convert the string to upper case when testing the values
# entered here. Any time a string is given but the program
# fails to accept it due to case issues is a bug ...
#
# User Prefs
#
# This variable is meant as an adminstrators tool of
# disabling the reading of a preference file in the
# user's home directory. By default PythonCAD will look
# for a file in ${HOME}/.pythoncad/prefs.py after reading
# the global preference file '/etc/pythoncad/prefs.py'.
# If the user_prefs variable is set to False, the search
# for a user's preference file is not done.
#
# The prescence of this variable only makes sense in
# the '/etc/pythoncad.prefs' file.
#
# Valid choices: True, False

user_prefs = True

#
# Units
#
# The basic unit of length in an image.
#
# Valid choices:
# 'millimeters', 'micrometers', 'meters', 'kilometers',
# 'inches', 'feet', 'yards', 'miles'
#

units = 'millimeters'

#
# Chamfer Length
#
# The default chamfer length in an image.
#
# Valid values: Any numerical value 0.0 or greater
#

chamfer_length = 1.5

#
# Fillet Radius
#
# The default fillet radius in an image.
#
# Valid values: Any numerical value 0.0 or greater
#

fillet_radius = 2.0

#
# Leader arrow size
#
# This option sets the default arrow size on leader lines.
#
# Valid values: Any numerical value 0.0 or greater
#

leader_arrow_size = 10.0

#
# Dimension Options
#

#
# Dual Dimension display
#
# This option will set any new dimension object to display
# both possible dimension strings by default.
#
# Valid choices: True, False
#

dim_dual_mode = True

#
# Highlight Points
#
# This option will activate the drawing of small boxes around
# the Point entities in an image.
#
# Valid choices: True, False
#

highlight_points = True

#
# Linetypes
#
# There are several default Linetypes provided in PythonCAD.
# If you want to define more, they are added here.
#
# Each Linetype is defined as a tuple of two objects:
#
# (name, dashlist)
#
# The name is a string or unicode string, and the dash list
# is either 'None' (meaning a solid line), or a list with
# an even number of integer values. Each value pair represents
# the on-off bit pattern in the line.
#
# Examples:
# A dashed linetype called 'dash' with 4 bits on then 4 bits off:
# ('dash', [4, 4])
#
# A dashed linetype called 'dash2' with 10 bits on, 2 off, 6 on, 2 off
# (u'dash2', [10, 2, 6, 2]) # the "u" means unicode ...
#
# Add any new linetypes you wish in the linetypes list variable
#

linetypes = [
    # ('dash', [4, 4]), # dash example above
    # (u'dash2', [10, 2, 6, 2]), # dash2 example above
    ]

#
# Colors
#
# By default PythonCAD starts with eight basic colors defined.
# If you want to add more, here is where to add them.
#
# A Color is defined in one of two ways:
#
# '#xxxxxx' - a hexidecimal string like '#ff00ff'
# (r, g, b) - a tuple with three integers giving the red, green, and
#             blue values. Each value must be 0 <= val <= 255.
#
# Add any new colors you wish to use in the colors list variable

colors = [
    # '#ffffff', # hexidecimal example
    # '#33cc77', # another hex example
    # (100, 50, 30), # tuple example
    # (255, 30, 180), # another tuple example
    ]

#
# Styles
#
# Styles define a common set of properties for objects like
# segments, circles, and arcs. There are eight default styles
# in PythonCAD, and adding more styles can be done here.
#
# Defining a style is done by creating a tuple containing
# four fields:
#
# (name, linetype, color, thickness)
#
# The 'name' field is simply a string or unicode string. The
# 'linetype' field is a two object tuple described above, and
# the 'color' field is described above also. The 'thickness'
# field is a positive float value giving the line thickness.
#
# Examples:
#
# (u'style1', (u'lt1', [10, 4]), '#ffcc99', 0.1)
# A style called 'style1', composed of a linetype called 'lt1'
# which is a dashed line 10 bits on, 4 off, drawn with the
# color '#ffcc99' and 0.1 units thick.
#
# Add any new styles you want to use to the 'styles' list
# variable below. Several examples are included to provide
# a starting guide for creating new styles.
#
#

styles = [
    # (u'style1', (u'lt1', [10, 4]), '#ffcc99', 0.1), # example
    # (u'style2', (u'lt2', [6, 2, 10, 4]), '#cc00ff', 0.3), # another example
    # (u'style3', (u'lt3', [2, 6, 2, 2]), '#8844bb', 0.2), # third example
    ]

#
# Default style
#
# Set this variable to the name of the style you want the
# initial drawing style to be in PythonCAD. If you set this
# variable to None, or comment it out, the default style
# will be a solid white line.

default_style = None

#
# Dimension Styles
#
# A dimension style is a set of parameters that define
# how the dimension looks. Any dimension has a large number
# of attributes that can be set, so a dimension style is
# a way of grouping together these attributes into a common
# set and offering a means of making the dimensions look
# uniform.
#
# Defining a dimension style requires creating a dictionary
# with a certain keys and values. PythonCAD defines a single
# default dimension style, and any new dimension styles that
# are created here use that default style as a base, and the
# values in the new style then override the defaults.
#
# The list of dictionary keys and acceptable values is
# somewhat long. This list is given below with each key
# and the acceptable values for each key listed.
#
# Key: 'DIM_PRIMARY_FONT_FAMILY'
# Values: A string giving the font name
# Default: 'Sans'
#
# Key: 'DIM_PRIMARY_FONT_SIZE'
# Values: A positive integer value
# Default: 12
#
# Key: 'DIM_PRIMARY_TEXT_SIZE'
# Values: A positive float value
# Default: 1.0
#
# Key: 'DIM_PRIMARY_FONT_WEIGHT'
# Values: Either 'Normal', 'Light', 'Bold', or 'Heavy'
# Default: 'Normal'
#
# Key: 'DIM_PRIMARY_FONT_STYLE'
# Values: 'Normal', 'Oblique', or 'Italic'
# Default: 'Normal'
#
# Key: 'DIM_PRIMARY_FONT_COLOR'
# Values: A Color definition (see above), like (255, 255, 255) or '#ffffff'
# Default: '#ffffff'
#
# Key: 'DIM_PRIMARY_PREFIX'
# Value: A string or unicode string
# Default: u''
#
# Key: 'DIM_PRIMARY_SUFFIX'
# Value: A string or unicode string
# Default: u''
#
# Key: 'DIM_PRIMARY_PRECISION'
# Value: An integer value where 0 <= value <= 15
# Default: 3
#
# Key: 'DIM_PRIMARY_UNITS'
# Value: 'Millimeters', 'Micrometers', 'Meters', 'Milometers',
#        'Inches', 'Feet', 'Yards', 'Miles'
# Default: 'Millimeters'
#
# Key: 'DIM_PRIMARY_LEADING_ZERO'
# Value: True or False
# Default: True
#
# Key: 'DIM_PRIMARY_TRAILING_DECIMAL'
# Value: True or False
# Default: True
#
# Key: 'DIM_SECONDARY_FONT_FAMILY'
# Values: A string giving the font name
# Default: 'Sans'
#
# Key: 'DIM_SECONDARY_FONT_SIZE'
# Values: A positive integer value
# Default: 12
#
# Key: 'DIM_SECONDARY_TEXT_SIZE'
# Values: A positive float value
# Default: 1.0
#
# Key: 'DIM_SECONDARY_FONT_WEIGHT'
# Values: Either 'Normal', 'Light', 'Bold', or 'Heavy'
# Default: 'Normal'
#
# Key: 'DIM_SECONDARY_FONT_STYLE'
# Values: 'Normal', 'Oblique', or 'Italic'
# Default: 'Normal'
#
# Key: 'DIM_SECONDARY_FONT_COLOR'
# Values: A Color definition (see above), like (255, 255, 255) or '#ffffff'
# Default: '#ffffff'
#
# Key: 'DIM_SECONDARY_PREFIX'
# Value: A string or unicode string
# Default: u''
#
# Key: 'DIM_SECONDARY_SUFFIX'
# Value: A string or unicode string
# Default: u''
#
# Key: 'DIM_SECONDARY_PRECISION'
# Value: An integer value where 0 <= value <= 15
# Default: u''
#
# Key: 'DIM_SECONDARY_UNITS'
# Value: 'Millimeters', 'Micrometers', 'Meters', 'Milometers',
#        'Inches', 'Feet', 'Yards', 'Miles'
# Default: 'Millimeters'
#
# Key: 'DIM_SECONDARY_LEADING_ZERO'
# Value: True or False
# Default: True
#
# Key: 'DIM_SECONDARY_TRAILING_DECIMAL'
# Value: True or False
# Default: True
#
# Key: 'DIM_OFFSET'
# Value: A float value of 0.0 or greater.
# Default: 1.0
#
# Key: 'DIM_EXTENSION'
# Value: A float value of 0.0 or greater.
# Default: 1.0
#
# Key: 'DIM_COLOR'
# Value: A Color definition (see above), like (255, 255, 255) or '#ffffff'
# Default: (255, 165, 0)
#
# Key: 'DIM_THICKNESS'
# Value: A float value of 0.0 or greater.
# Default: 0.0
#
# Key: 'DIM_POSITION'
# Value: 'Split', 'Above', 'Below'
# Default: 'Split'
#
# Key: 'DIM_ENDPOINT'
# Value: 'No_endpoint' or 'None' or None, 'Arrow', 'Filled_arrow',
#        'Slash', 'Circle'
# Default: None
#
# Key: 'DIM_ENDPOINT_SIZE'
# Value: A float vale of 0.0 or greater.
# Default: 1.0
#
# Key: 'DIM_DUAL_MODE'
# Value: True or False
# Default: False
#
# Key: 'RADIAL_DIM_PRIMARY_PREFIX'
# Value: A string or unicode string
# Default: u''
#
# Key: 'RADIAL_DIM_PRIMARY_SUFFIX'
# Value: A string or unicode string
# Default: u''
#
# Key: 'RADIAL_DIM_SECONDARY_PREFIX'
# Value: A string or unicode string
# Default: u''
#
# Key: 'RADIAL_DIM_SECONDARY_SUFFIX'
# Value: A string or unicode string
# Default: u''
#
# Key: 'RADIAL_DIM_DIA_MODE'
# Value: True or False
# Default: False
#
# Key: 'ANGULAR_DIM_PRIMARY_PREFIX'
# Value: A string or unicode string
# Default: u''
#
# Key: 'ANGULAR_DIM_PRIMARY_SUFFIX'
# Value: A string or unicode string
# Default: u''
#
# Key: 'ANGULAR_DIM_SECONDARY_PREFIX'
# Value: A string or unicode string
# Default: u''
#
# Key: 'ANGULAR_DIM_SECONDARY_SUFFIX'
# Value: A string or unicode string
# Default: u''
#
#
# The keys that begin 'DIM_PRIMARY_' apply are specific to the
# primary dimension in any dimension, and 'DIM_SECONDARY_' are
# specific to the secondary dimension. 'RADIAL_DIM_' and
# 'ANGULAR_DIM_' are obviously applicible to those specific
# dimension types.
#
# 'DIM_OFFSET' is the distance between the dimensioned point and
# the start of the dimension bar, and 'DIM_EXTENSION' is the
# distance between where the dimension crossbar intersects the
# dimension bar and the end of the dimension bar. 'DIM_POSITION'
# will be used in placing the dimension text around the dimension
# crossbar. The names of the keys were chosen to be somewhat
# self explanatory, but they could change in future releases.
#
# As a dimension style is built by overriding the default values,
# creating a new style only requires changing the fields that
# you wish to update. In the example below, the four fields
# 'dim_offset', 'dim_endpoint', 'dim_endpoint_size', and
# 'dim_extension' are modified.

example_dict = {
    'dim_offset' : 5.0,
    'dim_endpoint' : 'filled_arrow',
    'dim_endpoint_size' : 10.0,
    'dim_extension' : 5.0,
    }
#
# here is an example of a dimension style with more changes
#

dimstyle_example_2 = {
    'dim_primary_font_family' : 'Times',
    'dim_primary_text_size' : 24.0,
    'dim_primary_font_color' : '#dd44bb',
    'dim_primary_suffix' : u' mm',
    'dim_primary_precision' : 2,
    'dim_secondary_font_family' : 'Helvetica',
    'dim_secondary_text_size' : 18.0,
    'dim_secondary_font_color' : '#33ee55',
    'dim_secondary_suffix' : u' in.',
    'dim_secondary_units' : 'inches',
    'dim_offset' : 10.0,
    'dim_endpoint' : 'slash',
    'dim_endpoint_size' : 10.0,
    'dim_extension' : 5.0,
    'radial_dim_primary_prefix' : u'R. ',
    'radial_dim_primary_suffix' : u' mm',
    'radial_dim_secondary_prefix' : u'R. ',
    'radial_dim_secondary_suffix' : u' in.',
    'dim_dual_mode' : True,
    }
#
# The creation of the dimension style is done with by creating
# a tuple containing two objects:
#
# (name, dict)
#
# name: The dimension style name
# dict: The dictionary containing the values for the dimension style
#
# Add any dimension styles you create to the dimstyles list below.

dimstyles = [
    # (u'example_dimstyle', example_dict), # example
    # (u'ex2' , dimstyle_example_2), # another example
    ]

#
# Default dimension style
#
# Set this variable to the name of the dimension style you
# want PythonCAD to use by default. If you define this variable
# to None, or comment it out, the default dimension style
# is used.

default_dimstyle = None

#
# Text styles
#
# A text style defines a common set of text attributes
# that are used to define visual elements of some text.
# A single text style is defined in PythonCAD, so if you
# want more text styles here is where to add them.
#
# Defining a text style is done by creating a tuple containing
# six fields:
#
# (name, family, size, style, weight, color)
#
# The 'name' field is the name of the text style, and can be
# used to reference it. The 'family' field is the font family,
# like 'Sans' or 'Times'. The 'size' field is the text size as
# a float. The style can be either 'normal, 'oblique', or 'italic'.
# The 'weight' can be one of 'normal', 'light', 'bold', or 'heavy',
# and the color is a color definition (see above).
#
# Examples:
#
# ('default', 'sans', 10.0, 'normal', 'normal', '#ff00cc')
# A Sans format of color #ff00cc called 'default' that will
# draw the text 10.0 units tall.
#
# ('fancy', 'helvetica', 20, 'italic', 'bold', '#ffff00')
# A bold, italicized Helvetica of color #ffff00 called 'fancy'
# drawing the text 20.0 units tall.
#
# Defining fonts style (and font handling) is still in the
# earliest stages in PythonCAD, so the sections dealing with
# text will most like change ...
#
# Add more text styles you wish to use here
#

textstyles = [
    # ('default', 'sans', 10.0, 'normal', 'normal', '#ff00cc') # example
    ]

#
# Default text style
#
# Set this variable to the name of the text style you
# want PythonCAD to use by default. If you define this variable
# to None, or comment it out, the default text style is used
#

default_textstyle = None

#
# Text properties
#
# In addition to setting the text styles, some default font properties
# can be set in this file. In setting one of the following values, the
# value defined in the default textstyle will be overriden.
#
# The examples below are all commented out. Uncomment the ones you
# want to override the default style info.
#
# Default font family
#
# font_family = 'Sans' # uncomment this to set the default font family
#
# Default font size
# This value must be an integer greater than 0.
#
# font_size = 18 # uncomment this to set the default font size
#
# Default text size
# This value must be an float greater than 0.
#
# text_size = 18.0 # uncomment this to set the default text size
#
# Default font weight
# This can be 'normal', 'light', 'bold', or 'heavy'.
#
# font_weight = 'normal' # uncomment this to set the default font weight
#
# Default font style
# This can be 'normal', 'italic', or 'oblique'.
#
# font_style = 'normal' # uncomment this to set the default font style
#
# Default font color
# This must be a color definition.
#
# font_color = '#ff00ff' # uncomment this to set the default font color

#
# Miscellaneous options
#
# Autosplitting (NOT IMPLEMENTED YET)
#
# This option will activate the automatic splitting of segments,
# circles, and arcs if a new point is added directly on the object.
#
# Valid choices: True, False
#

autosplit = False