The Global Archicad Community

Stay informed. Get help. Share your knowledge.

Everything about using Libraries and Library Parts - Doors/Windows/Objects/Stairs etc. (Example: How can I display a Transom above my Door?)

Moderators: ejrolon, Barry Kelly, Karl Ottenstein, LaszloNagy, gkmethy, Gergely Feher

By ZeroC
#7431
I would like to know the usage of CUTPOLYA
My script is as following:

ADD 1, 1, 0
ROTX 90
MULZ -1
ROTY -90*(Openings-1)

CUTPOLYA 4, 1, 1,
-0.5, 0, 15,
0.5, 0, 15,
0.5, 3, 15,
-0.5, 3, 15
DEL top

FOR i = 1 to 4
ROTZ 90
ADDY -2
PRISM 4, 4,
0, 0,
0.2, 0,
0.2, 2,
0, 2
Next i
DEL 8

CUTEND
END

This script draw 4 walls and cut hole in the walls depend on the variable OPENINGS

I would to like to change the parameter of the variable OPENINGS. If OPENGINS = 1, It would cut hole in the TOP wall.
OPENGINS = 2, It would cut hole in the LEFT wall.
OPENGINS = 3, It would cut hole in the BOTTOM wall.
OPENGINS = 4, It would cut hole in the RIGHT wall.

The script above is inversed what I want to do. i.e. if OPENINGS = 1, hole in the bottom wall.

One more question is I don't really understand the parameter "d" of CUTPOLYA. Could anyone explain about the parameter "d" of CUTPOLYA to me?

Actually, I am an architectural student who is working on this tools in my thesis. I use this tools for descripting order but generating random form.
User avatar
By Matthew Lohden
#7443
Change the MULZ -1 to ROTY 180 and the script will work as you wish.

It seems you have run across a bit of odd behavior in the GDL. The MULZ transformation appears to have no effect on the direction of the CUTPOLYA but it reverses the "handedness" of the ROTY statement. The latter effect is normal and expected - a negative value in a MUL statement has the effect of mirroring the coordinate system (think of a ballerina reflected in a mirror, her reflection will appear to spin in the opposite direction). I don't understand why the direction of the CUTPOLYA is unaffected by the MULZ - this may be a bug.

Regarding the "d" (third) parameter: it is the offset distance from the X,Y plane to the base of the CUTPOLYA. The odd thing is that your script does not work as posted since the value (1) that you have for "d" puts the base of the CUTPOLYA outside the PRISMs you intend to cut. (I set the parameter to 0.1 to get the desired effect)

This brings up another strange thing about CUTPOLYA. A zero value for "d" results in an infinite tube (both directions) so that for the "half-infinite" tube requires a non-zero value.

I am troubled by the non-standard implementation of this statement. Normally the addition of mask values to a polygonal form is indicated by an underscore (as in PRISM and PRISM_). I understand that the "A" suffix indicates a difference in function (the half-infinite cut) but it seems the name of the statement should be CUTPOLY_A. In this case a CUTPOLY_ statement could be used for an infinite cutting form which would eliminate the need for the anomalous use of the zero value for "d".

Finally, I notice that your PRISMs overlap at the corners. I don't know what your ultimate purpose is for this script, but overlapping elements are usually bad form. The effect in the 3D model is for the overlapping elements to "cancel" each other and appear as void where they overlap. You might be better served by the cWALL statement, or you could make four trapezoidal (tall) PRISMs, or you could simply make one PRISM_ with a hole in the center. (Just my 2¢)

I hope this helps. Good luck with the thesis.
By ZeroC
#7446
Thanks for your kindly reply! It helps me a lot.

This is just the test of CUTPOLYA, not exactly what I want to draw. So that I don't care the corner is overlapping or not. Anyway, thanks for your opinion.
By Olivier Dentan
#7451
Matthew Lohden explained all this better than i can do with my limited langage.
I would like to add something else about cutpolya :

msk=7 ! masq value for edges visibility (1+2+4)
d=0.1 ! starting point of the half cutting tube, from your local origin
! MULz -1 does not work, you have to rotate the cutpolya of 180 to get an opposite direction.

ADD 1, 1, 0
ROTx 90
ROTy -90*(Openings-1)
CUTPOLYA 4, 1, d,
-0.5, 0.0, msk,
0.5, 0.0, msk,
0.5, 3.0, msk,
-0.5, 3.0, msk
DEL 3

FOR i = 1 TO 4
ROTz 90
ADDy -2
PRISM 4, 4,
0.0, 0.0,
0.2, 0.2,
0.2, 1.8,
0.0, 2.0
NEXT i
DEL 8

CUTEND
END

If d=0 the cutting tube is infinite. "d" cannot be inside the object you want to cut, in this case -0.8< d < 0.8.

Unfortunately there is a new feature or a bug with 8.1 and msk, it works the inverse as it worked with 7.
With 7 for msk=1, now with 8.1 you have to do msk=4. With 8.1 it does not work with planar surfaces.
I asked GS, but no answer.
For round shapes, dont try to add a value of 64 (smooth rendering), it has never worked, and it stil continues.

Hope this helps.
Attachments
(27.61 KiB) Downloaded 261 times
User avatar
By LaszloNagy
#11333
I have just written a Tech Note, which is not on the web yet, but pertinent to this discussion. Please read it below.
By the way, the Mask value problem has already been entered into our bug database for fixing some time ago.
Laszlo
........................................................
CUTPOLYA command not affected by MUL command in GDL

Let us consider the following general case of cutting a hole into a body with the CUTPOLYA command in GDL.

<see picture attached to post>

The cutting body defined by CUTPOLYA can be a half-infinite or infinite tube. In the above example, the bottom of the cutting body is a bit above the XY plane and is a half-infinite tube.
In this case, the hole is cut into the body.
In we use the MUL command to change the scale of bodies along the Z-axis; there could be cases where it seems the CUTPOLYA command does not work anymore. This is so because the MUL command does not affect the parameters of the CUTPOLYA command. For example, if the bottom of the half-infinite tube of CUTPOLYA starts 2 meters above the XY plane, and the body it is cutting start 3 meters above the XY plane and is 1 meters thick. If we place the “MULZ 0.2” command before these commands, the bodies bottom will now be 0.6 meters above the XY plane, will be 0.2 meters thick, meaning its top surface will be at the level of 0.8 meters above the XY plane. But since the CUTPOLYA command is not affected, its cutting body will still start from 2 meters upward, which mean it will not intersect the body and will not cut it.

The reason this works so is because after this was programmed in ArchiCAD 6.0, many GDL Objects were created that took advantage of this way of operation of the CUTPOLYA command. Fixing this command would have caused an unknown number of GDL Objects not to work. So, the CUTPOLYA command was left alone.

However, new cutting commands were introduced in later versions. One such command is CUTFORM. With this command, you can do as much and more than with the CUTPOLYA command, and its parameters ARE affected by the MUL commands. So in case you need something like the above, please use the CUTFORM command in your GDL Objects.
Attachments
CUTPOLYA.PNG
CUTPOLYA.PNG (14.09 KiB) Viewed 5212 times