Yes, use poly2_ with additional status codes.

**Péter Baksa**

Software Engineer, Library as a Platform

GRAPHISOFT SE, Budapest

Stay informed. Get help. Share your knowledge.

**Moderators:** Karl Ottenstein, LaszloNagy, ejrolon, Barry Kelly, Gordana Radonic, nbalogh, mnguyen, gkmethy, rmasaki, Akos Somorjai, Csilla Mai, Peter Baksa

Yes, use poly2_ with additional status codes.

Software Engineer, Library as a Platform

GRAPHISOFT SE, Budapest

Exactly Peter.

Here it is:

Here it is:

Code: Select all

```
HOTSPOT2 0, 0
FILL MyFill
mul2 1, lTopHeight
mul2 lRightWidth, 1
poly2_b{5} 5, 3, 1, 3, MyFillPen, MyFillBgdPen,
0, 0, 1, 0, 0, 1, 0,
0, 0.5, 32,
0, 0, 32,
0.5, 0, 33,
0, 0, 900,
0, 90, 4032
del 1
mul2 lLeftWidth, 1
poly2_b{5} 5, 3, 1, 3, MyFillPen, MyFillBgdPen,
0, 0, 1, 0, 0, 1, 0,
-0.5, 0, 32,
0, 0, 32,
0, 0.5, 33,
0, 0, 900,
0, 90, 4032
del 1
del 1
mul2 1, lBottomHeight
mul2 lRightWidth, 1
poly2_b{5} 5, 3, 1, 3, MyFillPen, MyFillBgdPen,
0, 0, 1, 0, 0, 1, 0,
0, -0.5, 32,
0, 0, 32,
0.5, 0, 33,
0, 0, 900,
0, -90, 4032
del 1
mul2 lLeftWidth, 1
poly2_b{5} 5, 3, 1, 3, MyFillPen, MyFillBgdPen,
0, 0, 1, 0, 0, 1, 0,
-0.5, 0, 32,
0, 0, 32,
0, -0.5, 33,
0, 0, 900,
0, -90, 4032
del 1
del 1
```

Paulo Henrique Santos, Architect

AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

It is also important to set the proper RESOL or TOLER, the ellipsoid arcs will be approximated with straight segments.

Software Engineer, Library as a Platform

GRAPHISOFT SE, Budapest

Ok. I posted the code without testing it. The dimensions were set for diameters. Here is the correct code with more HOTSPOTS and a proper RESOL command, well pointed by Peter.

Cheers,

Cheers,

Code: Select all

```
RESOL 32 !Curve Resolution (Number of Segments)
lRightWidth = 1.0
lLeftWidth = 1.5
lTopHeight = 2.0
lBottomHeight = 2.5
HOTSPOT2 0, 0
HOTSPOT2 0, lTopHeight
HOTSPOT2 -lLeftWidth, 0
HOTSPOT2 lRightWidth, 0
HOTSPOT2 0, -lBottomHeight
FILL MyFill
mul2 1, lTopHeight
mul2 lRightWidth, 1
poly2_b{5} 5, 3, 1, 3, MyFillPen, MyFillBgdPen,
0, 0, 1, 0, 0, 1, 0,
0, 1, 32,
0, 0, 32,
1, 0, 33,
0, 0, 900,
0, 90, 4032
del 1
mul2 lLeftWidth, 1
poly2_b{5} 5, 3, 1, 3, MyFillPen, MyFillBgdPen,
0, 0, 1, 0, 0, 1, 0,
-1, 0, 32,
0, 0, 32,
0, 1, 33,
0, 0, 900,
0, 90, 4032
del 1
del 1
mul2 1, lBottomHeight
mul2 lRightWidth, 1
poly2_b{5} 5, 3, 1, 3, MyFillPen, MyFillBgdPen,
0, 0, 1, 0, 0, 1, 0,
0, -1, 32,
0, 0, 32,
1, 0, 33,
0, 0, 900,
0, -90, 4032
del 1
mul2 lLeftWidth, 1
poly2_b{5} 5, 3, 1, 3, MyFillPen, MyFillBgdPen,
0, 0, 1, 0, 0, 1, 0,
-1, 0, 32,
0, 0, 32,
0, -1, 33,
0, 0, 900,
0, -90, 4032
del 1
del 1
```

Paulo Henrique Santos, Architect

AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

AC24_INT#3008 / I7 / 16Gb / 512Mb SSD / Windows 10

The other Way around - Maybe you get some ideas by downloading (draw it into Archicad) my GDL from bimcomponents and look at the code?

Its not an elliptical shape, but its for the building-site to be able to construct elliptical shapes there with the most simple method form the 2 centerpoints of an ellipse.

https://bimcomponents.com/GSM/Details/20917

Direct elliptical shapes without muly:

Mathematical - you can get a circle by angle, sin and cos.

To "bend" it in y, just an an factor to y

little example: You need parameter "Steps" with an ammount of about 30 to get good visual results

Its not an elliptical shape, but its for the building-site to be able to construct elliptical shapes there with the most simple method form the 2 centerpoints of an ellipse.

https://bimcomponents.com/GSM/Details/20917

Direct elliptical shapes without muly:

Mathematical - you can get a circle by angle, sin and cos.

To "bend" it in y, just an an factor to y

little example: You need parameter "Steps" with an ammount of about 30 to get good visual results

Code: Select all

```
hotspot2 0,0
hotspot2 a, 0
hotspot2 a, b !! to be able to drag it with the mouse like editable hotspots
dim contpoints[][] !! making the koordinate-Variables for each step-point
angle = 360/steps
add2 a/2, b/2 !! to get it in the middle
for i = 1 to steps
contpoints[i][1] = cos(angle*i)*a/2 !! calculates each shape-point-coordinate
contpoints[i][2] = sin(angle*i)*b/2
! circle2 contpoints[i][1], contpoints[i][2], 0.02 !!! just marking
hotspot2 contpoints[i][1], contpoints[i][2]
next i
!! now having the coordinates a second time around for the lining
line2 a/2, 0, contpoints[1][1], contpoints[1][2] !! first line extra..
for i = 1 to steps-1
line2 contpoints[i][1], contpoints[i][2], contpoints[i+1][1], contpoints[i+1][2]
next i
```

AC5.5-AC21EduAut, PC-Win10, Macbookpro

Is it possible to get an ellipsoidal curve without using mul?

On example 1 on the Additional Status Codes site is a ellipsodial curve but I can't seem to fathom how it works.

Through deleting lines and seeing what happens I've figured out that is has something to do with status code 2000

https://gdl.graphisoft.com/reference-gu ... atus-codes

The reason why I'm asking is because I'm trying to programm a basin with Rounded corners with the ability to adjust the point where it begins to round off. And that for each side

I'm lost

Something like this:

RA , 0 , ST,

A-RA , 0 , ST,

A , RB , ST,

A , B-RB , ST,

A-RA , B , ST,

RA , B , ST,

0 , B-RB , ST,

0 , RB , ST

Any Suggestions?

On example 1 on the Additional Status Codes site is a ellipsodial curve but I can't seem to fathom how it works.

Through deleting lines and seeing what happens I've figured out that is has something to do with status code 2000

https://gdl.graphisoft.com/reference-gu ... atus-codes

The reason why I'm asking is because I'm trying to programm a basin with Rounded corners with the ability to adjust the point where it begins to round off. And that for each side

I'm lost

Something like this:

RA , 0 , ST,

A-RA , 0 , ST,

A , RB , ST,

A , B-RB , ST,

A-RA , B , ST,

RA , B , ST,

0 , B-RB , ST,

0 , RB , ST

Any Suggestions?

Of course you can make any shape and have it parametric in GDL! that's why its so much fun.

Just use simple math to chart the points like this:

you need 3 parameters:

hEllipse = height

wEllipse = width

gs_resol = resolution

you may also want to set the origin as parametric in which case you will need the coordinates:

xPOS = x position

yPOS = y position

Just use simple math to chart the points like this:

you need 3 parameters:

hEllipse = height

wEllipse = width

gs_resol = resolution

you may also want to set the origin as parametric in which case you will need the coordinates:

xPOS = x position

yPOS = y position

Code: Select all

The resolution should depend on the use; if is a small element like plumbing then a resolution of 12 is enough but if its a large design element the you may want to bump the resolution up to around 36, or 72 at most. You should make the resolution accessible in MVO's so it dynamically responds to specific outputs.```
for n = 0 to 360 step 360/gs_resol
put xPOS +wEllipse*cos(n), yPOS +hEllipse*sin(n), 1
next n
poly2_b nsp/3, 1+2+4, gs_fill_pen, gs_back_pen,
get(nsp)
```

Creator of Cadswift's parametric GDL libraries

Creator of Infinite Openings and Component Catalogues

Push the envelope & watch it bend

website: https://cadswift.com.au/

YouTube: https://www.youtube.com/user/CADSwift/playlists

Creator of Infinite Openings and Component Catalogues

Push the envelope & watch it bend

website: https://cadswift.com.au/

YouTube: https://www.youtube.com/user/CADSwift/playlists

Kristian Bursell wrote: ↑Thu Dec 10, 2020 10:52 pm Of course you can make any shape and have it parametric in GDL! that's why its so much fun.Thanks so much for the quick reply!

Just use simple math to chart the points like this:

you need 3 parameters:

hEllipse = height

wEllipse = width

gs_resol = resolution

you may also want to set the origin as parametric in which case you will need the coordinates:

xPOS = x position

yPOS = y position

Code: Select allThe resolution should depend on the use; if is a small element like plumbing then a resolution of 12 is enough but if its a large design element the you may want to bump the resolution up to around 36, or 72 at most. You should make the resolution accessible in MVO's so it dynamically responds to specific outputs.`for n = 0 to 360 step 360/gs_resol put xPOS +wEllipse*cos(n), yPOS +hEllipse*sin(n), 1 next n poly2_b nsp/3, 1+2+4, gs_fill_pen, gs_back_pen, get(nsp)`

How can I get more than one NSP into a Poly?

Because at the end I want to use it in 3d with hprism_ So I need to get all 4 corners in one script.

Code: Select all

```
Gs_resol = 72
for n = 0 to 90 step 360/gs_resol
put A-RA +RA*cos(n), B-RB +RB*sin(n), 1
next n
Poly2_B 8+NSP/3, 7,19,19,
RA , 0 , 1,
A-RA , 0 , 1,
A , RB , 1,
A , B-RB , 1,
get(NSP),
A-RA , B , 1,
RA , B , 1,
0 , B-RB , 1,
0 , RB , 1
```

Graphisoft.PNG (14.14 KiB) Viewed 185 times

Arnaut2604 wrote: ↑Fri Dec 11, 2020 1:46 pm How can I get more than one NSP into a Poly?There is only "one" NSP

NSP is a special type of global parameter/variable which holds the number of values on the stack.

So just `put` everything you need onto the buffer and retrieve it with `get()`.

"Get" empties the buffer while reading its elements, while "use" will leave the values alone and just read them.

By the way: You can use as many "put" operations as you want. They always append.

The stack in GDL is first-in-first-out.

«Furthermore, I consider that Carth...

that should work

PARAMETER script

PARAMETER script

Code: Select all

2D script
```
values "ra" range[0, a/2]
values "rb" range[0, a/b]
```

Code: Select all

Edit: you must create parameters RA and RB```
EPS=0.0001
Gs_resol = 72
st=1
if RA > EPS AND RB > EPS then
put RA, 0, ST, !south line
A-RA, 0, ST
gosub "SE" !south-east corner
put A, RB, ST, !east line
A, B-RB, ST
gosub "NE" !north-east corner
put A-RA, B, ST, !north line
RA, B, ST
gosub "NW" !north-west corner
put 0, B-RB, ST, !west line
0, RB, ST
gosub "SW" !south-west corner
else
put 0, 0, ST,
A, 0, ST,
A, B, ST,
0, B, ST,
0, 0, -1
endif
Poly2_B NSP/3, 7,19,19,
get(nsp)
END !__________________________END____________________
"SE":
for n = 270 to 360 step 360/gs_resol
put A-RA + RA*cos(n), RB + RB*sin(n), st
next n
return
"NE":
for n = 0 to 90 step 360/gs_resol
put A-RA + RA*cos(n), B-RB + RB*sin(n), st
next n
return
"NW":
for n = 90 to 180 step 360/gs_resol
put RA + RA*cos(n), B-RB + RB*sin(n), st
next n
return
"SW":
for n = 180 to 270 step 360/gs_resol
put RA + RA*cos(n), RB + RB*sin(n), st
next n
return
```

Last edited by A. Smith on Mon Dec 14, 2020 6:53 pm, edited 1 time in total.

AC 22, 24 | Win 10