Basic workflow
-
As the profiles can have many components, the 2D (and 3D) representation is based on a loop, where the number of runs is equal with the number of profile components.
In each run, attributes of the current component can be reached with the “Profile_component_info” requests, and the component can be drawn with a POLY2_B{6} command, which can handle different pens and line types for each side. The geometry should be used with put-get method, which helps to convert the original geometry data to be used with the command. Some variables are coming from the master script, see the earlier chapter:
_nComponents
, _bShowPart[]
, _profileGeometryRawData
, _idxStartPoints[]
, _idxEndPoints[].
How to draw with poly2_b{6}
for _iComp = 1 to _nComponents
if _bShowPart[_iComp] then
! --- Get contour pen ---
_pen = 1
n = REQUEST{4} ("Profile_component_info", myProfileIdx, _iComp, "gs_profile_outlinepen", _pen)
! --- Get building material and cut fill attributes ---
_bmat = 1
n = REQUEST{4} ("Profile_component_info", myProfileIdx, _iComp, "gs_profile_bmat", _bmat)
n = REQUEST{2} ("Building_Material_info", _bmat, "gs_bmat_cutfill_properties", _fillType, _fillPen, _fillBgPen)
! --- Get the pens and linetypes for the polygon edges ---
dim _currPens[]
dim _currLineTypes[]
n = REQUEST{4} ("Profile_component_info", myProfileIdx, _iComp, "gs_profile_comp_pens", _currPens)
n = REQUEST{4} ("Profile_component_info", myProfileIdx, _iComp, "gs_profile_comp_linetypes", _currLineTypes)
fill _fillType
pen _pen
! --- Store parameters for the poly command ---
_penLtIdx = 1
for _i = _idxStartPoints[_iComp] to _idxEndPoints[_iComp] step 5
put _profileGeometryRawData[_i], ! xn
_profileGeometryRawData[_i + 1], ! yn
_profileGeometryRawData[_i + 2] + _profileGeometryRawData[_i + 4], ! status values : edgeVisible + additionalStatus
_currPens[_penLtIdx], ! pen
_currLineTypes[_penLtIdx] ! linetype
_penLtIdx = _penLtIdx + 1
next _i
! --- Draw the component ---
poly2_b{6} (NSP/5), 1+2+4, 1, 0, ! cut fill, 0 distortion flag
_fillPen, _fillBgPen,
0, 0, ! fill origin
0.1, 0.1, 0.2, 0.2, ! mxx, mxy, myx, myy
0.1, ! gradientInnerRadius
get (NSP)
endif
next _iComp
3D modelling is explained in the following chapter.