def getDefaultStyle(cls): if cls.__defstyle is None: _s = style.Style(u'Polyline Default Style', linetype.Linetype(u'Solid', None), color.Color(0xffffff), 1.0) cls.__defstyle = _s return cls.__defstyle
def _initialize_styles(): _style = graphicobject.GraphicObject.getDefaultStyle() globals.prefs['LINE_STYLE'] = _style globals.prefs['LINE_COLOR'] = _style.getColor() globals.prefs['LINE_TYPE'] = _style.getLinetype() globals.prefs['LINE_THICKNESS'] = _style.getThickness() # # set this style as the class default for the "real" drawing entities # segment.Segment.setDefaultStyle(_style) circle.Circle.setDefaultStyle(_style) arc.Arc.setDefaultStyle(_style) leader.Leader.setDefaultStyle(_style) polyline.Polyline.setDefaultStyle(_style) segjoint.SegJoint.setDefaultStyle(_style) segjoint.Chamfer.setDefaultStyle(_style) segjoint.Fillet.setDefaultStyle(_style) # # define and set a construction line style # _color = color.get_color(0xff, 0, 0) # red _lt = linetype.Linetype(u'Construction Lines', [2, 2]) _style = style.Style(u'Construction Objects', _lt, _color, 0.0) conobject.ConstructionObject.setDefaultStyle(_style) # # define and add the default text style and use values in the # text style to define various global key/value pairs # _ts = text.TextBlock.getDefaultTextStyle() globals.prefs['TEXT_STYLE'] = _ts globals.prefs['FONT_COLOR'] = _ts.getColor() globals.prefs['FONT_WEIGHT'] = _ts.getWeight() globals.prefs['FONT_STYLE'] = _ts.getStyle() globals.prefs['FONT_FAMILY'] = _ts.getFamily() globals.prefs['TEXT_SIZE'] = _ts.getSize() globals.prefs['TEXT_ANGLE'] = _ts.getAngle() globals.prefs['TEXT_ALIGNMENT'] = _ts.getAlignment() # # define and add the default dimension style and use the # values in that style to define various global preference # key/value pairs # _ds = dimension.Dimension.getDefaultDimStyle() globals.dimstyles.append(_ds) globals.prefs['DIM_STYLE'] = _ds for _key in _ds.getOptions(): _value = _ds.getOption(_key) globals.prefs[_key] = _value