Help to fill Constraint References with code

About the development of the FEM module/workbench.

Moderator: bernd

Post Reply
User avatar
johnwang
Veteran
Posts: 1382
Joined: Sun Jan 27, 2019 12:41 am

Help to fill Constraint References with code

Post by johnwang »

Hi,

This code is from https://github.com/FreeCAD/FreeCAD/blob ... te.py#L163

Code: Select all

    # constraint force
    con_force = ObjectsFem.makeConstraintForce(doc, "ConstraintForce")
    con_force.References = [
        (geom_obj, "Vertex7"),
        (geom_obj, "Vertex1"),
        (geom_obj, "Vertex2"),
        (geom_obj, "Vertex3"),
        (geom_obj, "Vertex4"),
        (geom_obj, "Vertex8"),
    ]
If I need to apply forces on Vertex1-3, How do I fill this con_force.References with a loop? Something like this? Not working yet:

Code: Select all

    # constraint force
        aRef=[]
        con_force = ObjectsFem.makeConstraintForce(doc, "ConstraintForce")
        for id in range(3):
            tstr="Point00"+str(id)
            aPoint=doc.getObject(tstr)
            aRef.append(aPoint)
        con_force.References=aRef
    
Thanks for help

Cheers
John
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Help to fill Constraint References with code

Post by bernd »

Post Reply