dbloftedsurf.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. //
  12. // DESCRIPTION:
  13. //
  14. // The AcDbLoftedSurface class is the interface class for representing
  15. // ASM lofted surfaces.
  16. #pragma once
  17. #ifndef DBLOFTEDSURF_H
  18. #define DBLOFTEDSURF_H
  19. #include "dbsurf.h"
  20. #include "db3dProfile.h"
  21. #pragma pack(push, 8)
  22. class AcDbLoftedSurface: public AcDbSurface
  23. {
  24. public:
  25. /// <summary>
  26. /// Default constructor.
  27. /// </summary>
  28. AcDbLoftedSurface ();
  29. /// <summary>
  30. /// Destructor.
  31. /// </summary>
  32. virtual ~AcDbLoftedSurface();
  33. ACDB_DECLARE_MEMBERS(AcDbLoftedSurface);
  34. /// <summary>
  35. /// Creates a lofted surface from the given curves using the specified options.
  36. /// The curves must be either all open or all closed. If the curves are all closed,
  37. /// then this function will accept a point entity as the first and/or last list entry.
  38. /// Each curve in the guideCurves list must intersect each of the cross-section curves,
  39. /// so the guide curves form a net-like structure with the cross-section curves.
  40. /// Both the cross-section curves and the guide curves will lie on the resulting surface.
  41. /// If any guide curves are passed in this list, then pPathCurve should be null.
  42. /// If pPathCurve is non-null, then the resulting surface will follow the shape of this
  43. /// curve as much as possible. This curve does not need to intersect the cross-section
  44. /// curves and does not even need to be near the cross sections.
  45. /// If this parameter is non-null, then guideCurves should be an empty list.
  46. /// </summary>
  47. /// <param name="crossSectionCurves">
  48. /// Input array of curve entities to be used as cross sections for the lofting operation.
  49. /// </param>
  50. /// <param name="guideCurves">
  51. /// Input optional array of guide curves.
  52. /// </param>
  53. /// <param name="pPathCurve">
  54. /// Input optional path curve.
  55. /// </param>
  56. /// <param name="loftOptions">
  57. /// Input loft options.
  58. /// </param>
  59. /// <returns>
  60. /// eOk if successful.
  61. /// </returns>
  62. virtual Acad::ErrorStatus createLoftedSurface (
  63. AcArray<AcDbEntity*>& crossSectionCurves,
  64. AcArray<AcDbEntity*>& guideCurves,
  65. AcDbEntity* pPathCurve, AcDbLoftOptions& loftOptions );
  66. /// <summary>
  67. /// Return the number of cross sections for the surface.
  68. /// </summary>
  69. /// <returns>
  70. /// Number of cross sections.
  71. /// </returns>
  72. int numCrossSections () const;
  73. /// <summary>
  74. /// Returns the cross section entity at zero-based index. If the cross section
  75. /// is for an edge or set of edges then the edge curve will be returned.
  76. /// The caller should not delete this pointer.
  77. /// </summary>
  78. /// <param name="idx">
  79. /// Input index of cross section.
  80. /// </param>
  81. /// <returns>
  82. /// Cross section entity. The caller should not delete this pointer.
  83. /// </returns>
  84. AcDbEntity* getCrossSection ( int idx ) const;
  85. /// <summary>
  86. /// Return the number of guides for the surface.
  87. /// </summary>
  88. /// <returns>
  89. /// Number of guides.
  90. /// </returns>
  91. int numGuideCurves () const;
  92. /// <summary>
  93. /// Returns the guide curve at zero-based index. If the guide
  94. /// is for an edge or set of edges then the edge curve will be returned.
  95. /// The caller should not delete this pointer.
  96. /// </summary>
  97. /// <param name="idx">
  98. /// Input index of guide curve.
  99. /// </param>
  100. /// <returns>
  101. /// Pointer to guide curve. The caller should not delete this pointer.
  102. /// </returns>
  103. AcDbEntity* getGuideCurve ( int idx ) const;
  104. /// <summary>
  105. /// Returns the path curve of the surface, or null if no path profile was
  106. /// used to create the surface. If the path is for an edge or set of edges
  107. /// then the edge curve will be returned.
  108. /// The caller should not delete this pointer.
  109. /// </summary>
  110. /// <returns>
  111. /// Pointer to path entity. The caller should not delete this pointer.
  112. /// </returns>
  113. AcDbEntity* getPathEntity () const;
  114. /// <summary>
  115. /// Gets the loft options used to create this surface.
  116. /// </summary>
  117. /// <param name="loftOptions">
  118. /// Output loft options.
  119. /// </param>
  120. void getLoftOptions ( AcDbLoftOptions& loftOptions ) const;
  121. /// <summary>
  122. /// Returns the cross section profile at zero-based index. The returned
  123. /// object contains the cross section entity and edge data if the profile is
  124. /// for an edge or set of edges, and also contains the continuity and
  125. /// takeoff vector magnitude if idx references the first or last profile.
  126. /// The caller is responsible for deleting the returned pointer.
  127. /// </summary>
  128. /// <param name="idx">
  129. /// Input index of cross section.
  130. /// </param>
  131. /// <returns>
  132. /// Cross section profile. The caller is responsible for deleting the returned pointer.
  133. /// </returns>
  134. ACDB_PORT AcDbLoftProfile* crossSection ( int idx ) const;
  135. /// <summary>
  136. /// Returns list of cross section profiles that were used to create the surface.
  137. /// The returned objects contain the cross section entity and edge data if the
  138. /// profile is for an edge or set of edges, and also contains the continuity and
  139. /// takeoff vector magnitude for the first and last profiles.
  140. /// The caller is responsible for deleting all pointers in the output list.
  141. /// </summary>
  142. /// <param name="crossSections">
  143. /// Output list of cross section profiles.
  144. /// </param>
  145. /// <returns>
  146. /// Cross section profile. The caller is responsible for deleting the returned pointer.
  147. /// </returns>
  148. ACDB_PORT void getCrossSections ( AcArray<AcDbLoftProfile*>& crossSections ) const;
  149. /// <summary>
  150. /// Returns the guide profile at zero-based index. The returned
  151. /// object contains the guide entity and edge data if the profile is
  152. /// for an edge or set of edges. The caller is responsible for deleting the
  153. /// returned pointer.
  154. /// </summary>
  155. /// <param name="idx">
  156. /// Input index of guide.
  157. /// </param>
  158. /// <returns>
  159. /// Guide profile. The caller is responsible for deleting the returned pointer.
  160. /// </returns>
  161. ACDB_PORT AcDbLoftProfile* guide ( int idx ) const;
  162. /// <summary>
  163. /// Returns list of guide profiles that were used to create the surface.
  164. /// The returned objects contain the guide entity and edge data if the
  165. /// profile is for an edge or set of edges. The caller is responsible for
  166. /// deleting all pointers in the output list.
  167. /// </summary>
  168. /// <param name="guides">
  169. /// Output list of guide profiles.
  170. /// </param>
  171. /// <returns>
  172. /// Guide profile. The caller is responsible for deleting the returned pointer.
  173. /// </returns>
  174. ACDB_PORT void getGuides ( AcArray<AcDbLoftProfile*>& guides ) const;
  175. /// <summary>
  176. /// Returns the path profile that was used to create the surface, or null if
  177. /// no path was used. The returned object contains the guide entity and edge data
  178. /// if the profile is for an edge or set of edges. The caller is responsible for
  179. /// deleting the returned pointer.
  180. /// </summary>
  181. /// <returns>
  182. /// Path profile, or null if no path was used to create the surface.
  183. /// The caller is responsible for deleting the returned pointer.
  184. /// </returns>
  185. ACDB_PORT AcDbLoftProfile* path () const;
  186. /// <summary>
  187. /// Returns the continuity at the first profile.
  188. /// </summary>
  189. /// <param name="isCrossSection">
  190. /// Input parameter - if true then continuity at first cross section will be
  191. /// returned, otherwise continuity at first guide will be returned.
  192. /// </param>
  193. /// <returns>
  194. /// 0, 1, or 2 which corresponds to G0, G1, or G2.
  195. /// </returns>
  196. ACDB_PORT int startContinuity ( bool isCrossSection = true ) const;
  197. /// <summary>
  198. /// Returns the continuity at the last profile.
  199. /// </summary>
  200. /// <param name="isCrossSection">
  201. /// Input parameter - if true then continuity at last cross section will be
  202. /// returned, otherwise continuity at last guide will be returned.
  203. /// </param>
  204. /// <returns>
  205. /// 0, 1, or 2 which corresponds to G0, G1, or G2.
  206. /// </returns>
  207. ACDB_PORT int endContinuity ( bool isCrossSection = true ) const;
  208. /// <summary>
  209. /// Returns the magnitude of the surface takeoff vector at the
  210. /// first profile.
  211. /// </summary>
  212. /// <param name="isCrossSection">
  213. /// Input parameter - if true then magnitude at first cross section will be
  214. /// returned, otherwise magnitude at first guide will be returned.
  215. /// </param>
  216. /// <returns>
  217. /// Magnitude of the surface takeoff vector at the first profile.
  218. /// </returns>
  219. ACDB_PORT double startMagnitude ( bool isCrossSection = true ) const;
  220. /// <summary>
  221. /// Returns the magnitude of the surface takeoff vector at the
  222. /// last profile.
  223. /// </summary>
  224. /// <param name="isCrossSection">
  225. /// Input parameter - if true then magnitude at last cross section will be
  226. /// returned, otherwise magnitude at last guide will be returned.
  227. /// </param>
  228. /// <returns>
  229. /// Magnitude of the surface takeoff vector at the first profile.
  230. /// </returns>
  231. ACDB_PORT double endMagnitude ( bool isCrossSection = true ) const;
  232. /// <summary>
  233. /// Sets the continuity at the first profile and recreates the surface.
  234. /// </summary>
  235. /// <param name="val">
  236. /// Input new continuity (must be 0, 1, or 2).
  237. /// </param>
  238. /// <param name="isCrossSection">
  239. /// Input parameter - if true then continuity at first cross section will be
  240. /// set, otherwise continuity at first guide will be set.
  241. /// </param>
  242. /// <returns>
  243. /// eOk if successful.
  244. /// </returns>
  245. ACDB_PORT Acad::ErrorStatus setStartContinuity ( int val, bool isCrossSection = true );
  246. /// <summary>
  247. /// Sets the continuity at the last profile and recreates the surface.
  248. /// </summary>
  249. /// <param name="val">
  250. /// Input new continuity (must be 0, 1, or 2).
  251. /// </param>
  252. /// <param name="isCrossSection">
  253. /// Input parameter - if true then continuity at last cross section will be
  254. /// set, otherwise continuity at last guide will be set.
  255. /// </param>
  256. /// <returns>
  257. /// eOk if successful.
  258. /// </returns>
  259. ACDB_PORT Acad::ErrorStatus setEndContinuity ( int val, bool isCrossSection = true );
  260. /// <summary>
  261. /// Sets the magnitude of the surface takeoff vector at the
  262. /// first profile and recreates the surface.
  263. /// </summary>
  264. /// <param name="val">
  265. /// Input new magnitude (must be non-negative).
  266. /// </param>
  267. /// <param name="isCrossSection">
  268. /// Input parameter - if true then magnitude at first cross section will be
  269. /// set, otherwise magnitude at first guide will be set.
  270. /// </param>
  271. /// <returns>
  272. /// eOk if successful.
  273. /// </returns>
  274. ACDB_PORT Acad::ErrorStatus setStartMagnitude ( double val, bool isCrossSection = true );
  275. /// <summary>
  276. /// Sets the magnitude of the surface takeoff vector at the
  277. /// last profile and recreates the surface.
  278. /// </summary>
  279. /// <param name="val">
  280. /// Input new magnitude (must be non-negative).
  281. /// </param>
  282. /// <param name="isCrossSection">
  283. /// Input parameter - if true then magnitude at last cross section will be
  284. /// set, otherwise magnitude at last guide will be set.
  285. /// </param>
  286. /// <returns>
  287. /// eOk if successful.
  288. /// </returns>
  289. ACDB_PORT Acad::ErrorStatus setEndMagnitude ( double val, bool isCrossSection = true );
  290. /// <summary>
  291. /// Sets new loft options and recreates the surface.
  292. /// </summary>
  293. /// <param name="guides">
  294. /// Input new loft options.
  295. /// </param>
  296. /// <returns>
  297. /// eOk if successful.
  298. /// </returns>
  299. ACDB_PORT Acad::ErrorStatus setLoftOptions ( const AcDbLoftOptions& loftOptions );
  300. /// <summary> This enum represents the type of lofted surface. </summary>
  301. enum LoftSurfaceType
  302. {
  303. /// <summary> Created from createLoftedSurface(). </summary>
  304. kLoftSurf,
  305. /// <summary> Created from createBlendSurface(). </summary>
  306. kLoftBlendSurf,
  307. /// <summary> Created from createNetworkSurface(). </summary>
  308. kLoftNetworkSurf
  309. };
  310. /// <summary>
  311. /// Returns the type of lofted surface.
  312. /// </summary>
  313. /// <returns>
  314. /// Loft surface type: ordinary loft, blend, or network.
  315. /// </returns>
  316. ACDB_PORT AcDbLoftedSurface::LoftSurfaceType loftSurfaceType () const;
  317. // AcDbObject methods
  318. virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* filer);
  319. virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* filer) const;
  320. virtual Acad::ErrorStatus dxfInFields(AcDbDxfFiler* filer);
  321. virtual Acad::ErrorStatus dxfOutFields(AcDbDxfFiler* filer) const;
  322. virtual bool isDependent() const;
  323. protected:
  324. virtual Acad::ErrorStatus subGetClassID(CLSID* pClsid) const;
  325. };
  326. #pragma pack(pop)
  327. #endif // DBLOFTEDSURF_H