public class DXFDocument
extends java.lang.Object
// Create a DXF document and get its associated DXFGraphics instance DXFDocument dxfDocument = new DXFDocument("Example"); DXFGraphics dxfGraphics = dxfDocument.getGraphics(); // Do drawing commands as on any other Graphics. If you have a paint(Graphics) method, // you can just use it with the DXFGraphics instance since it's a subclass of Graphics. graphics.setColor(Color.RED); graphics.setStroke(new BasicStroke(3)); graphics.drawLine(0, 0, 1000, 500); graphics.drawRect(1000, 500, 150, 150); graphics.drawRoundRect(20, 200, 130, 100, 20, 10); // Get the DXF output as a string - it's just text - and save in a file for use with a CAD package String stringOutput = dxfDocument.toDXFString(); String filePath = "path/to/file.dxf"; FileWriter fileWriter = new FileWriter(filePath); fileWriter.write(dxfText); fileWriter.flush(); fileWriter.close();
Constructor and Description |
---|
DXFDocument()
Create a new DXFDocument
|
DXFDocument(java.lang.String documentComment)
Create a new DXF document with the specified comment in its header
|
Modifier and Type | Method and Description |
---|---|
void |
addEntity(DXFEntity entity)
Utility method used by the associated DXFGraphics object.
|
DXFStyle |
addStyle(DXFStyle style)
Utility method used by the associated DXFGraphics object.
|
void |
addTable(DXFTable table)
Utility method used by the associated DXFGraphics object.
|
DXFGraphics |
getGraphics()
Get the DXFGraphics associated with this document for use with standard Graphics drawing operations to generate
a DXF text representation.
|
java.lang.String |
toDXFString()
Return the DXF text associated with this DXF document.
|
public DXFDocument()
public DXFDocument(java.lang.String documentComment)
documentComment
- Comment for the documentpublic DXFGraphics getGraphics()
public java.lang.String toDXFString()
public void addTable(DXFTable table)
table
- A DXFTable instancepublic void addEntity(DXFEntity entity)
entity
- A DXFEntity instance