Possible to add transform to rotate axes in ini
04 Aug 2011 21:26 #12192
by alanb
Possible to add transform to rotate axes in ini was created by alanb
Hi,
I want the axis display for my machine to be like a lathe but 3D not 2D. So Y I just want to rotate the frame 90 degrees around X. I know I can do this manually each time I start axis, but is there some way of specifying this rotation in the ini file to have it happen automatically?
thanks
Alan
I want the axis display for my machine to be like a lathe but 3D not 2D. So Y I just want to rotate the frame 90 degrees around X. I know I can do this manually each time I start axis, but is there some way of specifying this rotation in the ini file to have it happen automatically?
thanks
Alan
Please Log in or Create an account to join the conversation.
04 Aug 2011 22:38 - 04 Aug 2011 23:07 #12195
by BigJohnT
Replied by BigJohnT on topic Re:Possible to add transform to rotate axes in ini
Alex thinks you can do it from .axisrc but does not know exactly how... further research is needed.
I did find a bit of info on .axisrc
www.linuxcnc.org/docview/html/gui_axis.html#r1_11_4
Is the view one of the default views that you can select with the buttons on the top of the GUI?
John
I did find a bit of info on .axisrc
www.linuxcnc.org/docview/html/gui_axis.html#r1_11_4
Is the view one of the default views that you can select with the buttons on the top of the GUI?
John
Last edit: 04 Aug 2011 23:07 by BigJohnT.
Please Log in or Create an account to join the conversation.
05 Aug 2011 00:50 #12198
by cmorley
Replied by cmorley on topic Re:Possible to add transform to rotate axes in ini
Well here what I found:
If you set the INI option to lathe then no it seems axis ignores the command.
if in mill mode add one of these commands to the .axisrc file (a hidden file in your home folder):
commands.set_view_x()
commands.set_view_y()
commands.set_view_z()
commands.set_view_z2()
commands.set_view_p()
If you set the INI option to lathe then no it seems axis ignores the command.
if in mill mode add one of these commands to the .axisrc file (a hidden file in your home folder):
commands.set_view_x()
commands.set_view_y()
commands.set_view_z()
commands.set_view_z2()
commands.set_view_p()
Please Log in or Create an account to join the conversation.
05 Aug 2011 15:19 - 05 Aug 2011 15:20 #12220
by alanb
Replied by alanb on topic Re:Possible to add transform to rotate axes in ini
Actually the view I want is not one of the standard views. If you take the standard perspective view I want the Z axis to point where the X axis currently points. I though that I would include a screenshot of what I wanted but when I tried to rotate the axes so that Z was where I wanted it to be I met a problem. I was able to just about rotate Z down to X but then could not rotate around to point along the previous X direction. Obviously the designers have limited the range of rotation which is understandable, I had just assumed before that it would be possible but never tried it.
So I have attached a sketch. Having the Y axis pointing up would change the handedness of the system which would be my preference, though I would also be happy if y pointed down. Both could be achieved if we were allowed to attach a pre or post transform in the ini file
Alan
So I have attached a sketch. Having the Y axis pointing up would change the handedness of the system which would be my preference, though I would also be happy if y pointed down. Both could be achieved if we were allowed to attach a pre or post transform in the ini file
Alan
Last edit: 05 Aug 2011 15:20 by alanb.
Please Log in or Create an account to join the conversation.
05 Aug 2011 20:37 #12232
by BigJohnT
Replied by BigJohnT on topic Re:Possible to add transform to rotate axes in ini
You would have to change axis.py or another file to get that orientation AFAIK. I looked but could not find out what or where you you have to change it.
John
John
Please Log in or Create an account to join the conversation.
06 Aug 2011 21:45 #12264
by cmorley
Replied by cmorley on topic Re:Possible to add transform to rotate axes in ini
AXIS calls methods in glnav.py that change the view. You would need to modify the methods or add one.
It's not entirely clear to me how it works so would require experimentation.
It's not entirely clear to me how it works so would require experimentation.
Please Log in or Create an account to join the conversation.
08 Aug 2011 21:39 #12307
by alanb
Replied by alanb on topic Re:Possible to add transform to rotate axes in ini
I looked inside usr/bin at axis.py inside there I found the event handlers for the buttons that set the views, the one shown at the end of this message sets the perspective view. I have cut out some of the initial code. So my question is if I add a transformation at the point marked below will that be sufficient? Unfortunately I do not know the purpose of glRotateScene I assume its parameters are position of origin and orientation of axis but does it do anything else? Also if I wanted to create a button for this new view how easy is it to add that button to the UI ? Would I have to run Glade or is it just a case of adding some extra code to axis.py?
Any information would be gratefully received Alan
Any information would be gratefully received Alan
def set_view_p(event=None):
...
o.reset()
o.perspective = True
if o.g:
mid = [(a+b)/2 for a, b in zip(o.g.max_extents, o.g.min_extents)]
glTranslatef(-mid[0], -mid[1], -mid[2])
***** can I add a transformation here? **************
size = [(a-b) for a, b in zip(o.g.max_extents, o.g.min_extents)]
size = sqrt(size[0] **2 + size[1] ** 2 + size[2] ** 2)
if size > 1e99: size = 5. # in case there are no moves in the preview
w = o.winfo_width()
h = o.winfo_height()
fovx = o.fovy * w / h
fov = min(fovx, o.fovy)
o.set_eyepoint((size * 1.1 + 1.0) / 2 / sin ( fov * pi / 180 / 2))
o.lat = -60
o.lon = 335
x = (o.g.min_extents[0] + o.g.max_extents[0])/2
y = (o.g.min_extents[1] + o.g.max_extents[1])/2
z = (o.g.min_extents[2] + o.g.max_extents[2])/2
glRotateScene(o, 1.0, x, y, z, 0, 0, 0, 0)
else:
o.set_eyepoint(5.)
o.lat = -60
o.lon = 335
glRotateScene(o, 1.0, o.xcenter, o.ycenter, o.zcenter, 0, 0, 0, 0)
o.tkRedraw()
Please Log in or Create an account to join the conversation.
09 Aug 2011 01:34 #12315
by BigJohnT
Replied by BigJohnT on topic Re:Possible to add transform to rotate axes in ini
My guess would be to try different values to see what the effect is... don't forget to build after each change.
John
John
Please Log in or Create an account to join the conversation.
09 Aug 2011 05:45 #12322
by cmorley
Replied by cmorley on topic Re:Possible to add transform to rotate axes in ini
Where did you find that method?
Please Log in or Create an account to join the conversation.
09 Aug 2011 09:34 #12326
by ArcEye
Replied by ArcEye on topic Re:Possible to add transform to rotate axes in ini
cmorley wrote:
Thats what I thought, until I realised that the 2.4.6 version of axis is different to the later dev versions, it is in there.
I am following this with interest, because I want to change the perspective behaviour of Axis for a slant bed lathe and haven't found a satisfactory method yet.
Where did you find that method?
Thats what I thought, until I realised that the 2.4.6 version of axis is different to the later dev versions, it is in there.
I am following this with interest, because I want to change the perspective behaviour of Axis for a slant bed lathe and haven't found a satisfactory method yet.
Please Log in or Create an account to join the conversation.
Time to create page: 0.149 seconds