The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

GDL language and objects, API, Add-ons, Script…

Moderators: Barry Kelly, Karl Ottenstein, LaszloNagy, ejrolon, gkmethy

What is your opinion about this Wish?

Essential
3
60%
Important
1
20%
Average
No votes
0%
Not Important
No votes
0%
Not Needed
1
20%
User avatar
By Hmooslechner
#298714
First - thank You for enabling profiles in GDL!

But: Its implemented much too complex!

There are a lots of new variables, Script-Texts two different schript-sections nescessary to get one single profile to work.

Please : Make it simpler for us poor GDL-scripters!

When the Profile-Variable is defines and set - just let it use in the GDL-commands directly without the need for so much script-text.

Now - needed in Master-script:
Code: Select all
if GLOB_SCRIPT_TYPE = 2 or GLOB_SCRIPT_TYPE = 3 then
	_nComponents = 0
	dim _componentTypes[]

	n = REQUEST{2} ("Profile_components", myProfileIdx, _nComponents, _componentTypes)

	n2 = REQUEST ("Profile_default_boundingbox",  myProfileIdx, _xmin, _ymin, _xmax, _ymax)


	if n then
		dim _bShowPart[]
		_needRequestDetails = 0
	
		for _i = 1 to _nComponents
			_bShowPart[_i] = 1    
			  if GLOB_STRUCTURE_DISPLAY = 1 AND _componentTypes[_i] <> COMPTYPE_CORE then _bShowPart[_i] = 0   ! GLOB_STRUCTURE_DISPLAY: 0 – entire structure, 1 – core only, 2 – without finishes
			  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
			dim _profileGeometryRawData[]
			n = REQUEST ("Profile_default_geometry", myProfileIdx, _profileGeometryRawData)		! n1, n2, ..., nn, x11, y11,s11 
	
			dim _contStartPoints[]
			dim _contEndPoints[]
			_contStartPoints[1] = _nComponents + 1
			for _i = 2 to _nComponents
				_contStartPoints[_i] = _contStartPoints[_i - 1] + _profileGeometryRawData[_i - 1] * 5
				_contEndPoints[_i-1] = _contStartPoints[_i] - 1
			next _i
			_contEndPoints[_nComponents] = vardim1(_profileGeometryRawData)
		endif
	endif
endif

Needed in 3D-Script:
Code: Select all
if n then
	for _iComp = 1 to _nComponents

        if _bShowPart[_iComp] then
        	dim _currSurfaces[]
        	n = REQUEST{3} ("Profile_component_info", myProfileIdx, _iComp, "gs_profile_comp_surfaces", _currSurfaces)

         	_bmat = 1
        	_surface = 1
        	_pen = 1
        	n = REQUEST{3} ("Profile_component_info", myProfileIdx, _iComp, "gs_profile_bmat", _bmat)
			n = REQUEST{3} ("Profile_component_info", myProfileIdx, _iComp, "gs_profile_surface", _surface)
			n = REQUEST{3} ("Profile_component_info", myProfileIdx, _iComp, "gs_profile_outlinepen", _pen)

            building_material _bmat
            pen _pen

				put (_contEndPoints[_iComp] - _contStartPoints[_iComp] + 1) / 5,	!number of contour control points
					7,				! number of route points - fixed in this example
					1 + 2 + 16 + 32	! mask

				_surfIdx = 1
				for _i = _contStartPoints[_iComp] to _contEndPoints[_iComp] step 5
					put _profileGeometryRawData[_i], 
						_profileGeometryRawData[_i + 1], 
						_profileGeometryRawData[_i + 2] + _profileGeometryRawData[_i + 3] + _profileGeometryRawData[_i + 4], 
						_currSurfaces[_surfIdx]	
						
					_surfIdx = _surfIdx + 1
				next _i

				! put points for route
				put 0, 0, -1, 90,
					0, 0, 0, 90,
					0, 0, 1, 90,
					1, 0, 1, 90,
					1, 0, 2, 180,
					1, 1, 2, 180,
					1, 1, 3, 180

				tube{2} _surface, _surface, _surface,
					get (NSP)

        endif
	next _iComp
endif

What it should look like:
Code: Select all

tube{2} _surface, _surface, _surface,
	get (NSP) !!! just the root
   !!!! then some type of new command to use the profile parameter with a single line...