Constructors

Linetype

#Since v5.0
public Linetype()

Linetype

#Since v8.0
public Linetype(Linetype other)
other (Linetype)

Properties

AlwaysModelDistances

#Since v8.6
public bool AlwaysModelDistances { get; set; }
Linetype patterns and widths are typically interpreted as distances on the printed output when printing. In this case AlwaysModelDistances is false (default). When set to true, the linetype pattern and width will be interpreted as being in world distances. This is useful for cases like modeling a road as a single curve.

ComponentStatus

public virtual ComponentStatus ComponentStatus { get; set; }
Gets or sets the component status of the model component.
inherited fromModelComponent

ComponentType

#Since v6.0
public override ModelComponentType ComponentType { get; }

DeletedName

public string DeletedName { get; }
Gets the name of a component that is deleted.
inherited fromModelComponent

Disposed

public bool Disposed { get; }
Indicates if this object has been disposed or the document it originally belonged to has been disposed.
inherited fromCommonObject

HasId

public bool HasId { get; }
Returns a value indicating whether the component has an ID.
inherited fromModelComponent

HasIndex

public bool HasIndex { get; }
Returns a value indicating whether the component has an Index.
inherited fromModelComponent

HasName

public bool HasName { get; }
Returns a value indicating whether the component has a Name.
inherited fromModelComponent

HasShapes

#Since v9.0
public bool HasShapes { get; }
Does this linetype have shapes

HasUserData

public bool HasUserData { get; }
Gets true if this class has any custom information attached to it through UserData.
inherited fromCommonObject

Id

public virtual Guid Id { get; set; }
Gets or sets the ID of the current instance.
inherited fromModelComponent
InvalidOperationExceptionWhen setting the ID failed. This usually happened because the instance ID is already locked.

IdIsLocked

public bool IdIsLocked { get; }
Returns a value indicating whether the component ID is already locked.
inherited fromModelComponent

Index

public virtual int Index { get; set; }
Gets or sets the model component index attribute.
inherited fromModelComponent
InvalidOperationExceptionWhen setting the Index failed. This usually happens because the instance Index is already locked.

IndexIsLocked

public bool IndexIsLocked { get; }
Returns a value indicating whether the component Index is already locked.
inherited fromModelComponent

InstanceDefinitionModelSerialNumber

[CLSCompliant(false)] public virtual uint InstanceDefinitionModelSerialNumber { get; }
When a component is in a model as part of the information required for a linked instance definition, this value identifies the linked instance definition reference model.
inherited fromModelComponent
Remarks: Reference components are not saved in .3dm archives. Typically this value is set and locked by the code that adds a component to a model. This value is not saved in .3dm archives.

InUse

#Since v8.7
public bool InUse { get; }
Returns true if the linetype is in use by a Rhino object, a layer, an instance definition, or a section style.

IsComponentStatusLocked

public bool IsComponentStatusLocked { get; }
The component status itself can be locked. This returns an indication.
inherited fromModelComponent

IsDeleted

#Since v5.0
public override bool IsDeleted { get; }
Gets a value indicating whether this linetype has been deleted and is currently in the Undo buffer.

IsDocumentControlled

public virtual bool IsDocumentControlled { get; }
If true this object may not be modified. Any properties or functions that attempt to modify this object when it is set to "IsReadOnly" will throw a NotSupportedException.
inherited fromCommonObject

IsModified

#Since v5.0
public bool IsModified { get; }
true if this linetype has been modified by LinetypeTable.ModifyLinetype() and the modifications can be undone.

IsPatternLocked

#Since v8.0
public bool IsPatternLocked { get; }
Returns true if the pattern is locked and cannot be modified.

IsReference

#Since v5.0
public override bool IsReference { get; }
Gets a value indicting whether this linetype is a referenced linetype. Referenced linetypes are part of referenced documents.

IsSystemComponent

public bool IsSystemComponent { get; }
True if this model component is a system constant.

An incomplete list of system constant model components is below:

  • ON_ModelComponent::Unset

  • ON_InstanceDefinition::Empty

  • ON_Linetype::Unset
  • ON_Linetype::Continuous
  • ON_Linetype::ByLayer
  • ON_Linetype::ByParent

  • ON_Layer::Unset
  • ON_Layer::Default

  • ON_TextStyle::Unset
  • ON_TextStyle::Default
  • ON_TextStyle::ByLayer
  • ON_TextStyle::ByParent

  • ON_DimStyle::Unset
  • ON_DimStyle::Default
  • ON_DimStyle::DefaultInchDecimal
  • ON_DimStyle::DefaultInchFractional
  • ON_DimStyle::DefaultFootInchArchitecture
  • ON_DimStyle::DefaultMillimeterSmall
  • ON_DimStyle::DefaultMillimeterLarge
  • ON_DimStyle::DefaultMillimeterArchitecture
inherited fromModelComponent

IsValid

public virtual bool IsValid { get; }
Tests an object to see if it is valid.
inherited fromCommonObject

LineCapStyle

#Since v8.0
public LineCapStyle LineCapStyle { get; set; }
Defines how the ends of open curves should be drawn

LineJoinStyle

#Since v8.0
public LineJoinStyle LineJoinStyle { get; set; }
Defines how the corners of curves should be drawn

LinetypeIndex

#Since v5.0
[EditorBrowsable(EditorBrowsableState.Never)] public int LinetypeIndex { get; set; }
The index of this linetype.

ModelSerialNumber

[CLSCompliant(false)] public virtual uint ModelSerialNumber { get; }
A value identifying the model that manages this component.
inherited fromModelComponent
Remarks: If the component is being managed by a model, this value identifies the model. In Rhino, this value is the document runtime serial number. Typically this value is set and locked by the code that adds a component to a model. This value is not saved in .3dm archives.

Name

#Since v5.0
public override string Name { get; set; }
The name of this linetype.

NameIsLocked

public bool NameIsLocked { get; }
Returns a value indicating whether the component Name is already locked.
inherited fromModelComponent

PatternLength

#Since v5.0
public double PatternLength { get; }
Total length of one repeat of the pattern.

ReferenceModelSerialNumber

[CLSCompliant(false)] public virtual uint ReferenceModelSerialNumber { get; }
When a component is in a model for reference, this value identifies the reference model.
inherited fromModelComponent
Remarks: Reference components are not saved in .3dm archives. Typically this value is set and locked by the code that adds a component to a model. This value is not saved in .3dm archives.

SegmentCount

#Since v5.0
public int SegmentCount { get; }
Number of segments in the pattern.

ShapeBounds

#Since v9.0
public BoundingBox ShapeBounds { get; }
The bounding box of the shapes in this linetype definition.

ShapeGap

#Since v9.0
public double ShapeGap { get; set; }
If shapes are present in this linetype, this is the gap around the shape.

ShapeLocalOffset

#Since v9.0
public Vector2d ShapeLocalOffset { get; set; }
Local offset applied to shapes

ShapeSpacing

#Since v9.0
public double ShapeSpacing { get; set; }
If shapes are present in this linetype, this is the distance between shapes

UserData

public UserDataList UserData { get; }
List of custom information that is attached to this class.
inherited fromCommonObject

UserDictionary

public ArchivableDictionary UserDictionary { get; }
Dictionary of custom information attached to this class. The dictionary is actually user data provided as an easy to use shareable set of information.
inherited fromCommonObject

UserStringCount

#Since v8.9
public int UserStringCount { get; }
Gets the amount of user strings.

Width

#Since v8.0
public double Width { get; set; }
Base width for this linetype

WidthUnits

#Since v8.0
public UnitSystem WidthUnits { get; set; }
Unit system that widths are defined in. UnitSystem.None is default and means that the width is defined in pixels.

Methods

AddShape

#Since v9.0
public bool AddShape(Curve shapeCurve, double offset)
Add a curve shape to this linetype definition
shapeCurve (Curve)
offset (double)

AddShape

#Since v9.0
public bool AddShape(TextEntity text, double offset)
Add text as a shape to this linetype definition
text (TextEntity)
offset (double)

AppendSegment

#Since v5.0
public int AppendSegment(double length, bool isSolid)
Adds a segment to the pattern.
length (double)The length of the segment to be added.
isSolid (bool)If true, the length is interpreted as a line. If false, then the length is interpreted as a space.
Index of the added segment.

ClearId

public void ClearId()
Resets the HasId property of the model component to false, if possible.
inherited fromModelComponent
InvalidOperationExceptionIf the ID is locked.

ClearIndex

public void ClearIndex()
Resets the HasIndex property of the model component to false, if possible.
inherited fromModelComponent
InvalidOperationExceptionIf the index is locked.

ClearName

public void ClearName()
Resets the HasName property of the model component to false, if possible.
inherited fromModelComponent
InvalidOperationExceptionIf the name is locked.

CommitChanges

#Since v5.0
public bool CommitChanges()

ConstructConstObject

protected void ConstructConstObject(object parentObject, int subobjectIndex)
Assigns a parent object and a sub-object index to this.
inherited fromCommonObject
parentObject (object)The parent object.
subobjectIndex (int)The sub-object index.

CreateFromPatternString

#Since v7.4
public static Linetype CreateFromPatternString(string patternString, bool millimeters)
Creates a linetype from a pattern string. Values greater than zero represent line segments, and values less than or equal to zero represents space segments.
patternString (string)The pattern string.
millimeters (bool)Specify true if the pattern is represented in millimeters. Specify false if the pattern is represented in inches.
A valid linetype if successful, null otherwise.

DataCRC

[CLSCompliant(false)] public uint DataCRC(uint currentRemainder)
Increments the Cyclic Redundancy Check value by this instance.
inherited fromModelComponent
currentRemainder (uint)The current remainder value.
The updated remainder value.

Default

#Since v5.0
public void Default()
Set linetype to default settings.

DeleteAllUserStrings

#Since v8.9
public void DeleteAllUserStrings()

DeleteUserString

#Since v8.9
public bool DeleteUserString(string key)
key (string)

Dispose

public void Dispose()
Actively reclaims unmanaged resources that this instance uses.
inherited fromCommonObject

Dispose

protected virtual void Dispose(bool disposing)
For derived class implementers.

This method is called with argument true when class user calls Dispose(), while with argument false when the Garbage Collector invokes the finalizer, or Finalize() method.

You must reclaim all used unmanaged resources in both cases, and can use this chance to call Dispose on disposable fields if the argument is true.

Also, you must call the base virtual method within your overriding method.

inherited fromCommonObject
disposing (bool)true if the call comes from the Dispose() method; false if it comes from the Garbage Collector finalizer.

DuplicateLinetype

#Since v8.0
public Linetype DuplicateLinetype()
Duplicates a linetype, clears the name, id, and locked bits.
The duplicated linetype if successful, null otherwise.

EnsurePrivateCopy

public void EnsurePrivateCopy()
If you want to keep a copy of this class around by holding onto it in a variable after a command completes, call EnsurePrivateCopy to make sure that this class is not tied to the document. You can call this function as many times as you want.
inherited fromCommonObject

GetObjectData

[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)] public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Populates a System.Runtime.Serialization.SerializationInfo with the data needed to serialize the target object.
inherited fromCommonObject
info (SerializationInfo)The System.Runtime.Serialization.SerializationInfo to populate with data.
context (StreamingContext)The destination (see System.Runtime.Serialization.StreamingContext) for this serialization.

GetSegment

#Since v5.0
public void GetSegment(int index, out double length, out bool isSolid)
Gets the segment information at a index.
index (int)Zero based index of the segment.
length (out double)The length of the segment in millimeters.
isSolid (out bool)If the length is interpreted as a line, true is assigned during the call to this out parameter.

If the length is interpreted as a space, then false is assigned during the call to this out parameter.

IndexOutOfRangeExceptionIf the index is unacceptable.

GetTaperPoints

#Since v8.0
public Point2d[] GetTaperPoints()
Taper points are positions/width combinations along the length of a curve

GetUserString

#Since v8.9
public string GetUserString(string key)
Gets user string from this geometry.
key (string)id used to retrieve the string.
string associated with the key if successful. null if no key was found.

GetUserStrings

#Since v8.9
public NameValueCollection GetUserStrings()
Gets a copy of all (user key string, user value string) pairs attached to this geometry.
A new collection.

IsValidWithLog

public bool IsValidWithLog(out string log)
Determines if an object is valid. Also provides a report on errors if this object happens not to be valid.
inherited fromCommonObject
log (out string)A textual log. This out parameter is assigned during this call.
true if this object is valid; false otherwise.

LockId

public void LockId()
Locks the component Id property.
inherited fromModelComponent

LockIndex

public void LockIndex()
Locks the component Index property.
inherited fromModelComponent

LockName

public void LockName()
Locks the component Name property.
inherited fromModelComponent

NonConstOperation

protected virtual void NonConstOperation()
For derived classes implementers.

Defines the necessary implementation to free the instance from being constant.

inherited fromCommonObject

OnSwitchToNonConst

protected virtual void OnSwitchToNonConst()
Is called when a non-constant operation first occurs.
inherited fromCommonObject

PatternString

#Since v7.4
public string PatternString(bool millimeters)
Returns a string that represents the pattern of the linetype, which can be used in user interface. Values greater than zero represent line segments, and values less than or equal to zero represent space segments.
millimeters (bool)If true, the string is formatted in millimeters. If false, the string is formatted in inches.
The pattern string.

ReadFromFile

#Since v6.6
public static Linetype[] ReadFromFile(string path)
Reads linetypes from either a Rhino .3dm file or an AutoCAD .lin file.
path (string)The path to the file to read.
An array of linetypes if successful, otherwise an empty array.

RemoveAllShapes

#Since v9.0
public void RemoveAllShapes()
Remove all shapes from this linetype

RemoveSegment

#Since v5.0
public bool RemoveSegment(int index)
Removes a segment in the linetype.
index (int)Zero based index of the segment to remove.
true if the segment index was removed.

RemoveTaper

#Since v8.0
public void RemoveTaper()
Remove taper information for stroke

SetSegment

#Since v5.0
public bool SetSegment(int index, double length, bool isSolid)
Sets the length and type of the segment at index.
index (int)Zero based index of the segment.
length (double)The length of the segment to be added in millimeters.
isSolid (bool)If true, the length is interpreted as a line. If false, then the length is interpreted as a space.
true if the operation was successful; otherwise false.

SetSegments

#Since v6.8
public bool SetSegments(IEnumerable<double> segments)
Set all segments.
segments (IEnumerable<double>)An array of segments lengths. Lengths >= 0 are interpreted as a line. Lengths < 0 are interpreted as a space.
true if the segments were replaced

SetTaper

#Since v8.0
public void SetTaper(double startWidth, double endWidth)
Set taper to a simple start width / end width
startWidth (double)
endWidth (double)

SetTaper

#Since v8.0
public void SetTaper(double startWidth, Point2d taperPoint, double endWidth)
Set taper for this linetype width a single internal taper point
startWidth (double)
taperPoint (Point2d)
endWidth (double)

SetUserString

#Since v8.9
public bool SetUserString(string key, string value)
Attach a user string (key,value combination) to this geometry.
key (string)id used to retrieve this string.
value (string)string associated with key.
true on success.

ToJSON

public string ToJSON(SerializationOptions options)
Create a JSON string representation of this object
inherited fromCommonObject
options (SerializationOptions)

ToString

public override string ToString()
Returns the name of the model component type, and then its name and index.
inherited fromModelComponent
Remarks: This is provided as a visual aid. Do not rely on this for serialization.
Object.ToString