0.16 Features We'd Like To See

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
godblessfq
Posts: 94
Joined: Fri Jul 17, 2015 7:40 pm

Re: 0.16 Features We'd Like To See

Postby godblessfq » Sat Oct 24, 2015 1:49 pm

Hello everyone,
Maybe the preference dilogue can be improved.
I'd like the tool icon size to have more options. I want the size 20 and it's not in the dropdown list.
I have to modify user.cfg file in my home folder:
<FCInt Name="ToolbarIconSize" Value="20"/>
But that is overwriten the next time preference is set and I need to change it back again.
Why not just left it as an editable box?
OS: Debian GNU/Linux 8.0 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5632 (Git)
Build type: Release
godblessfq
Posts: 94
Joined: Fri Jul 17, 2015 7:40 pm

Re: 0.16 Features We'd Like To See

Postby godblessfq » Tue Nov 17, 2015 9:01 pm

Maybe the shape2Dview in the draft workbench should use the view direction as the default projection direction.
cox
Posts: 963
Joined: Wed Nov 26, 2014 11:37 pm

Re: 0.16 Features We'd Like To See

Postby cox » Tue Nov 17, 2015 10:07 pm

godblessfq wrote:Maybe the shape2Dview in the draft workbench should use the view direction as the default projection direction.
Sound intuitive :) +1
Need help? Feel free to ask, but please read the guidelines first
User avatar
microelly2
Posts: 4354
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: 0.16 Features We'd Like To See

Postby microelly2 » Tue Nov 17, 2015 11:01 pm

godblessfq wrote:Maybe the shape2Dview in the draft workbench should use the view direction as the default projection direction.

Code: Select all

import math
import FreeCAD,Draft
camera = FreeCADGui.ActiveDocument.ActiveView.getCameraNode()
a=str(camera.position.getValue().toString())
al=a.split(' ')

v=Draft.makeShape2DView(FreeCAD.ActiveDocument.YourObject)
v.Projection=(float(al[0]),float(al[1]),float(al[2]))
I still have to understand the rotation angle - tomorrow.
godblessfq
Posts: 94
Joined: Fri Jul 17, 2015 7:40 pm

Re: 0.16 Features We'd Like To See

Postby godblessfq » Wed Nov 18, 2015 1:52 pm

Thank you for the macro. I am gonna to replace the shape2dview tool with it. :)
mario52
Posts: 2648
Joined: Wed May 16, 2012 2:13 pm

Re: 0.16 Features We'd Like To See

Postby mario52 » Thu Nov 19, 2015 3:53 pm

hi microelly2
i modify your code for use with one object selected
I would put it in the wiki, what name can we give it
if you agree !

Code: Select all

import math
import FreeCAD,Draft

try:
    sel = FreeCADGui.Selection.getSelection()[0]
    camera = FreeCADGui.ActiveDocument.ActiveView.getCameraNode()
    a=str(camera.position.getValue().toString())
    al=a.split(' ')

    v=Draft.makeShape2DView(FreeCAD.ActiveDocument.getObject(sel.Name))
    v.Projection=(float(al[0]),float(al[1]),float(al[2]))
    App.ActiveDocument.recompute()
except Exception:
    print "Select one object"
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Dialog creation. My macros on Gist.github.
User avatar
microelly2
Posts: 4354
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: 0.16 Features We'd Like To See

Postby microelly2 » Thu Nov 19, 2015 8:46 pm

Good idea mario,
I would it call 2DView and store into https://github.com/FreeCAD/FreeCAD-macros
There is already a macro Foto.FCMacro, which makes a picture (still works from top view)

Do you have access to that git or I can check it in.
I want to make some more modification next:

1. rotate to view in a way that the real z-axis maps to the y-axis of the 2dView

2. and we should make the exeption handling stronger.

Code: Select all

def errorDialog(msg):
    diag = QtGui.QMessageBox(QtGui.QMessageBox.Critical,u"Error Message",msg )
    diag.setWindowFlags(PySide.QtCore.Qt.WindowStaysOnTopHint)
    diag.exec_()
    
 ....    
except Exception:
    errorDialog( "Select one object")
mario52
Posts: 2648
Joined: Wed May 16, 2012 2:13 pm

Re: 0.16 Features We'd Like To See

Postby mario52 » Fri Nov 20, 2015 9:52 am

hi
microelly2 wrote:I would it call 2DView
ok and the icon ?
microelly2 wrote:Do you have access to that git or I can check it in.
no
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Dialog creation. My macros on Gist.github.
User avatar
microelly2
Posts: 4354
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: 0.16 Features We'd Like To See

Postby microelly2 » Fri Nov 20, 2015 1:40 pm

I don't see a simple solution to get the right direction of generated figure by a script.
somewhere behind Drawing.projectEx and HLRAlgo_Projector may be a way to get the things right,
but for me a running script is better than hours to read.

So my proposal: Create a Draft.Clone of the part, Rotate this clone to get the right view from +z
and then create the shape2View from this clone.

May be someone can tell me how the rotation logic is :?
(otherwise I will put the proposal into a macro)