Method AddXYParameter
- Namespace
- GeometryHelper.Dxf
- Assembly
- GeometryHelper.dll
AddXYParameter(string, string, string, string, GeoPoint3, GeoPoint3)
Makes the block dynamic, where it is not, and gives it an XY parameter: the distances along x and along y from a base point to an end point, which each INSERT of the block shows as two dynamic properties, AutoCAD's XY parameter of four grips as its Block Editor makes one. Tie the parameter to the entities it moves with AddStretchAction(DxfBlockXYParameter, GeoPoint2, GeoPoint2, IEnumerable<DxfEntity>) and AddMoveAction(DxfBlockXYParameter, IEnumerable<DxfEntity>).
public DxfBlockXYParameter AddXYParameter(string xName, string xDescription, string yName, string yDescription, GeoPoint3 basePoint, GeoPoint3 endPoint)
Parameters
xNamestringThe label of the distance along x, the name of its property, as Width.
xDescriptionstringThe description of the distance along x; null or empty for none.
yNamestringThe label of the distance along y, the name of its property, as Depth.
yDescriptionstringThe description of the distance along y; null or empty for none.
basePointGeoPoint3The point the distances are measured from, in the block's coordinates.
endPointGeoPoint3The point the distances are measured to, which the properties move.
Returns
- DxfBlockXYParameter
The parameter, as written.
Remarks
A rectangle 100 by 50 from the origin given AddXYParameter("Width", null, "Depth", null, new GeoPoint3(0, 0, 0), new
GeoPoint3(100, 50, 0)) gives every INSERT the properties Width of 100 and Depth of 50, in that order, as AutoCAD
gives them. Each distance is measured from the base point the way the end point lies: an end point left of the base
point stays left of it.
The parameter is written as AutoCAD saved the XY parameter of ACadSharp's sample: the label of y at 305 and of x at 306, their descriptions at 307 and 308, the label offsets nought, the value sets of none; its element named XY; its grips at the end point, the base point, (base x, end y) and (end x, base y), each with its two location components, thirteen nodes of the evaluation graph and twelve edges.
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, or the end point is not apart from the base point along x and along y beyond the point tolerance of Default. Nothing is written then.
- 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.
AddXYParameter(string, string, string, string, GeoPoint3, GeoPoint3, DxfBlockParameterValueSet, DxfBlockParameterValueSet)
Makes the block dynamic, where it is not, and gives it an XY parameter, as AddXYParameter(string, string, string, string, GeoPoint3, GeoPoint3) does, of the distances each of its properties may take, AutoCAD's Horizontal and Vertical Value Sets of the parameter.
public DxfBlockXYParameter AddXYParameter(string xName, string xDescription, string yName, string yDescription, GeoPoint3 basePoint, GeoPoint3 endPoint, DxfBlockParameterValueSet xValueSet, DxfBlockParameterValueSet yValueSet)
Parameters
xNamestringThe label of the distance along x, the name of its property, as Width.
xDescriptionstringThe description of the distance along x; null or empty for none.
yNamestringThe label of the distance along y, the name of its property, as Depth.
yDescriptionstringThe description of the distance along y; null or empty for none.
basePointGeoPoint3The point the distances are measured from, in the block's coordinates.
endPointGeoPoint3The point the distances are measured to, which the properties move.
xValueSetDxfBlockParameterValueSetThe distances along x the property may take; null for any.
yValueSetDxfBlockParameterValueSetThe distances along y the property may take; null for any.
Returns
- DxfBlockXYParameter
The parameter, as written.
Remarks
A plate 100 by 50 from the origin given AddXYParameter("Width", null, "Depth", null, new GeoPoint3(0, 0, 0), new
GeoPoint3(100, 50, 0), DxfBlockParameterValueSet.Increments(50, 300, 10), DxfBlockParameterValueSet.List(new[] { 50.0,
80, 120 })) takes a Width of 77 to 80, 75 to 70 and 400 to 300, and a Depth of 90 to 80, 65 to 50 and 100 to 80,
as AutoCAD 2021 took them from every value before (plugins D25 and D25b): a tie of a list goes to the block's own
value where it is one of the two, else to the lesser, as Value says. Each set is written as AutoCAD writes the set of a
linear parameter, the set of y first (97, 146 to 149, 176) and then the set of x (96, 142 to 145, 175), as AutoCAD's
samples order them.
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 and along y beyond the point tolerance of Default, or a value set does not hold its distance, the block's own. Nothing is written then.
- 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.