PDA

View Full Version : how to calculate automatically the linear length



luciano
11-19-2018, 08:45 AM
Hi guys, I need to know if there's a free plug-in, or a simple way to calculate the total linear measurement of these elements. thankyou

Kryslin
11-20-2018, 06:22 PM
Modeler has the measure tool (detail -> measure), which would work for single items.

I'm guessing that you want to total the lengths of all the pieces, probably for materials estimation.

I don't know of anything off hand, even in LWCAD. I could probably script something to do the job, but have very little time right now.

Since there appears to be four groups of different lengths, I would get the length of 1 item from each group, then multiply it by the number in each group. repeat for each group, then add them up. Add a cutting allowance x the total number of pieces (3mm - 10mm, depending on material and cutting method), and you've got your total length.

erikals
11-20-2018, 07:00 PM
yes, no script i'm aware of does this.  (unfortunately)

probably more common for CAD apps.

Kryselin's method is the way to go i believe.

(or export the model to another app with the ability)

...or perhaps better, use another app, like ViaCad
https://www.youtube.com/watch?v=_XaRH2XNqWM

luciano
11-21-2018, 12:58 AM
anyway thankyou....

luciano
11-21-2018, 01:04 AM
and very tedious for me to count the individual pieces and add the lengths .... it would really need a script to be able to automate. I realize very complex iron frames, where I lose time to calculate the length of the "iron" used by hand... sorry for my english...

prometheus
11-21-2018, 03:59 AM
and very tedious for me to count the individual pieces and add the lengths .... it would really need a script to be able to automate. I realize very complex iron frames, where I lose time to calculate the length of the "iron" used by hand... sorry for my english...

Maybe this could work a bit efficient, if you have the rods as one surface? or just go to send connected to layers, delete all layers that arent the rods...you are then left with a layer per rod (if these rods is one connected segment that is and not welded to other segments)

Then you go through each rod layer and use absolut size..that avoids measuring with the measure tool, you should have a display of the lenghth etc on each rod.

As I can see the rods are green surface..and you may be able to use select by surface, invert and delete all other polygons initially, which leaves you with the rods only, then use connected to layers, and you have each segment ready to evaluate with absolute size ..whithout having to manually pick start and end for measuring.

luciano
11-21-2018, 06:43 AM
I want try...

Kryslin
11-21-2018, 06:47 AM
A quick question : Are all those pieces connected together in the model, or all they all seperate? As in, is each tube separate from the others?

I have an idea that might work, but each tube needs to be separate from the others...

luciano
11-21-2018, 07:08 AM
each tube are separatefrom the others... not are weld

Kryslin
11-21-2018, 10:33 AM
Ok, then my idea will work.

luciano
11-22-2018, 04:16 AM
Ok, then my idea will work.

I'm curious

Kryslin
11-23-2018, 03:32 PM
It's a scripting Idea. Since each rod is a separate mesh, I can select each "tube", compute the dimensions, store the results, and generate a report.

If you had extended everything out, and it was all a single mesh, this would be much more complicated.

shrox
11-23-2018, 03:56 PM
Would a uv map help in getting the total area?

erikals
11-23-2018, 04:54 PM
not much, interesting suggestion, but would be lots of manual work i believe, so might as well do it manually in 3D view

best way is selecting polys, then using Absolute Size.
slow, but works correct, and a straight forward approach.

prometheus
11-24-2018, 07:11 AM
not much, interesting suggestion, but would be lots of manual work i believe, so might as well do it manually in 3D view

best way is selecting polys, then using Absolute Size.
slow, but works correct, and a straight forward approach.

Sort of what I suggested, though with the difference of using connected to layers, so you do not have to select connected pieces, just run Absolute size on each layer and insert in excel or any other note app if needed.
I Wish there was a script or something to do a one single mouse click to select connected.

Kryslin may have something going if he can make the script of calculating each segment ..then return with a report including all segments individual length or full scale .

erikals
11-24-2018, 07:56 AM
Sort of what I suggested, though with the difference of using connected to layers
yes, have done similar earlier, the "problem" is that it isn't really faster than selecting the poly manually.

if it could be automated however, it would be faster.


Kryslin may have something going if he can make the script of calculating each segment ..then return with a report including all segments individual length or full scale .
yes, Absolute Size does this, so what we need is something similar that also copies that data to a polygon tag.

erikals
11-24-2018, 08:00 AM
perhaps also the script Absolute Measure by Deuce could be of use...
located in NewTek\LightWave11.6.2\support\plugins\scripts\LSc ript\model


// Measure tool -- Deuce

@version 2.3
@warnings

main
{
selmode(USER);
var numberofpoints = editbegin();
var total = 0;
var j = 1;

for(i=1; i<numberofpoints; i++)
{
var j = j + 1;
varpntA = pointinfo(points[i]);
varpntB = pointinfo(points[j]);

varseg = extent(varpntA,varpntB);
skew = sqrt((varseg.x * varseg.x) + (varseg.z * varseg.z));
total = total + sqrt((skew * skew) + (varseg.y * varseg.y));
}

editend();

reqbegin("Absolute Distance Measure");
reqsize(415,97);

c1 = ctldistance("Absolute Distance",total);
ctlposition(c1,36,21,345,25);

if(reqpost())
{
dist = getvalue(c1);
}
else

return;
reqend();
}

also see Measure_Points.ls by Matt Gorner in the same location

Kryslin
11-24-2018, 08:16 AM
Basically, my idea is like this:
1)Grab all the polygons.
2)For each polygon that hasn't been processed:
2a) Select that polygon
2b) Select the connected polygons.
2c) Remove the additional selected polygons from the master list.
2d) Get the length of the selected member, based on the greater bounding box dimension.
****I know this only works on things that are on axis.
2e) Add the measurement to the list.
2f) Repeat 2a)-2f) until no polygons remain.
3) Summarize data for reporting.
4) Output report file to user specified location.
4a) Include a use specified cutting allowance in the total (typically, 3mm-12mm, depending on material and cutting method).

Ideally, at 2d, I would rotate the points of the selected tube until the length was along the z-axis. That way, tube not on axis could be measured.

I should have some free time tonight and tomorrow (blizzard rolling in here in the lower great plains in the US).