Merge branch 'master' of git://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright: http://www.ii-system.com *
|
||||
* License: LGPL *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include "styles.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright: http://www.ii-system.com *
|
||||
* License: LGPL *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "styles.h"
|
||||
|
||||
#include <iisTaskPanel>
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright: http://www.ii-system.com *
|
||||
* License: LGPL *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef TEST_H
|
||||
#define TEST_H
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright: http://www.ii-system.com *
|
||||
* License: LGPL *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QtGui/QApplication>
|
||||
#include "test.h"
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright: http://www.ii-system.com *
|
||||
* License: LGPL *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#include <iisTaskPanel>
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/***************************************************************************
|
||||
* *
|
||||
* Copyright: http://www.ii-system.com *
|
||||
* License: LGPL *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef TEST_H
|
||||
#define TEST_H
|
||||
|
||||
|
||||
@@ -887,7 +887,8 @@ class svgHandler(xml.sax.ContentHandler):
|
||||
rot90=FreeCAD.Matrix(0,-1,0,0,1,0) #90
|
||||
m3=m3.multiply(rot90)
|
||||
m3.move(c.multiply(-1))
|
||||
sh.transform(m3)
|
||||
sh.transformShape(m3)
|
||||
#sh = sh.transformGeometry(m3)
|
||||
if self.fill:
|
||||
sh = Part.Wire([sh])
|
||||
sh = Part.Face(sh)
|
||||
|
||||
@@ -4,29 +4,29 @@
|
||||
# This is the second one of three init scripts, the third one
|
||||
# runs when the gui is up
|
||||
|
||||
#***************************************************************************
|
||||
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002
|
||||
#* *
|
||||
#* This file is part of the FreeCAD CAx development system. *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU General Public License (GPL) *
|
||||
#* as published by the Free Software Foundation; either version 2 of *
|
||||
#* the License, or (at your option) any later version. *
|
||||
#* for detail see the LICENCE text file. *
|
||||
#* *
|
||||
#* FreeCAD is distributed in the hope that it will be useful, *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
#* GNU Library General Public License for more details. *
|
||||
#* *
|
||||
#* You should have received a copy of the GNU Library General Public *
|
||||
#* License along with FreeCAD; if not, write to the Free Software *
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#* Juergen Riegel 2002 *
|
||||
#***************************************************************************/
|
||||
#***************************************************************************
|
||||
#* (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
|
||||
#* *
|
||||
#* This file is part of the FreeCAD CAx development system. *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
#* as published by the Free Software Foundation; either version 2 of *
|
||||
#* the License, or (at your option) any later version. *
|
||||
#* for detail see the LICENCE text file. *
|
||||
#* *
|
||||
#* FreeCAD is distributed in the hope that it will be useful, *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
#* GNU Lesser General Public License for more details. *
|
||||
#* *
|
||||
#* You should have received a copy of the GNU Library General Public *
|
||||
#* License along with FreeCAD; if not, write to the Free Software *
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#* Juergen Riegel 2002 *
|
||||
#***************************************************************************/
|
||||
|
||||
import FreeCAD
|
||||
param = FreeCAD.ParamGet(\
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> *
|
||||
#* Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
#* as published by the Free Software Foundation; either version 2 of *
|
||||
#* the License, or (at your option) any later version. *
|
||||
#* for detail see the LICENCE text file. *
|
||||
#* *
|
||||
#* This program is distributed in the hope that it will be useful, *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
#* GNU Library General Public License for more details. *
|
||||
#* *
|
||||
#* You should have received a copy of the GNU Library General Public *
|
||||
#* License along with this program; if not, write to the Free Software *
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
__title__="FreeCAD OpenSCAD Workbench - GUI Commands"
|
||||
__author__ = "Sebastian Hoogen"
|
||||
__url__ = ["http://free-cad.sourceforge.net"]
|
||||
|
||||
'''
|
||||
This Script includes the GUI Commands of the OpenSCAD module
|
||||
'''
|
||||
|
||||
import FreeCAD,FreeCADGui
|
||||
from PyQt4 import QtGui, QtCore
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> *
|
||||
#* Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> *
|
||||
#* Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
|
||||
@@ -1,3 +1,34 @@
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
#* as published by the Free Software Foundation; either version 2 of *
|
||||
#* the License, or (at your option) any later version. *
|
||||
#* for detail see the LICENCE text file. *
|
||||
#* *
|
||||
#* This program is distributed in the hope that it will be useful, *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
#* GNU Library General Public License for more details. *
|
||||
#* *
|
||||
#* You should have received a copy of the GNU Library General Public *
|
||||
#* License along with this program; if not, write to the Free Software *
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
__title__="FreeCAD OpenSCAD Workbench - 2D helper fuctions"
|
||||
__author__ = "Sebastian Hoogen"
|
||||
__url__ = ["http://free-cad.sourceforge.net"]
|
||||
|
||||
'''
|
||||
This Script includes python functions to ifind out the most basic shape type
|
||||
in a compound and to change the color of shapes according to thier shape type
|
||||
'''
|
||||
|
||||
import FreeCAD
|
||||
def shapedict(shapelst):
|
||||
return dict([(shape.hashCode(),shape) for shape in shapelst])
|
||||
|
||||
@@ -1,3 +1,34 @@
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
#* as published by the Free Software Foundation; either version 2 of *
|
||||
#* the License, or (at your option) any later version. *
|
||||
#* for detail see the LICENCE text file. *
|
||||
#* *
|
||||
#* This program is distributed in the hope that it will be useful, *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
#* GNU Library General Public License for more details. *
|
||||
#* *
|
||||
#* You should have received a copy of the GNU Library General Public *
|
||||
#* License along with this program; if not, write to the Free Software *
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
__title__="FreeCAD OpenSCAD Workbench - expand placements and matrices fuctions"
|
||||
__author__ = "Sebastian Hoogen"
|
||||
__url__ = ["http://free-cad.sourceforge.net"]
|
||||
|
||||
'''
|
||||
This Script includes python functions to shift all placements down the
|
||||
feature tree to the most baisc objects
|
||||
'''
|
||||
|
||||
import FreeCAD
|
||||
from OpenSCADFeatures import *
|
||||
from OpenSCADUtils import isspecialorthogonalpython,isspecialorthogonal
|
||||
|
||||
@@ -416,12 +416,12 @@ def p_difference_action(p):
|
||||
print "difference"
|
||||
print len(p[5])
|
||||
print p[5]
|
||||
mycut = doc.addObject('Part::Cut',p[1])
|
||||
mycut.Base = p[5][0]
|
||||
if (len(p[5]) == 1 ): #single object
|
||||
p[0] = p[5]
|
||||
else:
|
||||
# Cut using Fuse
|
||||
mycut = doc.addObject('Part::Cut',p[1])
|
||||
mycut.Base = p[5][0]
|
||||
# Can only Cut two objects do we need to fuse extras
|
||||
if (len(p[5]) > 2 ):
|
||||
print "Need to Fuse Extra First"
|
||||
@@ -803,7 +803,7 @@ def p_cylinder_action(p):
|
||||
mycyl.Height = h
|
||||
mycyl.Radius1 = r1
|
||||
mycyl.Radius2 = r2
|
||||
print "Center = ",center
|
||||
print "Center = ",tocenter
|
||||
if tocenter=='true' :
|
||||
center(mycyl,0,0,h)
|
||||
if False :
|
||||
@@ -939,7 +939,10 @@ def p_polyhedron_action(p) :
|
||||
f = make_face(v[int(i[0])],v[int(i[1])],v[int(i[2])])
|
||||
faces_list.append(f)
|
||||
shell=Part.makeShell(faces_list)
|
||||
mypolyhed.Shape=Part.Solid(shell)
|
||||
solid=Part.Solid(shell).removeSplitter()
|
||||
if solid.Volume < 0:
|
||||
solid.reverse()
|
||||
mypolyhed.Shape=solid
|
||||
p[0] = [mypolyhed]
|
||||
|
||||
def p_projection_action(p) :
|
||||
|
||||
@@ -1,3 +1,35 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# ply: __init__.py
|
||||
#
|
||||
# Copyright (C) 2001-2011,
|
||||
# David M. Beazley (Dabeaz LLC)
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of the David Beazley or Dabeaz LLC may be used to
|
||||
# endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -----------------------------------------------------------------------------
|
||||
# PLY package
|
||||
# Author: David Beazley (dave@dabeaz.com)
|
||||
|
||||
|
||||
@@ -1,3 +1,36 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# ply: setup.py
|
||||
#
|
||||
# Copyright (C) 2001-2011,
|
||||
# David M. Beazley (Dabeaz LLC)
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of the David Beazley or Dabeaz LLC may be used to
|
||||
# endorse or promote products derived from this software without
|
||||
# specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
try:
|
||||
from setuptools import setup
|
||||
except ImportError:
|
||||
|
||||
@@ -687,7 +687,6 @@ def insert(filename,docname):
|
||||
#doc.recompute()
|
||||
|
||||
|
||||
import FreeCAD
|
||||
|
||||
global dxfcache
|
||||
dxfcache = {}
|
||||
|
||||
@@ -1,3 +1,33 @@
|
||||
#***************************************************************************
|
||||
#* *
|
||||
#* Copyright (c) 2012 Sebastian Hoogen <github@sebastianhoogen.de> *
|
||||
#* *
|
||||
#* This program is free software; you can redistribute it and/or modify *
|
||||
#* it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
#* as published by the Free Software Foundation; either version 2 of *
|
||||
#* the License, or (at your option) any later version. *
|
||||
#* for detail see the LICENCE text file. *
|
||||
#* *
|
||||
#* This program is distributed in the hope that it will be useful, *
|
||||
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
#* GNU Library General Public License for more details. *
|
||||
#* *
|
||||
#* You should have received a copy of the GNU Library General Public *
|
||||
#* License along with this program; if not, write to the Free Software *
|
||||
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
#* USA *
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
__title__="FreeCAD OpenSCAD Workbench - replace object fuction"
|
||||
__author__ = "Sebastian Hoogen"
|
||||
__url__ = ["http://free-cad.sourceforge.net"]
|
||||
|
||||
'''
|
||||
This fucntions allows to replace an object in the feature hierarchy
|
||||
'''
|
||||
|
||||
def replaceobj(parent,oldchild,newchild):
|
||||
for propname in parent.PropertiesList:
|
||||
propvalue=parent.getPropertyByName(propname)
|
||||
|
||||
@@ -53,6 +53,7 @@ using namespace Part;
|
||||
|
||||
const int Part2DObject::H_Axis = -1;
|
||||
const int Part2DObject::V_Axis = -2;
|
||||
const int Part2DObject::N_Axis = -3;
|
||||
|
||||
PROPERTY_SOURCE(Part::Part2DObject, Part::Feature)
|
||||
|
||||
@@ -215,6 +216,9 @@ Base::Axis Part2DObject::getAxis(int axId) const
|
||||
else if (axId == V_Axis) {
|
||||
return Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(0,1,0));
|
||||
}
|
||||
else if (axId == N_Axis) {
|
||||
return Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(0,0,1));
|
||||
}
|
||||
return Base::Axis();
|
||||
}
|
||||
|
||||
|
||||
@@ -92,6 +92,7 @@ public:
|
||||
|
||||
static const int H_Axis;
|
||||
static const int V_Axis;
|
||||
static const int N_Axis;
|
||||
|
||||
/** @name methods overide Feature */
|
||||
//@{
|
||||
|
||||
@@ -34,8 +34,9 @@
|
||||
|
||||
|
||||
#include "FeatureLinearPattern.h"
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
#include <Base/Axis.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
#include <Mod/Part/App/Part2DObject.h>
|
||||
|
||||
using namespace PartDesign;
|
||||
|
||||
@@ -47,7 +48,6 @@ PROPERTY_SOURCE(PartDesign::LinearPattern, PartDesign::Transformed)
|
||||
LinearPattern::LinearPattern()
|
||||
{
|
||||
ADD_PROPERTY_TYPE(Direction,(0),"LinearPattern",(App::PropertyType)(App::Prop_None),"Direction");
|
||||
ADD_PROPERTY(StdDirection,(""));
|
||||
ADD_PROPERTY(Reversed,(0));
|
||||
ADD_PROPERTY(Length,(100.0));
|
||||
ADD_PROPERTY(Occurrences,(3));
|
||||
@@ -56,7 +56,6 @@ LinearPattern::LinearPattern()
|
||||
short LinearPattern::mustExecute() const
|
||||
{
|
||||
if (Direction.isTouched() ||
|
||||
StdDirection.isTouched() ||
|
||||
Reversed.isTouched() ||
|
||||
Length.isTouched() ||
|
||||
Occurrences.isTouched())
|
||||
@@ -66,7 +65,6 @@ short LinearPattern::mustExecute() const
|
||||
|
||||
const std::list<gp_Trsf> LinearPattern::getTransformations(const std::vector<App::DocumentObject*>)
|
||||
{
|
||||
std::string stdDirection = StdDirection.getValue();
|
||||
float distance = Length.getValue();
|
||||
if (distance < Precision::Confusion())
|
||||
throw Base::Exception("Pattern length too small");
|
||||
@@ -75,37 +73,35 @@ const std::list<gp_Trsf> LinearPattern::getTransformations(const std::vector<App
|
||||
throw Base::Exception("At least two occurrences required");
|
||||
bool reversed = Reversed.getValue();
|
||||
|
||||
gp_Dir dir;
|
||||
double offset = distance / (occurrences - 1);
|
||||
|
||||
if (!stdDirection.empty()) {
|
||||
// Note: The placement code commented out below had the defect of working always on the
|
||||
// absolute X,Y,Z direction, not on the relative coordinate system of the Body feature.
|
||||
// It requires positionBySupport() to be called in Transformed::Execute() AFTER
|
||||
// the call to getTransformations()
|
||||
// New code thanks to logari81
|
||||
if (stdDirection == "X") {
|
||||
//dir = Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(1,0,0));
|
||||
dir = gp_Dir(1,0,0);
|
||||
} else if (stdDirection == "Y") {
|
||||
//dir = Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(0,1,0));
|
||||
dir = gp_Dir(0,1,0);
|
||||
} else if(stdDirection == "Z") {
|
||||
//dir = Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(0,0,1));
|
||||
dir = gp_Dir(0,0,1);
|
||||
} else {
|
||||
throw Base::Exception("Invalid direction (must be X, Y or Z)");
|
||||
}
|
||||
} else {
|
||||
App::DocumentObject* refObject = Direction.getValue();
|
||||
if (refObject == NULL)
|
||||
throw Base::Exception("No direction specified");
|
||||
if (!refObject->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
throw Base::Exception("Direction reference must be edge or face of a feature");
|
||||
std::vector<std::string> subStrings = Direction.getSubValues();
|
||||
if (subStrings.empty() || subStrings[0].empty())
|
||||
throw Base::Exception("No direction reference specified");
|
||||
App::DocumentObject* refObject = Direction.getValue();
|
||||
if (refObject == NULL)
|
||||
throw Base::Exception("No direction reference specified");
|
||||
if (!refObject->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
throw Base::Exception("Direction reference must be edge or face of a feature");
|
||||
std::vector<std::string> subStrings = Direction.getSubValues();
|
||||
if (subStrings.empty() || subStrings[0].empty())
|
||||
throw Base::Exception("No direction reference specified");
|
||||
|
||||
gp_Dir dir;
|
||||
if (refObject->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId())) {
|
||||
Part::Part2DObject* refSketch = static_cast<Part::Part2DObject*>(refObject);
|
||||
Base::Axis axis;
|
||||
if (subStrings[0] == "H_Axis")
|
||||
axis = refSketch->getAxis(Part::Part2DObject::H_Axis);
|
||||
else if (subStrings[0] == "V_Axis")
|
||||
axis = refSketch->getAxis(Part::Part2DObject::V_Axis);
|
||||
else if (subStrings[0] == "N_Axis")
|
||||
axis = refSketch->getAxis(Part::Part2DObject::N_Axis);
|
||||
else if (subStrings[0].size() > 4 && subStrings[0].substr(0,4) == "Axis") {
|
||||
int AxId = std::atoi(subStrings[0].substr(4,4000).c_str());
|
||||
if (AxId >= 0 && AxId < refSketch->getAxisCount())
|
||||
axis = refSketch->getAxis(AxId);
|
||||
}
|
||||
axis *= refSketch->Placement.getValue();
|
||||
dir = gp_Dir(axis.getDirection().x, axis.getDirection().y, axis.getDirection().z);
|
||||
} else {
|
||||
Part::Feature* refFeature = static_cast<Part::Feature*>(refObject);
|
||||
Part::TopoShape refShape = refFeature->Shape.getShape();
|
||||
TopoDS_Shape ref = refShape.getSubShape(subStrings[0].c_str());
|
||||
@@ -119,8 +115,6 @@ const std::list<gp_Trsf> LinearPattern::getTransformations(const std::vector<App
|
||||
throw Base::Exception("Direction face must be planar");
|
||||
|
||||
dir = adapt.Plane().Axis().Direction();
|
||||
//gp_Dir d = adapt.Plane().Axis().Direction();
|
||||
//dir = Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(d.X(), d.Y(), d.Z()));
|
||||
} else if (ref.ShapeType() == TopAbs_EDGE) {
|
||||
TopoDS_Edge refEdge = TopoDS::Edge(ref);
|
||||
if (refEdge.IsNull())
|
||||
@@ -129,24 +123,14 @@ const std::list<gp_Trsf> LinearPattern::getTransformations(const std::vector<App
|
||||
if (adapt.GetType() != GeomAbs_Line)
|
||||
throw Base::Exception("Direction edge must be a straight line");
|
||||
|
||||
//gp_Dir d = adapt.Line().Direction();
|
||||
//dir = Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(d.X(), d.Y(), d.Z()));
|
||||
dir = adapt.Line().Direction();
|
||||
} else {
|
||||
throw Base::Exception("Direction reference must be edge or face");
|
||||
}
|
||||
TopLoc_Location invObjLoc = this->getLocation().Inverted();
|
||||
dir.Transform(invObjLoc.Transformation());
|
||||
}
|
||||
TopLoc_Location invObjLoc = this->getLocation().Inverted();
|
||||
dir.Transform(invObjLoc.Transformation());
|
||||
|
||||
// get the support placement
|
||||
// TODO: Check for NULL pointer
|
||||
/*Part::Feature* supportFeature = static_cast<Part::Feature*>(originals.front());
|
||||
if (supportFeature == NULL)
|
||||
throw Base::Exception("Cannot work on invalid support shape");
|
||||
Base::Placement supportPlacement = supportFeature->Placement.getValue();
|
||||
dir *= supportPlacement;
|
||||
gp_Vec direction(dir.getDirection().x, dir.getDirection().y, dir.getDirection().z);*/
|
||||
gp_Vec direction(dir.X(), dir.Y(), dir.Z());
|
||||
|
||||
if (reversed)
|
||||
|
||||
@@ -39,7 +39,6 @@ public:
|
||||
LinearPattern();
|
||||
|
||||
App::PropertyLinkSub Direction;
|
||||
App::PropertyString StdDirection;
|
||||
App::PropertyBool Reversed;
|
||||
App::PropertyFloat Length;
|
||||
App::PropertyInteger Occurrences;
|
||||
@@ -58,8 +57,6 @@ public:
|
||||
* Returns a list of (Occurrences - 1) transformations since the first, untransformed instance
|
||||
* is not counted. Each transformation will move the shape it is applied to by the distance
|
||||
* (Length / (Occurrences - 1)) so that the transformations will cover the total Length.
|
||||
* If StdDirection is "X", "Y" or "Z" then the transformation direction will be parallel to the
|
||||
* corresponding axis
|
||||
* If Direction contains a feature and a face name, then the transformation direction will be
|
||||
* the normal of the given face, which must be planar. If it contains an edge name, then the
|
||||
* transformation direction will be parallel to the given edge, which must be linear
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "FeatureMirrored.h"
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
#include <Mod/Part/App/Part2DObject.h>
|
||||
|
||||
using namespace PartDesign;
|
||||
|
||||
@@ -44,45 +45,47 @@ PROPERTY_SOURCE(PartDesign::Mirrored, PartDesign::Transformed)
|
||||
Mirrored::Mirrored()
|
||||
{
|
||||
ADD_PROPERTY_TYPE(MirrorPlane,(0),"Mirrored",(App::PropertyType)(App::Prop_None),"Mirror plane");
|
||||
ADD_PROPERTY(StdMirrorPlane,(""));
|
||||
}
|
||||
|
||||
short Mirrored::mustExecute() const
|
||||
{
|
||||
if (MirrorPlane.isTouched() ||
|
||||
StdMirrorPlane.isTouched())
|
||||
if (MirrorPlane.isTouched())
|
||||
return 1;
|
||||
return Transformed::mustExecute();
|
||||
}
|
||||
|
||||
const std::list<gp_Trsf> Mirrored::getTransformations(const std::vector<App::DocumentObject*>)
|
||||
{
|
||||
App::DocumentObject* ref = MirrorPlane.getValue();
|
||||
App::DocumentObject* refObject = MirrorPlane.getValue();
|
||||
if (refObject == NULL)
|
||||
throw Base::Exception("No mirror plane reference specified");
|
||||
if (!refObject->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
throw Base::Exception("Mirror plane reference must be face of a feature");
|
||||
std::vector<std::string> subStrings = MirrorPlane.getSubValues();
|
||||
std::string stdPlane = StdMirrorPlane.getValue();
|
||||
if (subStrings.empty() || subStrings[0].empty())
|
||||
throw Base::Exception("No mirror plane reference specified");
|
||||
|
||||
gp_Pnt p;
|
||||
gp_Dir d;
|
||||
if (!stdPlane.empty()) {
|
||||
p = gp_Pnt(0,0,0);
|
||||
if (stdPlane == "XY") {
|
||||
d = gp_Dir(0,0,1);
|
||||
} else if (stdPlane == "XZ") {
|
||||
d = gp_Dir(0,1,0);
|
||||
} else if(stdPlane == "YZ") {
|
||||
d = gp_Dir(1,0,0);
|
||||
} else {
|
||||
throw Base::Exception("Invalid mirror plane (must be XY, XZ or YZ)");
|
||||
gp_Pnt axbase;
|
||||
gp_Dir axdir;
|
||||
if (refObject->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId())) {
|
||||
Part::Part2DObject* refSketch = static_cast<Part::Part2DObject*>(refObject);
|
||||
Base::Axis axis;
|
||||
if (subStrings[0] == "H_Axis")
|
||||
axis = refSketch->getAxis(Part::Part2DObject::V_Axis);
|
||||
else if (subStrings[0] == "V_Axis")
|
||||
axis = refSketch->getAxis(Part::Part2DObject::H_Axis);
|
||||
else if (subStrings[0] == "")
|
||||
axis = refSketch->getAxis(Part::Part2DObject::N_Axis);
|
||||
else if (subStrings[0].size() > 4 && subStrings[0].substr(0,4) == "Axis") {
|
||||
int AxId = std::atoi(subStrings[0].substr(4,4000).c_str());
|
||||
if (AxId >= 0 && AxId < refSketch->getAxisCount())
|
||||
axis = refSketch->getAxis(AxId);
|
||||
}
|
||||
axis *= refSketch->Placement.getValue();
|
||||
axbase = gp_Pnt(axis.getBase().x, axis.getBase().y, axis.getBase().z);
|
||||
axdir = gp_Dir(axis.getDirection().x, axis.getDirection().y, axis.getDirection().z);
|
||||
} else {
|
||||
if (ref == NULL)
|
||||
throw Base::Exception("No mirror plane selected");
|
||||
if (!ref->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
throw Base::Exception("Mirror plane must be face of a feature");
|
||||
Part::TopoShape baseShape = static_cast<Part::Feature*>(ref)->Shape.getShape();
|
||||
|
||||
if (subStrings.empty() || subStrings[0].empty())
|
||||
throw Base::Exception("No mirror plane defined");
|
||||
Part::TopoShape baseShape = static_cast<Part::Feature*>(refObject)->Shape.getShape();
|
||||
// TODO: Check for multiple mirror planes?
|
||||
|
||||
TopoDS_Face face = TopoDS::Face(baseShape.getSubShape(subStrings[0].c_str()));
|
||||
@@ -92,22 +95,14 @@ const std::list<gp_Trsf> Mirrored::getTransformations(const std::vector<App::Doc
|
||||
if (adapt.GetType() != GeomAbs_Plane)
|
||||
throw Base::Exception("Mirror face must be planar");
|
||||
|
||||
p = getPointFromFace(face);
|
||||
d = adapt.Plane().Axis().Direction();
|
||||
TopLoc_Location invObjLoc = this->getLocation().Inverted();
|
||||
p.Transform(invObjLoc.Transformation());
|
||||
d.Transform(invObjLoc.Transformation());
|
||||
axbase = getPointFromFace(face);
|
||||
axdir = adapt.Plane().Axis().Direction();
|
||||
}
|
||||
TopLoc_Location invObjLoc = this->getLocation().Inverted();
|
||||
axbase.Transform(invObjLoc.Transformation());
|
||||
axdir.Transform(invObjLoc.Transformation());
|
||||
|
||||
// get the support placement
|
||||
// TODO: Check for NULL pointer
|
||||
/*Part::Feature* supportFeature = static_cast<Part::Feature*>(originals.front());
|
||||
if (supportFeature == NULL)
|
||||
throw Base::Exception("Cannot work on invalid support shape");
|
||||
Base::Placement supportPlacement = supportFeature->Placement.getValue();
|
||||
ax *= supportPlacement;
|
||||
gp_Ax2 mirrorAxis(gp_Pnt(ax.getBase().x, ax.getBase().y, ax.getBase().z), gp_Dir(ax.getDirection().x, ax.getDirection().y, ax.getDirection().z));*/
|
||||
gp_Ax2 mirrorAxis(p, d);
|
||||
gp_Ax2 mirrorAxis(axbase, axdir);
|
||||
|
||||
std::list<gp_Trsf> transformations;
|
||||
gp_Trsf trans;
|
||||
|
||||
@@ -39,7 +39,6 @@ public:
|
||||
Mirrored();
|
||||
|
||||
App::PropertyLinkSub MirrorPlane;
|
||||
App::PropertyString StdMirrorPlane;
|
||||
|
||||
/** @name methods override feature */
|
||||
//@{
|
||||
@@ -54,7 +53,6 @@ public:
|
||||
/** Create transformations
|
||||
* Returns a list containing one transformation since the first, untransformed instance
|
||||
* is not counted. The transformation will mirror the shape it is applied to on a plane
|
||||
* If StdMirrorPlane is "XY", "YZ" or "YZ" then the mirror plane will the corresponding plane
|
||||
* If MirrorPlane contains a feature and an face name, then the mirror plane will be
|
||||
* the the given face, which must be planar
|
||||
*/
|
||||
|
||||
@@ -32,9 +32,10 @@
|
||||
|
||||
|
||||
#include "FeaturePolarPattern.h"
|
||||
#include <Base/Tools.h>
|
||||
#include <Base/Axis.h>
|
||||
#include <Base/Tools.h>
|
||||
#include <Mod/Part/App/TopoShape.h>
|
||||
#include <Mod/Part/App/Part2DObject.h>
|
||||
|
||||
using namespace PartDesign;
|
||||
|
||||
@@ -46,7 +47,6 @@ PROPERTY_SOURCE(PartDesign::PolarPattern, PartDesign::Transformed)
|
||||
PolarPattern::PolarPattern()
|
||||
{
|
||||
ADD_PROPERTY_TYPE(Axis,(0),"PolarPattern",(App::PropertyType)(App::Prop_None),"Direction");
|
||||
ADD_PROPERTY(StdAxis,(""));
|
||||
ADD_PROPERTY(Reversed,(0));
|
||||
ADD_PROPERTY(Angle,(360.0));
|
||||
ADD_PROPERTY(Occurrences,(3));
|
||||
@@ -55,7 +55,6 @@ PolarPattern::PolarPattern()
|
||||
short PolarPattern::mustExecute() const
|
||||
{
|
||||
if (Axis.isTouched() ||
|
||||
StdAxis.isTouched() ||
|
||||
Reversed.isTouched() ||
|
||||
Angle.isTouched() ||
|
||||
Occurrences.isTouched())
|
||||
@@ -65,7 +64,6 @@ short PolarPattern::mustExecute() const
|
||||
|
||||
const std::list<gp_Trsf> PolarPattern::getTransformations(const std::vector<App::DocumentObject*>)
|
||||
{
|
||||
std::string stdAxis = StdAxis.getValue();
|
||||
float angle = Angle.getValue();
|
||||
if (angle < Precision::Confusion())
|
||||
throw Base::Exception("Pattern angle too small");
|
||||
@@ -80,32 +78,35 @@ const std::list<gp_Trsf> PolarPattern::getTransformations(const std::vector<App:
|
||||
else
|
||||
offset = Base::toRadians<double>(angle) / (occurrences - 1);
|
||||
|
||||
App::DocumentObject* refObject = Axis.getValue();
|
||||
if (refObject == NULL)
|
||||
throw Base::Exception("No axis reference specified");
|
||||
if (!refObject->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
throw Base::Exception("Axis reference must be edge of a feature");
|
||||
std::vector<std::string> subStrings = Axis.getSubValues();
|
||||
if (subStrings.empty() || subStrings[0].empty())
|
||||
throw Base::Exception("No axis reference specified");
|
||||
|
||||
gp_Pnt axbase;
|
||||
gp_Dir axdir;
|
||||
if (!stdAxis.empty()) {
|
||||
axbase = gp_Pnt(0,0,0);
|
||||
if (stdAxis == "X") {
|
||||
axdir = gp_Dir(1,0,0);
|
||||
//ax = Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(1,0,0));
|
||||
} else if (stdAxis == "Y") {
|
||||
axdir = gp_Dir(0,1,0);
|
||||
//ax = Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(0,1,0));
|
||||
} else if(stdAxis == "Z") {
|
||||
axdir = gp_Dir(0,0,1);
|
||||
//ax = Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(0,0,1));
|
||||
} else {
|
||||
throw Base::Exception("Invalid axis (must be X, Y or Z)");
|
||||
if (refObject->getTypeId().isDerivedFrom(Part::Part2DObject::getClassTypeId())) {
|
||||
Part::Part2DObject* refSketch = static_cast<Part::Part2DObject*>(refObject);
|
||||
Base::Axis axis;
|
||||
if (subStrings[0] == "H_Axis")
|
||||
axis = refSketch->getAxis(Part::Part2DObject::H_Axis);
|
||||
else if (subStrings[0] == "V_Axis")
|
||||
axis = refSketch->getAxis(Part::Part2DObject::V_Axis);
|
||||
else if (subStrings[0] == "N_Axis")
|
||||
axis = refSketch->getAxis(Part::Part2DObject::N_Axis);
|
||||
else if (subStrings[0].size() > 4 && subStrings[0].substr(0,4) == "Axis") {
|
||||
int AxId = std::atoi(subStrings[0].substr(4,4000).c_str());
|
||||
if (AxId >= 0 && AxId < refSketch->getAxisCount())
|
||||
axis = refSketch->getAxis(AxId);
|
||||
}
|
||||
axis *= refSketch->Placement.getValue();
|
||||
axbase = gp_Pnt(axis.getBase().x, axis.getBase().y, axis.getBase().z);
|
||||
axdir = gp_Dir(axis.getDirection().x, axis.getDirection().y, axis.getDirection().z);
|
||||
} else {
|
||||
App::DocumentObject* refObject = Axis.getValue();
|
||||
if (refObject == NULL)
|
||||
throw Base::Exception("No axis specified");
|
||||
if (!refObject->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
throw Base::Exception("Axis reference must be edge of a feature");
|
||||
std::vector<std::string> subStrings = Axis.getSubValues();
|
||||
if (subStrings.empty() || subStrings[0].empty())
|
||||
throw Base::Exception("No axis reference specified");
|
||||
|
||||
Part::Feature* refFeature = static_cast<Part::Feature*>(refObject);
|
||||
Part::TopoShape refShape = refFeature->Shape.getShape();
|
||||
TopoDS_Shape ref = refShape.getSubShape(subStrings[0].c_str());
|
||||
@@ -123,20 +124,11 @@ const std::list<gp_Trsf> PolarPattern::getTransformations(const std::vector<App:
|
||||
} else {
|
||||
throw Base::Exception("Axis reference must be an edge");
|
||||
}
|
||||
|
||||
TopLoc_Location invObjLoc = this->getLocation().Inverted();
|
||||
axbase.Transform(invObjLoc.Transformation());
|
||||
axdir.Transform(invObjLoc.Transformation());
|
||||
}
|
||||
TopLoc_Location invObjLoc = this->getLocation().Inverted();
|
||||
axbase.Transform(invObjLoc.Transformation());
|
||||
axdir.Transform(invObjLoc.Transformation());
|
||||
|
||||
// get the support placement
|
||||
// TODO: Check for NULL pointer
|
||||
/*Part::Feature* supportFeature = static_cast<Part::Feature*>(originals.front());
|
||||
if (supportFeature == NULL)
|
||||
throw Base::Exception("Cannot work on invalid support shape");
|
||||
Base::Placement supportPlacement = supportFeature->Placement.getValue();
|
||||
ax *= supportPlacement;
|
||||
gp_Ax2 axis(gp_Pnt(ax.getBase().x, ax.getBase().y, ax.getBase().z), gp_Dir(ax.getDirection().x, ax.getDirection().y, ax.getDirection().z));*/
|
||||
gp_Ax2 axis(axbase, axdir);
|
||||
|
||||
if (reversed)
|
||||
|
||||
@@ -39,7 +39,6 @@ public:
|
||||
PolarPattern();
|
||||
|
||||
App::PropertyLinkSub Axis;
|
||||
App::PropertyString StdAxis;
|
||||
App::PropertyBool Reversed;
|
||||
App::PropertyFloat Angle;
|
||||
App::PropertyInteger Occurrences;
|
||||
@@ -60,7 +59,6 @@ public:
|
||||
* (Angle / (Occurrences - 1)) so that the transformations will cover the total Angle. The only
|
||||
* exception is Angle = 360 degrees in which case the transformation angle will be
|
||||
* (Angle / Occurrences) so that the last transformed shape is not identical with the original shape
|
||||
* If StdAxis is "X", "Y" or "Z" then the transformation axis will the corresponding axis
|
||||
* If Axis contains a feature and an edge name, then the transformation axis will be
|
||||
* the the given edge, which must be linear
|
||||
* If Reversed is true, the direction of rotation will be opposite
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||
|
||||
#include "FeatureSketchBased.h"
|
||||
#include <Mod/Part/App/Part2DObject.h>
|
||||
|
||||
using namespace PartDesign;
|
||||
|
||||
|
||||
@@ -71,6 +71,15 @@ App::DocumentObject* Transformed::getSupportObject() const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
App::DocumentObject* Transformed::getSketchObject() const
|
||||
{
|
||||
std::vector<DocumentObject*> originals = Originals.getValues();
|
||||
if (!originals.empty() && originals.front()->getTypeId().isDerivedFrom(PartDesign::SketchBased::getClassTypeId()))
|
||||
return (static_cast<PartDesign::SketchBased*>(originals.front()))->getVerifiedSketch();
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
short Transformed::mustExecute() const
|
||||
{
|
||||
if (Originals.isTouched())
|
||||
|
||||
@@ -52,6 +52,9 @@ public:
|
||||
/// Return first original, which serves as "Support" until Body feature becomes functional
|
||||
App::DocumentObject* getSupportObject() const;
|
||||
|
||||
/// Return the sketch of the first original
|
||||
App::DocumentObject* getSketchObject() const;
|
||||
|
||||
/// Get the list of transformations describing the members of the pattern
|
||||
// Note: Only the Scaled feature requires the originals
|
||||
virtual const std::list<gp_Trsf> getTransformations(const std::vector<App::DocumentObject*> originals) {
|
||||
|
||||
@@ -895,7 +895,10 @@ void CmdPartDesignMirrored::activated(int iMsg)
|
||||
// Exception (Thu Sep 6 11:52:01 2012): 'App.Document' object has no attribute 'Mirrored'
|
||||
updateActive(); // Helps to ensure that the object already exists when the next command comes up
|
||||
doCommand(Doc,str.str().c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.StdMirrorPlane = \"XY\"", FeatName.c_str());
|
||||
Part::Part2DObject *sketch = (static_cast<PartDesign::SketchBased*>(features.front()))->getVerifiedSketch();
|
||||
if (sketch)
|
||||
doCommand(Doc,"App.activeDocument().%s.MirrorPlane = (App.activeDocument().%s, [\"V_Axis\"])",
|
||||
FeatName.c_str(), sketch->getNameInDocument());
|
||||
for (std::vector<std::string>::iterator it = tempSelNames.begin(); it != tempSelNames.end(); ++it)
|
||||
doCommand(Gui,"Gui.activeDocument().%s.Visibility=False",it->c_str());
|
||||
|
||||
@@ -967,7 +970,10 @@ void CmdPartDesignLinearPattern::activated(int iMsg)
|
||||
doCommand(Doc,"App.activeDocument().addObject(\"PartDesign::LinearPattern\",\"%s\")",FeatName.c_str());
|
||||
updateActive();
|
||||
doCommand(Doc,str.str().c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.StdDirection = \"X\"", FeatName.c_str());
|
||||
Part::Part2DObject *sketch = (static_cast<PartDesign::SketchBased*>(features.front()))->getVerifiedSketch();
|
||||
if (sketch)
|
||||
doCommand(Doc,"App.activeDocument().%s.Direction = (App.activeDocument().%s, [\"H_Axis\"])",
|
||||
FeatName.c_str(), sketch->getNameInDocument());
|
||||
doCommand(Doc,"App.activeDocument().%s.Length = 100", FeatName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.Occurrences = 2", FeatName.c_str());
|
||||
for (std::vector<std::string>::iterator it = tempSelNames.begin(); it != tempSelNames.end(); ++it)
|
||||
@@ -1041,7 +1047,10 @@ void CmdPartDesignPolarPattern::activated(int iMsg)
|
||||
doCommand(Doc,"App.activeDocument().addObject(\"PartDesign::PolarPattern\",\"%s\")",FeatName.c_str());
|
||||
updateActive();
|
||||
doCommand(Doc,str.str().c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.StdAxis = \"X\"", FeatName.c_str());
|
||||
Part::Part2DObject *sketch = (static_cast<PartDesign::SketchBased*>(features.front()))->getVerifiedSketch();
|
||||
if (sketch)
|
||||
doCommand(Doc,"App.activeDocument().%s.Axis = (App.activeDocument().%s, [\"N_Axis\"])",
|
||||
FeatName.c_str(), sketch->getNameInDocument());
|
||||
doCommand(Doc,"App.activeDocument().%s.Angle = 360", FeatName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.Occurrences = 2", FeatName.c_str());
|
||||
for (std::vector<std::string>::iterator it = tempSelNames.begin(); it != tempSelNames.end(); ++it)
|
||||
|
||||
@@ -93,14 +93,14 @@ TaskLinearPatternParameters::TaskLinearPatternParameters(TaskMultiTransformParam
|
||||
|
||||
void TaskLinearPatternParameters::setupUI()
|
||||
{
|
||||
connect(ui->comboDirection, SIGNAL(activated(int)),
|
||||
this, SLOT(onDirectionChanged(int)));
|
||||
connect(ui->checkReverse, SIGNAL(toggled(bool)),
|
||||
this, SLOT(onCheckReverse(bool)));
|
||||
connect(ui->spinLength, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onLength(double)));
|
||||
connect(ui->spinOccurrences, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(onOccurrences(int)));
|
||||
connect(ui->buttonReference, SIGNAL(toggled(bool)),
|
||||
this, SLOT(onButtonReference(bool)));
|
||||
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
|
||||
this, SLOT(onUpdateView(bool)));
|
||||
|
||||
@@ -119,14 +119,10 @@ void TaskLinearPatternParameters::setupUI()
|
||||
}
|
||||
// ---------------------
|
||||
|
||||
//ui->buttonX->setEnabled(true);
|
||||
//ui->buttonY->setEnabled(true);
|
||||
//ui->buttonZ->setEnabled(true);
|
||||
ui->comboDirection->setEnabled(true);
|
||||
ui->checkReverse->setEnabled(true);
|
||||
ui->spinLength->setEnabled(true);
|
||||
ui->spinOccurrences->setEnabled(true);
|
||||
ui->buttonReference->setEnabled(true);
|
||||
ui->lineReference->setEnabled(false); // This is never enabled since it is for optical feed-back only
|
||||
updateUI();
|
||||
}
|
||||
|
||||
@@ -140,35 +136,31 @@ void TaskLinearPatternParameters::updateUI()
|
||||
|
||||
App::DocumentObject* directionFeature = pcLinearPattern->Direction.getValue();
|
||||
std::vector<std::string> directions = pcLinearPattern->Direction.getSubValues();
|
||||
std::string stdDirection = pcLinearPattern->StdDirection.getValue();
|
||||
bool reverse = pcLinearPattern->Reversed.getValue();
|
||||
double length = pcLinearPattern->Length.getValue();
|
||||
unsigned occurrences = pcLinearPattern->Occurrences.getValue();
|
||||
|
||||
ui->buttonReference->setChecked(referenceSelectionMode);
|
||||
if (!stdDirection.empty())
|
||||
{
|
||||
//ui->buttonX->setAutoExclusive(true);
|
||||
//ui->buttonY->setAutoExclusive(true);
|
||||
//ui->buttonZ->setAutoExclusive(true);
|
||||
//ui->buttonX->setChecked(stdDirection == "X");
|
||||
//ui->buttonY->setChecked(stdDirection == "Y");
|
||||
//ui->buttonZ->setChecked(stdDirection == "Z");
|
||||
ui->lineReference->setText(tr(""));
|
||||
} else if (directionFeature != NULL && !directions.empty()) {
|
||||
//ui->buttonX->setAutoExclusive(false);
|
||||
//ui->buttonY->setAutoExclusive(false);
|
||||
//ui->buttonZ->setAutoExclusive(false);
|
||||
//ui->buttonX->setChecked(false);
|
||||
//ui->buttonY->setChecked(false);
|
||||
//ui->buttonZ->setChecked(false);
|
||||
ui->lineReference->setText(QString::fromAscii(directions.front().c_str()));
|
||||
for (int i=ui->comboDirection->count()-1; i >= 2; i--)
|
||||
ui->comboDirection->removeItem(i);
|
||||
|
||||
if (directionFeature != NULL && !directions.empty()) {
|
||||
if (directions.front() == "H_Axis")
|
||||
ui->comboDirection->setCurrentIndex(0);
|
||||
else if (directions.front() == "V_Axis")
|
||||
ui->comboDirection->setCurrentIndex(1);
|
||||
else if (directionFeature != NULL && !directions.empty()) {
|
||||
ui->comboDirection->addItem(QString::fromAscii(directions.front().c_str()));
|
||||
ui->comboDirection->setCurrentIndex(2);
|
||||
}
|
||||
} else {
|
||||
// Error message?
|
||||
ui->lineReference->setText(tr(""));
|
||||
}
|
||||
if (referenceSelectionMode)
|
||||
ui->lineReference->setText(tr("Select an edge or a face"));
|
||||
|
||||
if (referenceSelectionMode) {
|
||||
ui->comboDirection->addItem(tr("Select an edge or a face"));
|
||||
ui->comboDirection->setCurrentIndex(ui->comboDirection->count() - 1);
|
||||
} else
|
||||
ui->comboDirection->addItem(tr("Select reference..."));
|
||||
|
||||
// Note: These three lines would trigger onLength(), on Occurrences() and another updateUI() if we
|
||||
// didn't check for blockUpdate
|
||||
@@ -201,31 +193,22 @@ void TaskLinearPatternParameters::onSelectionChanged(const Gui::SelectionChanges
|
||||
PartDesign::LinearPattern* pcLinearPattern = static_cast<PartDesign::LinearPattern*>(getObject());
|
||||
std::vector<std::string> directions(1,subName);
|
||||
pcLinearPattern->Direction.setValue(getSupportObject(), directions);
|
||||
pcLinearPattern->StdDirection.setValue("");
|
||||
|
||||
recomputeFeature();
|
||||
updateUI();
|
||||
}
|
||||
else {
|
||||
ui->buttonReference->setChecked(referenceSelectionMode);
|
||||
ui->lineReference->setText(QString::fromAscii(subName.c_str()));
|
||||
for (int i=ui->comboDirection->count()-1; i >= 2; i--)
|
||||
ui->comboDirection->removeItem(i);
|
||||
|
||||
ui->comboDirection->addItem(QString::fromAscii(subName.c_str()));
|
||||
ui->comboDirection->setCurrentIndex(2);
|
||||
ui->comboDirection->addItem(tr("Select reference..."));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//void TaskLinearPatternParameters::onButtonX() {
|
||||
// onStdDirection("X");
|
||||
//}
|
||||
//
|
||||
//void TaskLinearPatternParameters::onButtonY() {
|
||||
// onStdDirection("Y");
|
||||
//}
|
||||
//
|
||||
//void TaskLinearPatternParameters::onButtonZ() {
|
||||
// onStdDirection("Z");
|
||||
//}
|
||||
|
||||
void TaskLinearPatternParameters::onCheckReverse(const bool on) {
|
||||
if (blockUpdate)
|
||||
return;
|
||||
@@ -259,30 +242,32 @@ void TaskLinearPatternParameters::onOccurrences(const int n) {
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskLinearPatternParameters::onStdDirection(const std::string& dir) {
|
||||
void TaskLinearPatternParameters::onDirectionChanged(int num) {
|
||||
if (blockUpdate)
|
||||
return;
|
||||
PartDesign::LinearPattern* pcLinearPattern = static_cast<PartDesign::LinearPattern*>(getObject());
|
||||
pcLinearPattern->StdDirection.setValue(dir.c_str());
|
||||
pcLinearPattern->Direction.setValue(NULL);
|
||||
|
||||
exitSelectionMode();
|
||||
updateUI();
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskLinearPatternParameters::onButtonReference(bool checked)
|
||||
{
|
||||
if (checked ) {
|
||||
if (num == 0) {
|
||||
pcLinearPattern->Direction.setValue(getSketchObject(), std::vector<std::string>(1,"H_Axis"));
|
||||
exitSelectionMode();
|
||||
}
|
||||
else if (num == 1) {
|
||||
pcLinearPattern->Direction.setValue(getSketchObject(), std::vector<std::string>(1,"V_Axis"));
|
||||
exitSelectionMode();
|
||||
}
|
||||
else if (num == ui->comboDirection->count() - 1) {
|
||||
// enter reference selection mode
|
||||
hideObject();
|
||||
showOriginals();
|
||||
referenceSelectionMode = true;
|
||||
Gui::Selection().clearSelection();
|
||||
addReferenceSelectionGate(true, true);
|
||||
} else {
|
||||
exitSelectionMode();
|
||||
}
|
||||
else if (num == 2)
|
||||
exitSelectionMode();
|
||||
|
||||
updateUI();
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskLinearPatternParameters::onUpdateView(bool on)
|
||||
@@ -295,16 +280,13 @@ void TaskLinearPatternParameters::onUpdateView(bool on)
|
||||
std::string direction = getDirection();
|
||||
if (!direction.empty()) {
|
||||
std::vector<std::string> directions(1,direction);
|
||||
pcLinearPattern->Direction.setValue(getSupportObject(), directions);
|
||||
if (direction == "H_Axis" || direction == "V_Axis")
|
||||
pcLinearPattern->Direction.setValue(getSketchObject(), directions);
|
||||
else
|
||||
pcLinearPattern->Direction.setValue(getSupportObject(), directions);
|
||||
} else
|
||||
pcLinearPattern->Direction.setValue(NULL);
|
||||
|
||||
std::string stdDirection = getStdDirection();
|
||||
if (!stdDirection.empty())
|
||||
pcLinearPattern->StdDirection.setValue(stdDirection.c_str());
|
||||
else
|
||||
pcLinearPattern->StdDirection.setValue(NULL);
|
||||
|
||||
pcLinearPattern->Reversed.setValue(getReverse());
|
||||
pcLinearPattern->Length.setValue(getLength());
|
||||
pcLinearPattern->Occurrences.setValue(getOccurrences());
|
||||
@@ -313,20 +295,15 @@ void TaskLinearPatternParameters::onUpdateView(bool on)
|
||||
}
|
||||
}
|
||||
|
||||
const std::string TaskLinearPatternParameters::getStdDirection(void) const
|
||||
{
|
||||
//if (ui->buttonX->isChecked())
|
||||
// return std::string("X");
|
||||
//else if (ui->buttonY->isChecked())
|
||||
// return std::string("Y");
|
||||
//else if (ui->buttonZ->isChecked())
|
||||
// return std::string("Z");
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
const std::string TaskLinearPatternParameters::getDirection(void) const
|
||||
{
|
||||
return ui->lineReference->text().toStdString();
|
||||
{
|
||||
if (ui->comboDirection->currentIndex() == 0)
|
||||
return "H_Axis";
|
||||
else if (ui->comboDirection->currentIndex() == 1)
|
||||
return "V_Axis";
|
||||
else if (ui->comboDirection->count() > 3 && ui->comboDirection->currentIndex() == 2)
|
||||
return ui->comboDirection->currentText().toStdString();
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
const bool TaskLinearPatternParameters::getReverse(void) const
|
||||
@@ -388,13 +365,14 @@ bool TaskDlgLinearPatternParameters::accept()
|
||||
std::string direction = linearpatternParameter->getDirection();
|
||||
if (!direction.empty()) {
|
||||
QString buf = QString::fromUtf8("(App.ActiveDocument.%1,[\"%2\"])");
|
||||
buf = buf.arg(QString::fromUtf8(linearpatternParameter->getSupportObject()->getNameInDocument()));
|
||||
if (direction == "H_Axis" || direction == "V_Axis")
|
||||
buf = buf.arg(QString::fromUtf8(linearpatternParameter->getSketchObject()->getNameInDocument()));
|
||||
else
|
||||
buf = buf.arg(QString::fromUtf8(linearpatternParameter->getSupportObject()->getNameInDocument()));
|
||||
buf = buf.arg(QString::fromUtf8(direction.c_str()));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Direction = %s", name.c_str(), buf.toStdString().c_str());
|
||||
} else
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Direction = None", name.c_str());
|
||||
std::string stdDirection = linearpatternParameter->getStdDirection();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.StdDirection = \"%s\"",name.c_str(),stdDirection.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %u",name.c_str(),linearpatternParameter->getReverse());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Length = %f",name.c_str(),linearpatternParameter->getLength());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Occurrences = %u",name.c_str(),linearpatternParameter->getOccurrences());
|
||||
|
||||
@@ -56,21 +56,16 @@ public:
|
||||
TaskLinearPatternParameters(TaskMultiTransformParameters *parentTask, QLayout *layout);
|
||||
virtual ~TaskLinearPatternParameters();
|
||||
|
||||
const std::string getStdDirection(void) const;
|
||||
const std::string getDirection(void) const;
|
||||
const bool getReverse(void) const;
|
||||
const double getLength(void) const;
|
||||
const unsigned getOccurrences(void) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onStdDirection(const std::string& dir);
|
||||
//void onButtonX();
|
||||
//void onButtonY();
|
||||
//void onButtonZ();
|
||||
void onDirectionChanged(int num);
|
||||
void onCheckReverse(const bool on);
|
||||
void onLength(const double l);
|
||||
void onOccurrences(const int n);
|
||||
void onButtonReference(const bool checked);
|
||||
virtual void onUpdateView(bool);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>225</width>
|
||||
<width>260</width>
|
||||
<height>402</height>
|
||||
</rect>
|
||||
</property>
|
||||
@@ -31,17 +31,30 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonReference">
|
||||
<widget class="QLabel" name="labelDirection">
|
||||
<property name="text">
|
||||
<string>Direction</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineReference"/>
|
||||
<widget class="QComboBox" name="comboDirection">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Horizontal sketch axis</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Vertical sketch axis</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Select reference...</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@@ -69,9 +82,6 @@
|
||||
<property name="maximum">
|
||||
<double>999999.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>5.000000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>100.000000000000000</double>
|
||||
</property>
|
||||
|
||||
@@ -93,14 +93,8 @@ TaskMirroredParameters::TaskMirroredParameters(TaskMultiTransformParameters *par
|
||||
|
||||
void TaskMirroredParameters::setupUI()
|
||||
{
|
||||
connect(ui->buttonXY, SIGNAL(pressed()),
|
||||
this, SLOT(onButtonXY()));
|
||||
connect(ui->buttonXZ, SIGNAL(pressed()),
|
||||
this, SLOT(onButtonXZ()));
|
||||
connect(ui->buttonYZ, SIGNAL(pressed()),
|
||||
this, SLOT(onButtonYZ()));
|
||||
connect(ui->buttonReference, SIGNAL(toggled(bool)),
|
||||
this, SLOT(onButtonReference(bool)));
|
||||
connect(ui->comboPlane, SIGNAL(activated(int)),
|
||||
this, SLOT(onPlaneChanged(int)));
|
||||
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
|
||||
this, SLOT(onUpdateView(bool)));
|
||||
|
||||
@@ -119,11 +113,7 @@ void TaskMirroredParameters::setupUI()
|
||||
}
|
||||
// ---------------------
|
||||
|
||||
ui->buttonXY->setEnabled(true);
|
||||
ui->buttonXZ->setEnabled(true);
|
||||
ui->buttonYZ->setEnabled(true);
|
||||
ui->buttonReference->setEnabled(true);
|
||||
ui->lineReference->setEnabled(false); // This is never enabled since it is for optical feed-back only
|
||||
ui->comboPlane->setEnabled(true);
|
||||
updateUI();
|
||||
}
|
||||
|
||||
@@ -132,35 +122,33 @@ void TaskMirroredParameters::updateUI()
|
||||
if (blockUpdate)
|
||||
return;
|
||||
blockUpdate = true;
|
||||
|
||||
PartDesign::Mirrored* pcMirrored = static_cast<PartDesign::Mirrored*>(getObject());
|
||||
|
||||
App::DocumentObject* mirrorPlaneFeature = pcMirrored->MirrorPlane.getValue();
|
||||
std::vector<std::string> mirrorPlanes = pcMirrored->MirrorPlane.getSubValues();
|
||||
std::string stdMirrorPlane = pcMirrored->StdMirrorPlane.getValue();
|
||||
|
||||
for (int i=ui->comboPlane->count()-1; i >= 2; i--)
|
||||
ui->comboPlane->removeItem(i);
|
||||
|
||||
ui->buttonReference->setChecked(referenceSelectionMode);
|
||||
if (!stdMirrorPlane.empty())
|
||||
{
|
||||
ui->buttonXY->setAutoExclusive(true);
|
||||
ui->buttonXZ->setAutoExclusive(true);
|
||||
ui->buttonYZ->setAutoExclusive(true);
|
||||
ui->buttonXY->setChecked(stdMirrorPlane == "XY");
|
||||
ui->buttonXZ->setChecked(stdMirrorPlane == "XZ");
|
||||
ui->buttonYZ->setChecked(stdMirrorPlane == "YZ");
|
||||
ui->lineReference->setText(tr(""));
|
||||
} else if (mirrorPlaneFeature != NULL && !mirrorPlanes.empty()) {
|
||||
ui->buttonXY->setAutoExclusive(false);
|
||||
ui->buttonXZ->setAutoExclusive(false);
|
||||
ui->buttonYZ->setAutoExclusive(false);
|
||||
ui->buttonXY->setChecked(false);
|
||||
ui->buttonXZ->setChecked(false);
|
||||
ui->buttonYZ->setChecked(false);
|
||||
ui->lineReference->setText(QString::fromAscii(mirrorPlanes.front().c_str()));
|
||||
if (mirrorPlaneFeature != NULL && !mirrorPlanes.empty()) {
|
||||
if (mirrorPlanes.front() == "H_Axis")
|
||||
ui->comboPlane->setCurrentIndex(0);
|
||||
else if (mirrorPlanes.front() == "V_Axis")
|
||||
ui->comboPlane->setCurrentIndex(1);
|
||||
else if (mirrorPlaneFeature != NULL && !mirrorPlanes.empty()) {
|
||||
ui->comboPlane->addItem(QString::fromAscii(mirrorPlanes.front().c_str()));
|
||||
ui->comboPlane->setCurrentIndex(2);
|
||||
}
|
||||
} else {
|
||||
// Error message?
|
||||
ui->lineReference->setText(tr(""));
|
||||
}
|
||||
if (referenceSelectionMode)
|
||||
ui->lineReference->setText(tr("Select a plane"));
|
||||
|
||||
if (referenceSelectionMode) {
|
||||
ui->comboPlane->addItem(tr("Select a face"));
|
||||
ui->comboPlane->setCurrentIndex(ui->comboPlane->count() - 1);
|
||||
} else
|
||||
ui->comboPlane->addItem(tr("Select reference..."));
|
||||
|
||||
blockUpdate = false;
|
||||
}
|
||||
@@ -186,55 +174,48 @@ void TaskMirroredParameters::onSelectionChanged(const Gui::SelectionChanges& msg
|
||||
PartDesign::Mirrored* pcMirrored = static_cast<PartDesign::Mirrored*>(getObject());
|
||||
std::vector<std::string> mirrorPlanes(1,subName);
|
||||
pcMirrored->MirrorPlane.setValue(getSupportObject(), mirrorPlanes);
|
||||
pcMirrored->StdMirrorPlane.setValue("");
|
||||
|
||||
recomputeFeature();
|
||||
updateUI();
|
||||
}
|
||||
else {
|
||||
ui->buttonReference->setChecked(referenceSelectionMode);
|
||||
ui->lineReference->setText(QString::fromAscii(subName.c_str()));
|
||||
for (int i=ui->comboPlane->count()-1; i >= 2; i--)
|
||||
ui->comboPlane->removeItem(i);
|
||||
|
||||
ui->comboPlane->addItem(QString::fromAscii(subName.c_str()));
|
||||
ui->comboPlane->setCurrentIndex(2);
|
||||
ui->comboPlane->addItem(tr("Select reference..."));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TaskMirroredParameters::onStdMirrorPlane(const std::string &plane) {
|
||||
void TaskMirroredParameters::onPlaneChanged(int num) {
|
||||
if (blockUpdate)
|
||||
return;
|
||||
PartDesign::Mirrored* pcMirrored = static_cast<PartDesign::Mirrored*>(getObject());
|
||||
pcMirrored->StdMirrorPlane.setValue(plane.c_str());
|
||||
pcMirrored->MirrorPlane.setValue(NULL);
|
||||
|
||||
exitSelectionMode();
|
||||
updateUI();
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskMirroredParameters::onButtonXY() {
|
||||
onStdMirrorPlane("XY");
|
||||
}
|
||||
|
||||
void TaskMirroredParameters::onButtonXZ() {
|
||||
onStdMirrorPlane("XZ");
|
||||
}
|
||||
|
||||
void TaskMirroredParameters::onButtonYZ() {
|
||||
onStdMirrorPlane("YZ");
|
||||
}
|
||||
|
||||
void TaskMirroredParameters::onButtonReference(bool checked)
|
||||
{
|
||||
if (checked ) {
|
||||
if (num == 0) {
|
||||
pcMirrored->MirrorPlane.setValue(getSketchObject(), std::vector<std::string>(1,"H_Axis"));
|
||||
exitSelectionMode();
|
||||
}
|
||||
else if (num == 1) {
|
||||
pcMirrored->MirrorPlane.setValue(getSketchObject(), std::vector<std::string>(1,"V_Axis"));
|
||||
exitSelectionMode();
|
||||
}
|
||||
else if (num == ui->comboPlane->count() - 1) {
|
||||
// enter reference selection mode
|
||||
hideObject();
|
||||
showOriginals();
|
||||
referenceSelectionMode = true;
|
||||
Gui::Selection().clearSelection();
|
||||
addReferenceSelectionGate(false, true);
|
||||
} else {
|
||||
exitSelectionMode();
|
||||
}
|
||||
else if (num == 2)
|
||||
exitSelectionMode();
|
||||
|
||||
updateUI();
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskMirroredParameters::onUpdateView(bool on)
|
||||
@@ -247,37 +228,28 @@ void TaskMirroredParameters::onUpdateView(bool on)
|
||||
std::string mirrorPlane = getMirrorPlane();
|
||||
if (!mirrorPlane.empty()) {
|
||||
std::vector<std::string> planes(1,mirrorPlane);
|
||||
pcMirrored->MirrorPlane.setValue(getSupportObject(),planes);
|
||||
if (mirrorPlane == "H_Axis" || mirrorPlane == "V_Axis")
|
||||
pcMirrored->MirrorPlane.setValue(getSketchObject(),planes);
|
||||
else
|
||||
pcMirrored->MirrorPlane.setValue(getSupportObject(),planes);
|
||||
} else
|
||||
pcMirrored->MirrorPlane.setValue(NULL);
|
||||
|
||||
std::string stdMirrorPlane = getStdMirrorPlane();
|
||||
if (!stdMirrorPlane.empty())
|
||||
pcMirrored->StdMirrorPlane.setValue(stdMirrorPlane.c_str());
|
||||
else
|
||||
pcMirrored->StdMirrorPlane.setValue(NULL);
|
||||
|
||||
recomputeFeature();
|
||||
}
|
||||
}
|
||||
|
||||
const std::string TaskMirroredParameters::getStdMirrorPlane(void) const
|
||||
{
|
||||
if (ui->buttonXY->isChecked())
|
||||
return std::string("XY");
|
||||
else if (ui->buttonYZ->isChecked())
|
||||
return std::string("YZ");
|
||||
else if (ui->buttonXZ->isChecked())
|
||||
return std::string("XZ");
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
const std::string TaskMirroredParameters::getMirrorPlane(void) const
|
||||
{
|
||||
return ui->lineReference->text().toStdString();
|
||||
if (ui->comboPlane->currentIndex() == 0)
|
||||
return "H_Axis";
|
||||
else if (ui->comboPlane->currentIndex() == 1)
|
||||
return "V_Axis";
|
||||
else if (ui->comboPlane->count() > 3 && ui->comboPlane->currentIndex() == 2)
|
||||
return ui->comboPlane->currentText().toStdString();
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
|
||||
TaskMirroredParameters::~TaskMirroredParameters()
|
||||
{
|
||||
delete ui;
|
||||
@@ -321,13 +293,14 @@ bool TaskDlgMirroredParameters::accept()
|
||||
std::string mirrorPlane = mirrorParameter->getMirrorPlane();
|
||||
if (!mirrorPlane.empty()) {
|
||||
QString buf = QString::fromUtf8("(App.ActiveDocument.%1,[\"%2\"])");
|
||||
buf = buf.arg(QString::fromUtf8(mirrorParameter->getSupportObject()->getNameInDocument()));
|
||||
if (mirrorPlane == "H_Axis" || mirrorPlane == "V_Axis")
|
||||
buf = buf.arg(QString::fromUtf8(mirrorParameter->getSketchObject()->getNameInDocument()));
|
||||
else
|
||||
buf = buf.arg(QString::fromUtf8(mirrorParameter->getSupportObject()->getNameInDocument()));
|
||||
buf = buf.arg(QString::fromUtf8(mirrorPlane.c_str()));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.MirrorPlane = %s", name.c_str(), buf.toStdString().c_str());
|
||||
} else
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.MirrorPlane = None", name.c_str());
|
||||
std::string stdMirrorPlane = mirrorParameter->getStdMirrorPlane();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.StdMirrorPlane = \"%s\"",name.c_str(),stdMirrorPlane.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()");
|
||||
if (!TransformedView->getObject()->isValid())
|
||||
throw Base::Exception(TransformedView->getObject()->getStatusString());
|
||||
|
||||
@@ -57,14 +57,10 @@ public:
|
||||
|
||||
virtual ~TaskMirroredParameters();
|
||||
|
||||
const std::string getStdMirrorPlane(void) const;
|
||||
const std::string getMirrorPlane(void) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onButtonXY();
|
||||
void onButtonXZ();
|
||||
void onButtonYZ();
|
||||
void onButtonReference(const bool checked);
|
||||
void onPlaneChanged(int num);
|
||||
virtual void onUpdateView(bool);
|
||||
|
||||
protected:
|
||||
@@ -72,7 +68,6 @@ protected:
|
||||
virtual void onSelectionChanged(const Gui::SelectionChanges& msg);
|
||||
|
||||
private:
|
||||
void onStdMirrorPlane(const std::string& plane);
|
||||
void setupUI();
|
||||
void updateUI();
|
||||
|
||||
|
||||
@@ -28,48 +28,33 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="buttonXY">
|
||||
<property name="text">
|
||||
<string>XY</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="buttonXZ">
|
||||
<property name="text">
|
||||
<string>XZ</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="buttonYZ">
|
||||
<property name="text">
|
||||
<string>YZ</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonReference">
|
||||
<widget class="QLabel" name="labelPlane">
|
||||
<property name="text">
|
||||
<string>Plane</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineReference"/>
|
||||
<widget class="QComboBox" name="comboPlane">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Horizontal sketch axis</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Vertical sketch axis</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Select reference...</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
||||
@@ -218,7 +218,10 @@ void TaskMultiTransformParameters::onTransformAddMirrored()
|
||||
Gui::Command::openCommand("Mirrored");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject(\"PartDesign::Mirrored\",\"%s\")",newFeatName.c_str());
|
||||
//Gui::Command::updateActive();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.StdMirrorPlane = \"XY\"", newFeatName.c_str());
|
||||
App::DocumentObject* sketch = getSketchObject();
|
||||
if (sketch)
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.MirrorPlane = (App.activeDocument().%s, [\"V_Axis\"])",
|
||||
newFeatName.c_str(), sketch->getNameInDocument());
|
||||
|
||||
finishAdd(newFeatName);
|
||||
}
|
||||
@@ -231,7 +234,10 @@ void TaskMultiTransformParameters::onTransformAddLinearPattern()
|
||||
Gui::Command::openCommand("LinearPattern");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject(\"PartDesign::LinearPattern\",\"%s\")",newFeatName.c_str());
|
||||
//Gui::Command::updateActive();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.StdDirection = \"X\"", newFeatName.c_str());
|
||||
App::DocumentObject* sketch = getSketchObject();
|
||||
if (sketch)
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Direction = (App.activeDocument().%s, [\"H_Axis\"])",
|
||||
newFeatName.c_str(), sketch->getNameInDocument());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Length = 100", newFeatName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Occurrences = 2", newFeatName.c_str());
|
||||
|
||||
@@ -246,7 +252,10 @@ void TaskMultiTransformParameters::onTransformAddPolarPattern()
|
||||
Gui::Command::openCommand("PolarPattern");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject(\"PartDesign::PolarPattern\",\"%s\")",newFeatName.c_str());
|
||||
//Gui::Command::updateActive();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.StdAxis = \"X\"", newFeatName.c_str());
|
||||
App::DocumentObject* sketch = getSketchObject();
|
||||
if (sketch)
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Axis = (App.activeDocument().%s, [\"N_Axis\"])",
|
||||
newFeatName.c_str(), sketch->getNameInDocument());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Angle = 360", newFeatName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Occurrences = 2", newFeatName.c_str());
|
||||
|
||||
|
||||
@@ -93,20 +93,14 @@ TaskPolarPatternParameters::TaskPolarPatternParameters(TaskMultiTransformParamet
|
||||
|
||||
void TaskPolarPatternParameters::setupUI()
|
||||
{
|
||||
connect(ui->buttonX, SIGNAL(pressed()),
|
||||
this, SLOT(onButtonX()));
|
||||
connect(ui->buttonY, SIGNAL(pressed()),
|
||||
this, SLOT(onButtonY()));
|
||||
connect(ui->buttonZ, SIGNAL(pressed()),
|
||||
this, SLOT(onButtonZ()));
|
||||
connect(ui->comboAxis, SIGNAL(activated(int)),
|
||||
this, SLOT(onAxisChanged(int)));
|
||||
connect(ui->checkReverse, SIGNAL(toggled(bool)),
|
||||
this, SLOT(onCheckReverse(bool)));
|
||||
connect(ui->spinAngle, SIGNAL(valueChanged(double)),
|
||||
this, SLOT(onAngle(double)));
|
||||
connect(ui->spinOccurrences, SIGNAL(valueChanged(int)),
|
||||
this, SLOT(onOccurrences(int)));
|
||||
connect(ui->buttonReference, SIGNAL(toggled(bool)),
|
||||
this, SLOT(onButtonReference(bool)));
|
||||
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
|
||||
this, SLOT(onUpdateView(bool)));
|
||||
|
||||
@@ -125,14 +119,10 @@ void TaskPolarPatternParameters::setupUI()
|
||||
}
|
||||
// ---------------------
|
||||
|
||||
ui->buttonX->setEnabled(true);
|
||||
ui->buttonY->setEnabled(true);
|
||||
ui->buttonZ->setEnabled(true);
|
||||
ui->comboAxis->setEnabled(true);
|
||||
ui->checkReverse->setEnabled(true);
|
||||
ui->spinAngle->setEnabled(true);
|
||||
ui->spinOccurrences->setEnabled(true);
|
||||
ui->buttonReference->setEnabled(true);
|
||||
ui->lineReference->setEnabled(false); // This is never enabled since it is for optical feed-back only
|
||||
updateUI();
|
||||
}
|
||||
|
||||
@@ -146,36 +136,32 @@ void TaskPolarPatternParameters::updateUI()
|
||||
|
||||
App::DocumentObject* axisFeature = pcPolarPattern->Axis.getValue();
|
||||
std::vector<std::string> axes = pcPolarPattern->Axis.getSubValues();
|
||||
std::string stdAxis = pcPolarPattern->StdAxis.getValue();
|
||||
bool reverse = pcPolarPattern->Reversed.getValue();
|
||||
double angle = pcPolarPattern->Angle.getValue();
|
||||
unsigned occurrences = pcPolarPattern->Occurrences.getValue();
|
||||
|
||||
ui->buttonReference->setChecked(referenceSelectionMode);
|
||||
if (!stdAxis.empty())
|
||||
{
|
||||
ui->buttonX->setAutoExclusive(true);
|
||||
ui->buttonY->setAutoExclusive(true);
|
||||
ui->buttonZ->setAutoExclusive(true);
|
||||
ui->buttonX->setChecked(stdAxis == "X");
|
||||
ui->buttonY->setChecked(stdAxis == "Y");
|
||||
ui->buttonZ->setChecked(stdAxis == "Z");
|
||||
ui->lineReference->setText(tr(""));
|
||||
} else if (axisFeature != NULL && !axes.empty()) {
|
||||
ui->buttonX->setAutoExclusive(false);
|
||||
ui->buttonY->setAutoExclusive(false);
|
||||
ui->buttonZ->setAutoExclusive(false);
|
||||
ui->buttonX->setChecked(false);
|
||||
ui->buttonY->setChecked(false);
|
||||
ui->buttonZ->setChecked(false);
|
||||
ui->lineReference->setText(QString::fromAscii(axes.front().c_str()));
|
||||
for (int i=ui->comboAxis->count()-1; i >= 1; i--)
|
||||
ui->comboAxis->removeItem(i);
|
||||
|
||||
if (axisFeature != NULL && !axes.empty()) {
|
||||
if (axes.front() == "N_Axis")
|
||||
ui->comboAxis->setCurrentIndex(0);
|
||||
else if (axisFeature != NULL && !axes.empty()) {
|
||||
ui->comboAxis->addItem(QString::fromAscii(axes.front().c_str()));
|
||||
ui->comboAxis->setCurrentIndex(1);
|
||||
}
|
||||
} else {
|
||||
// Error message?
|
||||
ui->lineReference->setText(tr(""));
|
||||
}
|
||||
if (referenceSelectionMode)
|
||||
ui->lineReference->setText(tr("Select an edge"));
|
||||
|
||||
if (referenceSelectionMode) {
|
||||
ui->comboAxis->addItem(tr("Select an edge"));
|
||||
ui->comboAxis->setCurrentIndex(ui->comboAxis->count() - 1);
|
||||
} else
|
||||
ui->comboAxis->addItem(tr("Select reference..."));
|
||||
|
||||
// Note: These three lines would trigger onLength(), on Occurrences() and another updateUI() if we
|
||||
// didn't check for blockUpdate
|
||||
ui->checkReverse->setChecked(reverse);
|
||||
ui->spinAngle->setValue(angle);
|
||||
ui->spinOccurrences->setValue(occurrences);
|
||||
@@ -204,31 +190,22 @@ void TaskPolarPatternParameters::onSelectionChanged(const Gui::SelectionChanges&
|
||||
PartDesign::PolarPattern* pcPolarPattern = static_cast<PartDesign::PolarPattern*>(getObject());
|
||||
std::vector<std::string> axes(1,subName);
|
||||
pcPolarPattern->Axis.setValue(getSupportObject(), axes);
|
||||
pcPolarPattern->StdAxis.setValue("");
|
||||
|
||||
recomputeFeature();
|
||||
updateUI();
|
||||
}
|
||||
else {
|
||||
ui->buttonReference->setChecked(referenceSelectionMode);
|
||||
ui->lineReference->setText(QString::fromAscii(subName.c_str()));
|
||||
for (int i=ui->comboAxis->count()-1; i >= 1; i--)
|
||||
ui->comboAxis->removeItem(i);
|
||||
|
||||
ui->comboAxis->addItem(QString::fromAscii(subName.c_str()));
|
||||
ui->comboAxis->setCurrentIndex(1);
|
||||
ui->comboAxis->addItem(tr("Select reference..."));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TaskPolarPatternParameters::onButtonX() {
|
||||
onStdAxis("X");
|
||||
}
|
||||
|
||||
void TaskPolarPatternParameters::onButtonY() {
|
||||
onStdAxis("Y");
|
||||
}
|
||||
|
||||
void TaskPolarPatternParameters::onButtonZ() {
|
||||
onStdAxis("Z");
|
||||
}
|
||||
|
||||
void TaskPolarPatternParameters::onCheckReverse(const bool on) {
|
||||
if (blockUpdate)
|
||||
return;
|
||||
@@ -262,30 +239,28 @@ void TaskPolarPatternParameters::onOccurrences(const int n) {
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskPolarPatternParameters::onStdAxis(const std::string& axis) {
|
||||
void TaskPolarPatternParameters::onAxisChanged(int num) {
|
||||
if (blockUpdate)
|
||||
return;
|
||||
PartDesign::PolarPattern* pcPolarPattern = static_cast<PartDesign::PolarPattern*>(getObject());
|
||||
pcPolarPattern->StdAxis.setValue(axis.c_str());
|
||||
pcPolarPattern->Axis.setValue(NULL);
|
||||
|
||||
exitSelectionMode();
|
||||
updateUI();
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskPolarPatternParameters::onButtonReference(bool checked)
|
||||
{
|
||||
if (checked ) {
|
||||
if (num == 0) {
|
||||
pcPolarPattern->Axis.setValue(getSketchObject(), std::vector<std::string>(1,"N_Axis"));
|
||||
exitSelectionMode();
|
||||
}
|
||||
else if (num == ui->comboAxis->count() - 1) {
|
||||
// enter reference selection mode
|
||||
hideObject();
|
||||
showOriginals();
|
||||
referenceSelectionMode = true;
|
||||
Gui::Selection().clearSelection();
|
||||
addReferenceSelectionGate(true, false);
|
||||
} else {
|
||||
exitSelectionMode();
|
||||
}
|
||||
else if (num == 1)
|
||||
exitSelectionMode();
|
||||
|
||||
updateUI();
|
||||
recomputeFeature();
|
||||
}
|
||||
|
||||
void TaskPolarPatternParameters::onUpdateView(bool on)
|
||||
@@ -298,16 +273,13 @@ void TaskPolarPatternParameters::onUpdateView(bool on)
|
||||
std::string axis = getAxis();
|
||||
if (!axis.empty()) {
|
||||
std::vector<std::string> axes(1,axis);
|
||||
pcPolarPattern->Axis.setValue(getSupportObject(),axes);
|
||||
if (axis == "N_Axis")
|
||||
pcPolarPattern->Axis.setValue(getSketchObject(), axes);
|
||||
else
|
||||
pcPolarPattern->Axis.setValue(getSupportObject(), axes);
|
||||
} else
|
||||
pcPolarPattern->Axis.setValue(NULL);
|
||||
|
||||
std::string stdAxis = getStdAxis();
|
||||
if (!stdAxis.empty())
|
||||
pcPolarPattern->StdAxis.setValue(stdAxis.c_str());
|
||||
else
|
||||
pcPolarPattern->StdAxis.setValue(NULL);
|
||||
|
||||
pcPolarPattern->Reversed.setValue(getReverse());
|
||||
pcPolarPattern->Angle.setValue(getAngle());
|
||||
pcPolarPattern->Occurrences.setValue(getOccurrences());
|
||||
@@ -316,22 +288,15 @@ void TaskPolarPatternParameters::onUpdateView(bool on)
|
||||
}
|
||||
}
|
||||
|
||||
const std::string TaskPolarPatternParameters::getStdAxis(void) const
|
||||
const std::string TaskPolarPatternParameters::getAxis(void) const
|
||||
{
|
||||
if (ui->buttonX->isChecked())
|
||||
return std::string("X");
|
||||
else if (ui->buttonY->isChecked())
|
||||
return std::string("Y");
|
||||
else if (ui->buttonZ->isChecked())
|
||||
return std::string("Z");
|
||||
if (ui->comboAxis->currentIndex() == 0)
|
||||
return "N_Axis";
|
||||
else if (ui->comboAxis->count() > 2 && ui->comboAxis->currentIndex() == 1)
|
||||
return ui->comboAxis->currentText().toStdString();
|
||||
return std::string("");
|
||||
}
|
||||
|
||||
const std::string TaskPolarPatternParameters::getAxis(void) const
|
||||
{
|
||||
return ui->lineReference->text().toStdString();
|
||||
}
|
||||
|
||||
const bool TaskPolarPatternParameters::getReverse(void) const
|
||||
{
|
||||
return ui->checkReverse->isChecked();
|
||||
@@ -391,13 +356,14 @@ bool TaskDlgPolarPatternParameters::accept()
|
||||
std::string axis = polarpatternParameter->getAxis();
|
||||
if (!axis.empty()) {
|
||||
QString buf = QString::fromUtf8("(App.ActiveDocument.%1,[\"%2\"])");
|
||||
buf = buf.arg(QString::fromUtf8(polarpatternParameter->getSupportObject()->getNameInDocument()));
|
||||
if (axis == "N_Axis")
|
||||
buf = buf.arg(QString::fromUtf8(polarpatternParameter->getSketchObject()->getNameInDocument()));
|
||||
else
|
||||
buf = buf.arg(QString::fromUtf8(polarpatternParameter->getSupportObject()->getNameInDocument()));
|
||||
buf = buf.arg(QString::fromUtf8(axis.c_str()));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Axis = %s", name.c_str(), buf.toStdString().c_str());
|
||||
} else
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Axis = None", name.c_str());
|
||||
std::string stdAxis = polarpatternParameter->getStdAxis();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.StdAxis = \"%s\"",name.c_str(),stdAxis.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %u",name.c_str(),polarpatternParameter->getReverse());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Angle = %f",name.c_str(),polarpatternParameter->getAngle());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Occurrences = %u",name.c_str(),polarpatternParameter->getOccurrences());
|
||||
|
||||
@@ -63,14 +63,10 @@ public:
|
||||
const unsigned getOccurrences(void) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onStdAxis(const std::string& axis);
|
||||
void onButtonX();
|
||||
void onButtonY();
|
||||
void onButtonZ();
|
||||
void onAxisChanged(int num);
|
||||
void onCheckReverse(const bool on);
|
||||
void onAngle(const double a);
|
||||
void onOccurrences(const int n);
|
||||
void onButtonReference(const bool checked);
|
||||
virtual void onUpdateView(bool);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -28,48 +28,28 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="buttonX">
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="buttonY">
|
||||
<property name="text">
|
||||
<string>Y</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="buttonZ">
|
||||
<property name="text">
|
||||
<string>Z</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QToolButton" name="buttonReference">
|
||||
<widget class="QLabel" name="labelAxis">
|
||||
<property name="text">
|
||||
<string>Direction</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
<string>Axis</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineReference"/>
|
||||
<widget class="QComboBox" name="comboAxis">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Normal sketch axis</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Select reference...</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
||||
@@ -148,6 +148,16 @@ App::DocumentObject* TaskTransformedParameters::getSupportObject() const
|
||||
}
|
||||
}
|
||||
|
||||
App::DocumentObject* TaskTransformedParameters::getSketchObject() const
|
||||
{
|
||||
if (insideMultiTransform) {
|
||||
return parentTask->getSketchObject();
|
||||
} else {
|
||||
PartDesign::Transformed* pcTransformed = static_cast<PartDesign::Transformed*>(TransformedView->getObject());
|
||||
return pcTransformed->getSketchObject();
|
||||
}
|
||||
}
|
||||
|
||||
void TaskTransformedParameters::hideObject()
|
||||
{
|
||||
Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
|
||||
@@ -61,7 +61,8 @@ public:
|
||||
const std::vector<App::DocumentObject*> getOriginals(void) const;
|
||||
/// Get the support object either of the object associated with this feature or with the parent feature (MultiTransform mode)
|
||||
App::DocumentObject* getSupportObject() const;
|
||||
|
||||
/// Get the sketch object of the first original either of the object associated with this feature or with the parent feature (MultiTransform mode)
|
||||
App::DocumentObject* getSketchObject() const;
|
||||
|
||||
protected Q_SLOTS:
|
||||
/// Connect the subTask OK button to the MultiTransform task
|
||||
|
||||
@@ -62,16 +62,12 @@ bool ViewProviderMultiTransform::setEdit(int ModNum)
|
||||
|
||||
std::vector<App::DocumentObject*> ViewProviderMultiTransform::claimChildren(void) const
|
||||
{
|
||||
std::vector<App::DocumentObject*> result = ViewProviderTransformed::claimChildren();
|
||||
|
||||
PartDesign::MultiTransform* pcMultiTransform = static_cast<PartDesign::MultiTransform*>(getObject());
|
||||
if (pcMultiTransform == NULL)
|
||||
return std::vector<App::DocumentObject*>(); // TODO: Show error?
|
||||
|
||||
std::vector<App::DocumentObject*> transformFeatures = pcMultiTransform->Transformations.getValues();
|
||||
|
||||
result.insert(result.end(), transformFeatures.begin(), transformFeatures.end());
|
||||
return result;
|
||||
return transformFeatures;
|
||||
}
|
||||
|
||||
bool ViewProviderMultiTransform::onDelete(const std::vector<std::string> &svec) {
|
||||
|
||||
@@ -38,17 +38,6 @@ using namespace PartDesignGui;
|
||||
|
||||
PROPERTY_SOURCE(PartDesignGui::ViewProviderTransformed,PartDesignGui::ViewProvider)
|
||||
|
||||
std::vector<App::DocumentObject*> ViewProviderTransformed::claimChildren(void)const
|
||||
{
|
||||
PartDesign::Transformed* pcTransformed = static_cast<PartDesign::Transformed*>(getObject());
|
||||
if (pcTransformed == NULL)
|
||||
return std::vector<App::DocumentObject*>(); // TODO: Show error?
|
||||
|
||||
std::vector<App::DocumentObject*> originals = pcTransformed->Originals.getValues();
|
||||
|
||||
return originals;
|
||||
}
|
||||
|
||||
void ViewProviderTransformed::setupContextMenu(QMenu* menu, QObject* receiver, const char* member)
|
||||
{
|
||||
QAction* act;
|
||||
|
||||
@@ -42,8 +42,6 @@ public:
|
||||
virtual ~ViewProviderTransformed()
|
||||
{}
|
||||
|
||||
/// grouping handling
|
||||
std::vector<App::DocumentObject*> claimChildren(void) const;
|
||||
void setupContextMenu(QMenu*, QObject*, const char*);
|
||||
|
||||
virtual bool onDelete(const std::vector<std::string> &);
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#! python
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2011 Werner Mayer LGPL
|
||||
#
|
||||
|
||||
from __future__ import division # allows floating point division from integers
|
||||
import FreeCAD, Part, math
|
||||
|
||||
@@ -274,14 +274,10 @@ int SketchObject::getAxisCount(void) const
|
||||
|
||||
Base::Axis SketchObject::getAxis(int axId) const
|
||||
{
|
||||
const std::vector< Part::Geometry * > &vals = getInternalGeometry();
|
||||
if (axId == H_Axis) {
|
||||
return Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(1,0,0));
|
||||
}
|
||||
else if (axId == V_Axis) {
|
||||
return Base::Axis(Base::Vector3d(0,0,0), Base::Vector3d(0,1,0));
|
||||
}
|
||||
if (axId == H_Axis || axId == V_Axis || axId == N_Axis)
|
||||
return Part::Part2DObject::getAxis(axId);
|
||||
|
||||
const std::vector< Part::Geometry * > &vals = getInternalGeometry();
|
||||
int count=0;
|
||||
for (std::vector<Part::Geometry *>::const_iterator geo=vals.begin();
|
||||
geo != vals.end(); geo++)
|
||||
|
||||
91
src/Tools/LicenseChecker.py
Normal file
91
src/Tools/LicenseChecker.py
Normal file
@@ -0,0 +1,91 @@
|
||||
#! python
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2013 Werner Mayer LGPL
|
||||
#
|
||||
# Utility to search for source, header and Python files with a missing license text
|
||||
|
||||
import codecs, os
|
||||
|
||||
ext=[".cpp", ".cxx", ".cc", ".c", ".hpp", ".hxx", ".hh", ".h", ".inl", ".inc", ".py"]
|
||||
flt=['__init__.py', '_rc.py', 'CxImage',
|
||||
'coin_header_includes.h',
|
||||
'CxxDebug.hxx',
|
||||
'IndirectPythonInterface.hxx',
|
||||
('thumbs%sIExtractImage.h')%(os.path.sep),
|
||||
#('src%sTools')%(os.path.sep),
|
||||
('src%sTools%sembedded')%(os.path.sep,os.path.sep),
|
||||
('App%skdl_cp')%(os.path.sep),
|
||||
('3rdParty%satlas')%(os.path.sep),
|
||||
('Mod%sGDML')%(os.path.sep),
|
||||
('boost%snumeric%sbindings')%(os.path.sep,os.path.sep),
|
||||
('salomesmesh%sinc')%(os.path.sep),
|
||||
('App%sCore%stritritest.h')%(os.path.sep,os.path.sep)
|
||||
]
|
||||
# A note to tritritest.h
|
||||
# tritritest.h has no licensing information, but Tomas Moller replied
|
||||
# the following, when asked about it:
|
||||
#
|
||||
# The code is is free to use for anyone and any projects, but I give no
|
||||
# warranties.
|
||||
#
|
||||
# See: http://anonscm.debian.org/gitweb/?p=debian-science/packages/freecad.git;a=blob;f=debian/copyright
|
||||
lic=['LGPL',
|
||||
'GNU Library',
|
||||
'GNU Lesser',
|
||||
'Permission to copy, use, modify',
|
||||
'Permission to use, copy, modify',
|
||||
'Distributed under the Boost Software License',
|
||||
'Redistribution and use in source and binary forms',
|
||||
'Redistribution and use in source and binary forms',
|
||||
'it under the same terms as Python itself',
|
||||
'As a special exception, you may create a larger work that contains',
|
||||
'Permission is hereby granted, free of charge, to any person obtaining',
|
||||
'Permission is granted to anyone to use this software',
|
||||
'This file was automatically generated by SWIG'
|
||||
]
|
||||
|
||||
def startProcessing():
|
||||
fn = os.path.realpath(__file__)
|
||||
# get path of parent directory
|
||||
fn = os.path.dirname(fn)
|
||||
fn = os.path.dirname(fn)
|
||||
global ext
|
||||
global flt
|
||||
traverse(fn, ext, flt)
|
||||
|
||||
def traverse(path, ext, flt):
|
||||
for r,d,f in os.walk(path):
|
||||
for i in f:
|
||||
fn = os.path.join(r,i)
|
||||
# filter out some file names
|
||||
stop = False
|
||||
for j in flt:
|
||||
if fn.find(j) >= 0:
|
||||
stop=True
|
||||
break
|
||||
if stop:
|
||||
continue
|
||||
bn = os.path.basename(fn).lower()
|
||||
for j in ext:
|
||||
if bn.endswith(j):
|
||||
parsefile(fn)
|
||||
break
|
||||
|
||||
def parsefile(fn):
|
||||
data = codecs.open(fn,'r','utf-8')
|
||||
try:
|
||||
lines = data.readlines()
|
||||
data.close()
|
||||
|
||||
global lic
|
||||
for i in lines:
|
||||
for j in lic:
|
||||
if i.find(j) >= 0:
|
||||
return
|
||||
|
||||
print ("Missing license text in file %s") % (fn)
|
||||
except:
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
startProcessing()
|
||||
@@ -1,4 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2004 Werner Mayer LGPL
|
||||
|
||||
import os,sys,string
|
||||
|
||||
#os.chdir("E:\\Develop\\FreeCADWin\\scripts")
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
/*
|
||||
(c) 2006 Werner Mayer LGPL
|
||||
*/
|
||||
|
||||
#include <qtextcodec.h>
|
||||
#include <qfile.h>
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# (c) 2012 Werner Mayer LGPL
|
||||
|
||||
import sys
|
||||
from os import chdir
|
||||
from os import path
|
||||
|
||||
Reference in New Issue
Block a user