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

Learn to manage BIM workflows and create professional Archicad templates with the BIM Manager Program.

GDL
About building parametric objects with GDL.
SOLVED!

Composite Skin Label for Core Material Only

sikho
Contributor

Hello, I am trying to write a GDL script for a composite Skin label that will only list the core material name.

I am running into problems with the below IF statement.  It should be "If the wall_skins_params skin status is 1 then my variable 'elemBMATData'  is the same value as the global variable 'wall_skins_bMat_names'"

 

IF wall_skins_params [thisSkin][6] = 1 THEN
 elemBMatData = wall_skins_bMat_names
ENDIF

 

Can anyone offer advice on why this doesn't work ?

The next steps will be to write a script that only returns values for the finish skin status materials.

 

-I'm running Archicad 25 on a windows 10 computer.

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Podolsky
Ace

You need to run a loop:

 

DIM elemBMatData[] : k=1 
FOR i=1 TO WALL_SKINS_NUMBER
        IF WALL_SKINS_PARAMS[i][6]>0 THEN
                  elemBMatData[k]=WALL_SKINS_BMAT_NAMES[i] : k=k+1
        ENDIF
NEXT i 

View solution in original post

2 REPLIES 2
Solution
Podolsky
Ace

You need to run a loop:

 

DIM elemBMatData[] : k=1 
FOR i=1 TO WALL_SKINS_NUMBER
        IF WALL_SKINS_PARAMS[i][6]>0 THEN
                  elemBMatData[k]=WALL_SKINS_BMAT_NAMES[i] : k=k+1
        ENDIF
NEXT i 
sikho
Contributor

That's excellent. Thank you Podolsky.

 

For anyone else who is interested, I've posted the working code below. Copy and paste into the 2D window of the GDL Editor:

 

GOSUB "BuildingElement - getCompositeData" !Go to the subroutine that gets the skin names from the building element
GOSUB "CompositeData - draw2D" !Go to the subroutie that creates the actual label on the drawing
END !You're done, nice job.



!--------------------------------------------------------------------------------------------------------------------------------------
!This is the subroutine that creates the actual label on the drawing
!-----------

"CompositeData - draw2D":
GOSUB "CompositeData - defineStyle" !Go to the subroutine that creates the style of the label
GOSUB "CompositeData - getDimensionFormat" !Go to the subroutine that sets the dimension for the label
columnWidth = columnWidth*glob_scale/1000
FOR thisSkin = 1 to elemSkinN !This is the start of a loop that sets up the amount of rows needed based on the number of skins
GOSUB "CompositeData - drawSkinFillText" !Go to the subroutine that inputs the text for the label
textY = textY - lineSpacing
NEXT thisSkin !Looping back around now
RETURN !...and you're done.


!These are the subroutines referenced above:

"CompositeData - defineStyle":
dataTextStyle = 1*dataTextBold + 2*dataTextItalics + 4*dataTextUnderlined
define style "Data Left" dataTextFont, dataTextHeight, 1, dataTextStyle
define style "Data Right" dataTextFont, dataTextHeight, 3, dataTextStyle
lineSpacing = 0 : rrr = request("Height_of_Style", "Data Left", lineSpacing)
lineSpacing = lineSpacing*glob_scale/1000
RETURN

"CompositeData - getDimensionFormat":
linearDimensionFormat = "" : rrr = request("Linear_Dimension", "", linearDimensionFormat)
RETURN

"CompositeData - drawSkinFillText":
skinName = elemBMatData [thisSkin] [1]
style "Data Left"
text2 columnWidth , textY, skinName
RETURN


!-----------
!That's it for creating the actual label, the next part is getting the skin names from the building elements
!=======================================================================================================================================



!--------------------------------------------------------------------------------------------------------------------------------------
!This is the subroutine that gets the skins element from the building element
!-----------

!First we need to figure out what type of building element the label is for and then go to the right part of our code:

"BuildingElement - getCompositeData":
IF (glob_elem_type = eElemTypeWall) THEN GOSUB "Wall - getCompositeData"
IF (glob_elem_type = eElemTypeRoof) THEN GOSUB "Roof - getCompositeData"
IF (glob_elem_type = eElemTypeSlab) THEN GOSUB "Slab - getCompositeData"
RETURN


! To get the skin name from cmposite walls we need:

"Wall - getCompositeData":
elemSkinN =0
FOR i=1 TO WALL_SKINS_NUMBER
IF WALL_SKINS_PARAMS [i] [6] >0 THEN
elemSkinN = elemSkinN +1
ENDIF
NEXT i

DIM elemBMatData[][] : k=1
FOR i=1 TO WALL_SKINS_NUMBER
IF WALL_SKINS_PARAMS[i][6]>0 THEN
elemBMatData[k]=WALL_SKINS_BMAT_NAMES[i] : k=k+1
ENDIf
NEXT i
RETURN


! To get the skin name from cmposite roofs we need:


"Roof - getCompositeData":
elemSkinN =0
FOR i=1 TO ROOF_SKINS_NUMBER
IF ROOF_SKINS_PARAMS [i] [6] >0 THEN
elemSkinN = elemSkinN +1
ENDIF
NEXT i

DIM elemBMatData[][] : k=1
FOR i=1 TO ROOF_SKINS_NUMBER
IF ROOF_SKINS_PARAMS[i][6]>0 THEN
elemBMatData[k]=ROOF_SKINS_BMAT_NAMES[i] : k=k+1
ENDIf
NEXT i
RETURN


! To get the skin name from cmposite slabs we need:

"Slab - getCompositeData":
elemSkinN =0
FOR i=1 TO SLAB_SKINS_NUMBER
IF SLAB_SKINS_PARAMS [i] [6] >0 THEN
elemSkinN = elemSkinN +1
ENDIF
NEXT i

DIM elemBMatData[][] : k=1
FOR i=1 TO SLAB_SKINS_NUMBER
IF SLAB_SKINS_PARAMS[i][6]>0 THEN
elemBMatData[k]=SLAB_SKINS_BMAT_NAMES[i] : k=k+1
ENDIf
NEXT i
RETURN

!-----------







And copy and paste this into the Master window:

true = 1
false = 0
eps = 0.0001

!Element Types Enumerator
i = 0 : eElemTypeNone = i
i = 1 : eElemTypeNone = i
i = 2 : eElemTypeObject = i
i = 3 : eElemTypeWindow = i
i = 4 : eElemTypeDoor = i
i = 5 : eElemTypeWall = i
i = 6 : eElemTypeColumn = i
i = 7 : eElemTypeSlab = i
i = 8 : eElemTypeRoof = i
i = 9 : eElemTypeFill = i
i = 10 : eElemTypeMesh = i
i = 11 : eElemTypeZone = i
i = 12 : eElemTypeBeam = i
i = 13 : eElemTypeCWWall = i
i = 14 : eElemTypeCWFrame = i
i = 15 : eElemTypeCWPanel = i
i = 16 : eElemTypeCWJunction = i
i = 17 : eElemTypeCWAccessory = i
i = 18 : eElemTypeShell = i
i = 19 : eElemTypeSkylight = i
i = 20 : eElemTypeMorph = i

!Skin Data Enumerator
i = 1 : eSkinDataFill = i
i = 2 : eSkinDataThick = i
!There is a lot more data available but we only need the first two for this label

dim elemSkinData[][],
elemBMatData[][]

elemSkinN = 0
elemBMatData[1][1] = ""


textY = 0