GDL
About building parametric objects with GDL.
SOLVED!

How do I use the Profile parameter in a GDL script.

Anonymous
Not applicable
I'm new to GDL, I can create basic shapes and write basic code, like IF statements, but I can't figure out how to create a shape using the Profile parameter to inform the geometry. Any help would be most appreciated.
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Lingwisyer
Guru
If GLOB_SCRIPT_TYPE = 2 or GLOB_SCRIPT_TYPE = 3 or GLOB_SCRIPT_TYPE = 4 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 GLOB_SCRIPT_TYPE <> 5 then
		If rafPro = "Complex" then
				ProWidth = abs(_xMax - _xMin)
				ProHeight = abs(_yMax - _yMin)
				SquareV2 = ProHeight / ( cos(phi) )
		endIf
	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

There is a sample object somewhere by Graphisoft, but it appears to be alluding me...

There is also an object shared in this thread which is in regards to having multiple Complex Profiles in a single object.



Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 

View solution in original post

4 REPLIES 4
Solution
Lingwisyer
Guru
If GLOB_SCRIPT_TYPE = 2 or GLOB_SCRIPT_TYPE = 3 or GLOB_SCRIPT_TYPE = 4 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 GLOB_SCRIPT_TYPE <> 5 then
		If rafPro = "Complex" then
				ProWidth = abs(_xMax - _xMin)
				ProHeight = abs(_yMax - _yMin)
				SquareV2 = ProHeight / ( cos(phi) )
		endIf
	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

There is a sample object somewhere by Graphisoft, but it appears to be alluding me...

There is also an object shared in this thread which is in regards to having multiple Complex Profiles in a single object.



Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660 
David Maudlin
Virtuoso
Lingwisyer wrote:
There is a sample object somewhere by Graphisoft, but it appears to be alluding me...
Check out this thread: Profiles in GDL.

David
David Maudlin / Architect
www.davidmaudlin.com
Digital Architecture
AC27 USA • iMac 27" 4.0GHz Quad-core i7 OSX11 | 24 gb ram • MacBook Pro M3 Pro | 36 gb ram OSX14
Anonymous
Not applicable
Thanks for the help. Lingwisyer, I couldn't get the code you posted to work but the one in the link regarding 'multiple Complex Profiles' works great. Thank you:
Lingwisyer wrote:
There is also an object shared in this thread which is in regards to having multiple Complex Profiles in a single object.
Lingwisyer
Guru
For the script I posted, you need to add myProfileIdx as a profile variable into the parameters list.

I also accidentally left in a section that was specific to my script...

Ignore:

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



Ling.

AC22-23 AUS 7000Help Those Help You - Add a Signature
Self-taught, bend it till it breaksCreating a Thread
Win10 | R5 2600 | 16GB | GTX1660