Merge branch 'refs/heads/master' into review-CL-Bundler

Conflicts:
	src/3rdParty/salomesmesh/CMakeLists.txt
This commit is contained in:
jriegel 2014-11-22 13:51:04 +01:00
commit 1bc6df8eac
26 changed files with 431 additions and 223 deletions

View File

@ -10,6 +10,14 @@ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
# added in cmake 3.0
if(POLICY CMP0050)
cmake_policy(SET CMP0050 OLD)
endif(POLICY CMP0050)
endif(COMMAND cmake_policy)
# include local modules
include(AddFileDependencies)
include(cMake/FreeCadMacros.cmake)
@ -17,10 +25,6 @@ include(cMake/FreeCadMacros.cmake)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cMake")
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
#if(CMAKE_CFG_INTDIR STREQUAL .)
# No Debug/Release output paths
set(DEBUG_MAIN_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)

View File

@ -9,13 +9,13 @@ SET(SMESH_VERSION_TWEAK 2)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
include_directories(
inc
src/SMDS
src/Driver
src/DriverUNV
src/DriverDAT
src/DriverSTL
src/StdMeshers
inc
${CMAKE_BINARY_DIR}/src
${CMAKE_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}
@ -23,6 +23,7 @@ include_directories(
${OCC_INCLUDE_DIR}
${NGLIB_INCLUDE_DIR}
${NETGEN_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR}
)
link_directories(${OCC_LIBRARY_DIR})

View File

@ -242,7 +242,7 @@ PyObject* Application::sOpen(PyObject * /*self*/, PyObject *args,PyObject * /*kw
QString fileName = QString::fromUtf8(Utf8Name.c_str());
QFileInfo fi;
fi.setFile(fileName);
QString ext = fi.completeSuffix().toLower();
QString ext = fi.suffix().toLower();
QList<EditorView*> views = getMainWindow()->findChildren<EditorView*>();
for (QList<EditorView*>::Iterator it = views.begin(); it != views.end(); ++it) {
if ((*it)->fileName() == fileName) {
@ -286,6 +286,9 @@ PyObject* Application::sOpen(PyObject * /*self*/, PyObject *args,PyObject * /*kw
edit->resize(400, 300);
getMainWindow()->addWindow( edit );
}
else {
Base::Console().Error("File type '%s' not supported\n", ext.toLatin1().constData());
}
} PY_CATCH;
Py_Return;
@ -304,7 +307,7 @@ PyObject* Application::sInsert(PyObject * /*self*/, PyObject *args,PyObject * /*
QString fileName = QString::fromUtf8(Utf8Name.c_str());
QFileInfo fi;
fi.setFile(fileName);
QString ext = fi.completeSuffix().toLower();
QString ext = fi.suffix().toLower();
if (ext == QLatin1String("iv")) {
App::Document *doc = 0;
if (DocName)
@ -348,6 +351,9 @@ PyObject* Application::sInsert(PyObject * /*self*/, PyObject *args,PyObject * /*
edit->resize(400, 300);
getMainWindow()->addWindow( edit );
}
else {
Base::Console().Error("File type '%s' not supported\n", ext.toLatin1().constData());
}
} PY_CATCH;
Py_Return;
@ -379,7 +385,7 @@ PyObject* Application::sExport(PyObject * /*self*/, PyObject *args,PyObject * /*
QString fileName = QString::fromUtf8(Utf8Name.c_str());
QFileInfo fi;
fi.setFile(fileName);
QString ext = fi.completeSuffix().toLower();
QString ext = fi.suffix().toLower();
if (ext == QLatin1String("iv") || ext == QLatin1String("wrl") ||
ext == QLatin1String("vrml") || ext == QLatin1String("wrz") ||
ext == QLatin1String("svg") || ext == QLatin1String("idtf")) {
@ -411,6 +417,9 @@ PyObject* Application::sExport(PyObject * /*self*/, PyObject *args,PyObject * /*
}
}
}
else {
Base::Console().Error("File type '%s' not supported\n", ext.toLatin1().constData());
}
}
} PY_CATCH;

View File

@ -582,7 +582,7 @@ bool Document::saveAs(void)
// save as new file name
Gui::WaitCursor wc;
Command::doCommand(Command::Doc,"App.getDocument(\"%s\").saveAs('%s')"
Command::doCommand(Command::Doc,"App.getDocument(\"%s\").saveAs(\"%s\")"
, DocName, (const char*)fn.toUtf8());
setModified(false);

View File

@ -134,6 +134,16 @@ PythonWrapper::PythonWrapper()
bool PythonWrapper::toCString(const Py::Object& pyobject, std::string& str)
{
if (PyUnicode_Check(pyobject.ptr())) {
PyObject* unicode = PyUnicode_AsUTF8String(pyobject.ptr());
str = PyString_AsString(unicode);
Py_DECREF(unicode);
return true;
}
else if (PyString_Check(pyobject.ptr())) {
str = PyString_AsString(pyobject.ptr());
return true;
}
#if defined (HAVE_SHIBOKEN) && defined(HAVE_PYSIDE)
if (Shiboken::String::check(pyobject.ptr())) {
const char* s = Shiboken::String::toCString(pyobject.ptr());

View File

@ -1,7 +1,7 @@
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
@ -46,3 +46,4 @@ from ArchRebar import *
from ArchFrame import *
from ArchPanel import *
from ArchEquipment import *
from ArchCutPlane import *

View File

@ -393,16 +393,6 @@ def getCutVolume(cutplane,shapes):
invcutvolume = cutface.extrude(cutnormal)
return cutface,cutvolume,invcutvolume
def cutComponent(cutPlane, archObject):
"""cut object from a plan"""
cutVolume = getCutVolume(cutPlane, archObject.Object.Shape)
cutVolume = cutVolume[2]
if cutVolume:
obj = FreeCAD.ActiveDocument.addObject("Part::Feature", "CutVolume")
obj.Shape = cutVolume
# add substraction component to Arch object
return removeComponents(obj,archObject.Object)
def getShapeFromMesh(mesh,fast=True,tolerance=0.001,flat=False,cut=True):
import Part, MeshPart, DraftGeomUtils
if mesh.isSolid() and (mesh.countComponents() == 1) and fast:
@ -942,26 +932,6 @@ class _CommandRemove:
FreeCAD.ActiveDocument.recompute()
class _CommandCutPlane:
"the Arch CutPlane command definition"
def GetResources(self):
return {'Pixmap' : 'Arch_CutPlane',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_CutPlane","Cut object"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_CutPlane","Cut the object with plane")}
def IsActive(self):
return len(FreeCADGui.Selection.getSelection()) > 1
def Activated(self):
face = FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0]
archObject = FreeCADGui.Selection.getSelectionEx()[0]
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Cutting")))
FreeCADGui.addModule("Arch")
FreeCADGui.doCommand("Arch.cutComponent(FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0],FreeCADGui.Selection.getSelectionEx()[0])")
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()
class _CommandSplitMesh:
"the Arch SplitMesh command definition"
def GetResources(self):
@ -1148,7 +1118,6 @@ class _ToggleIfcBrepFlag:
if FreeCAD.GuiUp:
FreeCADGui.addCommand('Arch_Add',_CommandAdd())
FreeCADGui.addCommand('Arch_Remove',_CommandRemove())
FreeCADGui.addCommand('Arch_CutPlane',_CommandCutPlane())
FreeCADGui.addCommand('Arch_SplitMesh',_CommandSplitMesh())
FreeCADGui.addCommand('Arch_MeshToShape',_CommandMeshToShape())
FreeCADGui.addCommand('Arch_SelectNonSolidMeshes',_CommandSelectNonSolidMeshes())

View File

@ -0,0 +1,131 @@
#***************************************************************************
#* *
#* Copyright (c) 2014 *
#* Jonathan Wiedemann <wood.galaxy@gmail.com> *
#* *
#* 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 *
#* *
#***************************************************************************
import FreeCAD,ArchCommands
from FreeCAD import Vector
if FreeCAD.GuiUp:
import FreeCADGui
from PySide import QtCore, QtGui
from DraftTools import translate
else:
def translate(ctxt,txt):
return txt
__title__="FreeCAD CutPlane"
__author__ = "Jonathan Wiedemann"
__url__ = "http://www.freecadweb.org"
# Couper
def cutComponentwithPlane(archObject, cutPlane, sideFace):
"""cut object from a plan define by a face, Behind = 0 , front = 1"""
cutVolume = ArchCommands.getCutVolume(cutPlane, archObject.Object.Shape)
if sideFace == 0:
cutVolume = cutVolume[2]
else:
cutVolume = cutVolume[1]
if cutVolume:
obj = FreeCAD.ActiveDocument.addObject("Part::Feature", "CutVolume")
obj.Shape = cutVolume
obj.ViewObject.ShapeColor = (1.00,0.00,0.00)
obj.ViewObject.Transparency = 75
# add substraction component to Arch object
if "Additions" in archObject.Object.PropertiesList:
return ArchCommands.removeComponents(obj,archObject.Object)
else:
cutObj = FreeCAD.ActiveDocument.addObject("Part::Cut", "CutPlane")
cutObj.Base = archObject.Object
cutObj.Tool = obj
return cutObj
class _CommandCutPlane:
"the Arch CutPlane command definition"
def GetResources(self):
return {'Pixmap' : 'Arch_CutPlane',
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_CutPlane","Cut object"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_CutPlane","Cut the object with plane")}
def IsActive(self):
return len(FreeCADGui.Selection.getSelection()) > 1
def Activated(self):
panel=_CutPlaneTaskPanel()
FreeCADGui.Control.showDialog(panel)
class _CutPlaneTaskPanel:
def __init__(self):
self.title = QtGui.QLabel('Cut Plane options')
self.infoText = QtGui.QLabel('Wich side')
self.grid = QtGui.QGridLayout()
self.grid.addWidget(self.title, 1, 0)
self.grid.addWidget(self.infoText, 2, 0)
self.combobox = QtGui.QComboBox()
items = ["Behind","Front"]
self.combobox.addItems(items)
self.combobox.setCurrentIndex(items.index("Behind"))
self.grid.addWidget(self.combobox, 2, 1)
groupBox = QtGui.QGroupBox()
groupBox.setLayout(self.grid)
self.form = groupBox
# Connecter la combobox a la fonction preveiwCutVolume
QtCore.QObject.connect(self.combobox,QtCore.SIGNAL("currentIndexChanged(int)"),self.previewCutVolume)
# Ajouter un objet PreveiwCutVolume vide
self.obj = FreeCAD.ActiveDocument.addObject("Part::Feature", "PreviewCutVolume")
# Afficher la preview CutVolume en fonction du choix par defaut de la combobox
self.previewCutVolume(self.combobox.currentIndex())
def accept(self):
# Suppression objet PreviewCutVolume
FreeCAD.ActiveDocument.removeObject(self.obj.Name)
val = self.combobox.currentIndex()
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Cutting")))
FreeCADGui.addModule("Arch")
FreeCADGui.doCommand("Arch.cutComponentwithPlane(FreeCADGui.Selection.getSelectionEx()[0],FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0],"+ str(val) +")")
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()
return True
def reject(self):
# Suppression objet PreviewCutVolume
FreeCAD.ActiveDocument.removeObject(self.obj.Name)
FreeCAD.Console.PrintMessage("Cancel Cut Plane\n")
return True
def getStandardButtons(self):
return int(QtGui.QDialogButtonBox.Ok|QtGui.QDialogButtonBox.Cancel)
def previewCutVolume(self, i):
cutVolume = ArchCommands.getCutVolume(FreeCADGui.Selection.getSelectionEx()[1].SubObjects[0], FreeCADGui.Selection.getSelectionEx()[0].Object.Shape)
FreeCAD.ActiveDocument.removeObject(self.obj.Name)
self.obj = FreeCAD.ActiveDocument.addObject("Part::Feature", "PreviewCutVolume")
#self.obj.Shape = cutVolume
self.obj.ViewObject.ShapeColor = (1.00,0.00,0.00)
self.obj.ViewObject.Transparency = 75
if i == 1:
cutVolume = cutVolume[1]
else:
cutVolume = cutVolume[2]
if cutVolume:
self.obj.Shape = cutVolume
if FreeCAD.GuiUp:
FreeCADGui.addCommand('Arch_CutPlane',_CommandCutPlane())

View File

@ -1,7 +1,7 @@
#***************************************************************************
#* *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* Copyright (c) 2011 *
#* Yorik van Havre <yorik@uncreated.net> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
@ -38,7 +38,7 @@ __url__ = "http://www.freecadweb.org"
# presets
WindowPartTypes = ["Frame","Solid panel","Glass panel"]
AllowedHosts = ["Wall","Structure","Roof"]
WindowPresets = ["Fixed", "Open 1-pane", "Open 2-pane", "Sash 2-pane",
WindowPresets = ["Fixed", "Open 1-pane", "Open 2-pane", "Sash 2-pane",
"Sliding 2-pane", "Simple door", "Glass door"]
Roles = ["Window","Door"]
@ -88,9 +88,9 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
"""makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,[placement]): makes a
window object based on the given data. windowtype must be one of the names
defined in Arch.WindowPresets"""
def makeSketch(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2):
import Part,Sketcher
width = float(width)
height = float(height)
@ -106,7 +106,7 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
# glass size divider
gla = 10
s = FreeCAD.ActiveDocument.addObject('Sketcher::SketchObject','Sketch')
def addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8):
"adds two rectangles to the given sketch"
idx = s.GeometryCount
@ -114,27 +114,27 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
s.addGeometry(Part.Line(p2,p3))
s.addGeometry(Part.Line(p3,p4))
s.addGeometry(Part.Line(p4,p1))
s.addConstraint(Sketcher.Constraint('Coincident',idx,2,idx+1,1))
s.addConstraint(Sketcher.Constraint('Coincident',idx+1,2,idx+2,1))
s.addConstraint(Sketcher.Constraint('Coincident',idx+2,2,idx+3,1))
s.addConstraint(Sketcher.Constraint('Coincident',idx+3,2,idx,1))
s.addConstraint(Sketcher.Constraint('Horizontal',idx))
s.addConstraint(Sketcher.Constraint('Horizontal',idx+2))
s.addConstraint(Sketcher.Constraint('Vertical',idx+1))
s.addConstraint(Sketcher.Constraint('Coincident',idx,2,idx+1,1))
s.addConstraint(Sketcher.Constraint('Coincident',idx+1,2,idx+2,1))
s.addConstraint(Sketcher.Constraint('Coincident',idx+2,2,idx+3,1))
s.addConstraint(Sketcher.Constraint('Coincident',idx+3,2,idx,1))
s.addConstraint(Sketcher.Constraint('Horizontal',idx))
s.addConstraint(Sketcher.Constraint('Horizontal',idx+2))
s.addConstraint(Sketcher.Constraint('Vertical',idx+1))
s.addConstraint(Sketcher.Constraint('Vertical',idx+3))
s.addGeometry(Part.Line(p5,p6))
s.addGeometry(Part.Line(p6,p7))
s.addGeometry(Part.Line(p7,p8))
s.addGeometry(Part.Line(p8,p5))
s.addConstraint(Sketcher.Constraint('Coincident',idx+4,2,idx+5,1))
s.addConstraint(Sketcher.Constraint('Coincident',idx+5,2,idx+6,1))
s.addConstraint(Sketcher.Constraint('Coincident',idx+6,2,idx+7,1))
s.addConstraint(Sketcher.Constraint('Coincident',idx+7,2,idx+4,1))
s.addConstraint(Sketcher.Constraint('Horizontal',idx+4))
s.addConstraint(Sketcher.Constraint('Horizontal',idx+6))
s.addConstraint(Sketcher.Constraint('Vertical',idx+5))
s.addConstraint(Sketcher.Constraint('Vertical',idx+7))
s.addConstraint(Sketcher.Constraint('Coincident',idx+4,2,idx+5,1))
s.addConstraint(Sketcher.Constraint('Coincident',idx+5,2,idx+6,1))
s.addConstraint(Sketcher.Constraint('Coincident',idx+6,2,idx+7,1))
s.addConstraint(Sketcher.Constraint('Coincident',idx+7,2,idx+4,1))
s.addConstraint(Sketcher.Constraint('Horizontal',idx+4))
s.addConstraint(Sketcher.Constraint('Horizontal',idx+6))
s.addConstraint(Sketcher.Constraint('Vertical',idx+5))
s.addConstraint(Sketcher.Constraint('Vertical',idx+7))
def outerFrame(s,width,height,h1,w1,o1):
p1 = Vector(0,0,0)
p2 = Vector(width,0,0)
@ -147,13 +147,13 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8)
s.addConstraint(Sketcher.Constraint('DistanceY',1,height)) #16
s.addConstraint(Sketcher.Constraint('DistanceX',0,width)) #17
s.addConstraint(Sketcher.Constraint('DistanceY',6,2,2,2,h1))
s.addConstraint(Sketcher.Constraint('DistanceX',2,2,6,2,h1))
s.addConstraint(Sketcher.Constraint('DistanceX',4,2,0,2,h1))
s.addConstraint(Sketcher.Constraint('DistanceY',6,2,2,2,h1))
s.addConstraint(Sketcher.Constraint('DistanceX',2,2,6,2,h1))
s.addConstraint(Sketcher.Constraint('DistanceX',4,2,0,2,h1))
s.addConstraint(Sketcher.Constraint('DistanceY',0,2,4,2,h1))
s.addConstraint(Sketcher.Constraint('Coincident',0,1,-1,1))
return ["OuterFrame","Frame","Wire0,Wire1",str(w1),str(o1)]
def doorFrame(s,width,height,h1,w1,o1):
p1 = Vector(0,0,0)
p2 = Vector(width,0,0)
@ -166,17 +166,17 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8)
s.addConstraint(Sketcher.Constraint('DistanceY',1,height)) #16
s.addConstraint(Sketcher.Constraint('DistanceX',0,width)) #17
s.addConstraint(Sketcher.Constraint('DistanceY',6,2,2,2,h1))
s.addConstraint(Sketcher.Constraint('DistanceX',2,2,6,2,h1))
s.addConstraint(Sketcher.Constraint('DistanceX',4,2,0,2,h1))
s.addConstraint(Sketcher.Constraint('DistanceY',6,2,2,2,h1))
s.addConstraint(Sketcher.Constraint('DistanceX',2,2,6,2,h1))
s.addConstraint(Sketcher.Constraint('DistanceX',4,2,0,2,h1))
s.addConstraint(Sketcher.Constraint('DistanceY',0,2,4,2,0.0))
s.addConstraint(Sketcher.Constraint('Coincident',0,1,-1,1))
return ["OuterFrame","Frame","Wire0,Wire1",str(w1),str(o1)]
if windowtype == "Fixed":
wp = outerFrame(s,width,height,h1,w1,o1)
wp.extend(["Glass","Glass panel","Wire1",str(w1/gla),str(w1/2)])
elif windowtype == "Open 1-pane":
wp = outerFrame(s,width,height,h1,w1,o1)
p1 = Vector(h1+tol,h1+tol,0)
@ -188,23 +188,23 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
p7 = Vector(width-(h1+h2),height-(h1+h2),0)
p8 = Vector(h1+h2,height-(h1+h2),0)
addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8)
s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',14,1,10,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',14,1,10,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceX',10,1,6,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceX',10,1,6,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceY',10,1,6,1,tol))
wp.extend(["InnerFrame","Frame","Wire2,Wire3",str(w2),str(o1+o2)])
wp.extend(["InnerGlass","Glass panel","Wire3",str(w2/gla),str(o1+o2+w2/2)])
elif windowtype == "Open 2-pane":
wp = outerFrame(s,width,height,h1,w1,o1)
p1 = Vector(h1+tol,h1+tol,0)
p2 = Vector((width/2)-tol,h1+tol,0)
p3 = Vector((width/2)-tol,height-(h1+tol),0)
p4 = Vector(h1+tol,height-(h1+tol),0)
p4 = Vector(h1+tol,height-(h1+tol),0)
p5 = Vector(h1+h2,h1+h2,0)
p6 = Vector((width/2)-h2,h1+h2,0)
p7 = Vector((width/2)-h2,height-(h1+h2),0)
@ -219,25 +219,27 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
p7 = Vector(width-(h1+h2),height-(h1+h2),0)
p8 = Vector((width/2)+h2,height-(h1+h2),0)
addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8)
s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',16,1,20,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2))
s.addConstraint(Sketcher.Constraint('Equal',22,14))
s.addConstraint(Sketcher.Constraint('DistanceY',8,2,16,1,0.0))
s.addConstraint(Sketcher.Constraint('DistanceY',10,1,18,2,0.0))
s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',16,1,20,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2))
s.addConstraint(Sketcher.Constraint('Equal',22,14))
s.addConstraint(Sketcher.Constraint('DistanceY',8,2,16,1,0.0))
s.addConstraint(Sketcher.Constraint('DistanceY',10,1,18,2,0.0))
s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceX',6,1,18,1,-tol))
s.addConstraint(Sketcher.Constraint('DistanceX',6,1,18,1,-tol))
s.addConstraint(Sketcher.Constraint('DistanceY',6,1,18,1,-tol))
s.addConstraint(Sketcher.Constraint('DistanceX',9,1,19,2,tol))
s.addConstraint(Sketcher.Constraint('PointOnObject',13,2,22))
s.addConstraint(Sketcher.Constraint('PointOnObject',20,1,12))
wp.extend(["LeftFrame","Frame","Wire2,Wire3",str(w2),str(o1+o2)])
wp.extend(["LeftGlass","Glass panel","Wire3",str(w2/gla),str(o1+o2+w2/2)])
wp.extend(["RightFrame","Frame","Wire4,Wire5",str(w2),str(o1+o2)])
wp.extend(["RightGlass","Glass panel","Wire5",str(w2/gla),str(o1+o2+w2/2)])
elif windowtype == "Sash 2-pane":
wp = outerFrame(s,width,height,h1,w1,o1)
p1 = Vector(h1+tol,h1+tol,0)
@ -258,25 +260,27 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
p7 = Vector(width-(h1+h2),height-(h1+h2),0)
p8 = Vector(h1+h2,height-(h1+h2),0)
addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8)
s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',16,2,20,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',10,2,14,2,-h2))
s.addConstraint(Sketcher.Constraint('Equal',23,15))
s.addConstraint(Sketcher.Constraint('DistanceX',12,1,20,1,0.0))
s.addConstraint(Sketcher.Constraint('DistanceX',13,2,20,2,0.0))
s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',16,2,20,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',10,2,14,2,-h2))
s.addConstraint(Sketcher.Constraint('Equal',23,15))
s.addConstraint(Sketcher.Constraint('DistanceX',12,1,20,1,0.0))
s.addConstraint(Sketcher.Constraint('DistanceX',13,2,20,2,0.0))
s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceX',6,1,18,1,-tol))
s.addConstraint(Sketcher.Constraint('DistanceX',6,1,18,1,-tol))
s.addConstraint(Sketcher.Constraint('DistanceY',6,1,18,1,-tol))
s.addConstraint(Sketcher.Constraint('DistanceY',10,1,16,1,tol))
s.addConstraint(Sketcher.Constraint('PointOnObject',9,2,17))
s.addConstraint(Sketcher.Constraint('PointOnObject',16,1,11))
wp.extend(["LowerFrame","Frame","Wire2,Wire3",str(w2),str(o1+o2+w2)])
wp.extend(["LowerGlass","Glass panel","Wire3",str(w2/gla),str(o1+o2+w2+w2/2)])
wp.extend(["UpperFrame","Frame","Wire4,Wire5",str(w2),str(o1+o2)])
wp.extend(["UpperGlass","Glass panel","Wire5",str(w2/gla),str(o1+o2+w2/2)])
elif windowtype == "Sliding 2-pane":
wp = outerFrame(s,width,height,h1,w1,o1)
p1 = Vector(h1+tol,h1+tol,0)
@ -297,29 +301,31 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
p7 = Vector(width-(h1+h2),height-(h1+h2),0)
p8 = Vector((width/2)+h2,height-(h1+h2),0)
addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8)
s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',16,1,20,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2))
s.addConstraint(Sketcher.Constraint('Equal',22,14))
s.addConstraint(Sketcher.Constraint('DistanceY',8,2,16,1,0.0))
s.addConstraint(Sketcher.Constraint('DistanceY',10,1,18,2,0.0))
s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',21,2,17,2,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',21,2,17,2,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',16,1,20,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2))
s.addConstraint(Sketcher.Constraint('Equal',22,14))
s.addConstraint(Sketcher.Constraint('DistanceY',8,2,16,1,0.0))
s.addConstraint(Sketcher.Constraint('DistanceY',10,1,18,2,0.0))
s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceX',6,1,18,1,-tol))
s.addConstraint(Sketcher.Constraint('DistanceX',6,1,18,1,-tol))
s.addConstraint(Sketcher.Constraint('DistanceY',6,1,18,1,-tol))
s.addConstraint(Sketcher.Constraint('DistanceX',9,1,19,2,tol))
s.addConstraint(Sketcher.Constraint('PointOnObject',13,2,22))
s.addConstraint(Sketcher.Constraint('PointOnObject',12,2,20))
wp.extend(["LeftFrame","Frame","Wire2,Wire3",str(w2),str(o1+o2)])
wp.extend(["LeftGlass","Glass panel","Wire3",str(w2/gla),str(o1+o2+w2/2)])
wp.extend(["RightFrame","Frame","Wire4,Wire5",str(w2),str(o1+o2+w2)])
wp.extend(["RightGlass","Glass panel","Wire5",str(w2/gla),str(o1+o2+w2+w2/2)])
elif windowtype == "Simple door":
wp = doorFrame(s,width,height,h1,w1,o1)
wp.extend(["Door","Solid panel","Wire1",str(w2),str(o1+o2)])
elif windowtype == "Glass door":
wp = doorFrame(s,width,height,h1,w1,o1)
p1 = Vector(h1+tol,h1+tol,0)
@ -331,19 +337,19 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
p7 = Vector(width-(h1+h2),height-(h1+h2),0)
p8 = Vector(h1+h2,height-(h1+h2),0)
addFrame(s,p1,p2,p3,p4,p5,p6,p7,p8)
s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h3))
s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',14,1,10,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceX',8,1,12,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',8,1,12,1,h3))
s.addConstraint(Sketcher.Constraint('DistanceX',14,1,10,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceY',14,1,10,1,h2))
s.addConstraint(Sketcher.Constraint('DistanceX',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceY',4,1,8,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceX',10,1,6,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceX',10,1,6,1,tol))
s.addConstraint(Sketcher.Constraint('DistanceY',10,1,6,1,tol))
wp.extend(["InnerFrame","Frame","Wire2,Wire3",str(w2),str(o1+o2)])
wp.extend(["InnerGlass","Glass panel","Wire3",str(w2/gla),str(o1+o2+w2/2)])
return (s,wp)
if windowtype in WindowPresets:
default = makeSketch(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2)
FreeCAD.ActiveDocument.recompute()
@ -357,7 +363,7 @@ def makeWindowPreset(windowtype,width,height,h1,h2,h3,w1,w2,o1,o2,placement=None
obj.Role = "Door"
FreeCAD.ActiveDocument.recompute()
return obj
print "Arch: Unknown window type"
@ -391,7 +397,7 @@ class _CommandWindow:
self.DECIMALS = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Units").GetInt("Decimals",2)
import DraftGui
self.FORMAT = DraftGui.makeFormatSpec(self.DECIMALS,'Length')
# auto mode
if sel and FreeCADGui.Selection.getSelectionEx():
obj = sel[0]
@ -415,7 +421,7 @@ class _CommandWindow:
host = obj.Support[0]
else:
host = obj.Support
obj.Support = None # remove
obj.Support = None # remove
elif Draft.isClone(obj,"Window"):
if obj.Objects[0].Inlist:
host = obj.Objects[0].Inlist[0]
@ -511,7 +517,7 @@ class _CommandWindow:
ui = FreeCADGui.UiLoader()
w.setWindowTitle(translate("Arch","Window options"))
grid = QtGui.QGridLayout(w)
# sill height
labels = QtGui.QLabel(translate("Arch","Sill height"))
values = ui.createWidget("Gui::InputField")
@ -527,7 +533,7 @@ class _CommandWindow:
grid.addWidget(labelp,1,0,1,1)
grid.addWidget(valuep,1,1,1,1)
QtCore.QObject.connect(valuep,QtCore.SIGNAL("currentIndexChanged(int)"),self.setPreset)
# image display
self.im = QtSvg.QSvgWidget(":/ui/ParametersWindowFixed.svg")
self.im.setMaximumWidth(200)
@ -556,10 +562,10 @@ class _CommandWindow:
setArchWindowParamFunction('"""+param+"""',d)""")
QtCore.QObject.connect(getattr(self,"val"+param),QtCore.SIGNAL("valueChanged(double)"),valueChanged)
return w
def setSill(self,d):
self.Sill = d
def setParams(self,param,d):
setattr(self,param,d)
self.tracker.length(self.Width)
@ -635,7 +641,7 @@ class _Window(ArchComponent.Component):
# because of load order, but it doesn't harm...
pass
FreeCAD.ActiveDocument.recompute()
def execute(self,obj):
import Part, DraftGeomUtils
@ -690,13 +696,13 @@ class _Window(ArchComponent.Component):
base.Placement = base.Placement.multiply(pl)
else:
print "Arch: Bad formatting of window parts definitions"
base = self.processSubShapes(obj,base)
self.applyShape(obj,base,pl)
def getSubVolume(self,obj,plac=None):
"returns a subvolume for cutting in a base object"
# check if we have a custom subvolume
if hasattr(obj,"Subvolume"):
if obj.Subvolume:
@ -728,10 +734,10 @@ class _Window(ArchComponent.Component):
b = base.Shape.BoundBox
width = max(b.XLength,b.YLength,b.ZLength)
if not width:
width = 1.1112 # some weird value to have little chance to overlap with an existing face
width = 1.1112 # some weird value to have little chance to overlap with an existing face
if not base:
return None
# finding biggest wire in the base shape
max_length = 0
f = None
@ -768,13 +774,13 @@ class _ViewProviderWindow(ArchComponent.ViewProviderComponent):
def getIcon(self):
import Arch_rc
return ":/icons/Arch_Window_Tree.svg"
def updateData(self,obj,prop):
if (prop in ["WindowParts","Shape"]):
if obj.Shape:
if not obj.Shape.isNull():
self.colorize(obj)
def onChanged(self,vobj,prop):
if (prop == "DiffuseColor") and vobj.Object:
if len(vobj.DiffuseColor) < 2:
@ -793,7 +799,7 @@ class _ViewProviderWindow(ArchComponent.ViewProviderComponent):
taskd.update()
FreeCADGui.Control.showDialog(taskd)
return True
def unsetEdit(self,vobj,mode):
vobj.DisplayMode = self.sets[0]
vobj.Transparency = self.sets[1]
@ -801,7 +807,7 @@ class _ViewProviderWindow(ArchComponent.ViewProviderComponent):
self.Object.Base.ViewObject.hide()
FreeCADGui.Control.closeDialog()
return
def colorize(self,obj):
"setting different part colors"
solids = obj.Shape.copy().Solids
@ -846,13 +852,13 @@ class _ArchWindowTaskPanel:
self.wiretree = QtGui.QTreeWidget(self.form)
self.grid.addWidget(self.wiretree, 2, 0, 1, 3)
self.wiretree.setColumnCount(1)
self.wiretree.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
self.wiretree.setSelectionMode(QtGui.QAbstractItemView.MultiSelection)
self.comptree = QtGui.QTreeWidget(self.form)
self.grid.addWidget(self.comptree, 2, 4, 1, 3)
self.comptree.setColumnCount(1)
# buttons
self.comptree.setColumnCount(1)
# buttons
self.addButton = QtGui.QPushButton(self.form)
self.addButton.setObjectName("addButton")
self.addButton.setIcon(QtGui.QIcon(":/icons/Arch_Add.svg"))
@ -865,7 +871,7 @@ class _ArchWindowTaskPanel:
self.grid.addWidget(self.editButton, 3, 2, 1, 3)
self.editButton.setMaximumSize(QtCore.QSize(60,40))
self.editButton.setEnabled(False)
self.delButton = QtGui.QPushButton(self.form)
self.delButton.setObjectName("delButton")
self.delButton.setIcon(QtGui.QIcon(":/icons/Arch_Remove.svg"))
@ -886,7 +892,7 @@ class _ArchWindowTaskPanel:
self.field2 = QtGui.QComboBox(self.form)
self.field3 = QtGui.QLineEdit(self.form)
self.field4 = ui.createWidget("Gui::InputField")
self.field5 = ui.createWidget("Gui::InputField")
self.field5 = ui.createWidget("Gui::InputField")
self.createButton = QtGui.QPushButton(self.form)
self.createButton.setObjectName("createButton")
self.createButton.setIcon(QtGui.QIcon(":/icons/Arch_Add.svg"))
@ -898,7 +904,7 @@ class _ArchWindowTaskPanel:
self.grid.addWidget(self.new3, 9, 0, 1, 1)
self.grid.addWidget(self.field3, 9, 2, 1, 5)
self.grid.addWidget(self.new4, 10, 0, 1, 1)
self.grid.addWidget(self.field4, 10, 2, 1, 5)
self.grid.addWidget(self.field4, 10, 2, 1, 5)
self.grid.addWidget(self.new5, 11, 0, 1, 1)
self.grid.addWidget(self.field5, 11, 2, 1, 5)
self.grid.addWidget(self.createButton, 12, 0, 1, 7)
@ -917,7 +923,7 @@ class _ArchWindowTaskPanel:
self.field4.setVisible(False)
self.field5.setVisible(False)
self.createButton.setVisible(False)
QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addElement)
QtCore.QObject.connect(self.delButton, QtCore.SIGNAL("clicked()"), self.removeElement)
QtCore.QObject.connect(self.editButton, QtCore.SIGNAL("clicked()"), self.editElement)
@ -940,7 +946,7 @@ class _ArchWindowTaskPanel:
def check(self,wid,col):
self.editButton.setEnabled(True)
self.delButton.setEnabled(True)
def select(self,wid,col):
FreeCADGui.Selection.clearSelection()
ws = ''
@ -956,7 +962,7 @@ class _ArchWindowTaskPanel:
if e.hashCode() == self.obj.Base.Shape.Edges[i].hashCode():
FreeCADGui.Selection.addSelection(self.obj.Base,"Edge"+str(i+1))
self.field3.setText(ws)
def getIcon(self,obj):
if hasattr(obj.ViewObject,"Proxy"):
return QtGui.QIcon(obj.ViewObject.Proxy.getIcon())
@ -1075,7 +1081,7 @@ class _ArchWindowTaskPanel:
except (ValueError,TypeError):
ok = False
ar.append(t)
if ok:
if self.obj:
parts = self.obj.WindowParts
@ -1089,7 +1095,7 @@ class _ArchWindowTaskPanel:
self.update()
else:
FreeCAD.Console.PrintWarning(translate("Arch", "Unable to create component\n"))
self.newtitle.setVisible(False)
self.new1.setVisible(False)
self.new2.setVisible(False)
@ -1103,12 +1109,12 @@ class _ArchWindowTaskPanel:
self.field5.setVisible(False)
self.createButton.setVisible(False)
self.addButton.setEnabled(True)
def reject(self):
FreeCAD.ActiveDocument.recompute()
FreeCADGui.ActiveDocument.resetEdit()
return True
def retranslateUi(self, TaskPanel):
TaskPanel.setWindowTitle(QtGui.QApplication.translate("Arch", "Components", None, QtGui.QApplication.UnicodeUTF8))
self.delButton.setText(QtGui.QApplication.translate("Arch", "Remove", None, QtGui.QApplication.UnicodeUTF8))
@ -1127,5 +1133,5 @@ class _ArchWindowTaskPanel:
for i in range(len(WindowPartTypes)):
self.field2.setItemText(i, QtGui.QApplication.translate("Arch", WindowPartTypes[i], None, QtGui.QApplication.UnicodeUTF8))
if FreeCAD.GuiUp:
if FreeCAD.GuiUp:
FreeCADGui.addCommand('Arch_Window',_CommandWindow())

View File

@ -28,6 +28,7 @@ SET(Arch_SRCS
ArchFrame.py
ArchPanel.py
ArchEquipment.py
ArchCutPlane.py
)
SOURCE_GROUP("" FILES ${Arch_SRCS})

View File

@ -312,7 +312,7 @@ bool MeshInput::LoadOBJ (std::istream &rstrIn)
bool ok = true;
for (int i=0;i<3;i++) {
if (it->_aulPoints[i] >= ct) {
Base::Console().Warning("Face index %ld out of range\n", it->_aulPoints[i]);
Base::Console().Warning("Face index %lu out of range\n", it->_aulPoints[i]);
ok = false;
}
}
@ -435,7 +435,7 @@ bool MeshInput::LoadOFF (std::istream &rstrIn)
bool ok = true;
for (int i=0;i<3;i++) {
if (it->_aulPoints[i] >= ct) {
Base::Console().Warning("Face index %ld out of range\n", it->_aulPoints[i]);
Base::Console().Warning("Face index %lu out of range\n", it->_aulPoints[i]);
ok = false;
}
}

View File

@ -809,6 +809,7 @@ void MeshKernel::Read (std::istream &rclIn)
str >> magic >> version;
swap_magic = magic; Base::SwapEndian(swap_magic);
swap_version = version; Base::SwapEndian(swap_version);
uint32_t open_edge = 0xffffffff; // value to mark an open edge
// is it the new or old format?
bool new_format = false;
@ -846,10 +847,25 @@ void MeshKernel::Read (std::istream &rclIn)
it->_aulPoints[1] = v2;
it->_aulPoints[2] = v3;
// On systems where an 'unsigned long' is a 64-bit value
// the empty neighbour must be explicitly set to 'ULONG_MAX'
// because in algorithms this value is always used to check
// for open edges.
str >> v1 >> v2 >> v3;
it->_aulNeighbours[0] = v1;
it->_aulNeighbours[1] = v2;
it->_aulNeighbours[2] = v3;
if (v1 < open_edge)
it->_aulNeighbours[0] = v1;
else
it->_aulNeighbours[0] = ULONG_MAX;
if (v2 < open_edge)
it->_aulNeighbours[1] = v2;
else
it->_aulNeighbours[1] = ULONG_MAX;
if (v3 < open_edge)
it->_aulNeighbours[2] = v3;
else
it->_aulNeighbours[2] = ULONG_MAX;
}
str >> _clBoundBox.MinX >> _clBoundBox.MaxX;

View File

@ -1385,7 +1385,7 @@ void ViewProviderMesh::faceInfo(unsigned long uFacet)
if (uFacet < facets.size()) {
MeshCore::MeshFacet face = facets[uFacet];
MeshCore::MeshGeomFacet tria = rKernel.GetFacet(face);
Base::Console().Message("Mesh: %s Facet %ld: Points: <%ld, %ld, %ld>, Neighbours: <%ld, %ld, %ld>\n"
Base::Console().Message("Mesh: %s Facet %lu: Points: <%lu, %lu, %lu>, Neighbours: <%lu, %lu, %lu>\n"
"Triangle: <[%.6f, %.6f, %.6f], [%.6f, %.6f, %.6f], [%.6f, %.6f, %.6f]>\n", fea->getNameInDocument(), uFacet,
face._aulPoints[0], face._aulPoints[1], face._aulPoints[2],
face._aulNeighbours[0], face._aulNeighbours[1], face._aulNeighbours[2],

View File

@ -184,7 +184,7 @@ void CurveProjectorShape::projectCurve( const TopoDS_Edge& aEdge,
// more the one intersection (@ToDo)
}else if(Alg.NbPoints() > 1){
PointOnEdge[i] = Base::Vector3f(FLOAT_MAX,0,0);
Base::Console().Log("MeshAlgos::projectCurve(): More then one intersection in Facet %ld, Edge %d\n",uCurFacetIdx,i);
Base::Console().Log("MeshAlgos::projectCurve(): More then one intersection in Facet %lu, Edge %d\n",uCurFacetIdx,i);
}
}
}
@ -202,7 +202,7 @@ void CurveProjectorShape::projectCurve( const TopoDS_Edge& aEdge,
cResultPoint = cSplitPoint;
GoOn = true;
}else{
Base::Console().Log("MeshAlgos::projectCurve(): Posibel reentry in Facet %ld\n", uCurFacetIdx);
Base::Console().Log("MeshAlgos::projectCurve(): Possible reentry in Facet %lu\n", uCurFacetIdx);
}
if( uCurFacetIdx == uStartFacetIdx )

View File

@ -771,10 +771,14 @@ App::DocumentObjectExecReturn *Helix::execute(void)
Standard_Boolean myLocalCS = LocalCoord.getValue() ? Standard_True : Standard_False;
Standard_Boolean myStyle = Style.getValue() ? Standard_True : Standard_False;
TopoShape helix;
if (myHeight / myPitch > 50.0)
this->Shape.setValue(helix.makeLongHelix(myPitch, myHeight, myRadius, myAngle, myLocalCS));
else
this->Shape.setValue(helix.makeHelix(myPitch, myHeight, myRadius, myAngle, myLocalCS, myStyle));
// work around for OCC bug #23314 (FC #0954)
// the exact conditions for failure are unknown. building the helix 1 turn at a time
// seems to always work.
this->Shape.setValue(helix.makeLongHelix(myPitch, myHeight, myRadius, myAngle, myLocalCS));
// if (myHeight / myPitch > 50.0)
// this->Shape.setValue(helix.makeLongHelix(myPitch, myHeight, myRadius, myAngle, myLocalCS));
// else
// this->Shape.setValue(helix.makeHelix(myPitch, myHeight, myRadius, myAngle, myLocalCS, myStyle));
}
catch (Standard_Failure) {
Handle_Standard_Failure e = Standard_Failure::Caught();

View File

@ -645,7 +645,7 @@ void DlgPrimitives::createPrimitive(const QString& placement)
// Execute the Python block
QString prim = tr("Create %1").arg(ui.comboBox1->currentText());
Gui::Application::Instance->activeDocument()->openCommand(prim.toUtf8());
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toAscii());
Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toUtf8());
Gui::Application::Instance->activeDocument()->commitCommand();
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
Gui::Command::doCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")");

View File

@ -63,7 +63,7 @@ ADD_CUSTOM_TARGET(WizardShaft ALL
SET(all_files ${all_wizardshaft_files})
fc_copy_sources(Mod/PartDesign "${CMAKE_BINARY_DIR}/Mod/PartDesign" ${all_files})
fc_copy_sources(WizardShaft "${CMAKE_BINARY_DIR}/Mod/PartDesign" ${all_files})
INSTALL(
FILES

View File

@ -53,7 +53,7 @@ ADD_CUSTOM_TARGET(Plot ALL
SOURCES ${all_files}
)
fc_copy_sources(Mod/Plot "${CMAKE_BINARY_DIR}/Mod/Plot" ${all_files})
fc_copy_sources(Plot "${CMAKE_BINARY_DIR}/Mod/Plot" ${all_files})
INSTALL(
FILES

View File

@ -170,7 +170,7 @@ void CmdApproxPlane::activated(int iMsg)
double q0, q1, q2, q3;
pm.getRotation().getValue(q0, q1, q2, q3);
Base::Console().Log("RMS value for plane fit with %ld points: %.4f\n", aData.size(), sigma);
Base::Console().Log("RMS value for plane fit with %lu points: %.4f\n", aData.size(), sigma);
Base::Console().Log(" Plane base(%.4f, %.4f, %.4f)\n", base.x, base.y, base.z);
Base::Console().Log(" Plane normal(%.4f, %.4f, %.4f)\n", norm.x, norm.y, norm.z);

View File

@ -69,7 +69,7 @@ ADD_CUSTOM_TARGET(Ship ALL
SOURCES ${all_files}
)
fc_copy_sources(Mod/Ship "${CMAKE_BINARY_DIR}/Mod/Ship" ${all_files})
fc_copy_sources(Ship "${CMAKE_BINARY_DIR}/Mod/Ship" ${all_files})
INSTALL(
FILES

View File

@ -1330,6 +1330,44 @@ void SketchObject::rebuildExternalGeometry(void)
ExternalGeo.push_back(line);
}
}
else if (curve.GetType() == GeomAbs_Circle) {
gp_Dir vec1 = sketchPlane.Axis().Direction();
gp_Dir vec2 = curve.Circle().Axis().Direction();
if (vec1.IsParallel(vec2, Precision::Confusion())) {
gp_Circ circle = curve.Circle();
gp_Pnt cnt = circle.Location();
gp_Pnt beg = curve.Value(curve.FirstParameter());
gp_Pnt end = curve.Value(curve.LastParameter());
GeomAPI_ProjectPointOnSurf proj(cnt,gPlane);
cnt = proj.NearestPoint();
circle.SetLocation(cnt);
cnt.Transform(mov);
circle.Transform(mov);
if (beg.SquareDistance(end) < Precision::Confusion()) {
Part::GeomCircle* gCircle = new Part::GeomCircle();
gCircle->setRadius(circle.Radius());
gCircle->setCenter(Base::Vector3d(cnt.X(),cnt.Y(),cnt.Z()));
gCircle->Construction = true;
ExternalGeo.push_back(gCircle);
}
else {
Part::GeomArcOfCircle* gArc = new Part::GeomArcOfCircle();
Handle_Geom_Curve hCircle = new Geom_Circle(circle);
Handle_Geom_TrimmedCurve tCurve = new Geom_TrimmedCurve(hCircle, curve.FirstParameter(),
curve.LastParameter());
gArc->setHandle(tCurve);
gArc->Construction = true;
ExternalGeo.push_back(gArc);
}
}
else {
// creates an ellipse
throw Base::Exception("Not yet supported geometry for external geometry");
}
}
else {
try {
BRepOffsetAPI_NormalProjection mkProj(aProjFace);

View File

@ -3009,32 +3009,20 @@ public:
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addGeometry(Part.Line(App.Vector(%f,%f,0),App.Vector(%f,%f,0)))",
sketchgui->getObject()->getNameInDocument(),
EditCurve[0].fX,EditCurve[0].fY,EditCurve[34].fX,EditCurve[34].fY);
//// add the tnagent constraints
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Tangent',%i,%i)) "
,sketchgui->getObject()->getNameInDocument()
,firstCurve,firstCurve+2);
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Tangent',%i,%i)) "
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Tangent',%i,1,%i,1)) "
,sketchgui->getObject()->getNameInDocument()
,firstCurve,firstCurve+3);
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Tangent',%i,%i)) "
,sketchgui->getObject()->getNameInDocument()
,firstCurve+1,firstCurve+2);
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Tangent',%i,%i)) "
,sketchgui->getObject()->getNameInDocument()
,firstCurve+1,firstCurve+3);
// add the four coincidents to ty them together
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Coincident',%i,1,%i,1)) "
,sketchgui->getObject()->getNameInDocument()
,firstCurve,firstCurve+3);
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Coincident',%i,2,%i,1)) "
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Tangent',%i,2,%i,1)) "
,sketchgui->getObject()->getNameInDocument()
,firstCurve,firstCurve+2);
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Coincident',%i,2,%i,1)) "
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Tangent',%i,2,%i,1)) "
,sketchgui->getObject()->getNameInDocument()
,firstCurve+2,firstCurve+1);
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Coincident',%i,2,%i,2)) "
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Tangent',%i,2,%i,2)) "
,sketchgui->getObject()->getNameInDocument()
,firstCurve+3,firstCurve+1);
//// add the either horizontal or vertical constraints
if(fabs(lx)>fabs(ly))
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.addConstraint(Sketcher.Constraint('Horizontal',%i)) "

View File

@ -24,6 +24,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <boost/bind.hpp>
#endif
#include "TaskDlgEditSketch.h"
@ -46,16 +47,33 @@ TaskDlgEditSketch::TaskDlgEditSketch(ViewProviderSketch *sketchView)
Elements = new TaskSketcherElements(sketchView);
General = new TaskSketcherGeneral(sketchView);
Messages = new TaskSketcherMessages(sketchView);
Content.push_back(Messages);
Content.push_back(General);
Content.push_back(Constraints);
Content.push_back(Elements);
App::Document* document = sketchView->getObject()->getDocument();
connectUndoDocument =
document->signalUndo.connect(boost::bind(&TaskDlgEditSketch::slotUndoDocument, this, _1));
connectRedoDocument =
document->signalRedo.connect(boost::bind(&TaskDlgEditSketch::slotRedoDocument, this, _1));
}
TaskDlgEditSketch::~TaskDlgEditSketch()
{
connectUndoDocument.disconnect();
connectRedoDocument.disconnect();
}
void TaskDlgEditSketch::slotUndoDocument(const App::Document& doc)
{
const_cast<App::Document&>(doc).recomputeFeature(sketchView->getObject());
}
void TaskDlgEditSketch::slotRedoDocument(const App::Document& doc)
{
const_cast<App::Document&>(doc).recomputeFeature(sketchView->getObject());
}
//==== calls from the TaskView ===============================================================

View File

@ -31,6 +31,9 @@
#include "TaskSketcherElements.h"
#include "TaskSketcherGeneral.h"
#include "TaskSketcherMessages.h"
#include <boost/signals.hpp>
typedef boost::signals::connection Connection;
namespace SketcherGui {
@ -65,11 +68,17 @@ public:
{ return QDialogButtonBox::Close|QDialogButtonBox::Help; }
protected:
ViewProviderSketch *sketchView;
void slotUndoDocument(const App::Document&);
void slotRedoDocument(const App::Document&);
protected:
ViewProviderSketch *sketchView;
TaskSketcherConstrains *Constraints;
TaskSketcherElements *Elements;
TaskSketcherElements *Elements;
TaskSketcherGeneral *General;
TaskSketcherMessages *Messages;
Connection connectUndoDocument;
Connection connectRedoDocument;
};

View File

@ -66,8 +66,8 @@ void SketcherGeneralWidget::saveSettings()
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Sketcher/General");
hGrp->SetBool("ShowGrid", ui->checkBoxShowGrid->isChecked());
ui->gridSize->pushToHistory();
ui->gridSize->pushToHistory();
hGrp->SetBool("GridSnap", ui->checkBoxGridSnap->isChecked());
hGrp->SetBool("AutoConstraints", ui->checkBoxAutoconstraints->isChecked());
@ -78,14 +78,12 @@ void SketcherGeneralWidget::loadSettings()
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
.GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/Sketcher/General");
ui->checkBoxShowGrid->setChecked(hGrp->GetBool("ShowGrid", true));
ui->gridSize->setParamGrpPath(QByteArray("User parameter:BaseApp/History/SketchGridSize"));
//ui->gridSize->setToLastUsedValue();
ui->gridSize->setParamGrpPath(QByteArray("User parameter:BaseApp/History/SketchGridSize"));
//ui->gridSize->setToLastUsedValue();
ui->checkBoxGridSnap->setChecked(hGrp->GetBool("GridSnap", ui->checkBoxGridSnap->isChecked()));
ui->checkBoxAutoconstraints->setChecked(hGrp->GetBool("AutoConstraints", ui->checkBoxAutoconstraints->isChecked()));
}
void SketcherGeneralWidget::toggleGridView(bool on)
{
ui->label->setEnabled(on);
@ -101,7 +99,7 @@ void SketcherGeneralWidget::setGridSize(double val)
void SketcherGeneralWidget::setInitGridSize(double val)
{
ui->gridSize->setValue(Base::Quantity(val,Base::Unit::Length));
ui->gridSize->setValue(Base::Quantity(val,Base::Unit::Length));
}
void SketcherGeneralWidget::toggleGridSnap(int state)
@ -150,7 +148,7 @@ TaskSketcherGeneral::TaskSketcherGeneral(ViewProviderSketch *sketchView)
Gui::Selection().Attach(this);
widget->loadSettings();
widget->setInitGridSize(sketchView->GridSize.getValue() );
widget->setInitGridSize(sketchView->GridSize.getValue() );
}
TaskSketcherGeneral::~TaskSketcherGeneral()
@ -182,7 +180,7 @@ void TaskSketcherGeneral::toggleAutoconstraints(int state)
/// @cond DOXERR
void TaskSketcherGeneral::OnChange(Gui::SelectionSingleton::SubjectType &rCaller,
Gui::SelectionSingleton::MessageType Reason)
Gui::SelectionSingleton::MessageType Reason)
{
//if (Reason.Type == SelectionChanges::AddSelection ||
// Reason.Type == SelectionChanges::RmvSelection ||

View File

@ -694,14 +694,15 @@ bool ViewProviderSketch::mouseButtonPressed(int Button, bool pressed, const SbVe
int GeoId;
Sketcher::PointPos PosId;
getSketchObject()->getGeoVertexIndex(edit->DragPoint, GeoId, PosId);
Gui::Command::openCommand("Drag Point");
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.movePoint(%i,%i,App.Vector(%f,%f,0),%i)"
,getObject()->getNameInDocument()
,GeoId, PosId, x-xInit, y-yInit, relative ? 1 : 0
);
Gui::Command::commitCommand();
Gui::Command::updateActive();
if (GeoId != Sketcher::Constraint::GeoUndef && PosId != Sketcher::none) {
Gui::Command::openCommand("Drag Point");
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.movePoint(%i,%i,App.Vector(%f,%f,0),%i)"
,getObject()->getNameInDocument()
,GeoId, PosId, x-xInit, y-yInit, relative ? 1 : 0
);
Gui::Command::commitCommand();
Gui::Command::updateActive();
}
setPreselectPoint(edit->DragPoint);
edit->DragPoint = -1;
//updateColor();
@ -987,10 +988,12 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
int GeoId;
Sketcher::PointPos PosId;
getSketchObject()->getGeoVertexIndex(edit->DragPoint, GeoId, PosId);
edit->ActSketch.initMove(GeoId, PosId, false);
relative = false;
xInit = 0;
yInit = 0;
if (GeoId != Sketcher::Constraint::GeoUndef && PosId != Sketcher::none) {
edit->ActSketch.initMove(GeoId, PosId, false);
relative = false;
xInit = 0;
yInit = 0;
}
} else {
Mode = STATUS_NONE;
}
@ -1044,13 +1047,15 @@ bool ViewProviderSketch::mouseMove(const SbVec2s &cursorPos, Gui::View3DInventor
Sketcher::PointPos PosId;
getSketchObject()->getGeoVertexIndex(edit->DragPoint, GeoId, PosId);
Base::Vector3d vec(x-xInit,y-yInit,0);
if (edit->ActSketch.movePoint(GeoId, PosId, vec, relative) == 0) {
setPositionText(Base::Vector2D(x,y));
draw(true);
signalSolved(QString::fromLatin1("Solved in %1 sec").arg(edit->ActSketch.SolveTime));
} else {
signalSolved(QString::fromLatin1("Unsolved (%1 sec)").arg(edit->ActSketch.SolveTime));
//Base::Console().Log("Error solving:%d\n",ret);
if (GeoId != Sketcher::Constraint::GeoUndef && PosId != Sketcher::none) {
if (edit->ActSketch.movePoint(GeoId, PosId, vec, relative) == 0) {
setPositionText(Base::Vector2D(x,y));
draw(true);
signalSolved(QString::fromLatin1("Solved in %1 sec").arg(edit->ActSketch.SolveTime));
} else {
signalSolved(QString::fromLatin1("Unsolved (%1 sec)").arg(edit->ActSketch.SolveTime));
//Base::Console().Log("Error solving:%d\n",ret);
}
}
}
return true;