QCAD
Open Source 2D CAD
Loading...
Searching...
No Matches
opennurbs_linetype.h
Go to the documentation of this file.
1/* $NoKeywords: $ */
2/*
3//
4// Copyright (c) 1993-2007 Robert McNeel & Associates. All rights reserved.
5// Rhinoceros is a registered trademark of Robert McNeel & Assoicates.
6//
7// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
8// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
9// MERCHANTABILITY ARE HEREBY DISCLAIMED.
10//
11// For complete openNURBS copyright information see <http://www.opennurbs.org>.
12//
14*/
15
16#if !defined(OPENNURBS_LINETYPE_INC_)
17#define OPENNURBS_LINETYPE_INC_
18
19
20// Description:
21// Determine if a line width is deemed to be a "hairline width" in Rhino
22// Any width that is >0 and < 0.001 mm is a hairline width for printing
23// Parameters:
24// width_mm: [in] the width to examine in millimeters
25// Returns:
26// true if this is a hairline width
27ON_DECL bool ON_IsHairlinePrintWidth( double width_mm );
28
29// Description:
30// Return a width in millimeters that is a valid hairline width in rhino
32
33
34
35
37// class ON_Linetype
38
40{
42
43public:
44
45 /*
46 Description:
47 Sets index = -1.
48 */
50
52
53
54 /*
55 Description:
56 Sets index = -1 and emptys name and segment list.
57 */
58 void Default();
59
60 /*
61 Description:
62 Tests that name is set and there is at least one non-zero length segment
63 */
64 ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
65
66 void Dump( ON_TextLog& ) const; // for debugging
67
68 /*
69 Description:
70 Write to file
71 */
73 ON_BinaryArchive& // serialize definition to binary archive
74 ) const;
75
76 /*
77 Description:
78 Read from file
79 */
81 ON_BinaryArchive& // restore definition from binary archive
82 );
83
84 // virtual
85 ON_UUID ModelObjectId() const;
86
87
89 //
90 // Interface
91
92 /*
93 Unique name for each linetype
94 */
95 bool SetLinetypeName( const char*);
96 bool SetLinetypeName( const wchar_t*);
97 const wchar_t* LinetypeName() const;
98
99 /*
100 Index of each linetype
101 This index is used by geometry objects to
102 reference a specific linetype
103 */
104 bool SetLinetypeIndex( int);
105 int LinetypeIndex() const;
106
107 /*
108 Description:
109 Returns the total length of one repeat of the pattern
110 */
111 double PatternLength() const;
112
113
114 /*
115 Description:
116 Returns the number of segments in the pattern
117 */
118 int SegmentCount() const;
119
120 /*
121 Description:
122 Adds a segment to the pattern
123 Returns:
124 Index of the added segment.
125 */
126 int AppendSegment( const ON_LinetypeSegment& segment);
127
128 /*
129 Description:
130 Removes a segment in the linetype.
131 Parameters:
132 index - [in]
133 Zero based index of the segment to remove.
134 Returns:
135 True if the segment index was removed.
136 */
137 bool RemoveSegment( int index );
138
139 /*
140 Description:
141 Sets the segment at index to match segment
142 */
143 bool SetSegment( int index, const ON_LinetypeSegment& segment);
144
145 /*
146 Description:
147 Sets the length and type of the segment at index
148 */
149 bool SetSegment( int index, double length, ON_LinetypeSegment::eSegType type);
150
151 /*
152 Description:
153 Returns a copy of the segment at index
154 */
155 ON_LinetypeSegment Segment( int index) const;
156
157 /*
158 Description:
159 Expert user function to get access to the segment array
160 for rapid calculations.
161 */
163 const ON_SimpleArray<ON_LinetypeSegment>& Segments() const;
164
165public:
167 ON_UUID m_linetype_id; // Set by Rhino - unique id of this linetype
169
170private:
172};
173
174#endif
175
Definition opennurbs_archive.h:152
Definition opennurbs_linetype.h:40
ON_OBJECT_DECLARE(ON_Linetype)
ON_wString m_linetype_name
Definition opennurbs_linetype.h:168
ON_SimpleArray< ON_LinetypeSegment > m_segments
Definition opennurbs_linetype.h:171
ON_UUID m_linetype_id
Definition opennurbs_linetype.h:167
int m_linetype_index
Definition opennurbs_linetype.h:166
Definition opennurbs_linestyle.h:83
eSegType
Definition opennurbs_linestyle.h:94
Definition opennurbs_object.h:393
virtual void Dump(ON_TextLog &) const
Definition opennurbs_object.cpp:1695
virtual ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const =0
virtual ON_BOOL32 Read(ON_BinaryArchive &binary_archive)
Definition opennurbs_object.cpp:1734
virtual ON_UUID ModelObjectId() const
Definition opennurbs_object.cpp:1622
virtual ON_BOOL32 Write(ON_BinaryArchive &binary_archive) const
Definition opennurbs_object.cpp:1714
Definition opennurbs_array.h:46
Definition opennurbs_textlog.h:20
Definition opennurbs_uuid.h:31
Definition opennurbs_string.h:392
#define ON_DECL
Definition opennurbs_defines.h:92
#define ON_CLASS
Definition opennurbs_defines.h:91
ON_DECL bool ON_IsHairlinePrintWidth(double width_mm)
Definition opennurbs_linetype.cpp:18
ON_DECL double ON_HairlinePrintWidth()
Definition opennurbs_linetype.cpp:26
#define NULL
Definition opennurbs_system.h:256
int ON_BOOL32
Definition opennurbs_system.h:362