ā2022-10-24 04:56 AM
Hi all,
I wonder if there's an add-on ever made for the following purpose:
In a current project we're developing, there's a bunch of bad measurement values (for example, 25.03 cm instead of 25.00 cm). And they're always really close to the correct measurement value.
Logically, we don't need the ".03" amount, it is only a matter of design inaccuracy. It would be great if we could run an 'element rounding-off' plug-in, which snaps every selected element to the closest round measure (admitting 0.5 and maybe 0.25), considering the project origin as a major reference to those measurements.
Anyone ever heard of such?
ā2022-10-24 04:40 PM
that would be great... if it existed it would win the award for the best useful plug-in in the world, for our studio!
ā2022-10-25 12:25 AM
Hey! I developed such label to our architecture firm and it currently belongs to our own library. But I could develop a similar label suiting your needs. Being the case you may e-mail me š (pedrocollares@gmail.com)
ā2022-10-26 07:40 AM - edited ā2022-10-26 07:41 AM
here's a quick demo for an addon checking wall length:
It checks all selected walls and change the cut fill to red if its length is not a multiple of the 'step' variable. This gives a quick visual reference to find errors in the model.
void lengthCheck()
{
API_GetPointType pointInfo;
GS::Array<API_Guid> inds;
GSErrCode err;
API_SelectionInfo selectionInfo;
API_Elem_Head tElemHead = {};
GS::Array<API_Neig> selNeigs;
double startX, endX, startY, endY, theta, dx, dy, Lprev,step,rem,L,eps;
Int32 index;
GS::UniString strType,dir;
GS::UniString name, strName;
API_Element element = {} , mask;
err = ACAPI_Selection_Get(&selectionInfo, &selNeigs, true);
BMKillHandle((GSHandle*)&selectionInfo.marquee.coords);
if (err != NoError && err != APIERR_NOSEL) {
ErrorBeep("ACAPI_Selection_GetInfo", err);
return;
}
ACAPI_ELEMENT_MASK_CLEAR(mask);
ACAPI_ELEMENT_MASK_SET(mask, API_WallType, penOverride.overrideCutFillBackgroundPen);
ACAPI_ELEMENT_MASK_SET(mask, API_WallType, penOverride.cutFillBackgroundPen);
ACAPI_ELEMENT_MASK_SET(mask, API_WallType, penOverride.cutFillPen);
for (index = 0; index < selectionInfo.sel_nElemEdit; index++) {
// Get selected element
BNZeroMemory(&element, sizeof(element));
element.header.guid = selNeigs[index].guid;
if (ACAPI_Element_Get(&element) != NoError)
continue;
startX = element.wall.begC.x;
startY = element.wall.begC.y;
endX = element.wall.endC.x;
endY = element.wall.endC.y;
step = 0.002500;
eps = 0.0000100;
if (abs(endX) > abs(startX)) {
dx = abs(endX - startX);
}
else {
dx = abs(startX - endX);
}
if (abs(endY) > abs(startY)) {
dy = abs(endY - startY);
}
else {
dy = abs(startY - endY);
}
L = sqrt(dx * dx + dy * dy);
theta = atan2(dx, dy) / (2 * PI) * 360;
if (dx < eps && dy > eps) //vertical wall
{
Lprev = dy ;
}
if (dx > eps && dy < eps) //horizontal wall
{
Lprev = dx;
}
if (dx > eps && dy > eps) //if not orthogonal wall
{
Lprev = L ;
}
rem = fmod(Lprev, step);
if (rem >= eps && rem < step - eps) {
element.wall.penOverride.overrideCutFillBackgroundPen = true;
element.wall.penOverride.cutFillBackgroundPen = 181;
element.wall.penOverride.cutFillPen = 181;
ACAPI_CallUndoableCommand("Element Test API Function",
[&]() -> GSErrCode {
err = ACAPI_Element_Change(&element, &mask, nullptr, 0, true);
if (err != NoError) {
ErrorBeep("elem change err", err);
}
return err;
});
}
}
return ;
}
ā2022-10-26 07:43 AM
Dear juliencuadra,
thank you so much! ā¤ļø
have a nice day
Fabio
ā2022-11-09 06:00 PM
I'm developing that but still wasn't able to finish it.