(vlax-get (vlax-ename->vla-object (car (entsel))) 'Centroid)Taken from this link: http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/massprop-where-the-values-are-stored/td-p/2288271
But you avoided my question about MASSPROP. massprop command calculates according to area but I want to calculate according to perimeter. They are different calculations.
If you do not want the center of the area (centroid), but only the center gravity of the lines, why there is any hole (while there is no area) ?
Anyway, you can combine your lisp with hand calculation. Programming is for doing something very frequently, hence, save alot of time. Your job doesnot look quite common. I've never heard of centre of gravity calculations based just upon shape perimeters. Calculating the centroid will achieve the same result.
My centroid calculations are rusty, although you will need to break the shape up into elements. E.g. if you had a T beam you could break it into two elements (the horizontal flange and the vertical web). Given you have a circle hole, this is not easy to do by hand. The surface of the part is not empty, so there is a hole (piercing operation). When calculating the area instead of getting perimeter one by one. Calculating by hand easily but lisp unable.
If the part has a surface, then it has an area. You can then find the (2d) centroid of the area/part which is your centre of gravity/mass. Otherwise I am not understanding your question. If your part is 3D, then it will be more complex.
You might need to post an example hand calculation (all steps etc) so someone can advise you where to start to program it. Center of pressure is calculated in this way in press tooling operation
This would be more understandable, I guess.
页:
1
[2]