Skip to content

Geometry

The parameter with the geometry value types can be used to create input controls for geometry elements like point, line or spline. The framework will take care of providing the right type of controls e.g. length input field for point coordinates and angle input for arc start/end angles. In the script, the value of such parameter will be converted to an actual geometry object from the module NemAll_Python_Geometry.

Tip

The framework takes care of converting the value from string like Line2D(1000,1100,5000,1500) defined in PYP file, into an actual Line2D object. You have to put the right string into PYP file as default value. To obtain it from a geometry object, you can use the GeometryStringValueConverter.

Value types

Point

Defining <ValueType> as Point2D creates a parameter that returns a Point2D object as a result value.

Parameter Point2D

<Parameter>
    <Name>Point2</Name>
    <Text>Center</Text>
    <Value>Point2D(1000,500)</Value>
    <ValueType>Point2D</ValueType>
</Parameter>

Defining <ValueType> as Point3D creates a parameter that returns a Point3D object as a result value.

Parameter Point3D

<Parameter>
    <Name>Point1</Name>
    <Text>Point 1</Text>
    <Value>Point3D(0,0,0)</Value>
    <ValueType>Point3D</ValueType>
</Parameter>

Vector

Defining <ValueType> as Vector2D creates a parameter that returns a Vector2D object as a result value.

Parameter Vector2D

<Parameter>
    <Name>Vector2</Name>
    <Text>Direction</Text>
    <Value>Vector2D(2000,200)</Value>
    <ValueType>Vector2D</ValueType>
</Parameter>

Defining <ValueType> as Vector3D creates a parameter that returns a Vector3D object as a result value.

Parameter Vector3D

<Parameter>
    <Name>Vector3</Name>
    <Text>Direction</Text>
    <Value>Vector3D(2000,200,1000)</Value>
    <ValueType>Vector3D</ValueType>
</Parameter>

Axis placement

Parameter AxisPlacement3D

Defining <ValueType> as AxisPlacement3D creates a parameter that returns an AxisPlacement3D object as a result value.

<Parameter>
    <Name>AxisPlacement</Name>
    <Text>Axis placement</Text>
    <Value>AxisPlacement3D(Origin(0,0,0)XDirection(1,0,0)ZDirection(0,1,1))</Value>
    <ValueType>AxisPlacement3D</ValueType>
</Parameter>

Arc

Defining <ValueType> as Arc2D creates a parameter that returns an Arc2D object as a result value.

Parameter Arc2D

<Parameter>
    <Name>Arc2</Name>
    <Text>Arc</Text>
    <Value>Arc2D(CenterPoint(7000, 0) MinorRadius(1000) MajorRadius(2000) AxisAngle(0.78539816339744828) StartAngle(0.78539816339744828) EndAngle(4.7123889803846897) IsCounterClockwise(1))</Value>
    <ValueType>Arc2D</ValueType>
</Parameter>

Defining <ValueType> as Arc3D creates a parameter that returns an Arc3D object as a result value.

Parameter Arc3D

<Parameter>
    <Name>Arc3</Name>
    <Text>Arc</Text>
    <Value>Arc3D(CenterPoint(7000, 5000, 1000) XDirection(1, 0, 0) ZAxis(0, 0, 1) MinorRadius(1000) MajorRadius(2000) AxisAngle(0.78539816339744828) StartAngle(0.78539816339744828) EndAngle(4.7123889803846897) IsCounterClockwise(1))</Value>
    <ValueType>Arc3D</ValueType>
</Parameter>

Circle

Defining <ValueType> as Circle2D creates a parameter that also returns an Arc2D object as a result value, but with DeltaAngle set to 360°.

Parameter Circle2D

<Parameter>
    <Name>Circle3</Name>
    <Text>Circle</Text>
    <Value>Circle2D(CenterPoint(10000, 0)MajorRadius(1000))</Value>
    <ValueType>Circle2D</ValueType>
</Parameter>

Defining <ValueType> as Circle3D creates a parameter that returns an Arc3D object as a result value, but with DeltaAngle set to 360°.

Parameter Circle3D

<Parameter>
    <Name>Circle3</Name>
    <Text>Circle</Text>
    <Value>Circle3D(CenterPoint(10000, 5000, 1000) ZAxis(0, 0, 1) MajorRadius(1000))</Value>
    <ValueType>Circle3D</ValueType>
</Parameter>

Line

Defining <ValueType> as Line2D creates a parameter that returns a Line2D object as a result value

Parameter Line2D

<Parameter>
    <Name>DashedLine</Name>
    <Text>Dashed line</Text>
    <Value>Line2D(1000,1100,5000,1500)</Value>
    <ValueType>Line2D</ValueType>
</Parameter>

Defining <ValueType> as Line3D creates a parameter that returns a Line3D object as a result value

Parameter Line3D

<Parameter>
    <Name>Line3</Name>
    <Text>Line</Text>
    <Value>Line3D(1000,6100,0,5000,6500,1000)</Value>
    <ValueType>Line3D</ValueType>
</Parameter>

Plane

Defining <ValueType> as Plane3D creates a parameter that returns an Plane3D object as a result value.

Parameter Plane3D

<Parameter>
    <Name>Plane</Name>
    <Text>Plane</Text>
    <Value>Plane3D(Point(0,0,0)Vector(0,1,1))</Value>
    <ValueType>Plane3D</ValueType>
</Parameter>

Polyline

Defining <ValueType> as Polyline2D creates a parameter that returns a Polyline2D object as a result value

Parameter Polyline2D

<Parameter>
    <Name>Polyline2</Name>
    <Text>Point</Text>
    <Value>Polyline2D(Points((2000,2000)(3000,3100)(4000,3500)))</Value>
    <ValueType>Polyline2D</ValueType>
</Parameter>

Defining <ValueType> as Polyline3D creates a parameter that returns a Polyline3D object as a result value

Parameter Polyline3D

<Parameter>
    <Name>Polyline3</Name>
    <Text>Point</Text>
    <Value>Polyline3D(Points((2000,7000,0)(3000,8100,1000)(4000,8500,3000)))</Value>
    <ValueType>Polyline3D</ValueType>
</Parameter>

Polygon

Defining <ValueType> as Polygon2D creates a parameter that returns a Polygon2D object as a result value

Parameter Polygon2D

<Parameter>
    <Name>Polygon2</Name>
    <Text>Point</Text>
    <Value>Polygon2D(Points((5000,2000)(6000,3100)(5000,3500)(5000,2000)))</Value>
    <ValueType>Polygon2D</ValueType>
</Parameter>

Defining <ValueType> as Polygon3D creates a parameter that returns a Polygon3D object as a result value

Parameter Polygon3D

<Parameter>
    <Name>Polygon3</Name>
    <Text>Point</Text>
    <Value>Polygon3D(Points((5000,7000,0)(6000,8100,1000)(5000,8500,3000)(5000,7000,0)))</Value>
    <ValueType>Polygon3D</ValueType>
</Parameter>

Spline

Defining <ValueType> as Spline2D creates a parameter that returns a Spline2D object as a result value

Parameter Spline2D

<Parameter>
    <Name>Spline2</Name>
    <Text>Point</Text>
    <Value>Spline2D(StartVector(1, 1)EndVector(1, 1)Points((7000,2000)(8000,3100)(10000,3500)))</Value>
    <ValueType>Spline2D</ValueType>
</Parameter>

Defining <ValueType> as Spline3D creates a parameter that returns a Spline3D object as a result value

Parameter Spline3D

<Parameter>
    <Name>Spline3</Name>
    <Text>Point</Text>
    <Value>Spline3D(StartVector(1, 1, 1)EndVector(1, 1, 1)Points((7000,7000,0)(8000,8100,1000)(10000,8500,3000)))</Value>
    <ValueType>Spline3D</ValueType>
</Parameter>

BSpline3D

Defining <ValueType> as BSpline3D creates a parameter that returns a BSpline3D object as a result value

Parameter BSpline3D

<Parameter>
    <Name>BSpline3</Name>
    <Text>Point</Text>
    <Value>BSpline3D(IsPeriodic(0)Degree(3)Weights()Knots(0,0,0,0,1,1,1,1)Points((12000,7000,0)(13000,9100,1000)(15000,6000,3000)(18000,9000,0)))</Value>
    <ValueType>BSpline3D</ValueType>
</Parameter>

Geometry object

Defining <ValueType> as GeometryObject creates a parameter that can be anything, depending on the string provided in the <Value>.

<Parameter>
    <Name>GeometryObject</Name>
    <Text>Geometry object</Text>
    <Value>Arc3D(CenterPoint(0,0,0)MinorRadius(1000)MajorRadius(1000)StartAngle(pi / 4 )EndAngle(pi * 3 / 2)XDirection(1,0,0)ZAxis(0,0,1)IsCounterClockwise(1))</Value>
    <ValueType>GeometryObject</ValueType>
</Parameter>

This value type can be initialized as a list, which makes it possible to create a collection of different geometry objects inside one parameter

<Parameter>
    <Name>GeometryObjectList</Name>
    <Text></Text>
    <Value>[Arc3D(CenterPoint(0,5000,0)MinorRadius(1000)MajorRadius(1500)StartAngle(pi / 4 )EndAngle(pi * 3 / 2)XDirection(1,0,0)ZAxis(0,0,1)IsCounterClockwise(1));
            Line2D(5000,0,7000,-2000);Polygon3D(Points((5000,7000,0)(8000,8000,0)(8000,5000,0)(5000,5000,0)(5000,7000,0)))]</Value>
    <ValueType>GeometryObject</ValueType>
</Parameter>

Coordinates in one row

If a geometry object requires a point or a vector (2D or 3D) to be specified, its coordinates can be displayed in one row.

Parameter Point3D in one row

Parameter Point3D

To achieve that, add the tag <XYZinRow> to the geometry parameter:

<Parameter>
    <Name>Point2</Name>
    <Text>Point 2</Text>
    <Value>Point3D(1000,1000,0)</Value>
    <ValueType>Point3D</ValueType>
    <XYZinRow>True</XYZinRow>
</Parameter>

Individual text for each coorinate

When for each of the x,y and z coordinates an individual text in the palette has to be set, this can be achieved by defining all the texts in the <Text> tag, seperated with a coma.

Parameter Point3D with individual text

<Parameter>
    <Name>RefPoint</Name>
    <Text>From left,From front,From bottom</Text>
    <Value>Point3D(1000,2000,3000)</Value>
    <ValueType>Point3D</ValueType>
</Parameter>

Hide or disable a control

When a geometry parameter has to be disabled or hidden, this can be achieved with the tags <Visible> and <Enable> as described in this chapter. However, if only a single component of the geometry parameter needs to be hidden or disabled (e.g., a ), it can be achieved by introducing | character in the tag.

Parameter Point3D with hidden coordinate

<Parameter>
    <Name>StartPoint</Name>
    <Text>Start point</Text>
    <Value>Point3D(5000,1000,0)</Value>
    <ValueType>Point3D</ValueType>
    <Visible>|StartPoint.Y:False<!--(1)!--></Visible>
</Parameter>
  1. This will hide the Y component of the point in the palette.

Examples on GitHub

The implementation of all geometrical value types is shown in the examples located in ...PaletteExamples/GeometryElements ( PYP | PY)

Min and max values

It is possible to set up minimum and maximum values for individual coordinates of a Point or Vector. Add the tag <MinValue> or <MaxValue> to the parameter as follows:

<Parameter>
    <Name>Point</Name>
    <Text>Point with min/max</Text>
    <Value>Point2D(1000,5000)</Value>
    <ValueType>Point2D</ValueType>
    <XYZinRow>True</XYZinRow>
    <MinValue>Point2D(MinValue<!--(1)!-->,0)</MinValue>
    <MaxValue>Point2D(10000,20000)</MaxValue>
</Parameter>
  1. This will set the min value to the one specified in <Value> tag, in this case to 1000
Placeholder