How can I use DashStyle property ?

Discuss and ask questions about CAD .NET library.

Moderators: SDS, support, admin

Post Reply
AliHatam
Posts: 13
Joined: 13 Aug 2021, 08:56

How can I use DashStyle property ?

Post by AliHatam » 13 Aug 2021, 09:00

Hi ,
How can I use DashStyle property for dashed or dot-dashed line drawing ?

support
Posts: 3253
Joined: 30 Mar 2005, 11:36
Contact:

Re: How can I use DashStyle property ?

Post by support » 13 Aug 2021, 15:20

Hello,

To draw a dashed or dot-dashed line, one should create a line type (CADLineType), specify its pattern (length of dash - positive value, length of space - negative value, length of dot - 0) by code and apply it to the created line:

Code: Select all

CADLineType DashLType = new CADLineType();
DashLType.Lines.Initialize(new double[] { 1.2, -0.5, 0.0, -0.5, 1.2 });
DashLType.Name = "Dash dot";
cadImage.Converter.Loads(DashLType);
cadImage.Converter.GetSection(CADImport.FaceModule.ConvSection.LTypes).AddEntity(DashLType);

CADLine cadLine = new CADLine
{
    LineType = cadImage.Converter.LTypeByName("Dash dot"),
    Point = new DPoint(0, 0, 0),
    Point1 = new DPoint(500, 800, 0),
    Color = Color.Blue,
};
cadImage.Converter.Loads(cadLine);
cadImage.Layouts[0].AddEntity(cadLine);
Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply