# Centre of Mass

15 messages
Open this post in threaded view
|

## Centre of Mass

 CONTENTS DELETED The author has deleted this message.
Open this post in threaded view
|

## Re: Centre of Mass

 On Sun, 22 Nov 2015 16:15:15 -0700 (MST) Jimmis98 <[hidden email]> wrote: > Hello. > I am creating a model of a car. I am going to actually build it from balsa > wood and ABS plastic. I would like the centre of mass of the model to be in > the middle of the distance between the front and rear wheels. I have reached > a point where the rear wheels is in position and I can move the location of > the front wheels parametrically. Is there a way to find the centre of mass > of the model, assuming it is made of a material of fixed density along its > volume (or maybe two materials, seeing that I will eventually work with two > as it is), and then have the front wheel relocate itself accordingly every > time I make a change and the centre of mass changes? > Additionally, is there a way to find the mass of an object? > Sorry if I am asking things that have no point of being asked in this forum > or have already been asked. OpenSCAD can't do it, but for a uniform material Meshlab can. See http://gazebosim.org/tutorials?tut=inertia&cat=build_robot_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Centre of Mass

Open this post in threaded view
|

## Re: Centre of Mass

 Total volume and center-of-mass could be calculated at export time, right around here: https://github.com/openscad/openscad/blob/master/src/export.cc#L142-L187Nice little overview of the math involved for volume here: http://n-e-r-v-o-u-s.com/blog/?p=4415...and for center of mass, aka "Centroid of a 3D shell described by 3 vertex facets": http://paulbourke.net/geometry/polygonmesh/...or... http://wwwf.imperial.ac.uk/~rn/centroid.pdfIt's a bit more involved, but same underlying principles. Andrew.
Open this post in threaded view
|

## Re: Centre of Mass

Open this post in threaded view
|

## Re: Centre of Mass

 On 11/23/2015 04:52 PM, Ari Diacou wrote: > I would love to have some functions that calculate information about > the model: > Hmm, most of that information (when applied to the final rendered model) could be generated by some post processing. This could be a nice candidate for a very simple plug-in interface as discussed in a different thread. I think there's an issue on github asking for something in that direction. With a more general approach, it could cover lots of things (e.g. call a slicer, upload to some webservice like octoprint, calculate information). All that would mean it's strictly a GUI feature, the language itself does not need to know anything about this. > I would, of course, also like: them to be implemented in the next > release, with good documentation, in the exact method i described, > and a pony. kthxbai. > No unicorn? Where's the challenge then? ;-) ciao,   Torsten. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- Torsten
Open this post in threaded view
|

## Re: Centre of Mass

 This post was updated on . In reply to this post by Jimmis98 CONTENTS DELETED The author has deleted this message.
Open this post in threaded view
|

## Re: Centre of Mass

Open this post in threaded view
|

## Re: Centre of Mass

 In reply to this post by Jimmis98 On Mon, 23 Nov 2015 09:31:59 -0700 (MST) Jimmis98 <[hidden email]> wrote: > So, basically, it is not yet supported by OpenSCAD itself and I will have > better luck either changing software or using an additional external tool. > Amirite? Yeah - just export the model as STL and load it into the relevant tool like meshlab. There are lots of things OpenSCAD doesn't do - and in most cases that is a good thing. Alan _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Open this post in threaded view
|

## Re: Centre of Mass

 In reply to this post by drxenocide On 11/23/2015 11:40 AM, Ari Diacou wrote: > I had no idea how big my random blob was going to be, or how far down I > should drill the bore. You can create constants (a.k.a "variables") from the random values, then use their values (perhaps in vectors) to build / translate rocks & holes & slicing planes: RockOD = rands(20,50,1)[0]; HoleOD = rands(3,5,1)[0]; HoleSides = rands(3,8,1)[0]; echo(str("Rock dia: ",RockOD)); echo(str("Hole dia: ",HoleOD)); difference() {      sphere(d=RockOD); #   cylinder(d=HoleOD,h=2*RockOD,\$fn=HoleSides,center=true);      translate([0,0,-RockOD/2])          cube([2*RockOD,2*RockOD,RockOD],center=true); } Granted that you can't reach into the model to get mesh features, but you can certainly use the /dimensions/ of the overall structure, because you know them already! -- Ed softsolder.com _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org  -- Ed softsolder.com
Open this post in threaded view
|

## Re: Centre of Mass

Open this post in threaded view
|

## Re: Centre of Mass

Open this post in threaded view
|