A
A
andreygoncherov2020-08-07 12:59:53
Programming
andreygoncherov, 2020-08-07 12:59:53

How to add several straight lines to a DXF file with a console utility?

Good afternoon.
The DXF file has an object made of curves. You need arbitrary text (automatically converted to curves) or just draw lines to the edge in a DXF file. Ideally through the console utility. In the worst case - something for Linux'a or completely to the edge through PHP.

I will be grateful and glad for any useful information on this matter;)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
andreygoncherov, 2020-08-07
@andreygoncherov

Found it ;) But comments on convenience and reliability will be
welcome ;
)
3 Console https://www.coolutils.com/CommandLine/TotalCADConverter
4 https:// www.codeproject.com/Articles/3398/CadLib-f... C++
5 https://github.com/enjoping/DXFighter PHP
6 https://archive.codeplex.com/?p=netdxf - C++ library

public static void Main()
{
  // your dxf file name
  string file = "sample.dxf";

  // by default it will create an AutoCad2000 DXF version
  DxfDocument dxf = new DxfDocument();
  // an entity
  Line entity = new Line(new Vector2(5, 5), new Vector2(10, 5));
  // add your entities here
  dxf.AddEntity(entity);
  // save to file
  dxf.Save(file);

  // this check is optional but recommended before loading a DXF file
  DxfVersion dxfVersion = DxfDocument.CheckDxfFileVersion(file);
  // netDxf is only compatible with AutoCad2000 and higher DXF version
  if (dxfVersion < DxfVersion.AutoCad2000) return;
  // load file
  DxfDocument loaded = DxfDocument.Load(file);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question