## Convert Datum Elements to Parametric Elements

The following Actions, convert the datum elements created by a Knowledge Pattern and converts them to parametric elements.

There are two steps involved in this; Creating the base type and then the extending the type i.e. GSMPoint to GSMPointCoord

These steps manipulate the initial datum point to the parametric type defined.

// ConvertDatumPointtoPointCoord( iPoint : Point ) : Void Let oGSMPoint ( GSMPoint ) Set oGSMPoint = iPoint oGSMPoint.PointType = "Coordinates" Let oGSMPointCoord( GSMPointCoord ) Set oGSMPointCoord = oGSMPoint oGSMPointCoord.X = iPoint->coord(1) oGSMPointCoord.Y = iPoint->coord(2) oGSMPointCoord.Z = iPoint->coord(3)

The next example converts a Datum line to a parametric line Point to Point.

// ConvertDatumPointtoLinePtPt( iLine : Line , iPoint1 : Point , iPoint2 : Point ) : Void Let oGSMLine (GSMLine) Set oGSMLine = iLine oGSMLine.LineType = "PointPoint" Let oGSMLinePtPt (GSMLinePtPt) Set oGSMLinePtPt = oGSMLine oGSMLinePtPt.FirstPoint = iPoint1 oGSMLinePtPt.SecondPoint = iPoint2

This pattern can be used to convert datum elements to any parametric form as long as you can determine the Type. This can be achieved by reverse engineering the type from an existing object of the same type. In this case a point on plane was created and then a simple rule to message out the point on plane type which is “OnPlane”.

Let GSMPointOnPlane1 (GSMPointOnPlane) Set GSMPointOnPlane1 =`Geometrical Set.1\Point.2` Message("#",GSMPointOnPlane1.PointType)

Once we have the type, we can then look in the language browser to understand what geometrical elements are required to construct a point on a plane. We only have to supply some of the elements based on how you want to define the point on a plane i.e. the Support and H, and V lengths.

Then we can define the action, remembering to start with the base type GSMPoint.

// ConvertDatumPointtoPointOnPlane( iPoint : Point , iPlane : Plane , H : Length , V : Length ) : Void Let oGSMPoint ( GSMPoint ) Set oGSMPoint = iPoint oGSMPoint.PointType = "OnPlane" Let oGSMPointOnPlane ( GSMPointOnPlane ) Set oGSMPointOnPlane = oGSMPoint oGSMPointOnPlane.Support = iPlane oGSMPointOnPlane.H = H oGSMPointOnPlane.V = V