Merge branch 'master' of ssh://free-cad.git.sourceforge.net/gitroot/free-cad/free-cad
This commit is contained in:
commit
def8cb81c0
|
@ -64,7 +64,7 @@ public:
|
||||||
bool operator > (const TimeInfo &time) const;
|
bool operator > (const TimeInfo &time) const;
|
||||||
|
|
||||||
static const char* currentDateTimeString();
|
static const char* currentDateTimeString();
|
||||||
static std::string diffTime(const TimeInfo &timeStart,const TimeInfo &timeEnd );
|
static std::string diffTime(const TimeInfo &timeStart,const TimeInfo &timeEnd = TimeInfo());
|
||||||
static float diffTimeF(const TimeInfo &timeStart,const TimeInfo &timeEnd );
|
static float diffTimeF(const TimeInfo &timeStart,const TimeInfo &timeEnd );
|
||||||
bool isNull() const;
|
bool isNull() const;
|
||||||
static TimeInfo null();
|
static TimeInfo null();
|
||||||
|
|
|
@ -77,7 +77,7 @@ public:
|
||||||
std::vector<std::vector<SelectionObject> > Result;
|
std::vector<std::vector<SelectionObject> > Result;
|
||||||
|
|
||||||
/// true if a valid filter is set
|
/// true if a valid filter is set
|
||||||
bool isValid(void) const {return Ast;}
|
bool isValid(void) const {return (bool) Ast;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string Filter;
|
std::string Filter;
|
||||||
|
|
|
@ -1734,12 +1734,12 @@ def heal(objlist=None,delete=True,reparent=True):
|
||||||
for n in dellist:
|
for n in dellist:
|
||||||
FreeCAD.ActiveDocument.removeObject(n)
|
FreeCAD.ActiveDocument.removeObject(n)
|
||||||
|
|
||||||
def upgrade(objects,deelte=False,force=None):
|
def upgrade(objects,delete=False,force=None):
|
||||||
"""upgrade(objects,delete=False,force=None): Upgrades the given object(s) (can be
|
"""upgrade(objects,delete=False,force=None): Upgrades the given object(s) (can be
|
||||||
an object or a list of objects). If delete is True, old objects are deleted.
|
an object or a list of objects). If delete is True, old objects are deleted.
|
||||||
The force attribute can be used to
|
The force attribute can be used to
|
||||||
force a certain way of upgrading. It can be: makeCompound, closeGroupWires,
|
force a certain way of upgrading. It can be: makeCompound, closeGroupWires,
|
||||||
makeSolid, closeWire, turnToParts, makeFusion, makeShell, makeFaces, turnToDraft,
|
makeSolid, closeWire, turnToParts, makeFusion, makeShell, makeFaces, draftify,
|
||||||
joinFaces, makeSketchFace, makeWires
|
joinFaces, makeSketchFace, makeWires
|
||||||
Returns a dictionnary containing two lists, a list of new objects and a list
|
Returns a dictionnary containing two lists, a list of new objects and a list
|
||||||
of objects to be deleted"""
|
of objects to be deleted"""
|
||||||
|
@ -1885,17 +1885,6 @@ def upgrade(objects,deelte=False,force=None):
|
||||||
return newobj
|
return newobj
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def turnToDraft(objectslist):
|
|
||||||
"""turns each of the objects into a Draft object, if possible"""
|
|
||||||
newobj = draftify(objects,delete=False)
|
|
||||||
if newobj:
|
|
||||||
if not isinstance(newobj,list):
|
|
||||||
newobj = [newobj]
|
|
||||||
addList.extend(newobj)
|
|
||||||
deleteList.extend(objectslist)
|
|
||||||
return newobj
|
|
||||||
return None
|
|
||||||
|
|
||||||
def makeSketchFace(obj):
|
def makeSketchFace(obj):
|
||||||
"""Makes a Draft face out of a sketch"""
|
"""Makes a Draft face out of a sketch"""
|
||||||
newobj = makeWire(obj.Shape,closed=True)
|
newobj = makeWire(obj.Shape,closed=True)
|
||||||
|
@ -1918,6 +1907,8 @@ def upgrade(objects,deelte=False,force=None):
|
||||||
newobj.Shape = f
|
newobj.Shape = f
|
||||||
addList.append(newobj)
|
addList.append(newobj)
|
||||||
result = True
|
result = True
|
||||||
|
if not o in deleteList:
|
||||||
|
deleteList.append(o)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def makeWires(objectslist):
|
def makeWires(objectslist):
|
||||||
|
@ -1979,12 +1970,12 @@ def upgrade(objects,deelte=False,force=None):
|
||||||
meshes.append(ob)
|
meshes.append(ob)
|
||||||
objects = parts
|
objects = parts
|
||||||
|
|
||||||
print "objects:",objects," edges:",edges," wires:",wires," openwires:",openwires," faces:",faces
|
#print "objects:",objects," edges:",edges," wires:",wires," openwires:",openwires," faces:",faces
|
||||||
print "groups:",groups," curves:",curves," facewires:",facewires, "loneedges:", loneedges
|
#print "groups:",groups," curves:",curves," facewires:",facewires, "loneedges:", loneedges
|
||||||
|
|
||||||
if force:
|
if force:
|
||||||
if force in ["makeCompound","closeGroupWires","makeSolid","closeWire","turnToParts","makeFusion",
|
if force in ["makeCompound","closeGroupWires","makeSolid","closeWire","turnToParts","makeFusion",
|
||||||
"makeShell","makeFaces","turnToDraft","joinFaces","makeSketchFace","makeWires"]:
|
"makeShell","makeFaces","draftify","joinFaces","makeSketchFace","makeWires"]:
|
||||||
result = eval(force)(objects)
|
result = eval(force)(objects)
|
||||||
else:
|
else:
|
||||||
msg(translate("Upgrade: Unknow force method:")+" "+force)
|
msg(translate("Upgrade: Unknow force method:")+" "+force)
|
||||||
|
@ -2030,8 +2021,8 @@ def upgrade(objects,deelte=False,force=None):
|
||||||
if result: msg(translate("draft", "Found several coplanar objects or faces: making one face\n"))
|
if result: msg(translate("draft", "Found several coplanar objects or faces: making one face\n"))
|
||||||
|
|
||||||
# only one object: if not parametric, we "draftify" it
|
# only one object: if not parametric, we "draftify" it
|
||||||
elif len(objects) == 1:
|
elif len(objects) == 1 and (not objects[0].isDerivedFrom("Part::Part2DObjectPython")):
|
||||||
result = turnToDraft(objects)
|
result = draftify(objects[0])
|
||||||
if result: msg(translate("draft", "Found 1 non-parametric objects: draftifying it\n"))
|
if result: msg(translate("draft", "Found 1 non-parametric objects: draftifying it\n"))
|
||||||
|
|
||||||
# we have only closed wires, no faces
|
# we have only closed wires, no faces
|
||||||
|
@ -2062,12 +2053,8 @@ def upgrade(objects,deelte=False,force=None):
|
||||||
result = makeWires(objects)
|
result = makeWires(objects)
|
||||||
if result: msg(translate("draft", "Found several edges: wiring them\n"))
|
if result: msg(translate("draft", "Found several edges: wiring them\n"))
|
||||||
|
|
||||||
# only one selected object, do not make a compound
|
# all other cases, if more than 1 object, make a compound
|
||||||
elif (len(objects) == 1):
|
elif (len(objects) > 1):
|
||||||
result = None
|
|
||||||
|
|
||||||
# all other cases
|
|
||||||
else:
|
|
||||||
result = makeCompound(objects)
|
result = makeCompound(objects)
|
||||||
if result: msg(translate("draft", "Found several non-treatable objects: making compound\n"))
|
if result: msg(translate("draft", "Found several non-treatable objects: making compound\n"))
|
||||||
|
|
||||||
|
@ -2085,6 +2072,181 @@ def upgrade(objects,deelte=False,force=None):
|
||||||
|
|
||||||
return [addList,deleteList]
|
return [addList,deleteList]
|
||||||
|
|
||||||
|
def downgrade(objects,delete=False,force=None):
|
||||||
|
"""downgrade(objects,delete=False,force=None): Downgrades the given object(s) (can be
|
||||||
|
an object or a list of objects). If delete is True, old objects are deleted.
|
||||||
|
The force attribute can be used to
|
||||||
|
force a certain way of downgrading. It can be: explode, shapify, subtr,
|
||||||
|
splitFaces, cut2, getWire, splitWires.
|
||||||
|
Returns a dictionnary containing two lists, a list of new objects and a list
|
||||||
|
of objects to be deleted"""
|
||||||
|
|
||||||
|
import Part, DraftGeomUtils
|
||||||
|
from DraftTools import msg,translate
|
||||||
|
|
||||||
|
if not isinstance(objects,list):
|
||||||
|
objects = [objects]
|
||||||
|
|
||||||
|
global deleteList, newList
|
||||||
|
deleteList = []
|
||||||
|
addList = []
|
||||||
|
|
||||||
|
# actions definitions
|
||||||
|
|
||||||
|
def explode(obj):
|
||||||
|
"""explodes a Draft block"""
|
||||||
|
pl = obj.Placement
|
||||||
|
newobj = []
|
||||||
|
for o in obj.Components:
|
||||||
|
o.ViewObject.Visibility = True
|
||||||
|
o.Placement = o.Placement.multiply(pl)
|
||||||
|
if newobj:
|
||||||
|
deleteList(obj)
|
||||||
|
return newobj
|
||||||
|
return None
|
||||||
|
|
||||||
|
def cut2(objects):
|
||||||
|
"""cuts first object from the last one"""
|
||||||
|
newobj = cut(objects[0],objects[1])
|
||||||
|
if newobj:
|
||||||
|
addList.append(newobj)
|
||||||
|
return newobj
|
||||||
|
return None
|
||||||
|
|
||||||
|
def splitFaces(objects):
|
||||||
|
"""split faces contained in objects into new objects"""
|
||||||
|
result = False
|
||||||
|
for o in objects:
|
||||||
|
if o.Shape.Faces:
|
||||||
|
for f in o.Shape.Faces:
|
||||||
|
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature","Face")
|
||||||
|
newobj.Shape = f
|
||||||
|
addList.append(newobj)
|
||||||
|
result = True
|
||||||
|
deleteList.append(o)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def subtr(objects):
|
||||||
|
"""subtracts objects from the first one"""
|
||||||
|
faces = []
|
||||||
|
for o in objects:
|
||||||
|
if o.Shape.Faces:
|
||||||
|
faces.append(o.Shape.Faces)
|
||||||
|
deleteList.append(o)
|
||||||
|
u = faces.pop(0)
|
||||||
|
for f in faces:
|
||||||
|
u = u.cut(f)
|
||||||
|
if not u.isNull():
|
||||||
|
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature","Subtraction")
|
||||||
|
newobj.Shape = u
|
||||||
|
addList.append(newobj)
|
||||||
|
return newobj
|
||||||
|
return None
|
||||||
|
|
||||||
|
def getWire(obj):
|
||||||
|
"""gets the wire from a face object"""
|
||||||
|
result = False
|
||||||
|
for w in obj.Shape.Faces[0].Wires:
|
||||||
|
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature","Wire")
|
||||||
|
newobj.Shape = w
|
||||||
|
addList.append(newobj)
|
||||||
|
result = True
|
||||||
|
deleteList.append(obj)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def splitWires(objects):
|
||||||
|
"""splits the wires contained in objects into edges"""
|
||||||
|
result = False
|
||||||
|
for o in objects:
|
||||||
|
if o.Shape.Edges:
|
||||||
|
for e in o.Shape.Edges:
|
||||||
|
newobj = FreeCAD.ActiveDocument.addObject("Part::Feature","Edge")
|
||||||
|
newobj.Shape = e
|
||||||
|
addList.append(newobj)
|
||||||
|
deleteList.append(o)
|
||||||
|
result = True
|
||||||
|
return result
|
||||||
|
|
||||||
|
# analyzing objects
|
||||||
|
|
||||||
|
faces = []
|
||||||
|
edges = []
|
||||||
|
onlyedges = True
|
||||||
|
parts = []
|
||||||
|
|
||||||
|
for o in objects:
|
||||||
|
if o.isDerivedFrom("Part::Feature"):
|
||||||
|
for f in o.Shape.Faces:
|
||||||
|
faces.append(f)
|
||||||
|
for e in o.Shape.Edges:
|
||||||
|
edges.append(e)
|
||||||
|
if o.Shape.ShapeType != "Edge":
|
||||||
|
onlyedges = False
|
||||||
|
parts.append(o)
|
||||||
|
objects = parts
|
||||||
|
|
||||||
|
if force:
|
||||||
|
if force in ["explode","shapify","subtr","splitFaces","cut2","getWire","splitWires"]:
|
||||||
|
result = eval(force)(objects)
|
||||||
|
else:
|
||||||
|
msg(translate("Upgrade: Unknow force method:")+" "+force)
|
||||||
|
result = None
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
# applying transformation automatically
|
||||||
|
|
||||||
|
# we have a block, we explode it
|
||||||
|
if (len(objects) == 1) and (getType(objects[0]) == "Block"):
|
||||||
|
result = explode(objects[0])
|
||||||
|
if result: msg(translate("draft", "Found 1 block: exploding it\n"))
|
||||||
|
|
||||||
|
# special case, we have one parametric object: we "de-parametrize" it
|
||||||
|
elif (len(objects) == 1) and (objects[0].isDerivedFrom("Part::Feature")) and ("Base" in objects[0].PropertiesList):
|
||||||
|
result = shapify(objects[0])
|
||||||
|
if result: msg(translate("draft", "Found 1 parametric object: breaking its dependencies\n"))
|
||||||
|
|
||||||
|
# we have only 2 objects: cut 2nd from 1st
|
||||||
|
elif len(objects) == 2:
|
||||||
|
result = cut2(objects)
|
||||||
|
if result: msg(translate("draft", "Found 2 objects: subtracting them\n"))
|
||||||
|
|
||||||
|
elif (len(faces) > 1):
|
||||||
|
|
||||||
|
# one object with several faces: split it
|
||||||
|
if len(objects) == 1:
|
||||||
|
result = splitFaces(objects)
|
||||||
|
if result: msg(translate("draft", "Found several faces: splitting them\n"))
|
||||||
|
|
||||||
|
# several objects: remove all the faces from the first one
|
||||||
|
else:
|
||||||
|
result = subtr(objects)
|
||||||
|
if result: msg(translate("draft", "Found several objects: subtracting them from the first one\n"))
|
||||||
|
|
||||||
|
# only one face: we extract its wires
|
||||||
|
elif (len(faces) > 0):
|
||||||
|
result = getWire(objects[0])
|
||||||
|
if result: msg(translate("draft", "Found 1 face: extracting its wires\n"))
|
||||||
|
|
||||||
|
# no faces: split wire into single edges
|
||||||
|
elif not onlyedges:
|
||||||
|
result = splitWires(objects)
|
||||||
|
if result: msg(translate("draft", "Found only wires: extracting their edges\n"))
|
||||||
|
|
||||||
|
# no result has been obtained
|
||||||
|
if not result:
|
||||||
|
msg(translate("draft", "No more downgrade possible\n"))
|
||||||
|
|
||||||
|
if delete:
|
||||||
|
names = []
|
||||||
|
for o in deleteList:
|
||||||
|
names.append(o.Name)
|
||||||
|
deleteList = []
|
||||||
|
for n in names:
|
||||||
|
FreeCAD.ActiveDocument.removeObject(n)
|
||||||
|
|
||||||
|
return [addList,deleteList]
|
||||||
|
|
||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
# Python Features definitions
|
# Python Features definitions
|
||||||
|
|
|
@ -2158,15 +2158,7 @@ class Upgrade(Modifier):
|
||||||
|
|
||||||
|
|
||||||
class Downgrade(Modifier):
|
class Downgrade(Modifier):
|
||||||
'''
|
'''The Draft_Downgrade FreeCAD command definition.'''
|
||||||
The Draft_Downgrade FreeCAD command definition.
|
|
||||||
This class downgrades selected objects in different ways,
|
|
||||||
following this list (in order):
|
|
||||||
- if there are more than one faces, the subsequent
|
|
||||||
faces are subtracted from the first one
|
|
||||||
- if there is only one face, it gets converted to a wire
|
|
||||||
- otherwise wires are exploded into single edges
|
|
||||||
'''
|
|
||||||
|
|
||||||
def GetResources(self):
|
def GetResources(self):
|
||||||
return {'Pixmap' : 'Draft_Downgrade',
|
return {'Pixmap' : 'Draft_Downgrade',
|
||||||
|
@ -2185,95 +2177,13 @@ class Downgrade(Modifier):
|
||||||
self.proceed()
|
self.proceed()
|
||||||
|
|
||||||
def proceed(self):
|
def proceed(self):
|
||||||
self.sel = Draft.getSelection()
|
if self.call:
|
||||||
edges = []
|
self.view.removeEventCallback("SoEvent",self.call)
|
||||||
faces = []
|
if Draft.getSelection():
|
||||||
|
self.commit(translate("draft","Downgrade"),
|
||||||
# scanning objects
|
['import Draft',
|
||||||
for ob in self.sel:
|
'Draft.downgrade(FreeCADGui.Selection.getSelection(),delete=True)'])
|
||||||
for f in ob.Shape.Faces:
|
self.finish()
|
||||||
faces.append(f)
|
|
||||||
for ob in self.sel:
|
|
||||||
for e in ob.Shape.Edges:
|
|
||||||
edges.append(e)
|
|
||||||
lastob = ob
|
|
||||||
|
|
||||||
# applying transformation
|
|
||||||
self.doc.openTransaction("Downgrade")
|
|
||||||
|
|
||||||
if (len(self.sel) == 1) and (Draft.getType(self.sel[0]) == "Block"):
|
|
||||||
# we have a block, we explode it
|
|
||||||
pl = self.sel[0].Placement
|
|
||||||
newob = []
|
|
||||||
for ob in self.sel[0].Components:
|
|
||||||
ob.ViewObject.Visibility = True
|
|
||||||
ob.Placement = ob.Placement.multiply(pl)
|
|
||||||
newob.append(ob)
|
|
||||||
self.doc.removeObject(self.sel[0].Name)
|
|
||||||
|
|
||||||
elif (len(self.sel) == 1) and (self.sel[0].isDerivedFrom("Part::Feature")) and ("Base" in self.sel[0].PropertiesList):
|
|
||||||
# special case, we have one parametric object: we "de-parametrize" it
|
|
||||||
msg(translate("draft", "Found 1 parametric object: breaking its dependencies\n"))
|
|
||||||
newob = Draft.shapify(self.sel[0])
|
|
||||||
|
|
||||||
elif len(self.sel) == 2:
|
|
||||||
# we have only 2 objects: cut 2nd from 1st
|
|
||||||
msg(translate("draft", "Found 2 objects: subtracting them\n"))
|
|
||||||
newob = Draft.cut(self.sel[0],self.sel[1])
|
|
||||||
|
|
||||||
elif (len(faces) > 1):
|
|
||||||
|
|
||||||
if len(self.sel) == 1:
|
|
||||||
# one object with several faces: split it
|
|
||||||
for f in faces:
|
|
||||||
msg(translate("draft", "Found several faces: splitting them\n"))
|
|
||||||
newob = self.doc.addObject("Part::Feature","Face")
|
|
||||||
newob.Shape = f
|
|
||||||
Draft.formatObject(newob,self.sel[0])
|
|
||||||
self.doc.removeObject(ob.Name)
|
|
||||||
|
|
||||||
else:
|
|
||||||
# several objects: remove all the faces from the first one
|
|
||||||
msg(translate("draft", "Found several objects: subtracting them from the first one\n"))
|
|
||||||
u = faces.pop(0)
|
|
||||||
for f in faces:
|
|
||||||
u = u.cut(f)
|
|
||||||
newob = self.doc.addObject("Part::Feature","Subtraction")
|
|
||||||
newob.Shape = u
|
|
||||||
for ob in self.sel:
|
|
||||||
Draft.formatObject(newob,ob)
|
|
||||||
self.doc.removeObject(ob.Name)
|
|
||||||
|
|
||||||
elif (len(faces) > 0):
|
|
||||||
# only one face: we extract its wires
|
|
||||||
msg(translate("draft", "Found 1 face: extracting its wires\n"))
|
|
||||||
for w in faces[0].Wires:
|
|
||||||
newob = self.doc.addObject("Part::Feature","Wire")
|
|
||||||
newob.Shape = w
|
|
||||||
Draft.formatObject(newob,lastob)
|
|
||||||
for ob in self.sel:
|
|
||||||
self.doc.removeObject(ob.Name)
|
|
||||||
|
|
||||||
else:
|
|
||||||
# no faces: split wire into single edges
|
|
||||||
onlyedges = True
|
|
||||||
for ob in self.sel:
|
|
||||||
if ob.Shape.ShapeType != "Edge":
|
|
||||||
onlyedges = False
|
|
||||||
if onlyedges:
|
|
||||||
msg(translate("draft", "No more downgrade possible\n"))
|
|
||||||
self.doc.abortTransaction()
|
|
||||||
return
|
|
||||||
msg(translate("draft", "Found only wires: extracting their edges\n"))
|
|
||||||
for ob in self.sel:
|
|
||||||
for e in edges:
|
|
||||||
newob = self.doc.addObject("Part::Feature","Edge")
|
|
||||||
newob.Shape = e
|
|
||||||
Draft.formatObject(newob,ob)
|
|
||||||
self.doc.removeObject(ob.Name)
|
|
||||||
self.doc.commitTransaction()
|
|
||||||
Draft.select(newob)
|
|
||||||
Modifier.finish(self)
|
|
||||||
|
|
||||||
|
|
||||||
class Trimex(Modifier):
|
class Trimex(Modifier):
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
#include <Base/Stream.h>
|
#include <Base/Stream.h>
|
||||||
#include <Base/Exception.h>
|
#include <Base/Exception.h>
|
||||||
#include <Base/FileInfo.h>
|
#include <Base/FileInfo.h>
|
||||||
|
#include <Base/TimeInfo.h>
|
||||||
|
#include <Base/Console.h>
|
||||||
|
|
||||||
#include <Mod/Mesh/App/Core/MeshKernel.h>
|
#include <Mod/Mesh/App/Core/MeshKernel.h>
|
||||||
#include <Mod/Mesh/App/Core/Evaluation.h>
|
#include <Mod/Mesh/App/Core/Evaluation.h>
|
||||||
|
@ -374,6 +376,9 @@ void FemMesh::compute()
|
||||||
|
|
||||||
void FemMesh::readNastran(const std::string &Filename)
|
void FemMesh::readNastran(const std::string &Filename)
|
||||||
{
|
{
|
||||||
|
Base::TimeInfo Start;
|
||||||
|
Base::Console().Log("Start: FemMesh::readNastran() =================================\n");
|
||||||
|
|
||||||
std::ifstream inputfile;
|
std::ifstream inputfile;
|
||||||
inputfile.open(Filename.c_str());
|
inputfile.open(Filename.c_str());
|
||||||
inputfile.seekg(std::ifstream::beg);
|
inputfile.seekg(std::ifstream::beg);
|
||||||
|
@ -480,6 +485,8 @@ void FemMesh::readNastran(const std::string &Filename)
|
||||||
while (inputfile.good());
|
while (inputfile.good());
|
||||||
inputfile.close();
|
inputfile.close();
|
||||||
|
|
||||||
|
Base::Console().Log(" %f: File read, start building mesh\n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo()));
|
||||||
|
|
||||||
//Now fill the SMESH datastructure
|
//Now fill the SMESH datastructure
|
||||||
std::vector<Base::Vector3d>::const_iterator anodeiterator;
|
std::vector<Base::Vector3d>::const_iterator anodeiterator;
|
||||||
SMESHDS_Mesh* meshds = this->myMesh->GetMeshDS();
|
SMESHDS_Mesh* meshds = this->myMesh->GetMeshDS();
|
||||||
|
@ -524,6 +531,8 @@ void FemMesh::readNastran(const std::string &Filename)
|
||||||
element_id[i]
|
element_id[i]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Base::Console().Log(" %f: Done \n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
#include <Base/FileInfo.h>
|
#include <Base/FileInfo.h>
|
||||||
#include <Base/Stream.h>
|
#include <Base/Stream.h>
|
||||||
#include <Base/Console.h>
|
#include <Base/Console.h>
|
||||||
|
#include <Base/TimeInfo.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <SMESH_Mesh.hxx>
|
#include <SMESH_Mesh.hxx>
|
||||||
|
@ -359,6 +360,7 @@ void ViewProviderFEMMeshBuilder::buildNodes(const App::Property* prop, std::vect
|
||||||
|
|
||||||
void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, SoCoordinate3* coords, SoIndexedFaceSet* faces,bool ShowInner) const
|
void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, SoCoordinate3* coords, SoIndexedFaceSet* faces,bool ShowInner) const
|
||||||
{
|
{
|
||||||
|
|
||||||
const Fem::PropertyFemMesh* mesh = static_cast<const Fem::PropertyFemMesh*>(prop);
|
const Fem::PropertyFemMesh* mesh = static_cast<const Fem::PropertyFemMesh*>(prop);
|
||||||
|
|
||||||
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(mesh->getValue().getSMesh())->GetMeshDS();
|
SMESHDS_Mesh* data = const_cast<SMESH_Mesh*>(mesh->getValue().getSMesh())->GetMeshDS();
|
||||||
|
@ -367,6 +369,10 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, SoCoordin
|
||||||
int numNodes = data->NbNodes();
|
int numNodes = data->NbNodes();
|
||||||
int numEdges = data->NbEdges();
|
int numEdges = data->NbEdges();
|
||||||
|
|
||||||
|
if(numFaces+numNodes+numEdges == 0) return;
|
||||||
|
Base::TimeInfo Start;
|
||||||
|
Base::Console().Log("Start: ViewProviderFEMMeshBuilder::createMesh() =================================\n");
|
||||||
|
|
||||||
const SMDS_MeshInfo& info = data->GetMeshInfo();
|
const SMDS_MeshInfo& info = data->GetMeshInfo();
|
||||||
int numNode = info.NbNodes();
|
int numNode = info.NbNodes();
|
||||||
int numTria = info.NbTriangles();
|
int numTria = info.NbTriangles();
|
||||||
|
@ -380,8 +386,10 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, SoCoordin
|
||||||
int numHedr = info.NbPolyhedrons();
|
int numHedr = info.NbPolyhedrons();
|
||||||
|
|
||||||
|
|
||||||
std::vector<FemFace> facesHelper(numTria+numQuad+numPoly+numTetr*4+numHexa*6+numPyrd*5+numPris*6);
|
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<FemFace> facesHelper(numTria+numQuad+numPoly+numTetr*4+numHexa*6+numPyrd*5+numPris*6);
|
||||||
|
Base::Console().Log(" %f: Start build up %i face helper\n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo()),facesHelper.size());
|
||||||
SMDS_VolumeIteratorPtr aVolIter = data->volumesIterator();
|
SMDS_VolumeIteratorPtr aVolIter = data->volumesIterator();
|
||||||
for (int i=0;aVolIter->more();) {
|
for (int i=0;aVolIter->more();) {
|
||||||
const SMDS_MeshVolume* aVol = aVolIter->next();
|
const SMDS_MeshVolume* aVol = aVolIter->next();
|
||||||
|
@ -433,6 +441,8 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, SoCoordin
|
||||||
|
|
||||||
int FaceSize = facesHelper.size();
|
int FaceSize = facesHelper.size();
|
||||||
|
|
||||||
|
Base::Console().Log(" %f: Start eliminate internal faces\n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo()));
|
||||||
|
|
||||||
// search for double (inside) faces and hide them
|
// search for double (inside) faces and hide them
|
||||||
if(!ShowInner){
|
if(!ShowInner){
|
||||||
for(int l=0; l< FaceSize;l++){
|
for(int l=0; l< FaceSize;l++){
|
||||||
|
@ -445,6 +455,7 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, SoCoordin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Base::Console().Log(" %f: Start build up node map\n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo()));
|
||||||
|
|
||||||
// sort out double nodes and build up index map
|
// sort out double nodes and build up index map
|
||||||
std::map<const SMDS_MeshNode*, int> mapNodeIndex;
|
std::map<const SMDS_MeshNode*, int> mapNodeIndex;
|
||||||
|
@ -456,6 +467,7 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, SoCoordin
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Base::Console().Log(" %f: Start set point vector\n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo()));
|
||||||
|
|
||||||
// set the point coordinates
|
// set the point coordinates
|
||||||
coords->point.setNum(mapNodeIndex.size());
|
coords->point.setNum(mapNodeIndex.size());
|
||||||
|
@ -468,6 +480,7 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, SoCoordin
|
||||||
coords->point.finishEditing();
|
coords->point.finishEditing();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// count triangle size
|
// count triangle size
|
||||||
int triangleCount=0;
|
int triangleCount=0;
|
||||||
for(int l=0; l< FaceSize;l++)
|
for(int l=0; l< FaceSize;l++)
|
||||||
|
@ -479,6 +492,7 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, SoCoordin
|
||||||
default: assert(0);
|
default: assert(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Base::Console().Log(" %f: Start build up triangle vector\n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo()));
|
||||||
// set the triangle face indices
|
// set the triangle face indices
|
||||||
faces->coordIndex.setNum(4*triangleCount);
|
faces->coordIndex.setNum(4*triangleCount);
|
||||||
int index=0;
|
int index=0;
|
||||||
|
@ -666,6 +680,7 @@ void ViewProviderFEMMeshBuilder::createMesh(const App::Property* prop, SoCoordin
|
||||||
}
|
}
|
||||||
|
|
||||||
faces->coordIndex.finishEditing();
|
faces->coordIndex.finishEditing();
|
||||||
|
Base::Console().Log(" %f: Finish =========================================================\n",Base::TimeInfo::diffTimeF(Start,Base::TimeInfo()));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -416,7 +416,7 @@ float QuadraticFit::Fit()
|
||||||
if (CountPoints() > 0) {
|
if (CountPoints() > 0) {
|
||||||
std::vector< Wm4::Vector3<double> > cPts;
|
std::vector< Wm4::Vector3<double> > cPts;
|
||||||
GetMgcVectorArray( cPts );
|
GetMgcVectorArray( cPts );
|
||||||
fResult = Wm4::QuadraticFit3<double>( CountPoints(), &(cPts[0]), _fCoeff );
|
fResult = (float) Wm4::QuadraticFit3<double>( CountPoints(), &(cPts[0]), _fCoeff );
|
||||||
_fLastResult = fResult;
|
_fLastResult = fResult;
|
||||||
|
|
||||||
_bIsFitted = true;
|
_bIsFitted = true;
|
||||||
|
@ -520,7 +520,7 @@ float SurfaceFit::Fit()
|
||||||
float fResult = FLOAT_MAX;
|
float fResult = FLOAT_MAX;
|
||||||
|
|
||||||
if (CountPoints() > 0) {
|
if (CountPoints() > 0) {
|
||||||
fResult = PolynomFit();
|
fResult = (float) PolynomFit();
|
||||||
_fLastResult = fResult;
|
_fLastResult = fResult;
|
||||||
|
|
||||||
_bIsFitted = true;
|
_bIsFitted = true;
|
||||||
|
@ -684,7 +684,7 @@ double SurfaceFit::Value(double x, double y) const
|
||||||
float z = 0.0f;
|
float z = 0.0f;
|
||||||
if (_bIsFitted) {
|
if (_bIsFitted) {
|
||||||
FunctionContainer clFuncCont(_fCoeff);
|
FunctionContainer clFuncCont(_fCoeff);
|
||||||
z = clFuncCont.F(x, y, 0.0f);
|
z = (float) clFuncCont.F(x, y, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
return z;
|
return z;
|
||||||
|
|
|
@ -413,7 +413,7 @@ public:
|
||||||
Base::Vector3f GetGradient( double x, double y, double z ) const
|
Base::Vector3f GetGradient( double x, double y, double z ) const
|
||||||
{
|
{
|
||||||
Wm4::Vector3<double> grad = pImplSurf->GetGradient( Wm4::Vector3<double>(x, y, z) );
|
Wm4::Vector3<double> grad = pImplSurf->GetGradient( Wm4::Vector3<double>(x, y, z) );
|
||||||
return Base::Vector3f( grad.X(), grad.Y(), grad.Z() );
|
return Base::Vector3f( (float)grad.X(), (float)grad.Y(), (float)grad.Z() );
|
||||||
}
|
}
|
||||||
|
|
||||||
Base::Matrix4D GetHessian( double x, double y, double z ) const
|
Base::Matrix4D GetHessian( double x, double y, double z ) const
|
||||||
|
|
|
@ -488,7 +488,7 @@ void CmdPartDesignFillet::activated(int iMsg)
|
||||||
|
|
||||||
std::vector<std::string> SubNames = std::vector<std::string>(selection[0].getSubNames());
|
std::vector<std::string> SubNames = std::vector<std::string>(selection[0].getSubNames());
|
||||||
|
|
||||||
int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
while(i < SubNames.size())
|
while(i < SubNames.size())
|
||||||
{
|
{
|
||||||
|
@ -635,7 +635,7 @@ void CmdPartDesignChamfer::activated(int iMsg)
|
||||||
|
|
||||||
std::vector<std::string> SubNames = std::vector<std::string>(selection[0].getSubNames());
|
std::vector<std::string> SubNames = std::vector<std::string>(selection[0].getSubNames());
|
||||||
|
|
||||||
int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
while(i < SubNames.size())
|
while(i < SubNames.size())
|
||||||
{
|
{
|
||||||
|
@ -775,7 +775,7 @@ void CmdPartDesignDraft::activated(int iMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> SubNames = std::vector<std::string>(selection[0].getSubNames());
|
std::vector<std::string> SubNames = std::vector<std::string>(selection[0].getSubNames());
|
||||||
int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
while(i < SubNames.size())
|
while(i < SubNames.size())
|
||||||
{
|
{
|
||||||
|
|
|
@ -370,7 +370,7 @@ void ViewProviderTransformed::recomputeFeature(void)
|
||||||
|
|
||||||
std::list<gp_Trsf> rejected_trsf = pcTransformed->getRejectedTransformations();
|
std::list<gp_Trsf> rejected_trsf = pcTransformed->getRejectedTransformations();
|
||||||
std::list<gp_Trsf>::const_iterator trsf = rejected_trsf.begin();
|
std::list<gp_Trsf>::const_iterator trsf = rejected_trsf.begin();
|
||||||
for (int i=0; i < rejected; i++,trsf++) {
|
for (unsigned int i=0; i < rejected; i++,trsf++) {
|
||||||
Base::Matrix4D mat;
|
Base::Matrix4D mat;
|
||||||
Part::TopoShape::convertToMatrix(*trsf,mat);
|
Part::TopoShape::convertToMatrix(*trsf,mat);
|
||||||
mats[i] = convert(mat);
|
mats[i] = convert(mat);
|
||||||
|
|
|
@ -692,9 +692,9 @@ public:
|
||||||
if (boost::math::isnan(arcAngle) || boost::math::isinf(arcAngle))
|
if (boost::math::isnan(arcAngle) || boost::math::isinf(arcAngle))
|
||||||
arcAngle = 0.f;
|
arcAngle = 0.f;
|
||||||
if (arcRadius >= 0 && arcAngle > 0)
|
if (arcRadius >= 0 && arcAngle > 0)
|
||||||
arcAngle -= 2*M_PI;
|
arcAngle -= (float) 2*M_PI;
|
||||||
if (arcRadius < 0 && arcAngle < 0)
|
if (arcRadius < 0 && arcAngle < 0)
|
||||||
arcAngle += 2*M_PI;
|
arcAngle += (float) 2*M_PI;
|
||||||
endAngle = startAngle + arcAngle;
|
endAngle = startAngle + arcAngle;
|
||||||
|
|
||||||
for (int i=1; i <= 29; i++) {
|
for (int i=1; i <= 29; i++) {
|
||||||
|
@ -731,7 +731,7 @@ public:
|
||||||
// here we check if there is a preselected point and
|
// here we check if there is a preselected point and
|
||||||
// we set up a transition from the neighbouring segment.
|
// we set up a transition from the neighbouring segment.
|
||||||
// (peviousCurve, previousPosId, dirVec, TransitionMode)
|
// (peviousCurve, previousPosId, dirVec, TransitionMode)
|
||||||
for (int i=0; i < sugConstr1.size(); i++)
|
for (unsigned int i=0; i < sugConstr1.size(); i++)
|
||||||
if (sugConstr1[i].Type == Sketcher::Coincident) {
|
if (sugConstr1[i].Type == Sketcher::Coincident) {
|
||||||
const Part::Geometry *geom = sketchgui->getSketchObject()->getGeometry(sugConstr1[i].GeoId);
|
const Part::Geometry *geom = sketchgui->getSketchObject()->getGeometry(sugConstr1[i].GeoId);
|
||||||
if ((geom->getTypeId() == Part::GeomLineSegment::getClassTypeId() ||
|
if ((geom->getTypeId() == Part::GeomLineSegment::getClassTypeId() ||
|
||||||
|
@ -844,7 +844,7 @@ public:
|
||||||
if (sugConstr2.size() > 0) {
|
if (sugConstr2.size() > 0) {
|
||||||
// exclude any coincidence constraints
|
// exclude any coincidence constraints
|
||||||
std::vector<AutoConstraint> sugConstr;
|
std::vector<AutoConstraint> sugConstr;
|
||||||
for (int i=0; i < sugConstr2.size(); i++) {
|
for (unsigned int i=0; i < sugConstr2.size(); i++) {
|
||||||
if (sugConstr2[i].Type != Sketcher::Coincident)
|
if (sugConstr2[i].Type != Sketcher::Coincident)
|
||||||
sugConstr.push_back(sugConstr2[i]);
|
sugConstr.push_back(sugConstr2[i]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user