Rhino C++ API  7.24
Public Member Functions | Public Attributes | Friends | List of all members
CRhinoLinetypeTable Class Reference

#include <rhinoSdkLinetype.h>

Inheritance diagram for CRhinoLinetypeTable:
ON_SimpleArray< CRhinoLinetype * >

Public Member Functions

int AddLinetype (const ON_Linetype &linetype, bool bReference=false)
 
int AddLinetype (const wchar_t *linetype_name, ON_SimpleArray< double > &segments)
 
int CreateLinetype (const ON_Linetype &linetype, unsigned int worksession_ref_model_sn, unsigned int linked_idef_sn)
 
const CRhinoLinetypeCurrentLinetype () const
 
ON_UUID CurrentLinetypeId () const
 
int CurrentLinetypeIndex () const
 
ON::object_linetype_source CurrentLinetypeSource () const
 
bool DeleteLinetype (int linetype_index, bool bQuiet)
 
bool DeleteLinetypes (int linetype_index_count, const int *linetype_index, bool bQuiet)
 
CRhinoDocDocument () const
 
int FindLinePatternFromId (ON_UUID line_pattern_id, bool bSearchSystemLinePatterns, bool bSearchDeletedLinePatterns, int not_found_return_value) const
 
int FindLinePatternFromName (const wchar_t *line_pattern_name, bool bSearchSystemLinePatterns, int not_found_return_value) const
 
int FindLinetype (const wchar_t *line_pattern_name) const
 
void GetSortedList (ON_SimpleArray< const CRhinoLinetype * > &sorted_list, bool bIgnoreDeleted, bool bIgnoreReferenced) const
 
void GetSortedList (ON_SimpleArray< const CRhinoLinetype * > &sorted_list, bool bIgnoreDeleted=false) const
 
void GetUnusedLinetypeName (const wchar_t *root_name, ON_wString &unused_line_pattern_name) const
 
void GetUnusedLinetypeName (ON_wString &unused_line_pattern_name) const
 
void InitDefaultLinetypes ()
 
int LinetypeCount () const
 
double LinetypeScale () const
 
void ListTable (ON_TextLog &text_log, unsigned int level_of_detail) const
 
bool ModifyLinetype (const ON_Linetype &linetype, int linetype_index, bool bQuiet=false)
 
const CRhinoLinetypeoperator[] (int) const
 
bool SetCurrentLinetypeIndex (int linetype_index, bool bQuiet=false)
 
void SetCurrentLinetypeSource (ON::object_linetype_source source)
 
void SetLinetypeScale (double scale)
 
void SetRemapIndex (int, int)
 
void Sort (int(*compare)(const CRhinoLinetype *, const CRhinoLinetype *, void *), int(*cull)(const CRhinoLinetype *, void *), void *p=0)
 
int SystemLinetypeCount () const
 
const class CRhinoDocTableReferenceTableReference () const
 
bool UndeleteLinetype (int linetype_index)
 
bool UndoModifyLinetype (int linetype_index, unsigned int ur_sn=0)
 

Public Attributes

const CRhinoLinetypeByLayerLinePattern
 index = -2; More...
 
const CRhinoLinetypeByParentLinePattern
 index = -3; More...
 
const CRhinoLinetypeContinuousLinePattern
 index = -1; More...
 

Friends

class CRhinoDetailViewObject
 
class CRhinoDoc
 

Member Function Documentation

◆ AddLinetype() [1/2]

int CRhinoLinetypeTable::AddLinetype ( const ON_Linetype linetype,
bool  bReference = false 
)

Description: Adds a new linetype with specified definition to the linetype table.

Parameters: linetype - [in] definition of new linetype. The information in linetype is copied. If linetype.LinetypeName() is empty the a unique name of the form "Linetype 01" will be automatically created.

bReference - [in] true if this linetype is a reference linetype. Reference linetypes are not saved in files.

Returns: @untitled table >=0 index of new linetype -1 linetype not added because a linetype with that name already exists.

Remarks: In some cases, calling AddLinetype() can cause the memory references previously returned by operator[] and CurrentLinetype() to become invalid.

◆ AddLinetype() [2/2]

int CRhinoLinetypeTable::AddLinetype ( const wchar_t *  linetype_name,
ON_SimpleArray< double > &  segments 
)

Description: Adds a new linetype to the linetype table. Parameters: linetype_name - [in] name for the new linetype segments - [in] array of segment lengths. Positive values are dashes, negative values are gaps Returns: @untitled table >=0 index of new linetype -1 linetype not added because a linetype with that name already exists or input is not valid.

◆ CreateLinetype()

int CRhinoLinetypeTable::CreateLinetype ( const ON_Linetype linetype,
unsigned int  worksession_ref_model_sn,
unsigned int  linked_idef_sn 
)

Description: Basic tool used to create a new linetype with specified definition to the linetype table. The AddLinetype() functions all use CreateLinetype() when a new linetype needs to be added to the linetype table.

Parameters: linetype - [in] definition of new linetype. The information in linetype is copied. If linetype.LinetypeName() is empty the a unique name of the form "Linetype 01" will be automatically created.

worksession_ref_model_sn - [in] 0: linetype is not a reference layer 1: linetype is a reference linetype but not part of a worksession reference file 2-1000: reserved for future use >1000: worksession reference file serial number

linked_idef_sn - [in] 0: linetype is not from a liked instance definition 1-1000: reserved for future use >1000: linetype instance defintion serial number

Returns: @untitled table >=0 index of new linetype -1 linetype not added because a linetype with that name already exists.

◆ CurrentLinetype()

const CRhinoLinetype& CRhinoLinetypeTable::CurrentLinetype ( ) const

Description: At all times, there is a "current" linetype. Unless otherwise specified, new objects are assigned to the current linetype. If the current linetype source is ON::linetype_from_layer, the object's layer's linetype is used instead

Returns: Reference to the current linetype. Note that this reference may become invalid after a call to AddLinetype().

◆ CurrentLinetypeId()

ON_UUID CRhinoLinetypeTable::CurrentLinetypeId ( ) const

◆ CurrentLinetypeIndex()

int CRhinoLinetypeTable::CurrentLinetypeIndex ( ) const

Description: At all times, there is a "current" linetype. Unless otherwise specified, new objects are assigned to the current linetype. If the current linetype source is ON::linetype_from_layer, the object's layer's linetype is used instead

Returns: Zero based linetype table index of the current linetype.

◆ CurrentLinetypeSource()

ON::object_linetype_source CRhinoLinetypeTable::CurrentLinetypeSource ( ) const

Description: Returns the source used by an object to determine its current linetype to be used by new objects. Default is ON::linetype_from_layer. Returns: The linetype source for new objects.

◆ DeleteLinetype()

bool CRhinoLinetypeTable::DeleteLinetype ( int  linetype_index,
bool  bQuiet 
)

Description: Deletes linetype

Parameters: linetype_index - [in] zero based index of linetype to delete. This must be in the range 0 <= linetype_index < LinetypeCount(). bQuiet - [in] If true, no warning message box appears if a linetype the linetype cannot be deleted because it is the current linetype or it contains active geometry.

Returns: true if successful. false if linetype_index is out of range or the the linetype cannot be deleted because it is the current linetype or because it linetype is referenced by active geometry.

◆ DeleteLinetypes()

bool CRhinoLinetypeTable::DeleteLinetypes ( int  linetype_index_count,
const int *  linetype_index,
bool  bQuiet 
)

Description: Deletes multiple linetypes

Parameters: linetype_index_count - [in] length of linetype_index[] array. linetype_index - [in] array zero based indices of linetypes to delete. The indices must be in the range 0 <= linetype_index < LinetypeCount(). bQuiet - [in] If true, no warning message box appears if a linetype the linetype cannot be deleted because it is the current linetype or it contains active geometry.

Returns: true if successful. false if linetype_index is out of range or the the linetype cannot be deleted because it is the current linetype or because it linetype contains active geometry.

◆ Document()

CRhinoDoc& CRhinoLinetypeTable::Document ( ) const

Description: Linetype tables store the list of linetypes in a Rhino document.

Returns: CRhinoDocument that owns this linetype table.

◆ FindLinePatternFromId()

int CRhinoLinetypeTable::FindLinePatternFromId ( ON_UUID  line_pattern_id,
bool  bSearchSystemLinePatterns,
bool  bSearchDeletedLinePatterns,
int  not_found_return_value 
) const

Description: Search for line patterns with a matching id. Parameters: line_pattern_id - [in] bSearchSystemLinePatterns - [in] If true, the system Continuous, By Layer, and By Parent line patterns are included in the search. bSearchDeletedLinePatterns - [in] If true, deleted line patterns are included in the search. not_found_return_value - [in] Value to return if no line pattern has a matching id. Depending on what should happen if the id is not found, CurrentLinetypeIndex(), ContinyousLinePattern.Index() and ON_UNSET_INT_INDEX are common choices for this value. Returns: The index of the matching line pattern is returned. If no match is found, then not_found_return_value is returned.

◆ FindLinePatternFromName()

int CRhinoLinetypeTable::FindLinePatternFromName ( const wchar_t *  line_pattern_name,
bool  bSearchSystemLinePatterns,
int  not_found_return_value 
) const

Description: Search for line patterns with a matching name. Parameters: line_pattern_name - [in] bSearchSystemLinePatterns - [in] If true, the system Continuous, By Layer, and By Parent line patterns are included in the search. not_found_return_value - [in] Value to return if no line pattern has a matching name. Depending on what should happen if the name is not found, CurrentLinetypeIndex(), ContinyousLinePattern.Index() and ON_UNSET_INT_INDEX are common choices for this value. Returns: The index of the matching line pattern is returned. If no match is found, then not_found_return_value is returned.

◆ FindLinetype()

int CRhinoLinetypeTable::FindLinetype ( const wchar_t *  line_pattern_name) const

Use FindLinePatternFromName() ON_DEPRECATED too many warnings - deal with this later

◆ GetSortedList() [1/2]

void CRhinoLinetypeTable::GetSortedList ( ON_SimpleArray< const CRhinoLinetype * > &  sorted_list,
bool  bIgnoreDeleted,
bool  bIgnoreReferenced 
) const

Description: Gets an array of pointers to linetypes whose value of CRhinoLinetype.m_sort_index != -1. The returned list is sorted by the value of CRhinoLinetype.m_sort_index.

Parameters: sorted_list - [out] this array is returned with length <= LinetypeCount() and is sorted by the values of CRhinoLinetype::m_sort_index.

bIgnoreDeleted - [in] true means don't include deleted linetypes.

bIgnoreDeleted - [in] true means don't include referenced linetypes. A "referenced" linetype is one from a worksession reference model or a linked instance definition model.

Remarks: Use Sort() to set the values of m_sort_index.

◆ GetSortedList() [2/2]

void CRhinoLinetypeTable::GetSortedList ( ON_SimpleArray< const CRhinoLinetype * > &  sorted_list,
bool  bIgnoreDeleted = false 
) const

◆ GetUnusedLinetypeName() [1/2]

void CRhinoLinetypeTable::GetUnusedLinetypeName ( const wchar_t *  root_name,
ON_wString unused_line_pattern_name 
) const

◆ GetUnusedLinetypeName() [2/2]

void CRhinoLinetypeTable::GetUnusedLinetypeName ( ON_wString unused_line_pattern_name) const

Description: Gets unused linetype name used as default when creating new linetypes. Parameters: unused_line_pattern_name - [out] new linetype name

◆ InitDefaultLinetypes()

void CRhinoLinetypeTable::InitDefaultLinetypes ( )

Description: Fills in the linetype table with any default linetypes not already included

◆ LinetypeCount()

int CRhinoLinetypeTable::LinetypeCount ( ) const

Returns: Number of linetypes in the linetype table, including deleted linetypes.

◆ LinetypeScale()

double CRhinoLinetypeTable::LinetypeScale ( ) const

Description: For display in Rhino viewports, the linetypes are scaled by a single scale factor for all viewports. This is not used for printing, where all linetype patterns are scaled to print in their defined size 1:1 on the paper. Returns: The scale factor for linetype display

◆ ListTable()

void CRhinoLinetypeTable::ListTable ( ON_TextLog text_log,
unsigned int  level_of_detail 
) const

◆ ModifyLinetype()

bool CRhinoLinetypeTable::ModifyLinetype ( const ON_Linetype linetype,
int  linetype_index,
bool  bQuiet = false 
)

Description: Modify linetype settings

Parameters: linetype - [in] new settings. This information is copied. linetype_index - [in] zero based index of linetype to set. This must be in the range 0 <= linetype_index < LinetypeCount(). bQuiet - [in] if true, information message boxes pop up when illegal changes are attempted.

Returns: true if successful. false if linetype_index is out of range or the settings attempt to lock or hide the current linetype.

◆ operator[]()

const CRhinoLinetype& CRhinoLinetypeTable::operator[] ( int  ) const

Description: Conceptually, the linetype table is an array of LinetypeCount() linetypes. The operator[] can be used to get individual linetypes. A linetype is either active or deleted and this state is reported by CRhinoLinetype::IsDeleted().

Parameters: linetype_index - zero based array index

Returns: Refererence to the linetype. If linetype_index is out of range, the current linetype is returned. Note that this reference may become invalid after AddLinetype() is called.

◆ SetCurrentLinetypeIndex()

bool CRhinoLinetypeTable::SetCurrentLinetypeIndex ( int  linetype_index,
bool  bQuiet = false 
)

Description: At all times, there is a "current" linetype. Unless otherwise specified, new objects are assigned to the current linetype. If the current linetype source is ON::linetype_from_layer, the object's layer's linetype is used instead The current linetype is never deleted.

Parameters: linetype_index - [in] value for new current linetype. 0 <= linetype_index < LinetypeCount(). bQuiet - [in] if true, then no warning message box pops up if the current linetype request can't be satisfied. Returns: true if current linetype index successfully set.

◆ SetCurrentLinetypeSource()

void CRhinoLinetypeTable::SetCurrentLinetypeSource ( ON::object_linetype_source  source)

Description: Set the source to be used by new objects to determine their current linetype Parameter: source - the new current linetype source

◆ SetLinetypeScale()

void CRhinoLinetypeTable::SetLinetypeScale ( double  scale)

Parameter: New scale factor for linetype display

◆ SetRemapIndex()

void CRhinoLinetypeTable::SetRemapIndex ( int  ,
int   
)

◆ Sort()

void CRhinoLinetypeTable::Sort ( int(*)(const CRhinoLinetype *, const CRhinoLinetype *, void *)  compare,
int(*)(const CRhinoLinetype *, void *)  cull,
void *  p = 0 
)

Description: Use this to set CRhinoLinetype::m_sort_index so that the values of m_sort_index run from 0 to LinetypeCount()-1 and compare(linetype_table[i],linetype_table[j]) < 0 ) implies linetype_table[i].m_sort_index < linetype_table[j].m_sort_index.

Parameters: compare - [in] compare function with prototype int compare(const CRhinoLinetype* arg1,const CRhinoLinetype* arg2,void* p). that returns <0 if arg1<arg2, 0 if arg1=arg2, and >0 if arg1>arg2. cull - [in] optional filter function with prototype bool cull(const CRhinoLinetype* arg,void* p). that returns true if the linetype should be ignored when sorting. Linetypes that are ignored are not included in the list returned by GetSortedList(). Pass 0 if you do not need to cull linetypes p - [in] pointer passed as last argument to compare() and cull().

Remarks: After calling Sort(), you can repeatedly call GetSortedList() to get a sorted list of CRhinoLinetype pointers. Sort() and GetSortedList() do not modify the order or persistent information in the linetype table. They are intended to be used to get sorted lists of linetypes for dialogs, etc.

◆ SystemLinetypeCount()

int CRhinoLinetypeTable::SystemLinetypeCount ( ) const

Description: Returns the number of system linetypes, or those that are implied members of the linetype table.

◆ TableReference()

const class CRhinoDocTableReference& CRhinoLinetypeTable::TableReference ( ) const

◆ UndeleteLinetype()

bool CRhinoLinetypeTable::UndeleteLinetype ( int  linetype_index)

Description: Undeletes a linetype that has been deleted by DeleteLinetype().

Parameters: linetype_index - [in] zero based index of linetype to undelete. This must be in the range 0 <= linetype_index < LinetypeCount().

Returns: true if successful.

◆ UndoModifyLinetype()

bool CRhinoLinetypeTable::UndoModifyLinetype ( int  linetype_index,
unsigned int  ur_sn = 0 
)

Description: If the linetype has been modified and the modifcation can be undone, then UndoModify() will restore the linetype to its previous state.

Returns: true if this linetype had been modified and the modifications were undone.

See Also: IsModified.

Friends And Related Function Documentation

◆ CRhinoDetailViewObject

friend class CRhinoDetailViewObject
friend

◆ CRhinoDoc

friend class CRhinoDoc
friend

Member Data Documentation

◆ ByLayerLinePattern

const CRhinoLinetype& CRhinoLinetypeTable::ByLayerLinePattern

index = -2;

◆ ByParentLinePattern

const CRhinoLinetype& CRhinoLinetypeTable::ByParentLinePattern

index = -3;

◆ ContinuousLinePattern

const CRhinoLinetype& CRhinoLinetypeTable::ContinuousLinePattern

index = -1;