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

Post by pperisin »

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
Founder
Posts: 20300
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Model origin

Post by wmayer »

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

Post by pperisin »

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

Re: Model origin

Post by pperisin »

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
Founder
Posts: 20300
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Model origin

Post by wmayer »

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

Post by pperisin »

Yes.

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

Re: Model origin

Post by pperisin »

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
Founder
Posts: 13659
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Model origin

Post by yorik »

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
Founder
Posts: 20300
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Model origin

Post by wmayer »

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

Post by pperisin »

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
Post Reply