|
SAA_nurbsSurfaceGetCompositeCurves
SAA_nurbsSurfaceGetNbCompositeCurves
Gets the composite trim or projection curves on a NURBS surface.
SAA_nurbsSurfaceGetNbCompositeCurves pscn pelmSrf type nCrvComp
SI_Error SAA_nurbsSurfaceGetCompositeCurves pscn pelmSrf geomtype shapeid type nCrvComp psubelmCrvComp
pelmSrf
A trimmed NURBS surface. Use SAA_AllocElem to allocate NURBS surface.
geomtype
Specifies what geometry you want to work with:
SAA_GEOM_ORIGINAL for the original, non-deformed geometry.
SAA_GEOM_DEFORMED for deformed geometry (if any deformations, such as
lattice, curve, surface, wave, qstretch, flexible envelope, or other custom effects, are
applied to the model). To check if a model is deformed, use SAA_modelIsDeformed.
SAA_GEOM_SHAPE to access shapes (the shapeid argument
specifies which shape).
shapeid
Identifies the shape if the geometry type is SAA_GEOM_SHAPE. To get the
shape identifiers, use SAA_modelGetNbShapes().
type
Specifies what type of composite curves to retrieve.
SAA_TRIMTYPE_PROJECTION
SAA_TRIMTYPE_TRIM
SAA_TRIMTYPE_ALL
nCrvComp
Number of composite curves.
psubelmCrvComp
Returns the composite curves. Use SAA_AllocSubElem to allocate it.
Possible Errors
SAA_nurbsSurfaceGetCompositeCurves returns SI_ERR_WRONG_COUNT
if nbCrvComp does not match the actual number of composite curves. This
return value is a warning, not an error. The function still returns the requested number
of composite curves. If nbCrvComp is too large, the function returns all
composite curves (of the requested type).
See Also
Example
This code fragment shows how to get the composite trim and projection curves for a
NURBS surface, and then get the raw curves for each composite curve.
proc SAA_nurbsSurfaceGetCompositeCurvesExampl {} {
global SAA_Constants
set scene [SAA_AllocScene]
SAA_sceneGetCurrent $scene
package require SW
set surface [SW_name2Element grid1 $scene]
# Get composite curves from a trimmed NURBS surface.
SAA_nurbsSurfaceGetNbCompositeCurves $scene $surface
$SAA_Constants(SAA_TRIMTYPE_ALL) nbCmpCrv
if { $nbCmpCrv == 0 } {
set err "No composite curves."
SAA_statusBarSet err
$SAA_Constants(SAA_WARNING_CODE)
SAA_Free $scene
SAA_Free $surface
return $err
}
set compositeCurves [SAA_AllocSubElem $nbCmpCrv]
set flags [SAA_AllocShort $nbCmpCrv]
set nbRawCurves [SAA_AllocInteger $nbCmpCrv]
SAA_nurbsSurfaceGetCompositeCurves $scene $surface
$SAA_Constants(SAA_GEOM_ORIGINAL) 0 \
$SAA_Constants(SAA_TRIMTYPE_ALL) $nbCmpCrv
$compositeCurves
# Get boundary flags.
SAA_compositeCurveGetBoundaryFlags $scene $surface $nbCmpCrv
$compositeCurves $flags
# Get the raw curves.
SAA_compositeCurveGetNbRawCurves $scene $surface $nbCmpCrv
$compositeCurves $nbRawCurves
set nbTotalRawCurves 0
for { set i 0 } { $i < $nbCmpCrv } { incr i } {
incr nbTotalRawCurves [ access $nbRawCurves $i
]
}
set rawCurves [SAA_AllocSubElem $nbTotalRawCurves]
set nbVertices [SAA_AllocInteger $nbTotalRawCurves]
set degrees [SAA_AllocInteger $nbTotalRawCurves]
SAA_compositeCurveGetRawCurves $scene $surface $nbCmpCrv
$compositeCurves $nbRawCurves $rawCurves
# Get the degree of each raw curve
SAA_rawCurveGetDegree $scene $surface $nbTotalRawCurves $rawCurves
$degrees
# Get the vertices of each raw curve.
SAA_rawCurveGetNbVertices $scene $surface $nbTotalRawCurves $rawCurves
$nbVertices
set nbTotalVertices 0
for { set i 0 } { $i < $nbTotalRawCurves } { incr i } {
incr nbTotalVertices [access
$nbVertices $i]
}
set vertices [SAA_AllocDVector $nbTotalVertices]
SAA_rawCurveGetVertices $scene $surface $nbTotalRawCurves $rawCurves
$nbVertices $vertices
# Dump raw curve info.
set crv 0
set vert 0
for { set i 0 } { $i < $nbCmpCrv } { incr i } {
puts
"compositeCurves${i}:"
set flag [access $flags $i]
if {$flag == 1 } {
puts "Composite
curve is a boundary."
} else {
puts "Composite
curve is a hole."
}
set nbRC [access $nbRawCurves $i]
puts "Number of raw curves = $nbRC"
for { set j 0 } { $j < $nbRC } { incr j;
incr crv} {
puts "Degree =
[access $degrees $crv]"
puts "Nb vertices
in rawCurves\[$j\] [access $nbVertices $crv]"
set nbV [ access
$nbVertices $crv ]
puts
"Coordinates:"
for { set k 0 } { $k
< $nbV } { incr k; incr vert } {
puts
"[access $vertices $vert -x], [access $vertices $vert -y] ,[access $vertices $vert
-z], [access $vertices $vert -w]"
}
}
}
foreach item "$scene $surface $compositeCurves $flags $nbRawCurves
$rawCurves $nbVertices $degrees" {
puts "deleting $item "
SAA_Free $item
}
}
|