Archicad C++ API
About Archicad add-on development using the C++ API.

How to intersect wall through Addon Code

kency
Enthusiast

I have two walls which is at an angle. As seen in the image below, the walls does not intersect neatly. I was able to correct this using the intersect tool in the UI. How can we achieve similar result through code?

kency_0-1722319614531.png

 

Expected

kency_1-1722319704826.png

 

 

5 REPLIES 5
Ralph Wessel
Mentor

Wall intersections through the API are the same as they are for the user - intersections are done automatically if the wall reference lines intersect. No additional functionality is required

Ralph Wessel BArch
Software Engineer Speckle Systems
kency
Enthusiast

@Ralph Wessel Thank you for the response. So for these two walls i made the points exactly same but the intersection did not happen automatically

kency_0-1722430805221.png

Expectation was: 

kency_1-1722430850835.png

The wall beg and end coordinates are as follows:

Wall 1 - (10.56,-9.15), (-0.19, 1.62)

Wall 2 - (0.11,-6.29), (10.56,-9.15)

Ralph Wessel
Mentor

Could you attach a module containing just the unjoined walls?

Ralph Wessel BArch
Software Engineer Speckle Systems
kency
Enthusiast

Hey @Ralph Wessel , It was a mistake from my side, the beg and end coordinates had a difference of approximately 0.001. (one of the points was calculated after a conversion) When I cleaned up the code to share with you, I noticed this slight difference.

 

So the wall endpoints must be the same for Archicad to intersect automatically?

Is there something else that can be done to intersect them forcefully through code like we have the intersect tool in the UI.

I'm not sure of the exact tolerance for Archicad to auto-intersect walls, but it's certainly less than 1mm. I expect it will be a length less than the precision shown on screen, i.e. the point where Archicad would display a non-zero value as "0" in the UI.

 

You may be able to invoke API functions to do the intersection for you, e.g. with ACAPI_Element_Edit, but in the case it's probably easier to just calculate the intersection using the wall reference lines and update the geometry accordingly.

Ralph Wessel BArch
Software Engineer Speckle Systems