AcExplicitConstr.h 11 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. #pragma once
  12. #include "AcGeomConstraint.h"
  13. #pragma pack (push, 8)
  14. /// <summary>
  15. /// This class represents a dimensional constraint node in the owning AcDbAssoc2dConstraintGroup.
  16. /// It is the base class for all the kind of dimensional constraints.
  17. /// </summary>
  18. ///
  19. class ACDB_PORT AcExplicitConstraint : public AcGeomConstraint
  20. {
  21. public:
  22. ACRX_DECLARE_MEMBERS(AcExplicitConstraint);
  23. /// <summary>
  24. /// Returns AcDbObjectId of the AcDbAssocValueDependency object referenced
  25. /// by this dimensional constraint.
  26. /// </summary>
  27. /// <returns> AcDbObjectId. </returns>
  28. ///
  29. AcDbObjectId valueDependencyId() const;
  30. /// <summary>
  31. /// Returns AcDbObjectId of the dimension dependency object referenced
  32. /// by this dimensional constraint.
  33. /// </summary>
  34. /// <returns> AcDbObjectId. </returns>
  35. ///
  36. AcDbObjectId dimDependencyId() const;
  37. /// <summary>
  38. /// Set the dimension dependency object referenced
  39. /// by this dimensional constraint.
  40. /// </summary>
  41. /// <param name="dimDependencyId">
  42. /// Input AcDbObjectId of the new dimension dependency object
  43. /// </param>
  44. /// <returns> Acad::eOk if successful </returns>
  45. ///
  46. Acad::ErrorStatus setDimDependencyId(const AcDbObjectId& dimDependencyId);
  47. /// <summary>
  48. /// Returns the value of the dimensional constraint measured from the
  49. /// distances/angles/radii of the constained geometries. It the constraint
  50. /// is satisfied, it is the same value as the dimension value obtained from
  51. /// the AcDbAssocVariable.
  52. /// </summary>
  53. ///
  54. Acad::ErrorStatus getMeasuredValue(double&) const;
  55. protected:
  56. /// <summary>
  57. /// Protected default constructor.
  58. /// </summary>
  59. ///
  60. AcExplicitConstraint(){};
  61. };
  62. /// <summary>
  63. /// This class represents a distance constraint node in the owning AcDbAssoc2dConstraintGroup.
  64. /// It can be applied between two constrained geometries (normally two points).
  65. /// </summary>
  66. ///
  67. class ACDB_PORT AcDistanceConstraint: public AcExplicitConstraint
  68. {
  69. public:
  70. ACRX_DECLARE_MEMBERS(AcDistanceConstraint);
  71. /// <summary>
  72. /// The direction type of this distance constraint. It is mainly used to
  73. /// indicate how the distance between the two geometries are measured.
  74. /// </summary>
  75. ///
  76. enum DirectionType
  77. {
  78. /// <summary>
  79. /// Not directed distance.
  80. /// The minimum distance between the two geometries is measured.
  81. /// </summary>
  82. ///
  83. kNotDirected = 0,
  84. /// <summary>
  85. /// Directed distance with fixed direction.
  86. /// The distance between the two geometries is measured along the fixed direction.
  87. /// </summary>
  88. ///
  89. kFixedDirection ,
  90. /// <summary>
  91. /// Directed distance with relative direction.
  92. /// The distance between the two geometries is measured along the direction
  93. /// which is perpendicular to an existing constraint line.
  94. /// </summary>
  95. ///
  96. kPerpendicularToLine ,
  97. /// <summary>
  98. /// Directed distance with relative direction.
  99. /// The distance between the two geometries is measured along the direction
  100. /// which is parallel to an existing constraint line.
  101. /// </summary>
  102. ///
  103. kParallelToLine
  104. };
  105. /// <summary>
  106. /// Default constructor.
  107. /// The direction type is set to kNotDirected.
  108. /// </summary>
  109. ///
  110. AcDistanceConstraint(bool bCreateImp = true);
  111. /// <summary>
  112. /// Constructor.
  113. /// The direction type is set to kFixedDirection.
  114. /// </summary>
  115. /// <param name="direction">
  116. /// Input AcGeVector3d indicating the fixed direction which is used to
  117. /// measure the distance. The vector length must not be zero.
  118. /// </param>
  119. ///
  120. AcDistanceConstraint(const AcGeVector3d& direction);
  121. /// <summary>
  122. /// Constructor.
  123. /// The direction type is set to kPerpendicularToLine or kParallelToLine.
  124. /// </summary>
  125. /// <param name="consLineId">
  126. /// Input AcGraphNode::Id indicating the constrained line whose direction
  127. /// is used to measure the distance.
  128. /// </param>
  129. /// <param name="type">
  130. /// Input DirectionType indicating the direction type which must be either
  131. /// kPerpendicularToLine or kParallelToLine.
  132. /// </param>
  133. ///
  134. AcDistanceConstraint(const AcGraphNode::Id consLineId, DirectionType type = kPerpendicularToLine);
  135. /// <summary>
  136. /// Returns the direction type of this distance constraint.
  137. /// </summary>
  138. /// <returns> Returns DirectionType. </returns>
  139. ///
  140. DirectionType directionType() const;
  141. /// <summary>
  142. /// Returns the fixed direction of this distance constraint.
  143. /// Only valid when the direction type is kFixedDirection.
  144. /// </summary>
  145. /// <returns> Returns AcGeVector3d. </returns>
  146. ///
  147. AcGeVector3d direction() const;
  148. /// <summary>
  149. /// Returns the constrained line id.
  150. /// Only valid when the direction type is kPerpendicularToLine or kParallelToLine.
  151. /// </summary>
  152. /// <returns> Returns AcGraphNode::Id. </returns>
  153. ///
  154. AcGraphNode::Id constrainedLineId() const;
  155. };
  156. /// <summary>
  157. /// This class represents a angle constraint node in the owning AcDbAssoc2dConstraintGroup.
  158. /// It can be applied between two constrained lines.
  159. /// </summary>
  160. ///
  161. class ACDB_PORT AcAngleConstraint: public AcExplicitConstraint
  162. {
  163. public:
  164. ACRX_DECLARE_MEMBERS(AcAngleConstraint);
  165. /// <summary>
  166. /// The angle sector type of this angle constraint. It is used to
  167. /// indicate how the angle between the two lines is measured.
  168. /// </summary>
  169. ///
  170. enum SectorType
  171. {
  172. /// <summary>
  173. /// The angle measured from the forward direction of line 1 to
  174. /// the forward direction of line 2 anticlockwise.
  175. /// </summary>
  176. ///
  177. kParallelAntiClockwise = 0,
  178. /// <summary>
  179. /// The angle measured from the forward direction of line 1 to
  180. /// the non forward direction of line 2 clockwise.
  181. /// </summary>
  182. ///
  183. kAntiParallelClockwise ,
  184. /// <summary>
  185. /// The angle measured from the forward direction of line 1 to
  186. /// the forward direction of line 2 clockwise.
  187. /// </summary>
  188. ///
  189. kParallelClockwise ,
  190. /// <summary>
  191. /// The angle measured from the forward direction of line 1 to
  192. /// the non forward direction of line 2 anticlockwise.
  193. /// </summary>
  194. ///
  195. kAntiParallelAntiClockwise
  196. };
  197. /// <summary>
  198. /// Default constructor.
  199. /// The angle sector type is set to kParallelAntiClockwise.
  200. /// </summary>
  201. ///
  202. AcAngleConstraint(bool bCreateImp = true);
  203. /// <summary>
  204. /// Constructor.
  205. /// </summary>
  206. /// <param name="type">
  207. /// Input SectorType indicating the angle sector which is used to
  208. /// measure the angle.
  209. /// </param>
  210. ///
  211. AcAngleConstraint(AcAngleConstraint::SectorType type);
  212. /// <summary>
  213. /// Returns the angle sector type of this angle constraint.
  214. /// </summary>
  215. /// <returns> Returns SectorType. </returns>
  216. ///
  217. SectorType sectorType() const;
  218. /// <summary> <para>
  219. /// Sets a multiplier that is used to multiply angles obtained from
  220. /// AcDbAssocValueDependencies that depend on AcDbAssocVariables to convert
  221. /// the angles to radians. It is needed because the expression evaluator used
  222. /// by AcDbAssocVariables considers all angles to be in degrees. To convert
  223. /// from degrees to radians, the multiplier needs to be set to Pi/180.
  224. /// If no angle multiplier is set, the default is Pi/180.
  225. /// </para> <para>
  226. /// For now there is just one global multiplier so that AcDbAssocVariables
  227. /// can store angles in degrees, not in radians. It is just a stop gap
  228. /// measure until we figure out how to handle units.
  229. /// </para> </summary>
  230. /// <param name="multiplier"> The angle multiplication factor. </param>
  231. ///
  232. static void setAngleMultiplier(double multiplier);
  233. /// <summary> Returns the current angle multipiler. </summary>
  234. /// <returns> The current angle multipiler. The default is Pi/180.</returns>
  235. ///
  236. static double angleMultiplier();
  237. };
  238. /// <summary>
  239. /// This class represents a angle constraint node in the owning AcDbAssoc2dConstraintGroup.
  240. /// It can be applied between 3 constrained points.
  241. /// </summary>
  242. ///
  243. class ACDB_PORT Ac3PointAngleConstraint: public AcAngleConstraint
  244. {
  245. public:
  246. ACRX_DECLARE_MEMBERS(Ac3PointAngleConstraint);
  247. /// <summary>
  248. /// Default constructor.
  249. /// The angle sector type is set to kParallelAntiClockwise.
  250. /// </summary>
  251. ///
  252. Ac3PointAngleConstraint(bool bCreateImp = true);
  253. /// <summary>
  254. /// Constructor.
  255. /// </summary>
  256. /// <param name="type">
  257. /// Input SectorType indicating the angle sector which is used to
  258. /// measure the angle.
  259. /// </param>
  260. ///
  261. Ac3PointAngleConstraint(AcAngleConstraint::SectorType type);
  262. };
  263. /// <summary>
  264. /// This class represents a radius or diameter constraint node in the owning AcDbAssoc2dConstraintGroup.
  265. /// It can be applied on one circle(arc) or ellipse(bounded ellipse).
  266. /// </summary>
  267. ///
  268. class ACDB_PORT AcRadiusDiameterConstraint : public AcExplicitConstraint
  269. {
  270. public:
  271. ACRX_DECLARE_MEMBERS(AcRadiusDiameterConstraint);
  272. /// <summary>
  273. /// The constraint type of this constraint. It is used to
  274. /// indicate whether radius or diameter is measured.
  275. /// </summary>
  276. ///
  277. enum RadiusDiameterConstrType
  278. {
  279. /// <summary>
  280. /// The radius of a constrained circle or arc is measured.
  281. /// </summary>
  282. ///
  283. kCircleRadius = 0,
  284. /// <summary>
  285. /// The diameter of a constrained circle or arc is measured.
  286. /// </summary>
  287. ///
  288. kCircleDiameter ,
  289. /// <summary>
  290. /// The minor radius of a constrained (bounded) ellipse is measured.
  291. /// </summary>
  292. ///
  293. kMinorRadius ,
  294. /// <summary>
  295. /// The major radius of a constrained (bounded) ellipse is measured.
  296. /// </summary>
  297. ///
  298. kMajorRadius
  299. };
  300. /// <summary>
  301. /// Default constructor.
  302. /// The constraint type is set to kCircleRadius.
  303. /// </summary>
  304. ///
  305. AcRadiusDiameterConstraint(bool bCreateImp = true);
  306. /// <summary>
  307. /// Constructor.
  308. /// </summary>
  309. /// <param name="type">
  310. /// Input RadiusDiameterConstrType indicating the constraint type.
  311. /// </param>
  312. ///
  313. AcRadiusDiameterConstraint(RadiusDiameterConstrType type);
  314. /// <summary>
  315. /// Returns the constraint type of this constraint.
  316. /// </summary>
  317. /// <returns> Returns RadiusDiameterConstrType. </returns>
  318. ///
  319. RadiusDiameterConstrType constrType() const;
  320. };
  321. #pragma pack (pop)