2021-02-22 10:00 AM - last edited on 2021-09-14 01:23 PM by Noemi Balogh
2021-02-22 10:06 AM
AC22-23 AUS 7000 | Help Those Help You - Add a Signature |
Self-taught, bend it till it breaks | Creating a Thread |
Win11 | i9 10850K | 64GB | RX6600 | Win10 | R5 2600 | 16GB | GTX1660 |
2021-02-22 10:14 AM
!below, n represents the number of the edges. eEach stands for the angle between the lines !that start from the centre and goes to the corners. aEach = 360/n !The loop is to store the coordinates of the corner points. The centre of the polygon is at ! 0,0. Each time the loop is executed, the "PUT" command stores another corner for aTurn = 0 to 360 step aEach PUT dCentreToCorner*cos(aTurn), dCentreToCorner*sin(aTurn) next aTurn !Now all the stored data is going to be used in a PRISM command. Rather any parameters, the coordinates !of the points come from the data stored. PRISM n+1, ZZYZX, get (nsp)
2021-02-22 10:26 AM
2021-02-22 01:21 PM
2021-02-22 02:30 PM
2021-02-22 02:35 PM
A. wrote:Great! Thx.
here is not the best example of my post with put/get and here Kristian Bursell explain how to use it wiser
and here Peter Baksa has code with put/use
2021-02-22 10:16 PM
cntNSP_1 = 0 cntNSP_2 = 0 for m = 1 to vardim1(_nodes_OESF_L) put -_nodes_OESF_L[xNde], _nodes_OESF_L [yNde], 0: cntNSP_1 = cntNSP_1 +1 next m put 0, StartY -.001, 0, 0: cntNSP_2 = cntNSP_2 +1 put 0, StartY, 0, 0: cntNSP_2 = cntNSP_2 +1 put 0, hOEsubFRAME, 0, 0: cntNSP_2 = cntNSP_2 +1 put 0, hOEsubFRAME +.001, 0, 0: cntNSP_2 = cntNSP_2 +1 tube cntNSP_1, cntNSP_2, 1+2+16+32, get(nsp)
2021-02-23 08:34 AM
Kristian wrote:Thanks! I'll dig into this. Just need a couple of hours of spare time.The original reason was that I wanted to add HEX colour values somewhere. Since I spent a week skiing with ny brother in law (IT-guy) we discussed some IT-related stuff and when he was explaining Json I imagined I could store whatever in Archicad the same way.
What sort of function are you applying it to? Is it 3D or 2D geometry and if so what type of shape?
Polygons, Extrudes, Revolves are all easy because each line has the same number of values (usually 3; x, y, status) therefore when setting the number of nodes its "nsp/3".
However Tubes are more complex because they can have 3 values for the profile and 4 values for the path. therefore you can't divide the NSP (stored values) to get the node count. So in this case I follow each line with a counter like this (pay attention to the cntNSP_1 & cntNSP_2) :
cntNSP_1 = 0 cntNSP_2 = 0 for m = 1 to vardim1(_nodes_OESF_L) put -_nodes_OESF_L[xNde], _nodes_OESF_L [yNde], 0: cntNSP_1 = cntNSP_1 +1 next m put 0, StartY -.001, 0, 0: cntNSP_2 = cntNSP_2 +1 put 0, StartY, 0, 0: cntNSP_2 = cntNSP_2 +1 put 0, hOEsubFRAME, 0, 0: cntNSP_2 = cntNSP_2 +1 put 0, hOEsubFRAME +.001, 0, 0: cntNSP_2 = cntNSP_2 +1 tube cntNSP_1, cntNSP_2, 1+2+16+32, get(nsp)