• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Autodesk Robot Structural Analysis

    Reply
    Active Member
    Posts: 8
    Registered: ‎06-01-2012
    Accepted Solution

    Linear Releases with API

    179 Views, 7 Replies
    06-07-2012 03:36 AM

    Hi,

     

    I'm trying to script some linear releases using the Robot API in C#, but can't seem to get my head around it. Can you please post an example defining a linear release?

     

    What I'm trying to achieve is releasing all edges shared by two panels, but only on one of the panels to avoid getting to many DOFs.

     

    Hope you are able to help me out,

     

    Andreas

    Please use plain text.
    Active Member
    Posts: 8
    Registered: ‎06-01-2012

    Re: Linear Releases with API

    06-07-2012 06:59 AM in reply to: AndreasBak

    I think I'm getting closer to an answer myself. The following code runs perfectly, but doesn't seem to produce any releases on the edges. What am I missing?

     

    IRobotLabel linearReleaseLabel = robotApplication.Project.Structure.Labels.Create(IRobotLabelType.I_LT_LINEAR_RELEASE, this.name);

     

    RobotLinearReleaseServerlinearReleaseServer = robotApplication.Project.Structure.Objects.LinearReleases;

     

    RobotLinearReleaseData linearReleaseData = (RobotLinearReleaseData)linearReleaseLabel.Data;

    linearReleaseData.HX =

    this.HX;

    linearReleaseData.KX =

    this.KX;

    linearReleaseData.KY =

    this.KY;

    linearReleaseData.KZ =

    this.KZ;

    linearReleaseData.RX = toRobotLinearReleaseDefinitionType(RX);

    linearReleaseData.UX = toRobotLinearReleaseDefinitionType(UX);

    linearReleaseData.UY = toRobotLinearReleaseDefinitionType(UY);

    linearReleaseData.UZ = toRobotLinearReleaseDefinitionType(UZ);

    robotApplication.Project.Structure.Labels.Store(linearReleaseLabel);

    RobotObjObjectServerrobotObjObjectServer = robotApplication.Project.Structure.Objects;

     

    for (inti = 0; i < panelIndices.Count; i++) {

     

    IRobotObjObject robotObjObject = (RobotObjObject) robotObjObjectServer.Get(i+1);

     

    RobotObjPartMain robotObjPartMain = (RobotObjPartMain) robotObjObject.Main;

     

    RobotObjEdgeCollection objEdges = (RobotObjEdgeCollection) robotObjPartMain.Edges;

     

    for (intj = 1; j <= objEdges.Count; j++) {

     

    RobotObjEdge objEdge = (RobotObjEdge) objEdges.Get(j);

     

    if (objEdge.HasLabel(IRobotLabelType.I_LT_LINEAR_RELEASE) == 0) {

    objEdge.SetLabel(

    IRobotLabelType.I_LT_LINEAR_RELEASE, this.name);

    }

    }

    }

    Please use plain text.
    Product Support
    Posts: 2,532
    Registered: ‎04-26-2010

    Re: Linear Releases with API

    06-07-2012 03:36 PM in reply to: AndreasBak

    try to add

     

    robotObjObject .Update
    robotObjObject .Initialize

     

    to the end of if



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Active Member
    Posts: 8
    Registered: ‎06-01-2012

    Re: Linear Releases with API

    06-08-2012 05:03 AM in reply to: RG_Adsk

    Hi Rafal,

     

    Thanks for the reply... Unfortunatly it still doesn't work. The label is is created without any problems, nevertheless I tryed changing the label to a Robot native one:

     

    objEdge.SetLabel(IRobotLabelType.I_LT_LINEAR_RELEASE, "pinned");

     

    And I know for sure that the line of code is running, but it still doesn't work. Is this not the right way of applying a linerar release label to an edge?

     

    Thanks again,

     

    Andreas

    Please use plain text.
    Product Support
    Posts: 2,532
    Registered: ‎04-26-2010

    Re: Linear Releases with API

    06-09-2012 12:55 AM in reply to: AndreasBak

    I need develeopers to check why SETLABEL and HASLABEL do not work for linear releases.

     



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Active Member
    Posts: 8
    Registered: ‎06-01-2012

    Re: Linear Releases with API

    06-13-2012 08:59 AM in reply to: RG_Adsk

    Hi Rafal,

     

    Have you got any clarification on this?

     

     

    Please use plain text.
    Product Support
    Posts: 2,532
    Registered: ‎04-26-2010

    Re: Linear Releases with API

    06-14-2012 12:58 AM in reply to: AndreasBak

    I have not checked yet but operation by  labels (set , has) as you did works only for supports for objects.

    For linear releases you should use:

     

    robotApplication.Project.Structure.Objects.LinearReleases....

     

     



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Product Support
    Posts: 2,532
    Registered: ‎04-26-2010

    Re: Linear Releases with API

    06-14-2012 05:41 AM in reply to: RG_Adsk
     private void button1_Click(object sender, EventArgs e)
            {
                RobotApplication robotApplication = new RobotApplication();
                IRobotLabel linearReleaseLabel = robotApplication.Project.Structure.Labels.Create(IRobotLabelType.I_LT_LINEAR_RELEASE, "apirel");
    
                RobotLinearReleaseData linearReleaseData = (RobotLinearReleaseData)linearReleaseLabel.Data;
                linearReleaseData.HX = 0;
                linearReleaseData.KX =0;
                linearReleaseData.KY =0;
                linearReleaseData.KZ =0;
                linearReleaseData.RX = IRobotLinearReleaseDefinitionType.I_LRDT_RELEASED  ;
                linearReleaseData.UX = IRobotLinearReleaseDefinitionType.I_LRDT_NONE;
                linearReleaseData.UY = IRobotLinearReleaseDefinitionType.I_LRDT_NONE;
                linearReleaseData.UZ = IRobotLinearReleaseDefinitionType.I_LRDT_NONE;
                robotApplication.Project.Structure.Labels.Store(linearReleaseLabel);
    
                RobotObjObjectServer robotObjObjectServer = robotApplication.Project.Structure.Objects;
                IRobotObjObject robotObjObject = (RobotObjObject)robotObjObjectServer.Get(1);
    
                int Numberofedges = robotObjObject.Main.Edges.Count;
                for (int i = 1; i <= Numberofedges; i++)
                {
                    if (robotObjObjectServer.LinearReleases.FindEdge(robotObjObject.Number,i) == 0)
                    {
                        robotObjObjectServer.LinearReleases.Set(robotObjObject.Number,i, robotObjObject.Number,1,"apirel");
                    }
                }
                robotObjObject.Update();
                this.Close();
            }

     



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.