1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Center of Mass

Discussion in 'Using Alibre Design' started by dlaery, Jan 7, 2021.

  1. KeithH

    KeithH Senior Member

    hi idsk,

    I haven't tried the script stuff yet. I'm still learning. But definetly will as I learn more
  2. Hunter

    Hunter Senior Member


    Can you not perhaps add an option to your script to add a sphere to the location where the point is generated? I use your script a lot, it is very useful!
  3. idslk

    idslk Alibre Super User

    Hello Hunter,

    thanks for the flowers :)
    i am a little short of time now...
    I'll try to make it for assemblies only - if i would put a ball in a single part, the ball would consist of the part material an would change the part weight...
    I hope that i can create a zero density material for the ball for the assembly variant...
    Maybe next week...

  4. idslk

    idslk Alibre Super User

    Hello Hunter,
    i've added a CoG_Ball to the script with version 0.4 for assemblies.
    There is a problem as so often - not everything is accessible trought the API...
    The next is, a geometry with visible faces (point vs ball) needs regenerating...so using the automatic ball will cost time...

    Due to the limited API , i'm not able to create a material with no density...
    It is no problem running the script for the first time , but every further time, specially when adding parts or changing position of parts in the assembly,
    the CoG changes and the CoG_Ball, which has his own mass, has an influence to the system.
    I've made a workaround:
    Before running the script, create a Material in your custom library with a densitiy of 0. 000 000 000 1 (only one 0 ist not "enough"...)and name it "no_density" (don't forget to save).


    The script will try to set the material of the ball, so that the ball will have no weight and no influence...
    If the script won't find this material you will get a printed warning in the console of AlibreScript...


    Demo assembly before running the script:
    first message:

    ask for ball size:
    if you press cancel, the script will run witout creating the ball. This is quicker but creates only the 3D-Point...

    Message after chosing the ball size:

    console output:

    console output script run a second time:

    Demo assembly after script run:

    Attention, the CoG_Ball part will be saved with your assembly if you don't delete it before saving.
    It will be newly created if you run the script after deleting it...

    This is some kind of BETA...please test with files you "don't need"

    If there are wishes for improvements... they are wellcome


    Attached Files:

    kw856 likes this.
  5. Hunter

    Hunter Senior Member

    Thanks, Stefan, I'll give it a try.

    One could make the CoG sphere a surface by deleting one of its faces (probably not trivial to do via script), or use a predefined surface (imported?) so that it doesn't have any mass. Anyway, I'm not trying to give you more work, I appreciate the effort.

Share This Page