NDEVR
API Documentation
DXFFactory.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: IOFactory
28File: DXFFactory
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/CADHandleManager.h>
35#include <NDEVR/IOFactory.h>
36#include <NDEVR/FileFormat.h>
37
38namespace NDEVR
39{
40 class DXFWriter;
41 struct BlockData;
42 class Geometry;
43 class Model;
45 struct BlockData;
46 struct DXFMaterial;
49 class CADWriteModifier;
55 class DXFFactory : public IOFactory
56 {
57 public:
58 NDEVR_CAD_API DXFFactory();
59 NDEVR_CAD_API static DXFFactory& DefaultFactory();
64 NDEVR_CAD_API static FileFormat AutodeskDXF();
69 NDEVR_CAD_API static FileFormat FlatDXF();
70 NDEVR_CAD_API virtual void getSupportedFormats(Buffer<FileFormat>& formats, bool is_read) override;
71 NDEVR_CAD_API virtual bool readFile(FactoryParameters& file) override;
72 NDEVR_CAD_API virtual bool writeFile(FactoryParameters& file) override;
73 NDEVR_CAD_API bool determineExtension(const File& file, String& extension) override;
74 NDEVR_CAD_API FactoryOptions defaultReadOptions(const FactoryParameters& file) const override;
75 NDEVR_CAD_API FactoryOptions defaultWriteOptions(const FactoryParameters& file) const override;
76 NDEVR_CAD_API FactoryFeatures factoryFeatures(const FactoryParameters& file, bool is_import) const override;
77 NDEVR_CAD_API void addWriteModifier(CADWriteModifier* modifier) { m_write_modifiers.add(modifier); }
78 static constexpr StringView CustomOptionsLabel() { return "dxf_options"; }
79 static constexpr StringView CustomOptionsAutoName() { return "auto_name_objects"; }
80 static constexpr StringView CustomOptionsTextFaceCamera() { return "text_face_camera"; }
81 static constexpr StringView CustomOptionsGroupImport() { return "group_import"; }
82 static constexpr StringView CustomOptionsPointMode() { return "point_mode"; }
83 static constexpr StringView CustomOptionsLineMode() { return "line_mode"; }
84
85 static constexpr StringView CustomOptionsDXFVersion() { return "dxf_version"; }
86 static constexpr StringView CustomOptionsDXFBinary() { return "dxf_binary"; }
87 static constexpr StringView CustomOptionsDXFDefaultMeshFormat() { return "default_mesh_format"; }
88 static constexpr StringView CustomOptionsDXFHideGridlines() { return "hide_gridlines"; }
89 static constexpr StringView CustomOptionsDXFClearHandleManager() { return "clear_handle_manager"; }
90 protected:
91 static void setupFromCustomOptions(DXFWriter& writer, const GenericOptionGroup& group, CADGeometryWriter& options);
92 bool writeDXFNoBlocks(DXFWriter& writer, Dictionary<UUID, BlockData> block_data, FactoryParameters& params, CADGeometryWriter& geo_write_options);
93 bool writeDXFBlocks(DXFWriter& writer, Dictionary<UUID, BlockData> block_data, FactoryParameters& params, CADGeometryWriter& geo_write_options);
94 protected:
97 };
98}
99
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Streams NDEVR Geometry entities as CAD objects.
An interface that can handle writing certain entities in a special way to the CAD environment.
FactoryFeatures factoryFeatures(const FactoryParameters &file, bool is_import) const override
Returns the features and configurable options for this factory given the parameters.
virtual bool readFile(FactoryParameters &file) override
Reads data from a file into the design object hierarchy.
virtual void getSupportedFormats(Buffer< FileFormat > &formats, bool is_read) override
Populates the given buffer with supported file formats for reading or writing.
static FileFormat FlatDXF()
The Flat DXF file changes models into unique layers.
FactoryOptions defaultWriteOptions(const FactoryParameters &file) const override
Returns the default write options for the given factory parameters.
bool determineExtension(const File &file, String &extension) override
Attempts to determine the file extension for the given file.
FactoryOptions defaultReadOptions(const FactoryParameters &file) const override
Returns the default read options for the given factory parameters.
DynamicPointer< CADHandleManager > m_handle_manager
Manages handle resolution between read/write sessions.
Definition DXFFactory.h:95
static FileFormat AutodeskDXF()
The Flat DXF file changes models into unique layers.
virtual bool writeFile(FactoryParameters &file) override
Writes data from the design object hierarchy to a file.
Buffer< CADWriteModifier * > m_write_modifiers
Registered write modifiers for special entity handling.
Definition DXFFactory.h:96
Converts objects into entities that can be placed within a DXF Entity Table.
Handles writing data to a CAD entity stream.
Definition DXFWriter.h:60
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
Allows IOFactories to report what features they support to make the import/export dialogs easier to s...
User-defined options that define preferences for importing and exporting using IOFactory objects.
Data that describes a particular file format and how to use the format with the program.
Definition FileFormat.h:45
Logic for reading or writing to a file as well as navigating filesystems or other common file operati...
Definition File.h:53
Stores a groups of GenericOptions that can be used to group them.
A core class within the model hierarchy containing vertex-based data (Usually 3D data) within a set c...
Definition Geometry.h:143
IOFactory(const StringView &factory_name)
Constructs an IOFactory with the given factory name.
A core class that represents a node on model hierarchy.
Definition Model.h:292
The core String View class for the NDEVR API.
Definition StringView.h:58
The core String class for the NDEVR API.
Definition String.h:95
The primary namespace for the NDEVR SDK.
@ file
The source file path associated with this object.
A block structure (Similar to a Model) used to share data with CAD.
A DXF friendly material class which contains UV properties similar to a Material object.
A container of input information that is to be filled with output information by an IOFactory.
Definition IOFactory.h:105