BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Why doesn't my 2D poly calculation work?

JGoode
Advocate
I can't seem to work out why the calculations don't seem to be working as I think I might have used the same sort of calculation previously. Is there any reason why it is not changing the object at all?

Poly2_b help.jpg
ArchiCAD 23

Windows 10
8 REPLIES 8
Use put and get for polygons instead writing inline.
no of nodes will be depending on the command type NSP/3..4..5
(how many status type data after coords)
and the all points at the end of the _poly like command will be "get(nsp)"

Best Regards,
Piotr
Barry Kelly
Moderator
Using PUT and GET for polygon nodes is great when the number of nodes is variable.
In a case like this where the number of nodes is fixed it really won't make any difference.

Are you saying that when you adjust the value of the 'rail_width' parameter that your object is not changing?
If so do a find and select for 'rail_width' in the master parameter and the first part of this 2D script to see if the value for that parameter is being set - overriding the parameter value.

Or possibly you are using a value for 'rail_width' that just doesn't make sense for the points you are plotting - i.e. value is too small?

Otherwise I don't understand what you mean by 'calculation' as all you have here is a polygon definition.

Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
JGoode
Advocate
Barry wrote:
Otherwise I don't understand what you mean by 'calculation' as all you have here is a polygon definition.
The calculation that defines the points in the object as in rail_width/2-(rail_width/2-0.49*********)
All bits of the definition that included this didn't work so I was wondering if there was a reason why they wouldn't work. I have it working now anyway using a different method.
ArchiCAD 23

Windows 10
Ok what is the error?
Polygon does not show? or shows incorrectly? You get error message (what message)?

Best Regards,
Piotr
Bruce
Expert
Have you checked to make sure you haven't accidentally created a 2D symbol, as from memory this will stop the 2D script from running?
Bruce Walker
www.brucepwalker.com
Barking Dog BIM YouTube
Mindmeister Mindmap
-- since v8.1 --
AC27 5003 INT Full | Windows 11 64 Pro | 12th Gen Intel i7-12700H 2.30 GHz | 64 Gb RAM | NVIDIA GeForce RTX 3060 32 Gb
Barry Kelly
Moderator
Bruce wrote:
Have you checked to make sure you haven't accidentally created a 2D symbol, as from memory this will stop the 2D script from running?
If there is a 2D script this should override anything drawn in the 2D symbol window.
Unless it is called as a FRAGMENT.

Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Barry Kelly
Moderator
JGoode wrote:
Barry wrote:
Otherwise I don't understand what you mean by 'calculation' as all you have here is a polygon definition.
The calculation that defines the points in the object as in rail_width/2-(rail_width/2-0.49*********)
All bits of the definition that included this didn't work so I was wondering if there was a reason why they wouldn't work. I have it working now anyway using a different method.
I don't see anything wrong with your script.
So long as you are adjusting the parameter for 'rail_width' your object should adjust.
But as I said be sure this parameter is not being set to a fixed value before the polygon or in the master or parameter script.

It is very hard to tell what is happening without seeing the entire object scripts.

Barry.
One of the forum moderators.
Versions 6.5 to 27
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
Hi,

it appears like you are trying to draw flanges, connections to the wall?

assuming that 0.49266 is a big number, or spacing between....that may be where you are going wrong....as you are canceling out your Rail_width/2 by adding it then minusing it at that point you are using that big number...

this looks like code from a projection with the facets of a curve turned into code...when it should be just the true size...

choosing a simple Poly2_B script(not fill distortions)
4 points, plus closing point (5 in total)(-1 to close a poly at end)


Flange_Depth = 0.012
Flange_Diameter = 0.04225

for the origin it would be
Poly2_b 5, 3, gs_fill_pen, gs_back_pen,
-Flange_Diameter/2, 0, 1,
-Flange_Diameter/2, Flange_Depth, 1,
Flange_Diameter/2, Flange_Depth, 1,
Flange_Diameter/2, 0, 1,
-Flange_Diameter/2, 0, -1



for the middle connection it would be...
Poly2_b 5, 3, gs_fill_pen, gs_back_pen,
Rail_width/2-Flange_Diameter/2, 0, 1,
Rail_width/2-Flange_Diameter/2, Flange_Depth, 1,
Rail_width/2+Flange_Diameter/2, Flange_Depth, 1,
Rail_width/2+Flange_Diameter/2, 0, 1,
Rail_width/2-Flange_Diameter/2, 0, -1

for the far end it would be...
Poly2_b 5, 3, gs_fill_pen, gs_back_pen,
Rail_width-Flange_Diameter/2, 0, 1,
Rail_width-Flange_Diameter/2, Flange_Depth, 1,
Rail_width+Flange_Diameter/2, Flange_Depth, 1,
Rail_width+Flange_Diameter/2, 0, 1,
Rail_width-Flange_Diameter/2, 0, -1


39 points is a lot for a simple shape....especially when the y-value does not change (only 2 values)
Learn and get certified!