DWG

class HPS::DWG

The DWG class contains objects and enumerations used for importing and exporting CAD files via RealDWG.

Public Types

typedef std::vector<DWG::Layout, Allocator<DWG::Layout>> LayoutArray
class CADModel : public HPS::CADModel

The CADModel class is a smart pointer. It represents the DWG drawing file.

Public Functions

HPS::View ActivateDefaultLayout()

Creates a new View object corresponding to the default layout for this CADModel. The View object that is returned will have the corresponding visibility settings, material settings, transformation settings, and camera for the default capture set on it. This call is equivalent to calling ActivateDefaultCapture

Returns

A newly created View object corresponding to this Layout.

CADModel()

The default constructor creates an uninitialized CADModel object. The Type() function will return Type::None.

CADModel(Component const &in_that)

This constructor creates a CADModel object that shares the underlying smart-pointer of the source Component. The copy will only be successful if the source component is really an upcast of an DWG::CADModel object. Otherwise the copy will fail and the resulting DWG::CADModel will be invalid.

Parameters

in_that – The source Component to copy.

CADModel(DWG::CADModel &&in_that)

The move constructor creates an DWG::CADModel by transferring the underlying object of the rvalue reference to this DWG::CADModel.

Parameters

in_that – An rvalue reference to an DWG::CADModel to take the underlying object from.

CADModel(DWG::CADModel const &in_that)

The copy constructor creates an DWG::CADModel object that shares the underlying smart-pointer of the source DWG::CADModel.

Parameters

in_that – The source DWG::CADModel to copy.

CADModel(HPS::CADModel const &in_that)

This constructor creates an DWG::CADModel object that shares the underlying smart-pointer of the source HPS::CADModel. The copy will only be successful if the source component is really an upcast of an DWG::CADModel object. Otherwise the copy will fail and the resulting DWG::CADModel will be invalid.

Parameters

in_that – The source HPS::CADModel to copy.

LayoutArray GetAllLayouts() const

Get a list of all DWG layouts from all subcomponents for this CADModel.

Returns

A list of all DWG layouts from all subcomponents for this CADModel.

DWGDatabase *GetDWGDatabase() const

Gets the AcDbDatabase pointer corresponding to this DWG::CADModel.

Returns

The AcDbDatabase pointer corresponding to this DWG::CADModel.

inline virtual HPS::Type ObjectType() const

This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).

Returns

The declared type of the object in question, which may differ from the true, underlying type.

CADModel &operator=(DWG::CADModel &&in_that)

The move assignment operator transfers the underlying object of the rvalue reference to this DWG::CADModel.

Parameters

in_that – An rvalue reference to an DWG::CADModel to take the underlying object from.

Returns

A reference to this DWG::CADModel.

virtual ~CADModel()

Public Static Attributes

static const HPS::Type staticType = HPS::Type::DWGCADModel
class Component : public HPS::Component

The Component class is a smart pointer. It represents a variety of DWG components. The primary purpose of this class is simply to provide access to the underlying DWG object for use by DWG library functions.

Subclassed by HPS::DWG::Layer

Public Functions

Component()

The default constructor creates an uninitialized DWG::Component object. The Type() function will return Type::None.

Component(DWG::Component &&in_that)

The move constructor creates an DWG::Component by transferring the underlying object of the rvalue reference to this DWG::Component.

Parameters

in_that – An rvalue reference to an DWG::Component to take the underlying object from.

Component(DWG::Component const &in_that)

The copy constructor creates an DWG::Component object that shares the underlying smart-pointer of the source DWG::Component.

Parameters

in_that – The source DWG::Component to copy.

Component(HPS::Component const &in_that)

This constructor creates an DWG::Component object that shares the underlying smart-pointer of the source Component. The copy will only be successful if the source component is really an upcast of an DWG::Component object. Otherwise the copy will fail and the resulting DWG::Component will be invalid.

Parameters

in_that – The source Component to copy.

DWGObjectID *GetDWGObjectID() const

Gets the AcDbObjectId corresponding to this DWG Component.

Returns

The AcDbObjectId corresponding to this DWG Component.

inline virtual HPS::Type ObjectType() const

This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).

Returns

The declared type of the object in question, which may differ from the true, underlying type.

Component &operator=(DWG::Component &&in_that)

The move assignment operator transfers the underlying object of the rvalue reference to this DWG::Component.

Parameters

in_that – An rvalue reference to an DWG::Component to take the underlying object from.

Returns

A reference to this DWG::Component.

virtual ~Component()

Releases a reference to this Component. The Component will not be deleted unless the final reference is destroyed.

Public Static Attributes

static const HPS::Type staticType = HPS::Type::DWGComponent
class Factory : public HPS::Sprocket

The Factory class is used to create and DWG objects which inherit from HPS::Component or one of its subclasses.

Public Static Functions

static CADModel CreateCADModel(Model const &in_model = HPS::Factory::CreateModel())

Creates a new DWG::CADModel.

Parameters

in_model – The Model associated with the newly created DWG::CADModel.

static Component CreateComponent(HPS::Component const &in_owner, HPS::Component::ComponentType in_type, DWGObjectID *in_object_id = nullptr)

Creates a new DWG::Component as a subcomponent of a given Component.

Parameters
static Layer CreateLayer(HPS::Component const &in_owner, DWGObjectID *in_object_id = nullptr)

Creates a new DWG::Layer as a subcomponent of a given Component.

Parameters
static Layout CreateLayout(HPS::Component const &in_owner, HPS::Component::ComponentType in_type, DWGObjectID *in_object_id = nullptr)

Creates a new DWG::Layout as a subcomponent of a given Component.

Parameters
class File

The File class provides functions to import CAD files via DWG.

Public Static Functions

static ImportNotifier Import(char const *in_file_name, ImportOptionsKit const &in_options)

Performs an asynchronous import of the specified CAD file with the provided options. May throw an IOException prior to starting the asynchronous import.

Parameters
  • in_file_name – The name of the CAD file to import.

  • in_options – The options controlling the import of the CAD file.

Returns

An ImportNotfier object that can be used to query the import progress and status.

class ImportNotifier : public HPS::IONotifier

The ImportNotifier class is a smart-pointer that is tied to a file import. It is used to interact with an ongoing import or get the results from a completed import.

Public Functions

void Assign(ImportNotifier const &in_that)

Associate this ImportNotifier with the same file import as the source ImportNotifier.

Parameters

in_that – The source ImportNotifier for the assignment.

DWG::CADModel GetCADModel() const

Get the CADModel for the file import. Throws an IOException if the import is not complete, was not successful or was canceled.

Returns

The CADModel for a successful file import.

Time GetImportTime() const

Get the number of milliseconds it took DWG to read the DWG file. Throws an IOException if the import is not complete, was not successful or was canceled.

Time GetParseTime() const

Get the number of milliseconds it took Visualize to parse the DWG data and create the corresponding scene graph. Throws an IOException if the import is not complete, was not successful or was canceled.

ImportNotifier()

The default constructor creates an ImportNotifier object which is not tied to any file import.

ImportNotifier(ImportNotifier &&in_that)

The move constructor creates an ImportNotifier by transferring the underlying impl of the rvalue reference to this ImportNotifier thereby avoiding a copy and allocation.

Parameters

in_that – An rvalue reference to an ImportNotifier to take the impl from.

ImportNotifier(ImportNotifier const &in_that)

The copy constructor creates a new ImportNotifier object that is associated with the same file import as the source ImportNotifier.

Parameters

in_that – The source ImportNotifier to copy.

ImportNotifier(IONotifier const &in_that)

The conversion constructor creates a new derived ImportNotifier object from a base IONotifier object. The copy will only be successful if the source notifier is really an upcast of this notifier type. Otherwise the copy will fail and the resulting ImportNotifier will be invalid.

Parameters

in_that – The source IONotifier to copy.

inline virtual HPS::Type ObjectType() const

This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).

Returns

The declared type of the object in question, which may differ from the true, underlying type.

ImportNotifier &operator=(ImportNotifier &&in_that)

The move assignment operator transfers the underlying impl of the rvalue reference to this ImportNotifier thereby avoiding a copy.

Parameters

in_that – An rvalue reference to an ImportNotifier to take the impl from.

Returns

A reference to this ImportNotifier.

ImportNotifier &operator=(ImportNotifier const &in_that)

Associate this ImportNotifier with the same file import as the source ImportNotifier.

Parameters

in_that – The source ImportNotifier for the assignment.

Returns

A reference to this ImportNotifier.

virtual ~ImportNotifier()

Public Static Attributes

static const HPS::Type staticType = HPS::Type::DWGImportNotifier
class ImportOptionsKit : public HPS::SprocketKit

The HPS::DWG::ImportOptionsKit class is a user space object. It contains settings controlling what and how data is imported via DWG. Calling HPS::DWG::ImportOptionsKit::GetDefault() will return an options kit with values found in here.

Public Functions

virtual bool Empty() const

Indicates whether this ImportOptionsKit has any values set on it.

Returns

true if no values are set on this ImportOptionsKit, false otherwise.

bool Equals(ImportOptionsKit const &in_kit) const

Check if the source ImportOptionsKit is equivalent to this ImportOptionsKit.

Parameters

in_kit – The source ImportOptionsKit to compare to this ImportOptionsKit.

Returns

true if the objects are equivalent, false otherwise.

ImportOptionsKit()

The default constructor creates an empty ImportOptionsKit object.

ImportOptionsKit(ImportOptionsKit &&in_that)

The move constructor creates an ImportOptionsKit by transferring the underlying impl of the rvalue reference to this ImportOptionsKit thereby avoiding a copy and allocation.

Parameters

in_that – An rvalue reference to an ImportOptionsKit to take the impl from.

ImportOptionsKit(ImportOptionsKit const &in_kit)

The copy constructor creates a new ImportOptionsKit object that contains the same settings as the source ImportOptionsKit.

Parameters

in_kit – The source ImportOptionsKit to copy.

inline virtual HPS::Type ObjectType() const

This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).

Returns

The declared type of the object in question, which may differ from the true, underlying type.

bool operator!=(ImportOptionsKit const &in_kit) const

Check if the source ImportOptionsKit is not equivalent to this ImportOptionsKit.

Parameters

in_kit – The source ImportOptionsKit to compare to this ImportOptionsKit.

Returns

true if the objects are not equivalent, false otherwise.

ImportOptionsKit &operator=(ImportOptionsKit &&in_that)

The move assignment operator transfers the underlying impl of the rvalue reference to this ImportOptionsKit thereby avoiding a copy.

Parameters

in_that – An rvalue reference to an ImportOptionsKit to take the impl from.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &operator=(ImportOptionsKit const &in_kit)

Copies the source ImportOptionsKit into this ImportOptionsKit.

Parameters

in_kit – The source ImportOptionsKit to copy.

Returns

A reference to this ImportOptionsKit.

bool operator==(ImportOptionsKit const &in_kit) const

Check if the source ImportOptionsKit is equivalent to this ImportOptionsKit.

Parameters

in_kit – The source ImportOptionsKit to compare to this ImportOptionsKit.

Returns

true if the objects are equivalent, false otherwise.

void Set(ImportOptionsKit const &in_kit)

Copies the source ImportOptionsKit into this ImportOptionsKit.

Parameters

in_kit – The source ImportOptionsKit to copy.

ImportOptionsKit &SetLogging(char const *in_log_file)

Sets whether to log internal HPS::DWG calls.

Parameters

in_log_fileFile name which will contain logging information.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &SetMaxTessellationDeviation(double in_deviation)

Sets the maximum tessellation deviation. This corresponds to the value returned by AcGiCommonDraw::deviation()

Parameters

in_deviation – Maximum deviation from tessellation.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &SetTextureDirectories(HPS::UTF8Array const &in_texture_directories)

Sets a list of directories where the importer looks for textures.

Parameters

in_texture_directories – An array of directories the importer searches for textures.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &SetUnreferencedRecords(bool in_state)

Sets whether to import block table records which are not referenced in the drawing.

Parameters

in_state – Whether to import block table records which are not referenced in the drawing.

Returns

A reference to this ImportOptionsKit.

void Show(ImportOptionsKit &out_kit) const

Copies this ImportOptionsKit into the given ImportOptionsKit.

Parameters

out_kit – The ImportOptionsKit to populate with the contents of this ImportOptionsKit.

bool ShowLogging(HPS::UTF8 &out_log_file) const

Shows the logging import setting.

Parameters

out_log_file – The file which will contain the logging information.

Returns

true if logging setting was specified, false otherwise.

bool ShowMaxTessellationDeviation(double &out_deviation) const

Shows the maximum tessellation deviation import setting.

Parameters

out_deviation – The maximum tessellation deviation setting for this import.

Returns

true if a maximum tessellation deviation was specified, false otherwise.

bool ShowTextureDirectories(HPS::UTF8Array &out_texture_directories) const

Shows the directories where the importer looks for textures.

Parameters

out_texture_directories – The directories in which the importer looks for textures.

Returns

true if texture directories were specified, false otherwise.

bool ShowUnreferencedRecords(bool &out_state) const

Shows the unreferenced records import setting.

Parameters

out_state – The unreferenced record setting for this import.

Returns

true if an unreferenced record setting was specified, false otherwise.

ImportOptionsKit &UnsetEverything()

Removes all settings from this ImportOptionsKit.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &UnsetLogging()

Removes the logging import state.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &UnsetMaxTessellationDeviation()

Removes the maximum tessellation deviation import state.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &UnsetTextureDirectories()

Removes the texture directory state.

Returns

A reference to this ImportOptionsKit.

ImportOptionsKit &UnsetUnreferencedRecords()

Removes the unreferenced records import state.

Returns

A reference to this ImportOptionsKit.

virtual ~ImportOptionsKit()

Public Static Functions

static ImportOptionsKit GetDefault()

Creates an ImportOptionsKit which contains the default settings. The returned object will not necessarily have values set for every option, but it will have settings for those options where it is reasonable to have a default. These values will be used for import unless an option is overridden by the options passed to File::Import.

Returns

An ImportOptionsKit with the default settings.

Public Static Attributes

static const HPS::Type staticType = HPS::Type::DWGImportOptionsKit
class Layer : public HPS::DWG::Component

The Layer class is a user space object. It allows users to turn layers imported through DWG on or off.

Public Functions

bool Equals(Layer const &in_layer) const

Check if the source Layer is equivalent to this Layer.

Parameters

in_kit – The source Layer to compare to this Layer.

Returns

true if the objects are equivalent, false otherwise.

bool IsOn() const
Layer()

The default constructor creates an empty Layer object.

Layer(Component const &in_that)

This constructor creates a Layer object that shares the underlying smart-pointer of the source Component. The copy will only be successful if the source component is really an upcast of an DWG::Layer object. Otherwise the copy will fail and the resulting DWG::Layer will be invalid.

Parameters

in_that – The source Component to copy.

Layer(HPS::Component const &in_that)

This constructor creates a Layer object that shares the underlying smart-pointer of the source Component. The copy will only be successful if the source component is really an upcast of an DWG::Layer object. Otherwise the copy will fail and the resulting DWG::Layer will be invalid.

Parameters

in_that – The source Component to copy.

Layer(Layer &&in_that)

The move constructor creates an Layer by transferring the underlying impl of the rvalue reference to this Layer thereby avoiding a copy and allocation.

Parameters

in_that – An rvalue reference to a Layer to take the impl from.

Layer(Layer const &in_layer)

The copy constructor creates a new Layer object that contains the same settings as the source Layer.

Parameters

in_sheet – The source Layer to copy.

inline virtual HPS::Type ObjectType() const

This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).

Returns

The declared type of the object in question, which may differ from the true, underlying type.

bool operator!=(Layer const &in_layer) const

Check if the source Layer is not equivalent to this Layer.

Parameters

in_kit – The source Layer to compare to this Layer.

Returns

true if the objects are not equivalent, false otherwise.

Layer &operator=(Layer &&in_that)

The move assignment operator transfers the underlying impl of the rvalue reference to this Layer thereby avoiding a copy.

Parameters

in_that – An rvalue reference to a Layer to take the impl from.

Returns

A reference to this Layer.

bool operator==(Layer const &in_layer) const

Check if the source Layer is equivalent to this Layer.

Parameters

in_kit – The source Layer to compare to this Layer.

Returns

true if the objects are equivalent, false otherwise.

void TurnOff() const
void TurnOn() const
virtual ~Layer()

Public Static Attributes

static const HPS::Type staticType = HPS::Type::DWGLayer
class Layout : public HPS::Capture

Public Functions

DWGObjectID *GetDWGObjectID() const

Gets the AcDbObjectId corresponding to this DWG Layout.

Returns

The AcDbObjectId corresponding to this DWG Layout.

Layout()

The default constructor creates an uninitialized DWG::Layout object. The Type() function will return Type::None.

Layout(Component const &in_that)

This constructor creates a Layout object that shares the underlying smart-pointer of the source Component. The copy will only be successful if the source component is really an upcast of a DWG::Layout object. Otherwise the copy will fail and the resulting DWG::Layout will be invalid.

Parameters

in_that – The source Component to copy.

Layout(DWG::Layout &&in_that)

The move constructor creates an DWG::Layout by transferring the underlying object of the rvalue reference to this DWG::Layout.

Parameters

in_that – An rvalue reference to an DWG::Layout to take the underlying object from.

Layout(DWG::Layout const &in_that)

The copy constructor creates an DWG::Layout object that shares the underlying smart-pointer of the source DWG::Layout.

Parameters

in_that – The source DWG::Layout to copy.

Layout(HPS::Capture const &in_that)

This constructor creates an DWG::Layout object that shares the underlying smart-pointer of the source Layout. The copy will only be successful if the source layout is really an upcast of an DWG::Layout object. Otherwise the copy will fail and the resulting DWG::Layout will be invalid.

Parameters

in_that – The source Layout to copy.

inline virtual HPS::Type ObjectType() const

This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).

Returns

The declared type of the object in question, which may differ from the true, underlying type.

Layout &operator=(DWG::Layout &&in_that)

The move assignment operator transfers the underlying object of the rvalue reference to this DWG::Layout.

Parameters

in_that – An rvalue reference to an DWG::Layout to take the underlying object from.

Returns

A reference to this DWG::Layout.

virtual ~Layout()

Public Static Attributes

static const HPS::Type staticType = HPS::Type::DWGLayout