Request the basic properties
Name of the Profile
-
With this request you can get the name of a profile by it’s index.
n = REQUEST ("Name_of_Profile", index, name)
Can not be used in parameter script. Details in GDL Reference Guide.
Number of components and their types
-
Both in 2D and 3D profile visualization you need the number of profile components first using the profile index or name.
n = REQUEST ("Profile_components", name_or_index, nComponents, compType1, compType2, ..., compTypen)
Can not be used in parameter script. Details in GDL Reference Guide.
This request returns the number (nComponents) and types (compTypen) of the profile components.
Coordinates of the original bounding box
Optionally you can get the profile’s bounding box with the “Profile_default_boundingbox” request:
n = REQUEST ("Profile_default_boundingbox", name_or_index, xmin, ymin, xmax, ymax)
Can not be used in parameter script. Details in GDL Reference Guide.
Request the details of geometry
How to set the Profile’s geometry?
The next step should be getting the geometry: this is a bit tricky, as all the components’ geometry and status information is returned in one single array with the “Profile_default_geometry” request:
n = REQUEST ("Profile_default_geometry", name_or_index, n1, n2, ..., nm,
x11, y11, edgeVisible11, vertEdgeVisible11, additionalStatus11, ...,
x1n1, y1n1, edgeVisible1n1, vertEdgeVisible1n1, additionalStatus1n1,
x21, y21, edgeVisible21, vertEdgeVisible21, additionalStatus21, ...,
x2n2, y2n2, edgeVisible2n2, vertEdgeVisible2n2, additionalStatus2n2, ...,
xm1, ym1, edgeVisiblem1, vertEdgeVisiblem1, additionalStatusm1, ...,
xmnm, ymnm, edgeVisiblemnm, vertEdgeVisiblemnm, additionalStatusmnm)
Can not be used in parameter script. Details in GDL Reference Guide.
How to split the default geometry array to use it for modelling?
-
In the following code we use an index of a profile which is stored in our profile parameter
myProfileIdx
. We get the profile component types, then check if there is any component to be drawn by the libpart based on the current partial structure display settings and the component types.
We set up an empty array called
_profileGeometryRawData
, and fill it with the default geometry request.To use it for drawing components, we need to split this single array into components. The simplest way is to collect each component’s start and end indices, storing them in two arrays:
This example is recommended to be used in the Master Script.
_idxStartPoints[], _idxEndPoints[]
.This example is recommended to be used in the Master Script.
COMPTYPE_CORE = 0
COMPTYPE_FINISH = 1
COMPTYPE_OTHER = 2
if GLOB_SCRIPT_TYPE = 2 or GLOB_SCRIPT_TYPE = 3 then
! --- Get the number of components and their types ---
_nComponents = 0
dim _componentTypes[]
n = REQUEST ("Profile_components", myProfileIdx, _nComponents, _componentTypes)
if n then
dim _bShowPart[]
_needRequestDetails = 0
! --- Check the current partial structure display settings and the component types ---
! ---- is there any part to be drawn by the script?
! ---- GLOB_STRUCTURE_DISPLAY: 0 – entire structure, 1 – core only, 2 – without finishes
for _i = 1 to _nComponents
_bShowPart[_i] = 1
if GLOB_STRUCTURE_DISPLAY = 1 AND _componentTypes[_i] <> COMPTYPE_CORE then _bShowPart[_i] = 0
if GLOB_STRUCTURE_DISPLAY = 2 AND _componentTypes[_i] = COMPTYPE_FINISH then _bShowPart[_i] = 0
if _bShowPart[_i] then _needRequestDetails = 1
next _i
if _needRequestDetails then
! --- Get the profile components geometry ---
dim _profileGeometryRawData[]
n = REQUEST ("Profile_default_geometry", myProfileIdx, _profileGeometryRawData)
! --- calculate indices to split up the original data into components ---
dim _idxStartPoints[]
dim _idxEndPoints[]
_idxStartPoints[1] = _nComponents + 1
_numPropertybyNodes = 5
for _i = 2 to _nComponents
_numCompNodes = _profileGeometryRawData[_i - 1]
_idxStartPoints[_i] = _idxStartPoints[_i - 1] + _numCompNodes * _numPropertybyNodes
_idxEndPoints[_i-1] = _idxStartPoints[_i] - 1
next _i
_idxEndPoints[_nComponents] = vardim1(_profileGeometryRawData)
endif
endif
endif
Each point has 5 properties: x coordinate, y coordinate, 2 visibility masks, and and additional status code. We will use them in the following chapters.