Drawings SDK Developer Guide > Working with .dwg Files > Working with Entities > Working with Specific Entitites > Working with Lines > Specific Line Properties
Specific Line Properties

A line object uses start point, end point, normal, and thickness properties to define the geometry to be drawn. In examples, the pLine variable stores a pointer to a line object.

Start and End Points

The Start and End Point properties define the start and end points of the line in three-dimensional coordinates. Both start and end points havethe coordinates (0,0,0) by default.

To get the start point, use the startPoint() method which does not have arguments and returns the three-dimensional point as an instance of the OdGePoint3d type. For example:


OdGePoint3d start = pLine->startPoint();
odPrintConsoleString(L"\nStart point = (%g,%g,%g)", start.x, start.y, start.z);

To set the start point, use the setStartPoint() method which requires the three-dimensional point as an argument of the OdGePoint3d type and does not return a value. For example:


OdGePoint3d point(1, 3, 2);
pLine->setStartPoint(point);

To get the end point, use the endPoint() method which does not have arguments and returns the three-dimensional point as an instance of the OdGePoint3d type. For example:


OdGePoint3d end = pLine->endPoint();
odPrintConsoleString(L"\nEnd point = (%g,%g,%g)", end.x, end.y, end.z);

To set the end point, use the setEndPoint() method which requires the three-dimensional point as an argument of the OdGePoint3d type and does not return a value. For example:


OdGePoint3d point(4, 8, 6);
pLine->setEndPoint(point);

Normal

The Normal property defines the normal to an arbitrary plane in which the line can be placed. The normal defines the orientation of the plane that passes through the line in world space. The normal has the coordinates (0,0,1) by default.

To get the normal, use the normal() method which does not have arguments and returns the three-dimensional unit vector as an instance of the OdGeVector3d type. For example:


OdGeVector3d normal = pLine->normal();
odPrintConsoleString(L"\nNormal = (%g,%g,%g)", normal.x, normal.y, normal.z);

To set the normal, use the setNormal() method which requires the three-dimensional vector as an argument of the OdGeVector3d type and does not return a value. For example:


OdGeVector3d vector(0.707, 0, 0.707);
pLine->setNormal(vector);

The setNormal() method automatically converts the specified coordinates to a unit vector. For example:


pLine->setNormal( OdGeVector3d(2.5, 1.2, 3.4) );
OdGeVector3d result = pLine->normal();
odPrintConsoleString(L"\n(%g, %g, %g)", result.x, result.y, result.z);
// (0.569803, 0.273505, 0.774932)

Thickness

The Thickness property defines the thickness of a line as a Double value in drawing units. A positive value defines the thickness to be drawn along the normal direction. A negative value defines the thickness to be drawn in the opposite direction from the normal. A zero value defines a line without thickness. The thickness is zero by default.

To get the thickness, use the thickness() method which does not have arguments and returns the thickness as a Double value. For example:


odPrintConsoleString(L"\nThickness = %g", pLine->thickness());

To set the thickness, use the setThickness() method which requires a Double value as an argument and does not return a value. For example:


pLine->setThickness(1.5);

See Also

Working with Lines

Computed Line Properties

Example of Working with the Line Object

Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.