PDA

View Full Version : Create a point in the centre



Wilfrick
06-09-2011, 04:26 AM
Hi,

I have a problem that I can't resolve...

In modeler, one layer with a lot of little objects (or polygons group if you prefere).
I need to create, for every selection, a point in the centre (so I can make a lot of instances without using so much geometry).
I mean the real centre, not the middle (for the middle I found a script, cp_centerpoint, but really I no need the middle point...)

To explain, it is like the point 0,0,0 after you make an F2, but I can't move the polygons with F2, create the center point and after repositionig them, they are a lot.

I found a sequence of operations to create the center point, for little quantity ok but I have really a lot of objects and it is very slow:

- separate all the geometries in different layers (one each point that will create);
- open an empty layer and put a geometry layer in background;
- create, where you want in the space, a point;
- modify/translate-more/alligner
- select Foreground->Background, C C C, OK

and now there is a point in the real center.
Like you can understand this is very slow, and need to create a lot of layer, select always a new, put one in background....

A dream is to can make a selection of polygons and create the center point without move layers and so on...

Thankyou very much for any idea...

Bye

VonBon
06-09-2011, 05:49 AM
you could, select the points/(area) from both objects that you want to
find the center of, and use [Weld Average].

Wilfrick
06-09-2011, 06:15 AM
you could, select the points/(area) from both objects that you want to
find the center of, and use [Weld Average].

Thankyou, but no, this doesn't create the center point, but the "middle" point, like the script cp_centerpoint makes.
If the object isn't a regular sphere, or cube, or a regular object, the center point isn't the same of the "middle" (or average) point.

To see it try to build a sphere, take some polys and translate far, now make F2 and you see at 0,0,0 the real center, I need a point in this position but without make F2. If you make weld average you see that the point it creates isn't in the center, but it take all points values and make the average... and really I no need it (and I don't understand in what situaion need the average point).

Now, on the same modified sphere, try to make all the command sequence that I wrote in first message and you will see that it translate the point in the real centre of object. But this method is slow and requires a lot of passages.

VonBon
06-09-2011, 06:33 AM
Post some pictures so we can get a better idea of what it is
that you want to do.

Wilfrick
06-09-2011, 06:58 AM
Now I think that can understand..... more simple that this I can't make.

Of course if you have a "regular" object, like a sphere or a cube, the average point is the same of the centre point, but I have a lot of objects with more points on one side that on the other (I call them not regular, to understand what I mean...).

Note: I can't move the objects, can't make F2... all the objects MUST stay where they are... need to create a centre point without move the objects.

wrench
06-09-2011, 07:45 AM
You can use Bounding Box to then Weld Average on...

Not great if you need to do it on lots of objects.

B

Wilfrick
06-09-2011, 07:58 AM
You can use Bounding Box to then Weld Average on...

Not great if you need to do it on lots of objects.

B

sigh... long but better than I found, thankyou.

wrench
06-09-2011, 08:17 AM
I'm sure there's a way of automating this if you speak nicely to your local friendly scripter. After all, it requires little input from the user.

B

evenflcw
06-09-2011, 11:29 AM
If you can, provide two files, one describing the before state, the other describing the after state you want. If you want something that process multiple layers, objects or parts, it's best if the example includes atleast three such elements. These examples complement your written description and also gives the scripter a means to verify that the tool works as desired, without constantly having to wait for your verdict.

Personally I found the description above had too much practical detail, but was less clear on what start state and desired end state are.

I understand you want a point in the geometric center of some geometry. That's no problem. But is this geometry supposed to be selected by user, or can it be identified automatically as a continuous/connected mesh (what layout fx plugins call "parts")? Do you want it to process one item at a time or attempt to do multiple items in one go? Do you want anything separated into different layers (, then what,) or not

Wilfrick
06-09-2011, 12:25 PM
wow... I never think that can do all in authomatic and never think to ask to someone to write me a script... I can't use your time (or the time of someone other) more than for answer here in forum...

I think to select some polygons and with a button build a center point.... of course it is great if the selected polygons disappear after create the point, all in the same layer, so in begin will be a lot of geometries and at the end will be a lot of points, one for each geometry at its center, nothing more.

Evenflcw, you talk about identify in authomatic the geometry as a continuous/connected mesh? you talk about a dream! this could save me a lot of time.

Like you ask I post an object (it is veeeeery big, need to fit all to see).
It has 2 layers with different geometries. It is great if each geometry is replaced by a point in the same layer and the geometries will be deleted. So at the end the object will has 2 layers with points.
I think now it is very clear about what I need to do.

Really thankyou for the interest.
Bye

Hopper
06-09-2011, 01:16 PM
It's been a while.. but isn't there an LScript Commander equivalent in Modeler?

jeric_synergy
06-09-2011, 01:30 PM
I bet there's some easy to adapt scripts out there.

Here's a question: for each GROUP, are they connected? If you select one poly in a group, can you use SEL. CONNECTED to select the rest?

In that case, your psuedo code could be:

ANY POLYS VISIBLE? THEN:

select first poly
select connected
copy to empty layer
select all points
weld average
copy point back to orignal layer
select same polys
HIDE them
repeat

If that's not possible, consider writing a "PARTS TO MID-POINT" script, using PARTS. You'll have to label the parts yourself though. <|^( Virtually the same amount of work.

Or, a oneshot "Make Midpoint of Selected"-- workflow would be SELECT POINTS, hit button. With the lasso that could be reasonably fast, but not automatic.

Wilfrick
06-09-2011, 02:02 PM
I'm not a programmer so I can't write a script, but like I wrote before, I really no need the middle point with weld average... I need the center point and weld average doesn't give the center point.
Maybe some geometries are symmetric, so the middle point is the same of the center point, but for the geometries not symmetric (in all the axis) the center point is different.

So in your sequence of commands need to add this: build bounding box, after copy the geometry in empty layer. The follow "weld average" on the bounding box will find the real center point.

I try to "tune" your sequence, but I don't know if these commands exist:

select first poly
select connected
copy to empty layer (better CUT, not copy, so no need "select same and hide", right?)
BOUNDING BOX
select all points
weld average
copy point back to orignal layer (CUT?)
(select same polys)
(HIDE them) (maybe delete?)
repeat

skywalker113
06-09-2011, 02:48 PM
If there needs to be a point in the center of each object, how about deleting all of the objects and start with a single object with a point in the center, then copy that one.

Another way to find the center of an object is to go to the view tab, click on pivot, select the polygons you want the pivot to center on, and then click center pivot.

daforum
06-09-2011, 04:13 PM
This script from Pictrix will add a point in the center. I use it when I need to add a center point to a disc of points to triangulate the disc....and other tasks too!

http://www.lwplugindb.com/Plugin.aspx?id=0311de50

Wilfrick
06-09-2011, 04:35 PM
If there needs to be a point in the center of each object, how about deleting all of the objects and start with a single object with a point in the center, then copy that one.

Another way to find the center of an object is to go to the view tab, click on pivot, select the polygons you want the pivot to center on, and then click center pivot.

1) the object is a very big mechanic machine, from a customer cad. So I take it and need to animate, I don't build the geometry.

2) I don't understand, it is more long and maybe not correct system than build a bounding box and weldaverage.

Wilfrick
06-09-2011, 04:41 PM
This script from Pictrix will add a point in the center. I use it when I need to add a center point to a disc of points to triangulate the disc....and other tasks too!

http://www.lwplugindb.com/Plugin.aspx?id=0311de50

Not correct, this plug build a point in the average point of all points of object, like does weld average, like does cp_centerpoint, no difference. It isn't the center point of the geometry. Of course you find the center of a circle or a sphere, but not of an assymetric object. Maybe you don't see the pics that I posted here.
Sorry, but thankyou for your interest :)

Cryonic
06-09-2011, 09:50 PM
So, basically you are wanting a Volume Centered Point rather than a Weight Averaged Point.

Wilfrick
06-10-2011, 02:24 AM
So, basically you are wanting a Volume Centered Point rather than a Weight Averaged Point.

I think yes... geometry centered point, volume centered point, I think these are 2 name to call the same thing, but sure I don't want something of average.

probiner
06-10-2011, 05:44 AM
Bounding box center point. Same like "Center Pivot" does, but putting a point there, i see.

Wilfrick
06-10-2011, 10:49 AM
Bounding box center point. Same like "Center Pivot" does, but putting a point there, i see.

Right, this is the more "fast" procedure... centerpoint on beounding box created and at the end delete all the boxes (or weld average on box and at the end delete all the polygons saving the point, same result). Of course need to do for each geometry.

jeric_synergy
06-10-2011, 12:23 PM
I guess I'm not understanding the definition of "center point" as used here then.

Bottom line: learn to script, or pay someone to script it for you.

Wilfrick
06-10-2011, 04:34 PM
I guess I'm not understanding the definition of "center point" as used here then.

From my pics I think it is very clear, sorry if I can't explain better, but more than tell you to push F2 (center data) and see that the center is at coordinates 0,0,0 I can't do.


Bottom line: learn to script, or pay someone to script it for you.

I never asked or pretended that someone write me a script, I asked only if anyone know a command inside modeler. The answer after 2 days is no, so I take this and I'm be happy with bounding box and weld average on box (solution from Wrench, and I must tell him "thankyou").

Only to tell you: I don't know none that can write a script and none here offered his self to write a script for money... maybe if someone asked me money I could think to pay, but none made this question, and it was very very clear that I need a script like Evenflcw talk about...

But ok, now I think you all hate me because I write and write on the same thing, better I stop to bore you with my need and ask. Thankyou to all.
Bye

evenflcw
06-10-2011, 05:51 PM
A script. I took the least ambiguous request, because it's faster to code when you don't have to think, just type.

It converts each part (ie connected mesh) into a point. The points are positioned at the bounding box center of each respective part. Each layer in the foreground is processed. Mind you, it is slow, because Modeler is slow to process selections and is dumb enough to refresh the display for every command call in a script (instead of only refreshing once the script has ended).

Use at own risk.

If you want changes or something else, please try to be as concise as possible.

Wilfrick
06-10-2011, 07:27 PM
A script. I took the least ambiguous request...

BOOM!
it works!! it works very well, and fast! You say slow... no, it is fast.
It does exactly what I need, nothing less, and it can't be more perfect: build points in the same layer and delete the old geometry. I need to test better, but from firsts tests all is great.

Sorry if, like you say, I was ambiguous, but I try to explain more clear that I can, and I think I wasn't ambiguous, look: you understand perfectly, the concept was simple: same layer, build points, delete old geometry, end.

Maybe my english desn't give me to explain better.... sorry...

I write you a pm.

evenflcw
06-11-2011, 06:46 AM
Glad it works and works faster than on my system. Something simple like this, for the example file provided, should only take a split second. On my notebook it takes like 10 seconds! Perhaps something with my system(s)!?

No need for sorries. I was (am?) grumpy. I'm not blaming anyone in particular, but a rather simple request did turn into 2 pages. Your english wasn't a problem.

Wilfrick
06-11-2011, 12:49 PM
Glad it works and works faster than on my system. Something simple like this, for the example file provided, should only take a split second. On my notebook it takes like 10 seconds! Perhaps something with my system(s)!?

No need for sorries. I was (am?) grumpy. I'm not blaming anyone in particular, but a rather simple request did turn into 2 pages. Your english wasn't a problem.

mmm... we have a different idea about the word "fast".
The layer 1, from my Q6600, is processed in 7 seconds... for me it is fast! think to do group by group by hands.... need 10 minutes maybe.
Layer 2 is in real time.

If you can, look pm please :)

Bye

Steve Warner
06-11-2011, 09:26 PM
Out of curiosity did you try the collapse polys tool? It should do something similar.

akademus
06-11-2011, 11:38 PM
Out of curiosity did you try the collapse polys tool? It should do something similar.

I was just wondering the same thing...

Wilfrick
06-12-2011, 04:56 AM
I tried but again no, it isn't the geometric center.

But now no need other try, Evenflc build the best script that can imagine for this function, better of each single (double, triple...) command than can be inside modeler to do this function.

Anyway thankyou for the idea.

Bye

OnlineRender
06-12-2011, 05:33 AM
A script. I took the least ambiguous request, because it's faster to code when you don't have to think, just type.

It converts each part (ie connected mesh) into a point. The points are positioned at the bounding box center of each respective part. Each layer in the foreground is processed. Mind you, it is slow, because Modeler is slow to process selections and is dumb enough to refresh the display for every command call in a script (instead of only refreshing once the script has ended).

Use at own risk.

If you want changes or something else, please try to be as concise as possible.

Well In nice , code .

jeric_synergy
06-12-2011, 11:25 AM
It converts each part (ie connected mesh) into a point.
So they ARE all 'connected'? I thought part of the problem was they were not. :twak:

Wilfrick
06-12-2011, 04:21 PM
So they ARE all 'connected'? I thought part of the problem was they were not. :twak:

Yes, evenflcw's script is for connected because my request was for connected.

For not connected need only a little change of this script but of course need to select hand by hand each group and apply script every time, so it works only with 1 group at time. Need a more hard programmation to can work in authomatic with a lot of group not connected (need to analyze all the geometries, and so on...so told me evenflcw), and for me no need so much work.

jeric_synergy
06-12-2011, 04:46 PM
Yes, evenflcw's script is for connected because my request was for connected.
In the interest of helping you improve your English, below is what made me believe the geometry was not connected:

Evenflcw, you talk about identify in authomatic the geometry as a continuous/connected mesh? you talk about a dream! this could save me a lot of time.

RudySchneider
06-12-2011, 05:59 PM
Evenflcw, you talk about identify in authomatic the geometry as a continuous/connected mesh? you talk about a dream! this could save me a lot of time...

jeric synergy --
You would do well to brush up on your own command of English, rather than be critical of others. I would like to understand what it is about the above sentence structure that led you to think Wilfrick was referring to OPEN geometry?

That is, he questioned whether Evenflcw was talking about continuous/connected mesh, then expressed his delight (hence the exclamation point!) if that was the case. And he topped it off by recognizing what a time-saver it would be. How is that NOT evident to you?

jeric_synergy
06-13-2011, 02:30 PM
Dream= something that doesn't exist.

Best not to get poetic in a second language. >|^P

UnCommonGrafx
06-13-2011, 03:14 PM
Rudy,
Well said.

digefxgrp
06-13-2011, 03:39 PM
ym-MultiScale is a plugin that will do exactly what you want.

It scales all objects in a single layer individually, based off each separate objects bounding volume.

By setting the "scale factor" to 0, the points would collapse down to one location "per object".
Then you have to use LW's point-merge tool to auto-weld each point group into a single point.

It's a very fast two-step process.

So if you have a layer with 10 objects, after running ym-MultiScale (using the above method), you'd end up with 10 points. Those points are also put into an empty layer so the original layer isn't altered.

funk
06-13-2011, 06:35 PM
ym-MultiScale is a plugin that will do exactly what you want.

Where can we find this?

edit: tried google and wayback machine but only came up with broken links

Wilfrick
06-14-2011, 06:53 PM
ym-MultiScale is a plugin that will do exactly what you want.

It scales all objects in a single layer individually, based off each separate objects bounding volume.

By setting the "scale factor" to 0, the points would collapse down to one location "per object".
Then you have to use LW's point-merge tool to auto-weld each point group into a single point.

It's a very fast two-step process.

So if you have a layer with 10 objects, after running ym-MultiScale (using the above method), you'd end up with 10 points. Those points are also put into an empty layer so the original layer isn't altered.

Very good, thankyou for the info, I will search.
I don't know ym-MultiScale but now I'm using the script wrote by evenflcw (he posted here at page 2) and it works very well and it does the same but only in one step.... Maybe it is more slow than ym-MultiScale, I don't know, but no need to do more that one click.
Bye