Script to create connectors automatically

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hello,

I am trying to automate a task and need some guidance.
In a model with various components, I have the guide points of the fasteners. Some fasteners connect more than two components.

I am looking to create the connectors automatically by selecting the points and export the connectors' information (cfast id and coordinates, attached elements).

The final goal is to create automatically more than 8000 fasteners and extract their information, in order to use them for fastener analysis.

Thanks for your help

N.

Answers

  • tinh
    tinh Altair Community Member
    edited September 2018

    Did you use panel 1d>connectors>spot?

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited September 2018

    Hello

    Yes I did.
    For a small number of fasteners (less than 100) it is doable to use that command.
    If the number of fasteners increases, checking this process is more prone to error.

     

    I have the following script.




    By intersecting fastener vector lines with the parts' surfaces, the nodes and fasteners are created.

    The problem is that it needs the surfaces to be in one component, the mesh in another and the lines in another.

    Again, for a small model, it is doable, but scalling up, with 30/40 components, it is not.


    What is your opinion? How could I improve this?

    Thanks for your help.

     

    Regards,

     

    N.

    Unable to find an attachment - read this blog

  • tinh
    tinh Altair Community Member
    edited September 2018

    Could you explain why surfs and elems need to be in 2 separated comps?

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited September 2018

    Hi

    The model for which that script was based on, was already organized like that.

  • tinh
    tinh Altair Community Member
    edited September 2018

    Could you explain why your script is not doable with 30-40 comp?

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited October 2018

    *setedgedensitylinkwithaspectratio -1
    *elementorder 1
    *startnotehistorystate {selectsurface}
    *createmarkpanel surface 1 2
    *interactiveremeshsurf 1 4 2 2 2 1 1
    *set_meshfaceparams 0 2 2 0 0 1 0.5 1 1
    *set_meshedgeparams 0 8 1 0 0 0 5 0 0
    *set_meshedgeparams 1 8 1 0 0 0 5 0 0
    *set_meshedgeparams 3 8 1 0 0 0 5 0 0
    *automesh 0 2 2
    *set_meshfaceparams 0 2 2 0 0 1 0.5 1 1
    *set_meshedgeparams 0 9 1 0 0 0 5 0 0
    *automesh 0 2 2
    *set_meshfaceparams 0 2 2 0 0 1 0.5 1 1
    *set_meshedgeparams 0 10 1 0 0 0 5 0 0
    *automesh 0 2 2
    *set_meshfaceparams 0 2 2 0 0 1 0.5 1 1
    *set_meshedgeparams 0 9 1 0 0 0 5 0 0
    *automesh 0 2 2
    *storemeshtodatabase 1
    *ameshclearsurface
    *endnotehistorystate {Automesh surfaces}
    *setdisplayattributes 2 0

     

     

    hello tinh the above one is from command file which is element creation from fine 2mm to 4mm element on surface.but my question is I want to use this automation to all other surface which are bigger in size and I want to edit mesh based on the height. will you please guide me how can it will be.this code is for 20mm height square surface.

  • tinh
    tinh Altair Community Member
    edited October 2018

    On automesh panel, If you just click on 'mesh' and let density as its default, switch the mode from 'interactive' to 'automatic', the commands will be quite simple

    Please try it and tell us results

  • Vlad VB
    Vlad VB Altair Community Member
    edited May 2020

    Tinh, 

        Do you have a recommendation how to create a large quantity of bolts with a tcl script? My input will be a points and which components they are attaching in the name of the component that point it. Thank you 

  • tinh
    tinh Altair Community Member
    edited May 2020

    Hi

    make a 'for' loop and iterate to create bolt.

    large quantity is not a problem.

  • Vlad VB
    Vlad VB Altair Community Member
    edited May 2020

    Tinh,

     

    Can you help me to separate this string 

     

    This is metadata from cad Import 

     

    {lines 929 .ALTAIR.HW.STEP.ColorId int 1} {lines 929 {.ALTAIR.HW.STEP.Curve Font} string CENTERLINE} {lines 929 {.ALTAIR.HW.STEP.Original Name} string {Z Vector - M8_xx8585/xx8584}} {lines 929 .ALTAIR.HW.STEP.Name string {Z Vector - M8_xx8585_xx8584}} {lines 929 .ALTAIR.HW.STEP.OriginalId int 44087} {lines 929 .ALTAIR.HW.STEP.TAG string {Z Vector - M8_xx8585/xx8584}} {lines 929 .ALTAIR.HW.STEP.ShowPublishedAndLineType int 1536} {lines 929 .ALTAIR.HW.STEP.Color:Blue double 1.0} {lines 929 .ALTAIR.HW.STEP.Color:Green double 1.0} {lines 929 .ALTAIR.HW.STEP.Color:Red double 1.0} {lines 929 .ALTAIR.HW.STEP.Thickness double 0.129999995232}

     

    Lines 929 (929) is a line number which will change and I need to get the {Z Vector - M8_xx8585/xx8584} and obtain M8, xx8585 and xx8584 into a separate parameters 

     

    Thank you 

     

  • Vlad VB
    Vlad VB Altair Community Member
    edited July 2020

    Hi

    make a 'for' loop and iterate to create bolt.

    large quantity is not a problem.

     

    Tinh, 

        When I use lines to create a single connector per line, it always creates two per line even when I put density to 0 or 1. How do I go around of fixing that and make sure that i only get one connector. Thank you 

  • tinh
    tinh Altair Community Member
    edited August 2020

     

    Tinh, 

        When I use lines to create a single connector per line, it always creates two per line even when I put density to 0 or 1. How do I go around of fixing that and make sure that i only get one connector. Thank you 

    What kind of connector do you create?

  • tinh
    tinh Altair Community Member
    edited August 2020

    Tinh,

     

    Can you help me to separate this string 

     

    This is metadata from cad Import 

     

    {lines 929 .ALTAIR.HW.STEP.ColorId int 1} {lines 929 {.ALTAIR.HW.STEP.Curve Font} string CENTERLINE} {lines 929 {.ALTAIR.HW.STEP.Original Name} string {Z Vector - M8_xx8585/xx8584}} {lines 929 .ALTAIR.HW.STEP.Name string {Z Vector - M8_xx8585_xx8584}} {lines 929 .ALTAIR.HW.STEP.OriginalId int 44087} {lines 929 .ALTAIR.HW.STEP.TAG string {Z Vector - M8_xx8585/xx8584}} {lines 929 .ALTAIR.HW.STEP.ShowPublishedAndLineType int 1536} {lines 929 .ALTAIR.HW.STEP.Color:Blue double 1.0} {lines 929 .ALTAIR.HW.STEP.Color:Green double 1.0} {lines 929 .ALTAIR.HW.STEP.Color:Red double 1.0} {lines 929 .ALTAIR.HW.STEP.Thickness double 0.129999995232}

     

    Lines 929 (929) is a line number which will change and I need to get the {Z Vector - M8_xx8585/xx8584} and obtain M8, xx8585 and xx8584 into a separate parameters 

     

    Thank you 

     

    Use 'split'

    Or 'string range' 

    Ex:

    lassign [split {Z Vector - M8_xx8585/xx8584} /] temp P1

    lassign [split $temp _] temp P2

    lassign [split $temp -] temp P3

    puts '$P3\n$P2\n$P1'

  • Vlad VB
    Vlad VB Altair Community Member
    edited August 2020

    What kind of connector do you create?

    Creating a bolt connector. i make a work around and create a mid node on the line and use a node to create it