Method AddPolarParameter
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
AddPolarParameter(string, string, string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet, DxfBlockParameterValueSet)
Makes the block dynamic, where it is not, and gives it a polar parameter: the distance from a base point to an end point and the angle of that line from the block's x axis, which each INSERT of the block shows as two dynamic properties, AutoCAD's Polar parameter of two grips as its Block Editor makes one. Tie the parameter to the entities it turns and stretches with AddPolarStretchAction(DxfBlockPolarParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>, IEnumerable<DxfEntity>), and those that follow its end point unturned with AddStretchAction(DxfBlockPolarParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) and AddMoveAction(DxfBlockPolarParameter, IEnumerable<DxfEntity>).
public DxfBlockPolarParameter AddPolarParameter(string distanceName, string distanceDescription, string angleName, string angleDescription, GeoPoint3 basePoint, GeoPoint3 endPoint, double labelOffset, DxfBlockParameterValueSet distanceValueSet, DxfBlockParameterValueSet angleValueSet)
Parameters
distanceNamestringThe label of the distance, the name of its property, as Length.
distanceDescriptionstringThe description of the distance; null or empty for none.
angleNamestringThe label of the angle, the name of its property, as Angle.
angleDescriptionstringThe description of the angle; null or empty for none.
basePointGeoPoint3The point the distance is measured from and the angle turns about, in the block's coordinates.
endPointGeoPoint3The point the distance is measured to, which the properties move, level with the base point along z.
labelOffsetdoubleHow far the label stands off the line, to its left looking from the base point to the end point.
distanceValueSetDxfBlockParameterValueSetThe distances the property may take; null for any.
angleValueSetDxfBlockParameterValueSetThe angles the property may take, in radians within a turn; null for any.
Returns
- DxfBlockPolarParameter
The parameter, as written.
Remarks
A pointer, a line from (0, 0) to (100, 0) with a circle of the radius 5 at its tip, given AddPolarParameter("Length",
null, "Angle", null, new GeoPoint3(0, 0, 0), new GeoPoint3(100, 0, 0), -20, null, null) and a polar stretch over
its tip gives every INSERT the properties Length of 100 and Angle of nought, in that order, as AutoCAD gives them;
Length set to 150 and Angle to a quarter turn take the tip to (0, 150).
The parameter is written as AutoCAD saved the polar parameter of ACadSharp's sample: the base point and the end point, its grips and their connections as a linear parameter's, the label of the distance and of the angle at 305 and 307, their descriptions at 306 and 308, the label offset (140), the distance's value set (96, 141 to 144, 175), of none the flags 1, and the angle's (97, 145 to 148, 176), of none the flags 3, nought to a whole turn; its element named Polar; its end grip and base grip, each with its two location components; seven nodes of the evaluation graph and six edges. AutoCAD 2021 read every INSERT of such a block as dynamic, of the properties Length and Angle, set them, and kept them through a DXF saved and opened again (plugin D25).
The value sets are taken as AutoCAD 2021 took them: of a Length from 50 to 300 by 10, 75 goes to 70 and 400 to 300; of an Angle in steps of 15 degrees, 40 goes to 45 and -10 to 345; of a Length of 50, 100, 150 or 200 for the block's own 100, 75 and 125 go to 100 and 175 to 150, from every value before.
Exceptions
- ArgumentNullException
Thrown when a name is null.
- ArgumentException
Thrown when a name is empty, a name or a description holds a line break, a coordinate is not a finite number, the end point is not apart from the base point along x or y beyond the point tolerance of Default or not level with it along z within it, the distance's value set does not hold the distance, or the angle's reaches beyond a turn or does not hold the angle, the block's own. Nothing is written then.
- ArgumentOutOfRangeException
Thrown when the offset is not a finite number.
- InvalidOperationException
Thrown when the block cannot be dynamic, as AddLinearParameter(string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet) says.
- NotSupportedException
Thrown when the block has a flip parameter, as AddLinearParameter(string, string, GeoPoint3, GeoPoint3, double, DxfBlockParameterValueSet) says. Nothing is written then.