Change of local Z axis sense with Robot API

Change of local Z axis sense with Robot API

LuisCRodrigues
Advocate Advocate
1,590 Views
8 Replies
Message 1 of 9

Change of local Z axis sense with Robot API

LuisCRodrigues
Advocate
Advocate

I want to change the sense of local Z axis of a panel using Robot API.
I've searched the API help and I didn't found any method to do so.
It has a method to define the local X axis but not the Z axis.

Does anyone knows a way to do this?

Thanks in advance.

0 Likes
Accepted solutions (1)
1,591 Views
8 Replies
Replies (8)
Message 2 of 9

Artur.Kosakowski
Autodesk Support
Autodesk Support
Accepted solution

Try to use the following code which changes the orientation of the Z axis for the panel number 1:

Dim r As New RobotOM.RobotApplication
Dim o As RobotOM.RobotObjObject
o = r.Project.Structure.Objects.Get(1)
o.Main.Attribs.DirZ = 1
o.Update()

 

If you find your post answered press the Accept as Solution button please. This will help other users to find solutions much faster. Thank you.



Artur Kosakowski
0 Likes
Message 3 of 9

LuisCRodrigues
Advocate
Advocate

Problem solved!

Thanks for your help.

0 Likes
Message 4 of 9

Anonymous
Not applicable

Hi Artur,

 

Could you tell me how the z-axis and other  axes (x and y)will be oriented if I use the snippet of code provided by you? I am unable to figure it out?

 

Thanks in advance!

0 Likes
Message 5 of 9

Anonymous
Not applicable

Hi,

 

Actually, I want my local coordinate axes for each panel to be such that the z-axis is always pointing outward. 

0 Likes
Message 6 of 9

Anonymous
Not applicable

also, there is a syntax error with the following line:

 

o.Update()

0 Likes
Message 7 of 9

Rafal.Gaweda
Autodesk Support
Autodesk Support

Hi @Anonymous

 

 

Actually, I want my local coordinate axes for each panel to be such that the z-axis is always pointing outward. 


You have to check local Z vector and change it according to your needs

 

Dim RSel As RobotSelection
    Set RSel = RobApp.Project.Structure.Selections.CreateFull(I_OT_PANEL)
    Dim PanelCol As RobotObjObjectCollection
    Set PanelCol = RobApp.Project.Structure.Objects.GetMany(RSel)

Dim X As RobotGeoPoint3D, Y As RobotGeoPoint3D, Z As RobotGeoPoint3D
    Dim Obj As RobotObjObject
    
    Set X = RobApp.CmpntFactory.Create(I_CT_GEO_POINT_3D)
    Set Y = RobApp.CmpntFactory.Create(I_CT_GEO_POINT_3D)
    Set Z = RobApp.CmpntFactory.Create(I_CT_GEO_POINT_3D)
        
        
        Set Obj = PanelCol.Get(1)
        Obj.Main.Attribs.GetLCS X, Y, Z


Rafal Gaweda
Message 8 of 9

Rafal.Gaweda
Autodesk Support
Autodesk Support

Hi @Anonymous

 

also, there is a syntax error with the following line:

 

o.Update()


 

This is C# code

 

In case of VBA : o.Update



Rafal Gaweda
Message 9 of 9

Rafal.Gaweda
Autodesk Support
Autodesk Support

Hi @Anonymous

 

Hint:

o.Main.Attribs.DirZ = 0  'default (assigned by program) local Z direction 

o.Main.Attribs.DirZ = 1 ' opposite to default direction



Rafal Gaweda