dbacis.h 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. //
  12. //
  13. // DESCRIPTION:
  14. //
  15. // Internal AutoCAD functions dealing with ASM-based entities which are
  16. // exported to be used by platform clients
  17. //
  18. #ifndef DB_API_DBACIS_H
  19. #define DB_API_DBACIS_H
  20. #include "acdb.h"
  21. #pragma pack (push, 8)
  22. class AcDbDwgFiler;
  23. class AcDbDxfFiler;
  24. class AcDbObject;
  25. class ENTITY;
  26. extern "C"
  27. {
  28. void acdbModelerStart();
  29. void acdbModelerEnd();
  30. Adesk::Boolean acdbIsModelerStarted();
  31. }
  32. ///////////////////////////////////////////////////////////////////////////////
  33. /// <summary>
  34. /// Get the modeler version that is appropriate for the given drawing version
  35. /// and the object pointer (optional).
  36. /// </summary>
  37. /// <returns>
  38. /// The modeler version
  39. /// </returns>
  40. /// <param name="dwgVer">Drawing version enum value</param>
  41. /// <param name="pObj">Optional object pointer that determines what version
  42. /// to save to</param>
  43. ///
  44. ACDB_PORT
  45. int acdbGetModelerDwgVer(AcDb::AcDbDwgVersion dwgVer,
  46. AcDbObject* pObj = nullptr);
  47. ///////////////////////////////////////////////////////////////////////////////
  48. /// <summary>
  49. /// Save the entity to DWG filer. The filed modeler version is dependent on
  50. /// modelerVersion as follows:
  51. /// < 0 - Deduce from the filer's drawing version (default, -1)
  52. /// 0 - Current version of the modeler
  53. /// > 0 - A valid modeler version such as 2170, corresponding to 217.0
  54. ///
  55. /// </summary>
  56. /// <returns>
  57. /// Acad::eOk if the entity is saved successfully
  58. /// </returns>
  59. /// <param name="filer">Filer to write to</param>
  60. /// <param name="entity">Entity to be saved</param>
  61. /// <param name="pDb">Database in which entity resides</param>
  62. /// <param name="modelerVersion">Modeler version to save to (see summary)</param>
  63. ///
  64. ACDB_PORT
  65. Acad::ErrorStatus acdbModelerSaveEntityToDwgFiler(AcDbDwgFiler* filer,
  66. ENTITY* entity,
  67. AcDbDatabase* pDb,
  68. int modelerVersion = -1);
  69. ///////////////////////////////////////////////////////////////////////////////
  70. /// <summary>
  71. /// Save the array of entities to the DWG filer. The filed modeler version is
  72. /// dependent on modelerVersion as follows:
  73. /// < 0 - Deduce from the filer's drawing version (default, -1)
  74. /// 0 - Current version of the modeler
  75. /// > 0 - A valid modeler version such as 2170, corresponding to 217.0
  76. ///
  77. /// </summary>
  78. /// <returns>
  79. /// Acad::eOk if all entities are saved successfully
  80. /// </returns>
  81. /// <param name="filer">Filer to write to</param>
  82. /// <param name="entities">Array of entities to be saved</param>
  83. /// <param name="pDb">Database in which entities reside</param>
  84. /// <param name="modelerVersion">Modeler version to save to (see summary)</param>
  85. ///
  86. ACDB_PORT
  87. Acad::ErrorStatus acdbModelerSaveEntitiesToDwgFiler(AcDbDwgFiler* filer,
  88. const AcArray<ENTITY*>& entities,
  89. AcDbDatabase* pDb,
  90. int modelerVersion = -1);
  91. ///////////////////////////////////////////////////////////////////////////////
  92. /// <summary>
  93. /// Save the entity to DXF filer. The filed modeler version is dependent on
  94. /// modelerVersion as follows:
  95. /// < 0 - Deduce from the filer's drawing version (default, -1)
  96. /// 0 - Current version of the modeler
  97. /// > 0 - A valid modeler version such as 2170, corresponding to 217.0
  98. ///
  99. /// </summary>
  100. /// <returns>
  101. /// Acad::eOk if the entity is saved successfully
  102. /// </returns>
  103. /// <param name="filer">Filer to write to</param>
  104. /// <param name="entity">Entity to be saved</param>
  105. /// <param name="pDb">Database in which entity resides</param>
  106. /// <param name="modelerVersion">Modeler version to save to (see summary)</param>
  107. ///
  108. ACDB_PORT
  109. Acad::ErrorStatus acdbModelerSaveEntityToDxfFiler(AcDbDxfFiler* filer,
  110. ENTITY* entity,
  111. AcDbDatabase* pDb,
  112. int modelerVersion = -1);
  113. ///////////////////////////////////////////////////////////////////////////////
  114. /// <summary>
  115. /// Save the array of entities to the DXF filer. The filed modeler version is
  116. /// dependent on modelerVersion as follows:
  117. /// < 0 - Deduce from the filer's drawing version (default, -1)
  118. /// 0 - Current version of the modeler
  119. /// > 0 - A valid modeler version such as 2170, corresponding to 217.0
  120. ///
  121. /// </summary>
  122. /// <returns>
  123. /// Acad::eOk if all entities are saved successfully
  124. /// </returns>
  125. /// <param name="filer">Filer to write to</param>
  126. /// <param name="entities">Array of entities to be saved</param>
  127. /// <param name="pDb">Database in which entities reside</param>
  128. /// <param name="modelerVersion">Modeler version to save to (see summary)</param>
  129. ///
  130. ACDB_PORT
  131. Acad::ErrorStatus acdbModelerSaveEntitiesToDxfFiler(AcDbDxfFiler* filer,
  132. const AcArray<ENTITY*>& entities,
  133. AcDbDatabase* pDb,
  134. int modelerVersion = -1);
  135. /// Some options enumerated to be used as bit flags, to be used with the entity
  136. /// restoration (read) functions below.
  137. ///
  138. enum ModelerRestoreOptions
  139. {
  140. kReadForeignEntities = 0x01, // Set this to restore foreign entities
  141. kReadUnknownEntities = 0x02, // Set this to restore unknown entities
  142. kLoseUnknownCustomAttributes = 0x04, // Unset this to restore unknown custom attributes
  143. kReadStrangerEntityDefault= (kReadForeignEntities |
  144. kReadUnknownEntities |
  145. kLoseUnknownCustomAttributes), // Recommended default
  146. kModelerRestoreOptionsFuture1 = 0x08, // Unused, ignore
  147. kModelerRestoreOptionsFuture2 = 0x10, // Unused, ignore
  148. kModelerRestoreOptionsFuture3 = 0x20, // Unused, ignore
  149. kModelerRestoreOptionsFuture4 = 0x40, // Unused, ignore
  150. };
  151. ///////////////////////////////////////////////////////////////////////////////
  152. /// <summary>
  153. /// Restore a single entity from the DWG filer and return in pEntity. The
  154. /// modeler version of restored entities is optionally returned in pModelerVersion.
  155. /// Pass an appropriate value for restoreOptions to control restore behavior.
  156. /// </summary>
  157. /// <returns>
  158. /// Acad::eOk if the entity is restored successfully (including a null entity)
  159. /// </returns>
  160. /// <param name="filer">DWG Filer to restore from</param>
  161. /// <param name="pEntity">Restored entity if any</param>
  162. /// <param name="pModelerVersion">If valid, set to the modeler version of restored entities</param>
  163. /// <param name="restoreOptions">A valid combination of ModelerRestoreOptions enum values </param>
  164. ///
  165. ACDB_PORT
  166. Acad::ErrorStatus acdbModelerRestoreEntityFromDwgFiler(AcDbDwgFiler* filer,
  167. ENTITY*& pEntity,
  168. int* pModelerVersion = nullptr,
  169. unsigned restoreOptions = kReadStrangerEntityDefault);
  170. ///////////////////////////////////////////////////////////////////////////////
  171. /// <summary>
  172. /// Restore entities from the DWG filer and return in the array, entities. The
  173. /// modeler version of restored entities is optionally returned in pModelerVersion.
  174. /// Pass an appropriate value for restoreOptions to control restore behavior.
  175. /// </summary>
  176. /// <returns>
  177. /// Acad::eOk if all entities are restored successfully
  178. /// </returns>
  179. /// <param name="filer">DWG Filer to restore from</param>
  180. /// <param name="entities">Restored array of entities</param>
  181. /// <param name="pModelerVersion">If valid, set to the modeler version of restored entities</param>
  182. /// <param name="restoreOptions">A valid combination of ModelerRestoreOptions enum values </param>
  183. ///
  184. ACDB_PORT
  185. Acad::ErrorStatus acdbModelerRestoreEntitiesFromDwgFiler(AcDbDwgFiler* filer,
  186. AcArray<ENTITY*>& entities,
  187. int* pModelerVersion = nullptr,
  188. unsigned restoreOptions = kReadStrangerEntityDefault);
  189. ///////////////////////////////////////////////////////////////////////////////
  190. /// <summary>
  191. /// Restore a single entity from the DXF filer and return in entity. The
  192. /// modeler version of restored entities is optionally returned in pModelerVersion.
  193. /// Pass an appropriate value for restoreOptions to control restore behavior.
  194. /// </summary>
  195. /// <returns>
  196. /// Acad::eOk if the entity is restored successfully, (including a null entity)
  197. /// </returns>
  198. /// <param name="filer">DXF Filer to restore from</param>
  199. /// <param name="pEntity">Restored entity if any</param>
  200. /// <param name="pModelerVersion">If valid, set to the modeler version of restored entities</param>
  201. /// <param name="restoreOptions">A valid combination of ModelerRestoreOptions enum values </param>
  202. ///
  203. ACDB_PORT
  204. Acad::ErrorStatus acdbModelerRestoreEntityFromDxfFiler(AcDbDxfFiler* filer,
  205. ENTITY*& pEntity,
  206. int* pModelerVersion = nullptr,
  207. unsigned restoreOptions = kReadStrangerEntityDefault);
  208. #pragma pack (pop)
  209. #endif