cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
GDL
About building parametric objects with GDL.

I want to add more variable values on a handicapped parking area object

soo
Contributor

Hello, everyone.

I'm making a handicapped parking area object.

I've learned how to grid the parking area from the basic object of Archicad 27 now.

but I wanna put more options into this object.

right now, I just put a thickness of line.

 

화면 캡처 2024-06-13 171051.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

i wanna put two more parameters A, B for thickness of line and empty space for a wide range of applications

 

<MASTER SCRIPT>

 

 

if GLOB_SCRIPT_TYPE = 2 then
edgeStatus = 1
else
edgeStatus = 15
endif

goto "master_end"


"detailed empty points":
_innerA = A - 2 * lineWidth
_innerB = B - 2 * lineWidth
_widthonLine = sqr(2) * lineWidth
_segmentNum = int((_innerA + _innerB) / _widthonLine) + 1


dim rightPoints[][]
dim leftPoints[][]

for i = 1 to _segmentNum
rightPoints[i][1] = 0
rightPoints[i][2] = 0
leftPoints[i][1] = 0
leftPoints[i][2] = 0
next i 

rightPoints[1][1] = lineWidth + EPS
rightPoints[1][2] = lineWidth + EPS
leftPoints[1][1] = lineWidth + EPS
leftPoints[1][2] = lineWidth + EPS


_side = 1
_rightCornerPoint = -1
_leftCornerPoint = -1


for i = 2 to _segmentNum
if _side = 1 then
if (rightPoints[i-1][1] + _widthonLine) - (_innerA + lineWidth) < 0 | \
abs((rightPoints[i-1][1] + _widthonLine) -_innerA) < EPS then 
rightPoints[i][1] = rightPoints[i-1][1] + _widthonLine
rightPoints[i][2] = lineWidth
else
_side = 2
_rightCornerPoint = i
rightPoints[i][1] = _innerA + lineWidth
rightPoints[i][2] = _widthonLine - (_innerA - rightPoints[i-1][1]) 
endif
else
rightPoints[i][1] = _innerA + lineWidth
rightPoints[i][2] = rightPoints[i-1][2] +  _widthonLine

endif
next i

_side = 1
for i = 2 to _segmentNum
if _side = 1 then
if (leftPoints[i-1][2] + _widthonLine) - (_innerB + lineWidth) < 0 | \
abs((leftPoints[i-1][2] + _widthonLine) - (_innerB + lineWidth)) < EPS then 
leftPoints[i][2] = leftPoints[i-1][2] + _widthonLine
leftPoints[i][1] = lineWidth
else
_side = 2
_leftCornerPoint = i
leftPoints[i][1] = _widthonLine - (_innerB - leftPoints[i-1][2])
leftPoints[i][2] = _innerB + lineWidth
endif
else
leftPoints[i][1] = leftPoints[i-1][1] +  _widthonLine
leftPoints[i][2] = _innerB + lineWidth
endif
next i

if abs(rightPoints[i-1][1] - leftPoints[i-1][1]) > EPS & \
abs(rightPoints[i-1][2] - leftPoints[i-1][2]) > EPS then
rightPoints[i][1] = _innerA + lineWidth
rightPoints[i][2] = _innerB + lineWidth - EPS
leftPoints[i][1] = _innerA + lineWidth - EPS
leftPoints[i][2] = _innerB + lineWidth 
endif

put A ! x size
put B ! y size

_CornerPointNum = 0
for i = 2 to vardim1(rightPoints) step 2
if i = _rightCornerPoint then _CornerPointNum = _CornerPointNum + 1
if i = _leftCornerPoint then _CornerPointNum = _CornerPointNum + 1
next i

put 5*(int(vardim1(rightPoints)/2)+1) + _CornerPointNum ! nFistPolyPoints

put 0, 0, edgeStatus,
A, 0, edgeStatus,
A, B, edgeStatus,
0, B, edgeStatus,
0, 0, -1

for i = 2 to vardim1(rightPoints) step 2
put rightPoints[i-1][1],rightPoints[i-1][2], edgeStatus
if i = _rightCornerPoint then
put A - lineWidth, lineWidth, edgeStatus
endif
put rightPoints[i][1],rightPoints[i][2], edgeStatus,
leftPoints[i][1],leftPoints[i][2], edgeStatus
if i = _leftCornerPoint then
put lineWidth, B-lineWidth, edgeStatus
endif

put leftPoints[i-1][1],leftPoints[i-1][2], edgeStatus,
rightPoints[i-1][1],rightPoints[i-1][2], -1


next i

return

"master_end":

 

 

<2D SCRIPT>

 

 

gosub "detailed empty points"

mul2 A/get(1), B/get(1)

pen gs_cont_pen
fill gs_fill_type

while NSP > 0 do
nPolyPoints = get(1)
poly2_b nPolyPoints, 1+2+4, gs_fill_pen, gs_back_pen,
get (nPolyPoints*3)
endwhile

 

I can't find any tips by myself.

Please answer this. thank you.

1 REPLY 1
Pertti Paasky
Expert
I commented one line in the masterscript. and 
Looks reasonable now.
Something wrong with put and get statements.
PerttiPaasky_0-1718272885052.png

 


! <MASTER SCRIPT>
 
EPS=.001
if GLOB_SCRIPT_TYPE = 2 then
edgeStatus = 1
else
edgeStatus = 15
endif
 
goto "master_end"
 
 
"detailed empty points":
_innerA = A - 2 * lineWidth
_innerB = B - 2 * lineWidth
_widthonLine = sqr(2) * lineWidth
_segmentNum = int((_innerA + _innerB) / _widthonLine) + 1
 
 
dim rightPoints[][]
dim leftPoints[][]
 
for i = 1 to _segmentNum
rightPoints[i][1] = 0
rightPoints[i][2] = 0
leftPoints[i][1] = 0
leftPoints[i][2] = 0
next i
 
rightPoints[1][1] = lineWidth + EPS
rightPoints[1][2] = lineWidth + EPS
leftPoints[1][1] = lineWidth + EPS
leftPoints[1][2] = lineWidth + EPS
 
 
_side = 1
_rightCornerPoint = -1
_leftCornerPoint = -1
 
 
for i = 2 to _segmentNum
if _side = 1 then
if (rightPoints[i-1][1] + _widthonLine) - (_innerA + lineWidth) < 0 | \
abs((rightPoints[i-1][1] + _widthonLine) -_innerA) < EPS then
rightPoints[i][1] = rightPoints[i-1][1] + _widthonLine
rightPoints[i][2] = lineWidth
else
_side = 2
_rightCornerPoint = i
rightPoints[i][1] = _innerA + lineWidth
rightPoints[i][2] = _widthonLine - (_innerA - rightPoints[i-1][1])
endif
else
rightPoints[i][1] = _innerA + lineWidth
rightPoints[i][2] = rightPoints[i-1][2] +  _widthonLine
 
endif
next i
 
_side = 1
for i = 2 to _segmentNum
if _side = 1 then
if (leftPoints[i-1][2] + _widthonLine) - (_innerB + lineWidth) < 0 | \
abs((leftPoints[i-1][2] + _widthonLine) - (_innerB + lineWidth)) < EPS then
leftPoints[i][2] = leftPoints[i-1][2] + _widthonLine
leftPoints[i][1] = lineWidth
else
_side = 2
_leftCornerPoint = i
leftPoints[i][1] = _widthonLine - (_innerB - leftPoints[i-1][2])
leftPoints[i][2] = _innerB + lineWidth
endif
else
leftPoints[i][1] = leftPoints[i-1][1] +  _widthonLine
leftPoints[i][2] = _innerB + lineWidth
endif
next i
 
if abs(rightPoints[i-1][1] - leftPoints[i-1][1]) > EPS & \
abs(rightPoints[i-1][2] - leftPoints[i-1][2]) > EPS then
rightPoints[i][1] = _innerA + lineWidth
rightPoints[i][2] = _innerB + lineWidth - EPS
leftPoints[i][1] = _innerA + lineWidth - EPS
leftPoints[i][2] = _innerB + lineWidth
endif
 
put A ! x size
put B ! y size
 
_CornerPointNum = 0
for i = 2 to vardim1(rightPoints) step 2
if i = _rightCornerPoint then _CornerPointNum = _CornerPointNum + 1
if i = _leftCornerPoint then _CornerPointNum = _CornerPointNum + 1
next i
 
! put 5*(int(vardim1(rightPoints)/2)+1) + _CornerPointNum ! nFistPolyPoints
 
put 0, 0, edgeStatus,
A, 0, edgeStatus,
A, B, edgeStatus,
0, B, edgeStatus,
0, 0, -1
 
for i = 2 to vardim1(rightPoints) step 2
put rightPoints[i-1][1],rightPoints[i-1][2], edgeStatus
if i = _rightCornerPoint then
put A - lineWidth, lineWidth, edgeStatus
endif
put rightPoints[i][1],rightPoints[i][2], edgeStatus,
leftPoints[i][1],leftPoints[i][2], edgeStatus
if i = _leftCornerPoint then
put lineWidth, B-lineWidth, edgeStatus
endif
 
put leftPoints[i-1][1],leftPoints[i-1][2], edgeStatus,
rightPoints[i-1][1],rightPoints[i-1][2], -1
 
 
next i
 
return
 
"master_end":
 
! <2D SCRIPT>
 
gosub "detailed empty points"
 
mul2 A/get(1), B/get(1)
 
pen gs_cont_pen
fill gs_fill_type
 
while NSP > 0 do
nPolyPoints = nsp/3   !get(1)
poly2_b nPolyPoints, 1+2+4, gs_fill_pen, gs_back_pen, get (nPolyPoints*3)

endwhile
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!