We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Need some help in 2d

Anonymous
Not applicable
In 2d I need to draw a box with a circle in it. A line must connect the corners without going into the circle. And the sizes of the box can change so it will not be equal sometimes. I need some help. I know this is very easy ... I just started w/ GDL.

x= 5
y = 9
Rect2 0, 0, x, y
circle2 x/2, y/2, 1
line2 0, 0, x, y

Thanks
8 REPLIES 8
Anonymous
Not applicable
Mryan,
Circle2 has only one parameter, the radius, not three.
You probably got an error message.
Could you post a drawing of what you want to code ?
I am unsure of the figure you want to code for.
Peter Devlin
Frank Beister
Moderator
Peter: CIRCLE has one, CIRCLE2 has 3 parameters. Mryan is right yet.

Mryan: Your code is quiet good, but as so often it's more math than programming. You have to give us more informations about the defining of the circle. 1st the dioganal line may not cross the circle, but has the circle to fit inside the resulting triangle or may it be flexible in its radius. May it cross the box lines? It's possible to get more than one result, should all be displayed?

What is it for?
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
For a square its very simple to do.... the solution is this (where x and y are equal)

x= 12"
y = 12"
Rect2 (-.5 * x), (-.5 * y), (.5 * x), (.5 * y)
circle2 0, 0, 0.90125"
line2 (-.5 * x), (-.5 * y), -.6328", -.6328"
line2 .6328", .6328", (.5 * x), (.5 * y)

When x and y are not equal i don't know how to draw a line that runs from corner to the circle and then again from the other side of the circle to the corner

x= 12"
y = 24"
Rect2 (-.5 * x), (-.5 * y), (.5 * x), (.5 * y)
circle2 0, 0, 0.90125"
line2 (-.5 * x), (-.5 * y), -.6328", -.6328"
line2 .6328", .6328", (.5 * x), (.5 * y)
Anonymous
Not applicable
Your right Frank, I was thinking about the wrong circle.
Mryan, I apologize.
Peter Devlin
Frank Beister
Moderator
Try this:
!flex paras
r = 0.4
x = a/2
y = b/2

!calculated vars
r = MIN(x,y,r)
w = ATN(b/a)

RECT2 -x, -y, x, y
circle2 0, 0, r

LINE2 -x, -y, -r*COS(w), -r*SIN(w)
LINE2 -x,  y, -r*COS(w),  r*SIN(w)
LINE2  x,  y,  r*COS(w),  r*SIN(w)
LINE2  x, -y,  r*COS(w), -r*SIN(w)
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm
Anonymous
Not applicable
thank you very much
Thomas Holm
Booster
Frank, your avatar is the best I've seen yet!
AC4.1-AC26SWE; MacOS13.5.1; MP5,1+MBP16,1
Frank Beister
Moderator
Thanks. Was a bit of work to get the animation into the file size limit. 😉
bim author since 1994 | bim manager since 2018 | author of selfGDL.de | openGDL | skewed archicad user hall of fame | author of bim-all-doors.gsm