The Global ARCHICAD Community

Stay informed. Get help. Share your knowledge.

Everything about GDL - Doors/Windows/Objects/Stairs etc. (Example: I created an object that prints an error message in 3D all the time, please help!)

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

User avatar
By Lingwisyer
#296621
Hi all,

Anyone know how to get multiple complex profiles to work within a single object? So far when I try to add a second profile, changing the relevant request definitions, the first profile breaks...



Ling.
Attachments
complex.jpg
User avatar
By Moonlight
#298352
Hi there,

I will post the answer in GDL-forum.

If you're talking about saving your profiles in GDL, the best way I have found and based on the image you have posted is to save their vertices coordinates in the Master Script is by using arrays and parameter buffer, in that case you will only have to be careful but the differences between using "use" and "get".

best regards,
;)
User avatar
By Lingwisyer
#298387
I figured out how to do it last week but looks like I forgot to update here. I believe that my issue was all of the variables that needed to be modified resulting in missing or conflicting variables.

Code: Select all
!!! Pull Complex Profile !!!

COMPTYPE_CORE = 0
COMPTYPE_FINISH = 1
COMPTYPE_OTHER = 2


if GLOB_SCRIPT_TYPE = 2 or GLOB_SCRIPT_TYPE = 3 or GLOB_SCRIPT_TYPE = 5 then
	_nComponents = 0
	dim _componentTypes[]

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

	n2 = REQUEST ("Profile_default_boundingbox",  myProfileIdx, _xMin, _yMin, _xMax, _yMax)

	n3 = REQUEST{4} ("Profile_component_info", myProfileIdx, _nComponents, "gs_profile_surface", bMat_profile)

	If rafPro = "Complex" then
			ProWidth = abs(_xMax - _xMin)
			ProHeight = abs(_yMax - _yMin)
			SquareV2 = ProHeight / ( cos(phi) )
	endIf

	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



!!! Pull Complex Profile 2 !!!

if GLOB_SCRIPT_TYPE = 2 or GLOB_SCRIPT_TYPE = 3 or GLOB_SCRIPT_TYPE = 5 then
	_nComponents2 = 0
	dim _componentTypes2[]

	n = REQUEST{2} ("Profile_components", myProfileIdx2, _nComponents2, _componentTypes2)

	n2 = REQUEST ("Profile_default_boundingbox",  myProfileIdx2, _xMin2, _yMin2, _xMax2, _yMax2)

	if n then
		dim _bShowPart2[]
		_needRequestDetails = 0
	
		for _i2 = 1 to _nComponents2
			_bShowPart2[_i2] = 1    
			  if GLOB_STRUCTURE_DISPLAY = 1 AND _componentTypes2[_i2] <> COMPTYPE_CORE then _bShowPart2[_i2] = 0   ! GLOB_STRUCTURE_DISPLAY: 0 – entire structure, 1 – core only, 2 – without finishes
			  if GLOB_STRUCTURE_DISPLAY = 2 AND _componentTypes2[_i2] = COMPTYPE_FINISH then _bShowPart2[_i2] = 0
			  if _bShowPart2[_i2] then _needRequestDetails = 1
		next _i2
	
		if _needRequestDetails then
			dim _profileGeometryRawData2[]
			n = REQUEST ("Profile_default_geometry", myProfileIdx2, _profileGeometryRawData2)		! n1, n2, ..., nn, x11, y11,s11 
	
			dim _contStartPoints2[]
			dim _contEndPoints2[]
			_contStartPoints2[1] = _nComponents2 + 1
			for _i2 = 2 to _nComponents2
				_contStartPoints2[_i2] = _contStartPoints2[_i2 - 1] + _profileGeometryRawData2[_i2 - 1] * 5
				_contEndPoints2[_i2-1] = _contStartPoints2[_i2] - 1
			next _i2
			_contEndPoints2[_nComponents2] = vardim1(_profileGeometryRawData2)
		endif
	endif
endif

Saving some profiles in GDL would be a good next step, but a bit extra at the moment.



Ling.
User avatar
By Moonlight
#298423
I see that you didn't specify that you need to extract complex profile geometries when you asked the question
User avatar
By Lingwisyer
#298446
Assumption based on my image of two extruded profiles, one of which had failed to generate properly...
User avatar
By Moonlight
#298469
@Hmooslechner,

Future maintenance and change by the manufacturer.
User avatar
By Lingwisyer
#298480
Flexibility of use. Object in image was scripted with duplication and offset for simplicity of testing.
User avatar
By Hmooslechner
#298577
the coding for getting a single profile seems to be "huge" - has anyone of You figured out, how to get it much simpler?

I thought about using profiles in windows-script, but there has to be much more profiles - not only one or two.

Ok - You can copy-paste the code for each extra profile and then rename all the variable-names for each new - but is there really no way to get this simpler?
User avatar
By Lingwisyer
#298578
Could you possibly loop it with a running array or buffer, then pull the desired profiles referencing the array or buffer? Max value being how ever many myProfileIdx[ ] you decided to include in your parameter list.



Ling.