Model origin

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
pperisin
Posts: 695
Joined: Wed Oct 20, 2010 12:29 pm

Model origin

Postby pperisin » Wed Dec 22, 2010 8:48 am

Hi

Is there a way to show origin in model window (coordinate [0, 0, 0]).

This is kinda necessary for me.

Regards,
Petar Perisin
wmayer
Site Admin
Posts: 14805
Joined: Thu Feb 19, 2009 10:32 am

Re: Model origin

Postby wmayer » Wed Dec 22, 2010 12:25 pm

Is it this what you need?

Code: Select all

from pivy import coin
type=coin.SoType.fromName("SoAxisCrossKit")
axis=type.createInstance()
Gui.ActiveDocument.ActiveView.getSceneGraph().addChild(axis)
pperisin
Posts: 695
Joined: Wed Oct 20, 2010 12:29 pm

Re: Model origin

Postby pperisin » Wed Dec 22, 2010 12:48 pm

Yes. Thank you very much
pperisin
Posts: 695
Joined: Wed Oct 20, 2010 12:29 pm

Re: Model origin

Postby pperisin » Wed Dec 22, 2010 1:23 pm

Hi,

I see that this origin has 3 arrows that are 10cm long.
Is there a way to make origin arrows bigger or smaller, based on the zoom level

Regards
Petar Perisin
wmayer
Site Admin
Posts: 14805
Joined: Thu Feb 19, 2009 10:32 am

Re: Model origin

Postby wmayer » Wed Dec 22, 2010 1:44 pm

I guess what you mean is a axis cross of fix size independent of the zoom level. So try out this:

Code: Select all

from pivy import coin
axisCross=coin.SoType.fromName("SoShapeScale").createInstance()
axisCross.setPart("shape", coin.SoType.fromName("SoAxisCrossKit").createInstance())
axisCross.scaleFactor.setValue(1.0)
Gui.ActiveDocument.ActiveView.getSceneGraph().addChild(axisCross)
You can play with the scaleFactor.
pperisin
Posts: 695
Joined: Wed Oct 20, 2010 12:29 pm

Re: Model origin

Postby pperisin » Wed Dec 22, 2010 1:51 pm

Yes.

That's it. Thank you very much
:D
pperisin
Posts: 695
Joined: Wed Oct 20, 2010 12:29 pm

Re: Model origin

Postby pperisin » Wed Dec 22, 2010 3:01 pm

Hi,

Sorry for asking a lot, but I have scaled entire cursor to scale 0.4, and size is good, only the lines of arrows are too thin.
So, my final question is - is it possible to make arrows a bit wider?

Regards
Petar Perisin
User avatar
yorik
Site Admin
Posts: 11514
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Model origin

Postby yorik » Wed Dec 22, 2010 4:00 pm

Just as a note, you can create quite complex widgets with pivy/coin... I think this cross widget is a default one Werner or Jürgen did for FreeCAD and I'm not sure how far it is customizable, but you can easily build a totally custom one. Have a look here:
http://sourceforge.net/apps/mediawiki/f ... title=Pivy
wmayer
Site Admin
Posts: 14805
Joined: Thu Feb 19, 2009 10:32 am

Re: Model origin

Postby wmayer » Wed Dec 22, 2010 4:34 pm

So, my final question is - is it possible to make arrows a bit wider?
The SoAxisCrossKit is a node kit and there you can usually access each component of it and may customize it. In this case you should be able to access the arrow with

Code: Select all

axis=axisCross.getPart("shape",0)
cone=axis.getPart("xHead.shape",0)
cone.bottomRadius.setValue(10)
pperisin
Posts: 695
Joined: Wed Oct 20, 2010 12:29 pm

Re: Model origin

Postby pperisin » Thu Dec 23, 2010 9:20 am

Hi,

Thank you guys for help, but radius of an arrow is not what I wanted. I wanted a bit bigger radius of a line that connects arrow and the origin.

This is what I have now:
------------------->

I would like to have this:
=============>

You probably figured out which radius now.

Since I'm new to python (and generally to object oriented programming) I still have one final question:

When I'm writing down final line in python console:
cone.bottomRadius.setValue(10)

when I write 'cone.' a list appears. Why is 'bottomRadius' not listed in this list? and where in documentation can I find 'bottomRadius'

Regards,
Petar Perisin