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

    Stefan,

    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...

    Regards
    Stefan
     
  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).

    upload_2021-4-5_21-54-7.png

    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...

    upload_2021-4-5_22-17-31.png

    Demo assembly before running the script:
    upload_2021-4-5_21-59-56.png
    first message:
    upload_2021-4-5_22-0-27.png

    ask for ball size:
    upload_2021-4-5_22-1-6.png
    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:
    upload_2021-4-5_22-1-54.png

    console output:
    upload_2021-4-5_22-3-16.png

    console output script run a second time:
    upload_2021-4-5_22-4-38.png

    Demo assembly after script run:
    upload_2021-4-5_22-6-22.png

    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

    Regards
    Stefan
     

    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