AcDbSurfaceTrimInfo.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  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. // CREATED BY: Pei Zhan August 2009
  13. //
  14. // DESCRIPTION:
  15. //
  16. //////////////////////////////////////////////////////////////////////////////
  17. #pragma once
  18. #include "AcDbAssocEdgeActionParam.h"
  19. #include "AcDbCompoundObjectId.h"
  20. #pragma pack (push, 8)
  21. class ENTITY;
  22. /// <summary>
  23. /// AcDbSurfaceTrimInfo describes how a (blank) surface will be trimmed: the
  24. /// information about trimming (tool) surface and trimming curve (if it is a
  25. /// trimming curve, a projection vector should be provided so the curve will
  26. /// be projected on to the blank surface).
  27. /// Also necessary is the topological information between
  28. /// the trimmed (blank) surface and trimming(tool) surface/curve - if the area
  29. /// intended to be trimmed is inside or outside of the trimming curve/surface
  30. /// </summary>
  31. ///
  32. class ACDB_PORT AcDbSurfaceTrimInfo
  33. {
  34. public:
  35. /// <summary>
  36. /// This enum is type of relation betweem tool and trimmed area.
  37. /// </summary>
  38. ///
  39. enum TrimRelation {
  40. /// <summary>
  41. /// Trimmed area is outside the tool.
  42. /// </summary>
  43. ///
  44. outside_tool,
  45. /// <summary>
  46. /// Trimmed area is inside the tool.
  47. /// </summary>
  48. ///
  49. inside_tool,
  50. };
  51. /// <summary> Default constructor. </summary>
  52. ///
  53. AcDbSurfaceTrimInfo();
  54. /// <summary> Default destructor. </summary>
  55. ///
  56. virtual ~AcDbSurfaceTrimInfo();
  57. /// <summary>
  58. /// set the information about tool if it is an object of AcDbCurve
  59. /// </summary>
  60. /// <param name="curveId">
  61. /// object id of the AcDbCurve
  62. /// </param>
  63. /// <param name="projVector">
  64. /// the vector that specifies how the curve will be projected onto the blank surface
  65. /// </param>
  66. /// <param name="relation">
  67. /// the relation between tool and trimmed area on blank - inside the tool or outside
  68. /// </param>
  69. void setTrimInfo( const AcDbCompoundObjectId& curveId, const AcGeVector3d & projVector, TrimRelation relation );
  70. /// <summary>
  71. /// set the information about tool if it is a wire body generated from a curve
  72. /// </summary>
  73. /// <param name="pWireBody">
  74. /// ASM wire body of the curve
  75. /// </param>
  76. /// <param name="projVector">
  77. /// the vector that specifies how the curve will be projected onto the blank surface
  78. /// </param>
  79. /// <param name="relation">
  80. /// the relation between tool and trimmed area on blank - inside the tool or outside
  81. /// </param>
  82. void setTrimInfo( ENTITY *pWireBody, const AcGeVector3d& projVector, TrimRelation relation);
  83. /// <summary>
  84. /// set the information about tool if it is an object of AcDbSurface/AcDbRegion
  85. /// </summary>
  86. /// <param name="surfaceId">
  87. /// id of the AcDbSurface/AcDbRegion object
  88. /// </param>
  89. /// <param name="relation">
  90. /// the relation between tool and trimmed area on blank - inside the tool or outside
  91. /// </param>
  92. /// <param name="subentId">
  93. /// face subentity id that will be used for trimming if the surface has more than one faces
  94. /// </param>
  95. void setTrimInfo( const AcDbCompoundObjectId &surfaceId, TrimRelation relation, const AcDbSubentId& subentId);
  96. /// <summary>
  97. /// set the information about tool if it is an ASM body from an AcDbSurface/AcDbRegion object
  98. /// </summary>
  99. /// <param name="pAsmBody">
  100. /// ASM body from the AcDbSurface/AcDbRegion object
  101. /// </param>
  102. /// <param name="relation">
  103. /// the relation between tool and trimmed area on blank - inside the tool or outside
  104. /// </param>
  105. /// <param name="subentId">
  106. /// face subentity id that will be used for trimming if the surface has more than one faces
  107. /// </param>
  108. void setTrimInfo( ENTITY *pAsmBody, TrimRelation relation, const AcDbSubentId& subentId );
  109. /// <summary>
  110. /// if the tool is a curve (either an object of AcDbCurve or a wire body in ASM)
  111. /// </summary>
  112. ///
  113. bool isCurve() const;
  114. /// <summary>
  115. /// For Autodesk Internal Use only.
  116. /// the ASM body of the tool.
  117. /// </summary>
  118. ///
  119. ENTITY *toolBody() const;
  120. /// <summary>
  121. /// For Autodesk Internal Use only.
  122. /// set the ASM body of the tool, the tool is represented as either an ASM body or AcDbCompoundObjectId
  123. /// if this method is called, the ASM body will be stored in the class and no AcDbCompoundObjectId
  124. /// will be used
  125. /// </summary>
  126. ///
  127. void setToolBody(ENTITY *pEntity);
  128. /// <summary>
  129. /// returns the AcDbCompoundObjectId of the tool, if an ASM body is used, it will return
  130. /// AcDbCompoundObjectId::nullId()
  131. /// </summary>
  132. ///
  133. AcDbCompoundObjectId toolBodyId() const;
  134. /// <summary>
  135. /// sets the AcDbCompoundObjectId of the tool, the tool is represented as either an ASM body
  136. /// or AcDbCompoundObjectId if this method is called, the AcDbCompoundObjectId will be stored
  137. /// and any ASM data that is previously set will be cleared
  138. /// </summary>
  139. ///
  140. void setToolBodyId( const AcDbCompoundObjectId &toolId );
  141. /// <summary>
  142. /// returns the TrimRelation between the tool and trimmed area on the blank
  143. /// </summary>
  144. ///
  145. TrimRelation relation() const;
  146. /// <summary>
  147. /// sets the TrimRelation between the tool and trimmed area on the blank
  148. /// </summary>
  149. ///
  150. void setRelation( TrimRelation relation );
  151. /// <summary>
  152. /// returns the projection vector if the tool is a curve. it is meaningless if
  153. /// the tool is a surface/region
  154. /// </summary>
  155. ///
  156. AcGeVector3d projVector() const;
  157. /// <summary>
  158. /// sets the projection vector if the tool is a curve. it shouldn't be called and
  159. /// has no effect if the tool is a surface/region
  160. /// </summary>
  161. ///
  162. void setProjVector(const AcGeVector3d& projVector);
  163. /// <summary>
  164. /// returns the subentity id of the face that is used to trim the blank, if
  165. /// the tool is a surface/region. Returns kNullSubentId if the tool is a curve
  166. /// </summary>
  167. ///
  168. AcDbSubentId faceSubentId() const;
  169. private:
  170. bool mbCurve;
  171. // the projection vector that a curve uses to project onto the blank
  172. AcGeVector3d mProjVector;
  173. // tool can be either an AcDbCompoundObjectId (db-resident) or
  174. // an ENTITY pointer (non-database resident), they are mutual exclusive
  175. AcDbCompoundObjectId mToolBodyId;
  176. // optional face subentity id, if the tool has more than one faces
  177. AcDbSubentId mToolFaceSubentId;
  178. mutable ENTITY *mToolBody;
  179. // the relation between the tool and the trimmed piece (outside or inside)
  180. TrimRelation mRelation;
  181. };
  182. #pragma pack (pop)