Linear Releases with API

Linear Releases with API

Anonymous
Not applicable
1,852 Views
7 Replies
Message 1 of 8

Linear Releases with API

Anonymous
Not applicable

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

0 Likes
Accepted solutions (2)
1,853 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

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);

}

}

}

0 Likes
Message 3 of 8

Rafal.Gaweda
Autodesk Support
Autodesk Support

try to add

 

robotObjObject .Update
robotObjObject .Initialize

 

to the end of if



Rafal Gaweda
0 Likes
Message 4 of 8

Anonymous
Not applicable

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

0 Likes
Message 5 of 8

Rafal.Gaweda
Autodesk Support
Autodesk Support

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

 



Rafal Gaweda
0 Likes
Message 6 of 8

Anonymous
Not applicable

Hi Rafal,

 

Have you got any clarification on this?

 

 

0 Likes
Message 7 of 8

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution

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
Message 8 of 8

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution
 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
0 Likes