How to change the layer LineType

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: admin, support, SDS

How to change the layer LineType

Postby brace » 10 Jan 2017, 00:02

To change the Layer color i do

Code: Select all
vDrawing.Converter.LayerByName('0').Color := clRed;


But to change the line type

Code: Select all
vDrawing.Converter.LayerByName('0').LineType := WHAT?


Moreover where is the documentation about this property?

Thanks a lot.
brace
 
Posts: 4
Joined: 05 Mar 2015, 10:18

Re: How to change the layer LineType

Postby support » 10 Jan 2017, 14:11

Hello,

TsgDXFLinetype objects are stored in the LTYPES section, each line type has a unique name. So you can retrieve a line type by its name and apply it to the layer. For example:

Code: Select all
vDrawing.Converter.LayerByName('0').LineType := vDrawing.Converter.Sections[csLTypes].FindEntByName('ISO dash') as TsgDXFLineType;


TsgDXFLayer.LineType property is documented in CAD VCL help which is available online:
http://cadsofttools.com/help/cadvcl/tsg ... netype.htm


Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
support
 
Posts: 2673
Joined: 30 Mar 2005, 08:36

Re: How to change the layer LineType

Postby brace » 10 Jan 2017, 15:06

THanks for the reply.

I tried to use your code but i still create a continuous line.

I suspect this is because i need to call Loaded as described in the help.

PROBLEM 1
Please tell me how to use Loaded in this case:

Code: Select all
var
  vDrawing: TsgCADDXFImage;
begin
  vDrawing := TsgCADDXFImage.Create;
  vDrawing.LoadFromFile('../../TwoSimpleLayers.dxf');
  // Changes color of Layer '0'
  vDrawing.Converter.LayerByName('0').Color := clRed;
  vDrawing.Converter.LayerByName('1').Color := clGreen;
  vDrawing.Converter.LayerByName('1').LineType := vDrawing.Converter.Sections[csLTypes].FindEntByName('ISO dash') as TsgDXFLineType;;
  Loaded; // <----- HOW TO?

  Image1.Canvas.StretchDraw(Rect(0, 0,
    Round(vDrawing.Width * Image1.Height / vDrawing.Height), Image1.Height), vDrawing);
  vDrawing.Free;


PROBLEM 2
Where do i find the complete list of options ("ISO dash" is one and the others)?

Thanks
brace
 
Posts: 4
Joined: 05 Mar 2015, 10:18

Re: How to change the layer LineType

Postby support » 11 Jan 2017, 11:30

Hello,

You should call a TsgDXFConverter.Loads procedure which reloads a modified object (TsgDXFEntity or its derivatives) in the TsgDXFConverter. For the layer "1" the Loads call will be the following:

Code: Select all
vDrawing.Converter.Loads(vDrawing.Converter.LayerByName('1'));

The linetypes list depends on a drawing file, you can see all the available linetypes in AutoCAD: open the drawing file and enter LINETYPE at the Command prompt, the Linetype Manager window will be displayed.


Mikhail
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support
support
 
Posts: 2673
Joined: 30 Mar 2005, 08:36

Re: How to change the layer LineType

Postby Brooklyn19 » 25 Jan 2017, 10:13

support wrote:Hello,

You should call a TsgDXFConverter.Loads procedure which reloads a modified object (TsgDXFEntity or its derivatives) in the TsgDXFConverter. this phen375 For the layer "1" the Loads call will be the following:

Code: Select all
vDrawing.Converter.Loads(vDrawing.Converter.LayerByName('1'));

The linetypes list depends on a drawing file, you can see all the available linetypes in AutoCAD: open the drawing file male extra and enter LINETYPE at the Command prompt, the Linetype Manager window will be displayed.


Mikhail


Thanks Mikhail,
Brooklyn19
 
Posts: 1
Joined: 17 Jan 2017, 09:03
Location: USA


Return to CAD VCL

Who is online

Users browsing this forum: No registered users and 3 guests