pw:: SourceCurve

SourceCurve type

Derives From

pw::Object pw::Entity pw::SourceEntity

Summary
SourceCurve type
This action creates a new source curve object.
This action given two point-lists, returns a segment type, a start point, and an end point that represent the best segment between the given points.
This action gets the number of segments in this curve.
This action gets the segment at the given index.
This action sets the segment at the given index.
This action adds the segment to the end of the segments in the curve.
This action inserts the segment at the given index.
This action removes a segment from the curve.
This action removes all of the segments from the curve.
This action replaces all of the segments in the curve.
This action gets a position on a curve in the defining space of the curve.
This action gets the model space position on a curve.
This action gets a parameter value on a curve.
This action gets the curve length from the beginning to a given location.
This action gets the parameters at which the curve intersects the value.
This action gets the total length of the curve.

Static Actions

create

pw::SourceCurve create

This action creates a new source curve object.

Parameters

This action has no parameters.

Returns

This action returns a new pw::SourceCurve object.

Example

This example shows how to create a source curve with two conic segments.

Code

set conic(1) [pw::SegmentConic create]
$conic(1) addPoint {-25 8 0}
$conic(1) addPoint {-8 8 0}
$conic(1) setIntersectPoint {-20 20 0}
set conic(2) [pw::SegmentConic create]
$conic(2) addPoint [$conic(1) getPoint [$conic(1) getPointCount]]
$conic(2) addPoint {10 16 0}
$conic(2) setShoulderPoint {8 8 0}
set srcCrv(1) [pw::SourceCurve create]
$srcCrv(1) addSegment $conic(1)
$srcCrv(1) addSegment $conic(2)

getBestSegment

pw::SourceCurve getBestSegment -start startVar -end endVar start_points end_points

This action given two point-lists, returns a segment type, a start point, and an end point that represent the best segment between the given points.

Parameters

-start startVarThis optional parameter is the string name of a variable to receive the best start integer index or point.
-end endVarThis optional parameter is the string name of a variable to receive the best end integer index or point.
start_pointsThis parameter is a list of points for the start of the segment.
end_pointsThis parameter is a list of points for the end of the segment.

Returns

This action returns a segment type string.

Instance Actions

getSegmentCount

$srcCrv getSegmentCount

This action gets the number of segments in this curve.

Parameters

This action has no parameters.

Returns

This action returns the integer number of segments.

Example

This example shows how to get the number of segments in a curve.  $srcCrv(1) is referencing an existing source curve.

Code

puts [$srcCrv(1) getSegmentCount]

Output

2

getSegment

$srcCrv getSegment ?-copy? index

This action gets the segment at the given index.

Parameters

-copyThis optional flag is a notification that a copy of the segment is returned.
indexThis parameter is the integer index of the segment to get with the range [1, number of segments].

Returns

This action returns a pw::Segment object.

Example

This example shows how to get the number of control points for a certain segment in a curve.  $srcCrv(3) is referencing an existing source curve.

Code

puts "This segment has [[$srcCrv(3) getSegment 2] getPointCount] \
control points."

Output

This segment has 5 control points.

setSegment

$srcCrv setSegment index segment

This action sets the segment at the given index.

Parameters

indexThis parameter is the integer index of the segment to set with the range [1, number of segments].
segmentThis parameter is the pw::Segment object to set.

Returns

This action returns nothing.

Example

This example shows how to set a segment at a certain index in a curve.  $srcCrv(1) is referencing an existing source curve.

Code

set seg(1) [pw::SegmentSpline create]
$seg(1) addPoint [[$srcCrv(1) getSegment 1] getPoint 1]
$seg(1) addPoint "0 0 0"
$srcCrv(1) setSegment 1 $seg(1)

addSegment

$srcCrv addSegment segment

This action adds the segment to the end of the segments in the curve.

Parameters

segmentThis parameter is the pw::Segment object to add.

Returns

This action returns nothing.

Information

An error will be raised if the segment already belongs to another curve or connector.

Example

This example shows how to add a segment to the end of a curve.  $srcCrv(1) is referencing an existing source curve.

Code

set seg(1) [pw::SegmentSpline create]
$seg(1) addPoint [[$srcCrv(1) getSegment 2] getPoint 2]
$seg(1) addPoint "0 0 0"
$srcCrv(1) addSegment $seg(1)

insertSegment

$srcCrv insertSegment index segment

This action inserts the segment at the given index.

Parameters

indexThis parameter is the integer index to insert the given segment at with the range [1, number of segments+1].
segmentThis parameter is the pw::Segment object to insert.

Returns

This action returns nothing.

Information

An error will be raised if the segment already belongs to another curve or connector.

Inserting at an index of (number-of-segments + 1) will append the segment.

Example

This example shows how to insert a segment at the second index of a curve.  $srcCrv(1) is referencing an existing source curve.

Code

set seg(1) [pw::SegmentSpline create]
$seg(1) addPoint [[$srcCrv(1) getSegment 1] getPoint 2]
$seg(1) addPoint "0 0 0"
$srcCrv(1) insertSegment 2 $seg(1)

removeSegment

$srcCrv removeSegment < index | segment >

This action removes a segment from the curve.

Parameters

indexThis parameter is the integer index of the segment to remove with the range [1, number of segments].
segmentThis parameter is the pw::Segment object to remove.

Returns

This action returns nothing.

Example

This example shows how to remove a segment from a curve according to its index.  $srcCrv(1) is referencing an existing source curve.

Code

$srcCrv(1) removeSegment 3

removeAllSegments

$srcCrv removeAllSegments

This action removes all of the segments from the curve.

Parameters

This action has no parameters.

Returns

This action returns nothing.

Example

This example shows how to remove all segments from a curve.  $srcCrv(1) is referencing an existing source curve.

Code

$srcCrv(1) removeAllSegments

replaceAllSegments

$srcCrv replaceAllSegments segments

This action replaces all of the segments in the curve.

Parameters

segmentsThis parameter is a list of pw::Segment objects that will be the new segments of this curve.

Returns

This action returns nothing.

Example

This example shows how to replace all the existing segments in a curve with new ones.  $srcCrv(1) is referencing an existing source curve.  $seg(1) and $seg(2) are referencing existing segments.

Code

$srcCrv(1) replaceAllSegments [list $seg(1) $seg(2)]

getPosition

$srcCrv getPosition ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value

This action gets a position on a curve in the defining space of the curve.

Parameters

-parameterThis optional flag is the notification to get the position at a parameter.  The value is a float with the range [0.0, 1.0] or a uv vector with v ignored.  This is the default option.
-controlThis optional flag is the notification to get the position at a control point.  The value is an integer index with the range [1, number of control points].
-arcThis optional flag is the notification to get the position at an arc length.  The value is a normalized float arc length from the start of the curve with the range [0.0, 1.0].
-XThis optional flag is the notification to get the position at a constant x; value is a float constant x coordinate value.
-YThis optional flag is the notification to get the position at a constant y; value is a float constant y coordinate value.
-ZThis optional flag is the notification to get the position at a constant z; value is a float constant z coordinate value.
-closestThis optional flag is the notification to get the closest position; the value is an xyz point, or grid coord.
valueThis parameter is the value to get the position.

Returns

This action returns a point giving the position on the curve which may be in the form “u v dbentity”.

Information

If the curve is defined in model space, an xyz vector will be returned.  If the curve is defined by a database, the position will be returned in database parameter space.

Example

This example shows how to get the position at a constant X value on a curve.  This curve was created on a database entity.  $srcCrv(1) is referencing an existing source curve.

Code

puts [pw::Application getDescription \
[$srcCrv(1) getPosition -X 3]]

Output

curve-1 (0.6,0)

getXYZ

$srcCrv getXYZ ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value

This action gets the model space position on a curve.

Parameters

-parameterThis optional flag is the notification to get the position at a parameter.  The value is a float with the range [0.0, 1.0] or a uv vector with v ignored.  This is the default option.
-controlThis optional flag is the notification to get the position at a control point.  The value is an integer index with the range [1, number of control points].
-arcThis optional flag is the notification to get the position at an arc length.  The value is a normalized float arc length from the start of the curve with the range [0.0, 1.0].
-XThis optional flag is the notification to get the position at a constant x; value is a float constant x coordinate value.
-YThis optional flag is the notification to get the position at a constant y; value is a float constant y coordinate value.
-ZThis optional flag is the notification to get the position at a constant z; value is a float constant z coordinate value.
-closestThis optional flag is the notification to get the closest position; the value is an xyz point, or grid coord.
valueThis parameter is the value to get the position.

Returns

This action returns an XYZ vector.

Example

This example shows how to get the model space position at 3/4 the the length of a curve.  $srcCrv(1) is referencing an existing source curve.

Code

puts [$srcCrv(1) getXYZ -parameter [list 0.75]]

Output

3.75 2.0 0.0

getParameter

$srcCrv getParameter ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value

This action gets a parameter value on a curve.

Parameters

-parameterThis optional flag is the notification to get the position at a parameter.  The value is a float with the range [0.0, 1.0] or a uv vector with v ignored.  This is the default option.
-controlThis optional flag is the notification to get the position at a control point.  The value is an integer index with the range [1, number of control points].
-arcThis optional flag is the notification to get the position at an arc length.  The value is a normalized float arc length from the start of the curve with the range [0.0, 1.0].
-XThis optional flag is the notification to get the position at a constant x; value is a float constant x coordinate value.
-YThis optional flag is the notification to get the position at a constant y; value is a float constant y coordinate value.
-ZThis optional flag is the notification to get the position at a constant z; value is a float constant z coordinate value.
-closestThis optional flag is the notification to get the closest position; the value is an xyz point, or grid coord.
valueThis parameter is the value to get the position.

Returns

This action returns the float parameter of the curve.

Information

The -parameter value option only returns the given value clamped to [0.0, 1.0].  It is included for consistency with other commands.

Example

This example shows how to get the parameter value of a grid point on a curve.  $srcCrv(1) is referencing an existing source curve.

Code

puts [$srcCrv(1) getParameter -grid 2]

Output

0.25

getLength

$srcCrv getLength ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value

This action gets the curve length from the beginning to a given location.

Parameters

-parameterThis optional flag is the notification to get the position at a parameter.  The value is a float with the range [0.0, 1.0] or a uv vector with v ignored.  This is the default option.
-controlThis optional flag is the notification to get the position at a control point.  The value is an integer index with the range [1, number of control points].
-arcThis optional flag is the notification to get the position at an arc length.  The value is a normalized float arc length from the start of the curve with the range [0.0, 1.0].
-XThis optional flag is the notification to get the position at a constant x; value is a float constant x coordinate value.
-YThis optional flag is the notification to get the position at a constant y; value is a float constant y coordinate value.
-ZThis optional flag is the notification to get the position at a constant z; value is a float constant z coordinate value.
-closestThis optional flag is the notification to get the closest position; the value is an xyz point, or grid coord.
valueThis parameter is the value to get the position.

Returns

This action returns the float curve length.

Information

The -arc value option converts value from a normalized to a non-normalized length.  It is included for consistency with other commands.

Example

This example shows how to get the length along a curve from the the point on the curve closest to the given point.  $srcCrv(1) is referencing an existing source curve.

Code

puts [$srcCrv(1) getLength -closest "4.5 1 0"]

Output

6.985033540042618

getParameters

$srcCrv getParameters ?< -X | -Y | -Z >? value

This action gets the parameters at which the curve intersects the value.

Parameters

-XThis optional flag is the notification to get the position at a constant x; value is a float constant x coordinate value.
-YThis optional flag is the notification to get the position at a constant y; value is a float constant y coordinate value.
-ZThis optional flag is the notification to get the position at a constant z; value is a float constant z coordinate value.
valueThis parameter is the value to get the position.

Returns

This action returns an array of parameters.

Example

This example shows how to get parameters where this curve crosses Y-axis at 0.5.  $srcCrv(1) is referencing an existing source curve.

Code

puts [$srcCrv(1) getParameters -Y .5]

Output

0.17637560670204108 0.2778605205775764 0.692205316990254

getTotalLength

$srcCrv getTotalLength ?-constrained constrainedVar?

This action gets the total length of the curve.

Parameters

-constrained constrainedVarThis optional parameter is the string name of a variable to receive the length of the this entity, that is constrained to database entities.

Returns

This action returns float length with the range [0.0, infinity).

Example

This example shows how to get the total length of a connecter, plus the length of the part constrained to a database entity.  $srcCrv(1) is referencing an existing source curve.

Code

puts [$srcCrv(1) getTotalLength -constrained onDB]
puts $onDB

Output

10.012756135615804
5.0
pw::SourceCurve create
This action creates a new source curve object.
pw::SourceCurve getBestSegment -start startVar -end endVar start_points end_points
This action given two point-lists, returns a segment type, a start point, and an end point that represent the best segment between the given points.
$srcCrv getSegmentCount
This action gets the number of segments in this curve.
$srcCrv getSegment ?-copy? index
This action gets the segment at the given index.
$srcCrv setSegment index segment
This action sets the segment at the given index.
$srcCrv addSegment segment
This action adds the segment to the end of the segments in the curve.
$srcCrv insertSegment index segment
This action inserts the segment at the given index.
$srcCrv removeSegment < index | segment >
This action removes a segment from the curve.
$srcCrv removeAllSegments
This action removes all of the segments from the curve.
$srcCrv replaceAllSegments segments
This action replaces all of the segments in the curve.
$srcCrv getPosition ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value
This action gets a position on a curve in the defining space of the curve.
$srcCrv getXYZ ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value
This action gets the model space position on a curve.
$srcCrv getParameter ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value
This action gets a parameter value on a curve.
$srcCrv getLength ?< -parameter | -control | -arc | -X | -Y | -Z | -closest >? value
This action gets the curve length from the beginning to a given location.
$srcCrv getParameters ?< -X | -Y | -Z >? value
This action gets the parameters at which the curve intersects the value.
$srcCrv getTotalLength ?-constrained constrainedVar?
This action gets the total length of the curve.
Base type for all glyph types
Entity type
Base type for all source entities
SourceCurve type
A string is an array of characters.
An integer is a whole number.
A point is a position either in model space or database parameter space.
Connector and Curve segment type
A float is a fractional number.
A vector is a list of float values.
A coord is a position in grid space.