AcDbAssocSurfaceActionBody.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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. // CREATED BY: Jiri Kripac March 2009
  12. //
  13. //////////////////////////////////////////////////////////////////////////////
  14. #pragma once
  15. #include "AcDbAssocParamBasedActionBody.h"
  16. #pragma pack (push, 8)
  17. /// <summary>
  18. /// Base action body class for surface modeling actions whose result is a single
  19. /// surface. The base class just keeps a dependency on the resulting surface
  20. /// and the "is semiassociative" flag.
  21. /// </summary>
  22. ///
  23. class ACDB_PORT AcDbAssocSurfaceActionBody : public AcDbAssocParamBasedActionBody
  24. {
  25. public:
  26. ACRX_DECLARE_MEMBERS(AcDbAssocSurfaceActionBody);
  27. /// <summary> Default constructor. </summary>
  28. /// <param name="createImpObject"> See AcDbAssocCreateImpObject. </param>
  29. ///
  30. explicit AcDbAssocSurfaceActionBody(AcDbAssocCreateImpObject createImpObject = kAcDbAssocCreateImpObject);
  31. /// <summary><para>
  32. /// Returns the AcDbDependency on the AcDbSurface that is the result of the
  33. /// evaluation of this action, optionally creating the dependency, it it does
  34. /// not exist yet.
  35. /// </para><para>
  36. /// If isWriteOnlyDependency is true, the depedency is write-only, the action
  37. /// is the creation action on the surface, and is positioned as the very first
  38. /// action in the list of actions on the surface. Otherwise the dependency
  39. /// is read-write and the action is a modification action on the surface.
  40. /// There is always just a single creation action on a surface but any number
  41. /// of modification actions.
  42. /// </para></summary>
  43. ///
  44. AcDbObjectId resultingSurfaceDep(bool createIfDoesNotExist, bool isWriteOnlyDependency = true);
  45. /// <summary>
  46. /// Returns the AcDbSurface that is the result of the evaluation of this action.
  47. /// The action has a write-only or read-write dependency on the surface.
  48. /// </summary>
  49. ///
  50. AcDbObjectId resultingSurface() const;
  51. /// <summary><para>
  52. /// Sets the AcDbSurface that is the result of the evaluation of this action.
  53. /// The action has a write-only or read-write dependency on the surface.
  54. /// If the dependency does not exist yet, it is created.
  55. /// </para><para>
  56. /// If isWriteOnlyDependency is true, the depedency is write-only, the action
  57. /// is the creation action on the surface, and is positioned as the very first
  58. /// action in the list of actions on the surface. Otherwise the dependency
  59. /// is read-write and the action is a modification action on the surface.
  60. /// There is always just a single creation action on a surface but any number
  61. /// of modification actions.
  62. /// </para></summary>
  63. ///
  64. Acad::ErrorStatus setResultingSurface(const AcDbObjectId& surfaceId, bool isWriteOnlyDependency = true);
  65. /// <summary><para>
  66. /// Semi-associative surface shows special surface properties (such as offset
  67. /// distance for an ofest surface or tangency grips for patach surface) if the
  68. /// dependent-on geometries are in the correct positions relative to the
  69. /// resulting surface, such as the input profiles of a patch surface coincide
  70. /// with the edges of the patch surface. If they are not, the surface becomes
  71. /// non-associative and all the actions on the surface are erased.
  72. /// </para><para>
  73. /// Internally it means that a semi-associative the surface is in fact fully
  74. /// associative, but its evaluate method behaves differently, similarly to
  75. /// when an action is evaluated in kModifyActionAssocEvaluationMode mode.
  76. /// </para><para>
  77. /// Instead of updating the surface to match the dependent-on geometries,
  78. /// it checks if the relation between the dependent-on geometries and the
  79. /// surface is as expected, and if not, it makes the surface non-associative,
  80. /// erasing all its actions.
  81. /// </para></summary>
  82. ///
  83. bool isSemiAssociative() const;
  84. /// <summary>
  85. /// Derived surface creation action body classes implement this method to check
  86. /// and report whether their semi-associativity is satisfied (it is called only
  87. /// when the action body is semi-associative). The base-class implementation
  88. /// just returns true.
  89. /// </summary>
  90. ///
  91. virtual bool isSemiAssociativitySatisfiedOverride() const;
  92. /// <summary> Overridden implementation of the base class method. </summary>
  93. ///
  94. virtual void evaluateOverride();
  95. /// <summary> Overridden implementation of the base class method. </summary>
  96. ///
  97. virtual Acad::ErrorStatus getDependentActionsToEvaluateOverride(AcDbActionsToEvaluateCallback*) const;
  98. /// <summary> Overridden implementation of the base class method. </summary>
  99. ///
  100. virtual Acad::ErrorStatus addMoreObjectsToDeepCloneOverride(
  101. AcDbIdMapping&, AcDbObjectIdArray& additionalObjectsToClone) const;
  102. /// <summary> Overridden implementation of the base class method. </summary>
  103. ///
  104. virtual Acad::ErrorStatus dragStatusOverride(const AcDb::DragStat);
  105. /// <summary>
  106. /// Finds all actions that affected the given topological subentity (face,
  107. /// edge, vertex) of the given ASM-based entity (AcDbSurface, AcDb3dSolid,
  108. /// AcDbRegion).
  109. /// </summary>
  110. /// <remarks>
  111. /// It does it by collecting all StepIds on the ASM entity and finding all
  112. /// actions on the given AcDbObject whose StepId is one of the StepIds
  113. /// on the ASM entity. These are the actions that somehow caused the
  114. /// creation or change of the ASM face/edge/vertex.
  115. /// </remarks>
  116. ///
  117. static Acad::ErrorStatus findActionsThatAffectedTopologicalSubentity(
  118. const AcDbEntity* pAsmBasedEntity,
  119. const AcDbSubentId&,
  120. AcDbObjectIdArray& actionIds);
  121. /// <summary>
  122. /// The given AcDbEntity is expected to be of an ASM-based entity (AcDbSurface,
  123. /// AcDb3dSolid, AcDbRegion). If the entity has actions on it that create or
  124. /// modify the entity, then for each action it returns the subentities (faces,
  125. /// edges, vertices) of the ASM body that were created or modified by that
  126. /// action. Notice that a single subentity may be modified by several actions,
  127. /// therefore may show up in the actionSubentIds array of more than one action.
  128. /// </summary>
  129. /// <remarks>
  130. /// The returned array of actionIds is of all actions on the entity, including
  131. /// internal actions.
  132. /// </remarks>
  133. ///
  134. static Acad::ErrorStatus getTopologicalSubentitiesForActionsOnEntity(
  135. const AcDbEntity* pAsmBasedEntity,
  136. bool alsoUseAdjacentTopology,
  137. AcDbObjectIdArray& actionIds,
  138. AcArray<AcArray<AcDbSubentId> >& actionSubentIds);
  139. /// <summary>
  140. /// Given an object, finds all AcDbSurfaces that have an action that takes the
  141. /// given object as input (the action has a read-only dependency on the
  142. /// object) and the AcDbSurface as output (the action has write-only or
  143. /// read-write dependency on the AcDbSurface). The surfaces depend on the
  144. /// object because when the object is changed, the actions that use this object
  145. /// as input are re-evaluated and update the surfaces.
  146. /// </summary>
  147. ///
  148. static Acad::ErrorStatus getSurfacesDirectlyDependentOnObject(
  149. const AcDbObject*,
  150. AcDbObjectIdArray& dependentSurfaceIds);
  151. /// <summary>
  152. /// This method is analogous to the like-named method in AcDbEntity. When an
  153. /// AcDbSurface has actions that control it and this method is called on the
  154. /// AcDbSurface entity, the call is redirected to the corresponding method
  155. /// in the creation action of the surface. The action then provides the data
  156. /// or performs the operation instead of the AcDbSurface.
  157. /// </summary>
  158. ///
  159. virtual Acad::ErrorStatus getGripPoints(
  160. AcGePoint3dArray& gripPoints,
  161. AcDbIntArray& osnapModes,
  162. AcDbIntArray& geomIds) const;
  163. /// <summary>
  164. /// This method is analogous to the like-named method in AcDbEntity. When an
  165. /// AcDbSurface has actions that control it and this method is called on the
  166. /// AcDbSurface entity, the call is redirected to the corresponding method
  167. /// in the creation action of the surface. The action then provides the data
  168. /// or performs the operation instead of the AcDbSurface.
  169. /// </summary>
  170. ///
  171. virtual Acad::ErrorStatus getGripPoints(
  172. AcDbGripDataPtrArray& grips,
  173. const double curViewUnitSize,
  174. const int gripSize,
  175. const AcGeVector3d& curViewDir,
  176. const int bitflags) const;
  177. /// <summary>
  178. /// This method is analogous to the like-named method in AcDbEntity. When an
  179. /// AcDbSurface has actions that control it and this method is called on the
  180. /// AcDbSurface entity, the call is redirected to the corresponding method
  181. /// in the creation action of the surface. The action then provides the data
  182. /// or performs the operation instead of the AcDbSurface.
  183. /// </summary>
  184. ///
  185. virtual Acad::ErrorStatus moveGripPoints(
  186. const AcDbIntArray& indices,
  187. const AcGeVector3d& offset);
  188. /// <summary>
  189. /// This method is analogous to the like-named method in AcDbEntity. When an
  190. /// AcDbSurface has actions that control it and this method is called on the
  191. /// AcDbSurface entity, the call is redirected to the corresponding method
  192. /// in the creation action of the surface. The action then provides the data
  193. /// or performs the operation instead of the AcDbSurface.
  194. /// </summary>
  195. ///
  196. virtual Acad::ErrorStatus moveGripPoints(
  197. const AcDbVoidPtrArray& gripAppData,
  198. const AcGeVector3d& offset,
  199. const int bitflags);
  200. /// <summary>
  201. /// This method is analogous to the like-named method in AcDbEntity. When an
  202. /// AcDbSurface has actions that control it and this method is called on the
  203. /// AcDbSurface entity, the call is redirected to the corresponding method
  204. /// in the creation action of the surface. The action then provides the data
  205. /// or performs the operation instead of the AcDbSurface.
  206. /// </summary>
  207. ///
  208. virtual Acad::ErrorStatus moveStretchPoints(
  209. const AcDbIntArray& indices,
  210. const AcGeVector3d& offset);
  211. /// <summary>
  212. /// This method is analogous to the like-named method in AcDbEntity. When an
  213. /// AcDbSurface has actions that control it and this method is called on the
  214. /// AcDbSurface entity, the call is redirected to the corresponding method
  215. /// in the creation action of the surface. The action then provides the data
  216. /// or performs the operation instead of the AcDbSurface.
  217. /// </summary>
  218. ///
  219. virtual void gripStatus(const AcDb::GripStat status);
  220. /// <summary>
  221. /// This method is analogous to the like-named method in AcDbEntity. When an
  222. /// AcDbSurface has actions that control it and this method is called on the
  223. /// AcDbSurface entity, the call is redirected to the corresponding method
  224. /// in the creation action of the surface. The action then provides the data
  225. /// or performs the operation instead of the AcDbSurface.
  226. /// </summary>
  227. ///
  228. virtual Acad::ErrorStatus getGripEntityUCS(
  229. const void* pGripAppData,
  230. AcGeVector3d& normalVec,
  231. AcGePoint3d& origin,
  232. AcGeVector3d& xAxis) const;
  233. /// <summary>
  234. /// This method is analogous to the like-named method in AcDbEntity. When an
  235. /// AcDbSurface has actions that control it and this method is called on the
  236. /// AcDbSurface entity, the call is redirected to the corresponding method
  237. /// in the creation action of the surface. The action then provides the data
  238. /// or performs the operation instead of the AcDbSurface.
  239. /// </summary>
  240. ///
  241. virtual void list() const;
  242. }; // class AcDbAssocSurfaceActionBody
  243. #pragma pack (pop)