Design forum
cancel
Showing results for 
Search instead for 
Did you mean: 

GDL: Multiple Complex Profiles

Lingwisyer
Virtuoso
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.
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200
14 REPLIES 14

Nader Belal
Advisor
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,
😉
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.

Lingwisyer
Virtuoso
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.

!!! 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.
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

Nader Belal
Advisor
I see that you didn't specify that you need to extract complex profile geometries when you asked the question
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.

Lingwisyer
Virtuoso
Assumption based on my image of two extruded profiles, one of which had failed to generate properly...
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

Hmooslechner
Expert
Why not drawing all the forms into one single profile?
AC5.5-AC25EduAut, PC-Win10, MacbookAirM1

Nader Belal
Advisor
@Hmooslechner,

Future maintenance and change by the manufacturer.
A good friend of mine have once told me that I´m so brute that I´m capable of creating a GDL script capable of creating GDLs.

Lingwisyer
Virtuoso
Flexibility of use. Object in image was scripted with duplication and offset for simplicity of testing.
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

Hmooslechner
Expert
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?
AC5.5-AC25EduAut, PC-Win10, MacbookAirM1

Lingwisyer
Virtuoso
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.
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

licheng6095
Newcomer
Hello everyone! I wrote a simple script by archicad 22

This is the main code

dim pfsj2[]    
pen 1
	
for i = 1 to MULTIPLECO_A
	jdsl=0 		    !Calculate the number of points
	!----------------------------get profile number and geometry
	n = request{2}("Profile_components", myProfileIdx, jmsl, jglx)   !profile number
	n = REQUEST ("Profile_default_geometry", myProfileIdx, pfsj2)    !profile geometry
	if jmsl>0 then 
		for i2 = 1 to jmsl
			!------------------------------------Collection point
	        n = REQUEST{3} ("Profile_component_info", myProfileIdx, i2, "gs_profile_surface", _surface) !MAT
			for i3 = 1 to pfsj2[i2]
				jdsl=jdsl+1 								!Calculate the number of points
				x=pfsj2[jmsl+5*jdsl-5+1]
				y=pfsj2[jmsl+5*jdsl-5+2]
	           if  pfsj2[jmsl+5*jdsl]=900  then sn =  900  
	           if  pfsj2[jmsl+5*jdsl]=4000 then sn =  4015
	           if  pfsj2[jmsl+5*jdsl]=-1   then sn =  -1
	           if  pfsj2[jmsl+5*jdsl]=0    then sn =  15  
				put x,y,sn,_surface
			next i3
			!------------------------------------MODEL
	        SPRISM_{4}  _surface,_surface,_surface,1+2+4+8, 
				        nsp/4,
				        0, 0,    0, 1,1,0,    
				        0, 0,    0, 1,0,0,
				        get(nsp)
		next i2
	endif
next i
archicad 21/ windows 10/ architect

Lingwisyer
Virtuoso
The issue with using an array in the parameters to define the profile is that the selection can only be done by index rather than by drop down and since you cannot view the index numbers anywhere other than the Attribute Manager, this is not a viable option. If we were able to use requests in the Parameter Script this could have worked as then you could have a second and third dummie parameter with one being a standard profile selection, and the other displaying the index number of the selected profile, but alas, this is not the case...

If you can modify parameter arrays via the UI Script this might be possible, as requests work there. The extra work here may as well be used to duplicate standard profile parameters with additional HIDEPARAMETER statements.



Ling.
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

licheng6095
Newcomer
Lingwisyer wrote:
The issue with using an array in the parameters to define the profile is that the selection can only be done by index rather than by drop down and since you cannot view the index numbers anywhere other than the Attribute Manager, this is not a viable option. If we were able to use requests in the Parameter Script this could have worked as then you could have a second and third dummie parameter with one being a standard profile selection, and the other displaying the index number of the selected profile, but alas, this is not the case...

If you can modify parameter arrays via the UI Script this might be possible, as requests work there. The extra work here may as well be used to duplicate standard profile parameters with additional HIDEPARAMETER statements.



Ling.
archicad 21/ windows 10/ architect

Lingwisyer
Virtuoso
Well, that was easy enough. I have not played around with the UI Script much so I was not sure how it would work.
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

Lingwisyer
Virtuoso
So, the block that we usually include in the Master Script is almost entirely regarding structural function? With the rawprofilegeometry being the break down of the profile into it's structural components?

If that is the case, for many uses, the only bit that might be useful is the bounding box request. A 26 line reduction per profile.



Ling.
AC18-23 AUS 7000
Self-taught, bend it till it breaks.
Win10 | E5620 x 2 | 24GB | K2200

Didn't find the answer? Start a new discussion

Labels

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!