Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Complex poly object

JGoode
Advocate

Hello,

 

I am trying to create an object which is essentially a 4 sided shape where the 4 corners can be moved which is simple enough on it's own. However there is also the requirement to have the option of adding a fillet or chamfer to each corner. Is this achievable without creating a different poly for every possibility? 

 

Thanks

ArchiCAD 17, 19, 21 and 23
Windows 8
16 REPLIES 16

Barry Kelly
Moderator

A simple rectangle would be no problems at all.

I would use PUT statements for the nodes.

And then a POLY with GET to retrieve those nodes.

If you have not seen that done let me know and I will find or make a script for it.

 

So you would have IF statements for the nodes.

If simple corner PUT node coordinates and mask value .

If chamfer PUT 2 node coordinates and mask values.

If fillet PUT node coordinate and mask value, PUT centre coordinate and mask value (900), PUT end of arc coordinate and mask value.

Then GET all of these in the POLY command.

 

If your POLY can have the four corners move independently of each other (i.e. the for sides are not equal in length), then it will be more tricky.

It can still be done as above by using the PUTs in IF statements, but the tricky part will be working out the coordinates of the nodes and the centres of the arcs.

I am sure it is mathematically possible - would just involve a little trigonometry.

 

Barry.


One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

Hi Barry,

 

Firstly, thank you for your response. I haven't used PUT statements before so that would be my main issue in even beginning this method. The object could have 4 uneven sides and the corners could be moved to any position so it's as tricky as it gets. 

 

Many thanks

ArchiCAD 17, 19, 21 and 23
Windows 8

OK, it is quite late for me now (11pm) and my best thinking for the day is done.

I will try to get a little example together tomorrow after work to show the PUT/GET with a simple rectangle with/without fillets.

 

The un-even shape I will have to think about.

But as I say, it is just trig.

 

BarryKelly_0-1652281162706.png

 

Barry.


One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

here is a quick put example

 

put 3", 1.75", 15,
3", 1.25", 15,
-3", 1.25", 15,
-3", 1.75", 15

 

poly2_B{2} nsp/3,7+8+16,RangeFillPen,RangeFillBackPen,0,0,SYMB_ROTANGLE,
get(nsp)

 

also the tube object in my sig has a lot of what you need, although its looped so it can have many more than 4 sides. its probably more than you need but maybe it can help.

 

adding fillet or chamfer would be fairly simple to add to the profile.

FREE Soffit & Fascia for Rail Tool - https://bit.ly/BIMRithmSoffitandFascia
FREE wall Accessory framing and coverings - bit.ly/BIMRithmWallAccessories
FREE Truss object - https://bit.ly/BIMRithmTrussV1
FREE Custom Tube Object - https://bit.ly/BIMRithmPolyTube
AC 24, Twinmotion current, Windows 11, Msi 10UG with rtx 3070, wacom intuos pro m, Wacom Cintiq Pro 16, razer Tartarus pro.

Barry Kelly
Moderator

OK, here is my quick attempt at a 4 sided polygon that can have plain, chamfered or filleted corners.

I have only done a rectangular polygon based on the A & B sizes (width & height), and I have used PUT and GET to allow for the various nodes required for the different corner types.

 

First you need these parameters.

 

BarryKelly_1-1652363652129.png

 

Then in the Parameter script ...

 

 

VALUES "corner_1" "None", "Chamfer", "Fillet"
VALUES "corner_2" "None", "Chamfer", "Fillet"
VALUES "corner_3" "None", "Chamfer", "Fillet"
VALUES "corner_4" "None", "Chamfer", "Fillet"

 

 

And in the 2D script ...

 

 

if corner_1 = "None" then
	put 0, 0, 1
endif
if corner_1 = "Chamfer" then
	put 0, 0+fillet_rad_1, 1
	put 0+fillet_rad_1, 0, 1
endif
if corner_1 = "Fillet" then
	put 0, 0+fillet_rad_1, 1
	put 0+fillet_rad_1, 0+fillet_rad_1, 900
	put 0+fillet_rad_1, 0, 3001
endif

if corner_2 = "None" then
	put A, 0, 1
endif
if corner_2 = "Chamfer" then
	put A-fillet_rad_2, 0, 1
	put A, 0+fillet_rad_2, 1
endif
if corner_2 = "Fillet" then
	put A-fillet_rad_2, 0, 1
	put A-fillet_rad_2, 0+fillet_rad_2, 900
	put A, 0+fillet_rad_2, 3001
endif

if corner_3 = "None" then
	put A, B, 1
endif
if corner_3 = "Chamfer" then
	put A, B-fillet_rad_3, 1
	put A-fillet_rad_3, B, 1
endif
if corner_3 = "Fillet" then
	put A, B-fillet_rad_3, 1
	put A-fillet_rad_3, B-fillet_rad_3, 900
	put A-fillet_rad_3, B, 3001
endif

if corner_4 = "None" then
	put 0, B, 1
endif
if corner_4 = "Chamfer" then
	put 0+fillet_rad_4, B, 1
	put 0, B-fillet_rad_4, 1
endif
if corner_4 = "Fillet" then
	put 0+fillet_rad_4, B, 1
	put 0+fillet_rad_4, B-fillet_rad_4, 900
	put 0, B-fillet_rad_4, 3001
endif

 
PEN fill_perim_pen
FILL fill_style

poly2_B nsp/3,1*1 + 2*1 + 4*1 + 8*0 + 32*0 + 64*0,fill_foreground_pen,fill_background_pen,
get(nsp)

 

 

That will give you a rectangular polygon that stretches by the corner hotspots.

And the corners can be set to either none,chamfer or fillet.

 

BarryKelly_3-1652364195082.png

 

 

To have truly stretchy corner nodes (can be stretched in any direction) is quite easy.

You just need parameters for the x & y coordinates of the corners and if you want add stretchy hotspots for them.

The trick then is doing the calculations to work out where the coordinates are for the extra nodes needed for the chamfer and fillets.

Someone smarter than me will have to work that one out.

For each corner you will need to take into consideration the position of the two adjacent corners, as that will affect the edge line angles which will affect where the extra nodes are for the chamfer and fillet corners.

 

But this is a good example of how the PUT/GET part works.

 

Barry.

 


One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

Hi Barry, 

 

This is much further than I would have got on my own! Thank you very much. I'm having a bit of an issue with the fillet on corner 1. I had issues with the chamfer on corner 1 which I resolved but the lines are not connecting correctly after the curve. The line which should go from corner 1 to corner 2... goes to corner 4 and visa versa. 

 

Any ideas why or how to fix?

 

Edit: Problem solved, had to figure it out and shuffle some values around. Thanks again for your time and help!

ArchiCAD 17, 19, 21 and 23
Windows 8

Sorry, it looks like I missed copying the script for the first corner.

I will fix that up.

 

You have to be very methodical and make sure all your nodes are in the correct order.

That is why I often use PUT for every node.

So I can simply reorder then by dragging the script lines around.

 

When you have multiple PUTS, you can group them together with one PUT statement and a comma after at the end (so it is basically a continuation to the next line), and no comma at the very end of the last line.

 

So ...

put 0, 0+fillet_rad_1, 1
put 0+fillet_rad_1, 0+fillet_rad_1, 900
put 0+fillet_rad_1, 0, 3001

could also be written ..

put 0, 0+fillet_rad_1, 1,
0+fillet_rad_1, 0+fillet_rad_1, 900,
0+fillet_rad_1, 0, 3001

 

Barry.


One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

A_ Smith
Advocate

I believe I make it with editable corners, even if shape isn't a rectangular (Archicad 22)

https://drive.google.com/file/d/1sqWMpqrC2YryQ5cZ68y1e-u_akk6yLLA/view?usp=drivesdk

AC 22, 24 | Win 10

@A_ Smith ,

Yes, that looks great.

You have the chamfer (straight cut) and fillet (curved) mixed up though.

 

The stretchy hotspots for the corner radius seem a little weird to use, but that is because they are measuring from the centre point. It is just weird that the radius doesn't match the actual hotspot as you drag it. But I don't think there is much you can do differently.

Just takes a little getting used to.

 

To make it even better, maybe hide the hotspot when it is a straight corner.

Then you wouldn't need the option to show/hide the radius hotspot (although of course you can keep that option).

 

I was also going to suggest you could add a 'switch' hotspot to change the corner type as well.

But I see you have allowed that and can turn that option on/off.

 

Great job.

Thanks for sorting out the geometry.

 

Barry.


One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

You're right, I messed up with fillet.

 

I know about issue with radius HS. It was really late to find better approach. I've edited object, so at least for acutes angles it works more less ok. Tbh it's better to type distance with HS, not to drag it. At least, until someone tells how to make it more sophisticated...

 

Indeed it's good call to hide 'cornerType' HS if it doesn't require radius. Is it possible to make AC show its string description, not integer value when you move it ?

AC 22, 24 | Win 10


@A_ Smith wrote:

Is it possible to make AC show its string description, not integer value when you move it ?


I don't think so (but I could be wrong).

Because you have used VALUE{2} and it is an integer parameter, the hotspot will only show the integer value - not the description the user sees when adjusting in the parameter list.

 

You would either have to use a standard VALUE with a string parameter, or have a hidden string parameter that changes (GLOB_MODPAR_NAME) based on the corner integer parameter you set.

Then show the string parameter as the hotspot display parameter.

 

Barry.


One of the forum moderators.
Versions 6.5 to 25
Dell XPS- i7-6700 @ 3.4Ghz, 16GB ram, GeForce GTX 960 (2GB), Windows 10
Dell Precision 3510 - i7 6820HQ @ 2.70GHz, 16GB RAM, AMD FirePro W5130M, Windows 10

Thank you so much for taking a look at this! This does so much of what I needed it to do. I am getting an error when the object is small (points less than 170mm) but only in some positions. I can't seem to find other consistencies that cause the error.

"Argument of ACS or ASN is not in range (-1 ... 1)
at line 228 in the Master script"

ArchiCAD 17, 19, 21 and 23
Windows 8

I didn't try to make it small, though I think size doesn't matter. But I didn't make rules for radius for corners depending on side length... So, for example if it is rectangular and sum of 2 corners radius equal or more than side between these corners, it will be error

 

edit: try to make small radius for corners. that should do the job

AC 22, 24 | Win 10

So it seems that you're correct that the size of the box doesn't matter, it's just that I noticed it when I made it smaller. I make it rectangular with 0 radius set on the corners and also sharp corners and sometimes get the issue occurring but I have no idea why.

ArchiCAD 17, 19, 21 and 23
Windows 8

Indeed sometimes there's error - when i try to make rectangular from parallelogram (with sharp cornersl.
 
maybe I will look into it later
AC 22, 24 | Win 10

I think it is ok now. Download again

AC 22, 24 | Win 10

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!