V2: another take at internal renames because of file renames
hopefully, the last one
This commit is contained in:
parent
921854cfb0
commit
9f56a6b9b2
|
@ -215,9 +215,9 @@ class _ViewProviderCompoundFilter:
|
|||
def CreateCompoundFilter(name):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
FreeCAD.ActiveDocument.openTransaction("Create CompoundFilter")
|
||||
FreeCADGui.addModule("CompoundFilter")
|
||||
FreeCADGui.addModule("CompoundFilter2")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = CompoundFilter.makeCompoundFilter(name = '"+name+"')")
|
||||
FreeCADGui.doCommand("f = CompoundFilter2.makeCompoundFilter(name = '"+name+"')")
|
||||
FreeCADGui.doCommand("f.Base = App.ActiveDocument."+sel[0].Name)
|
||||
FreeCADGui.doCommand("f.Base.ViewObject.hide()")
|
||||
if len(sel) == 2:
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
from latticeCommon import *
|
||||
from lattice2Common import *
|
||||
|
||||
|
||||
__title__="FuseCompound module for FreeCAD"
|
||||
|
@ -69,7 +69,7 @@ class _ViewProviderFuseCompound:
|
|||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return getIconPath("Lattice_FuseCompound.svg")
|
||||
return getIconPath("Lattice2_FuseCompound.svg")
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
|
@ -104,9 +104,9 @@ class _ViewProviderFuseCompound:
|
|||
|
||||
def CreateFuseCompound(name):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create FuseCompound")
|
||||
FreeCADGui.addModule("FuseCompound")
|
||||
FreeCADGui.addModule("FuseCompound2")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = FuseCompound.makeFuseCompound(name = '"+name+"')")
|
||||
FreeCADGui.doCommand("f = FuseCompound2.makeFuseCompound(name = '"+name+"')")
|
||||
FreeCADGui.doCommand("f.Base = FreeCADGui.Selection.getSelection()[0]")
|
||||
FreeCADGui.doCommand("lattice2Executer.executeFeature(f)")
|
||||
FreeCADGui.doCommand("f.Base.ViewObject.hide()")
|
||||
|
@ -116,10 +116,10 @@ def CreateFuseCompound(name):
|
|||
class _CommandFuseCompound:
|
||||
"Command to create FuseCompound feature"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : getIconPath("Lattice_FuseCompound.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice_FuseCompound","Fuse compound"),
|
||||
return {'Pixmap' : getIconPath("Lattice2_FuseCompound.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice2_FuseCompound","Fuse compound"),
|
||||
'Accel': "",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice_FuseCompound","Fuse objects contained in a compound")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice2_FuseCompound","Fuse objects contained in a compound")}
|
||||
|
||||
def Activated(self):
|
||||
if len(FreeCADGui.Selection.getSelection()) == 1 :
|
||||
|
@ -127,8 +127,8 @@ class _CommandFuseCompound:
|
|||
else:
|
||||
mb = QtGui.QMessageBox()
|
||||
mb.setIcon(mb.Icon.Warning)
|
||||
mb.setText(translate("Lattice_FuseCompound", "Select a shape that is a compound whose children intersect, first!", None))
|
||||
mb.setWindowTitle(translate("Lattice_FuseCompound","Bad selection", None))
|
||||
mb.setText(translate("Lattice2_FuseCompound", "Select a shape that is a compound whose children intersect, first!", None))
|
||||
mb.setWindowTitle(translate("Lattice2_FuseCompound","Bad selection", None))
|
||||
mb.exec_()
|
||||
|
||||
def IsActive(self):
|
||||
|
@ -137,8 +137,8 @@ class _CommandFuseCompound:
|
|||
else:
|
||||
return False
|
||||
|
||||
FreeCADGui.addCommand('Lattice_FuseCompound', _CommandFuseCompound())
|
||||
FreeCADGui.addCommand('Lattice2_FuseCompound', _CommandFuseCompound())
|
||||
|
||||
exportedCommands = ['Lattice_FuseCompound']
|
||||
exportedCommands = ['Lattice2_FuseCompound']
|
||||
|
||||
# -------------------------- /Gui command --------------------------------------------------
|
||||
|
|
|
@ -125,9 +125,9 @@ class ViewProviderLatticeApply(lattice2BaseFeature.ViewProviderLatticeFeature):
|
|||
def CreateLatticeApply(name):
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
FreeCAD.ActiveDocument.openTransaction("Create LatticeApply")
|
||||
FreeCADGui.addModule("latticeApply")
|
||||
FreeCADGui.addModule("lattice2Apply")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = latticeApply.makeLatticeApply(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f = lattice2Apply.makeLatticeApply(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f.Base = App.ActiveDocument."+sel[0].ObjectName)
|
||||
FreeCADGui.doCommand("f.Tool = App.ActiveDocument."+sel[1].ObjectName)
|
||||
FreeCADGui.doCommand("for child in f.ViewObject.Proxy.claimChildren():\n"+
|
||||
|
|
|
@ -195,14 +195,14 @@ def CreateLatticeArrayFilter(name,mode):
|
|||
iStc = i-1 #this may give negative index, but python accepts negative indexes
|
||||
break
|
||||
FreeCAD.ActiveDocument.openTransaction("Create ArrayFilter")
|
||||
FreeCADGui.addModule("latticeArrayFilter")
|
||||
FreeCADGui.addModule("lattice2ArrayFilter")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("sel = Gui.Selection.getSelectionEx()")
|
||||
FreeCADGui.doCommand("f = latticeArrayFilter.makeArrayFilter(name = '"+name+"')")
|
||||
FreeCADGui.doCommand("f = lattice2ArrayFilter.makeArrayFilter(name = '"+name+"')")
|
||||
FreeCADGui.doCommand("f.Base = App.ActiveDocument."+sel[iLtc].ObjectName)
|
||||
FreeCADGui.doCommand("f.FilterType = '"+mode+"'")
|
||||
if mode == 'specific items':
|
||||
FreeCADGui.doCommand("f.items = latticeArrayFilter.makeItemListFromSelection(sel["+str(iLtc)+"])")
|
||||
FreeCADGui.doCommand("f.items = lattice2ArrayFilter.makeItemListFromSelection(sel["+str(iLtc)+"])")
|
||||
if len(sel[0].SubElementNames) == 1:
|
||||
FreeCADGui.doCommand("f.SingleByDesign = True")
|
||||
else:
|
||||
|
|
|
@ -30,19 +30,19 @@ import math
|
|||
import FreeCAD as App
|
||||
import Part
|
||||
|
||||
from latticeCommon import *
|
||||
import latticeBaseFeature
|
||||
import latticeCompoundExplorer as LCE
|
||||
import latticeGeomUtils as Utils
|
||||
import latticeExecuter
|
||||
from lattice2Common import *
|
||||
import lattice2BaseFeature
|
||||
import lattice2CompoundExplorer as LCE
|
||||
import lattice2GeomUtils as Utils
|
||||
import lattice2Executer
|
||||
|
||||
# -------------------------- document object --------------------------------------------------
|
||||
|
||||
def makeLatticeArrayFromShape(name):
|
||||
'''makeLatticeArrayFromShape(name): makes a LatticeArrayFromShape object.'''
|
||||
return latticeBaseFeature.makeLatticeFeature(name, LatticeArrayFromShape, ViewProviderArrayFromShape)
|
||||
return lattice2BaseFeature.makeLatticeFeature(name, LatticeArrayFromShape, ViewProviderArrayFromShape)
|
||||
|
||||
class LatticeArrayFromShape(latticeBaseFeature.LatticeFeature):
|
||||
class LatticeArrayFromShape(lattice2BaseFeature.LatticeFeature):
|
||||
"The Lattice ArrayFromShape object"
|
||||
|
||||
def derivedInit(self,obj):
|
||||
|
@ -70,14 +70,14 @@ class LatticeArrayFromShape(latticeBaseFeature.LatticeFeature):
|
|||
|
||||
def derivedExecute(self,obj):
|
||||
# cache stuff
|
||||
if latticeBaseFeature.isObjectLattice(obj.Base):
|
||||
latticeExecuter.warning(obj,"Base is a lattice object. Since a non-lattice object is required by arrayFromShape tool, the results may be unexpected.")
|
||||
if lattice2BaseFeature.isObjectLattice(obj.Base):
|
||||
lattice2Executer.warning(obj,"Base is a lattice object. Since a non-lattice object is required by arrayFromShape tool, the results may be unexpected.")
|
||||
|
||||
base = obj.Base.Shape
|
||||
if obj.WholeObject:
|
||||
baseChildren = [base]
|
||||
#if obj.FlattenBaseHierarchy:
|
||||
# latticeExecuter.warning(obj, "FlattenBaseHierarchy is ignored because WholeObject is set to True")
|
||||
# lattice2Executer.warning(obj, "FlattenBaseHierarchy is ignored because WholeObject is set to True")
|
||||
else:
|
||||
if base.ShapeType != 'Compound':
|
||||
base = Part.makeCompound([base])
|
||||
|
@ -139,14 +139,14 @@ class LatticeArrayFromShape(latticeBaseFeature.LatticeFeature):
|
|||
totalW += w
|
||||
pos = pos * (1.0/totalW)
|
||||
elif posIsCenterBB:
|
||||
import latticeBoundBox
|
||||
bb = latticeBoundBox.getPrecisionBoundBox(child)
|
||||
import lattice2BoundBox
|
||||
bb = lattice2BoundBox.getPrecisionBoundBox(child)
|
||||
pos = bb.Center
|
||||
elif posIsVertex:
|
||||
v = child.Vertexes[obj.TranslateElementIndex - 1]
|
||||
pos = v.Point
|
||||
else:
|
||||
raise ValueError("latticePolarArrayFromShape: translation mode not implemented: "+obj.TranslateMode)
|
||||
raise ValueError("lattice2PolarArrayFromShape: translation mode not implemented: "+obj.TranslateMode)
|
||||
|
||||
if oriIsNone:
|
||||
pass
|
||||
|
@ -157,7 +157,7 @@ class LatticeArrayFromShape(latticeBaseFeature.LatticeFeature):
|
|||
elif oriIsInertial:
|
||||
leaves = LCE.AllLeaves(child)
|
||||
if len(leaves)>1:
|
||||
raise ValueError("latticePolarArrayFromShape: calculation of principal axes of compounds is not supported yet")
|
||||
raise ValueError("lattice2PolarArrayFromShape: calculation of principal axes of compounds is not supported yet")
|
||||
props = leaves[0].PrincipalProperties
|
||||
XAx = props['FirstAxisOfInertia']
|
||||
ZAx = props['ThirdAxisOfInertia']
|
||||
|
@ -172,17 +172,17 @@ class LatticeArrayFromShape(latticeBaseFeature.LatticeFeature):
|
|||
face = child.Faces[obj.OrientElementIndex - 1]
|
||||
ZAx = face.Surface.Axis
|
||||
else:
|
||||
raise ValueError("latticePolarArrayFromShape: rientation mode not implemented: "+obj.OrientMode)
|
||||
raise ValueError("lattice2PolarArrayFromShape: rientation mode not implemented: "+obj.OrientMode)
|
||||
|
||||
plm = App.Placement(pos, ori)
|
||||
outputPlms.append(plm)
|
||||
return outputPlms
|
||||
|
||||
|
||||
class ViewProviderArrayFromShape(latticeBaseFeature.ViewProviderLatticeFeature):
|
||||
class ViewProviderArrayFromShape(lattice2BaseFeature.ViewProviderLatticeFeature):
|
||||
|
||||
def getIcon(self):
|
||||
return getIconPath('Lattice_ArrayFromShape.svg') if self.Object.WholeObject == False else getIconPath('Lattice_PlacementFromShape.svg')
|
||||
return getIconPath('Lattice2_ArrayFromShape.svg') if self.Object.WholeObject == False else getIconPath('Lattice2_PlacementFromShape.svg')
|
||||
|
||||
# -------------------------- /document object --------------------------------------------------
|
||||
|
||||
|
@ -191,9 +191,9 @@ class ViewProviderArrayFromShape(latticeBaseFeature.ViewProviderLatticeFeature):
|
|||
def CreateLatticeArrayFromShape(name, nonArray = False):
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
FreeCAD.ActiveDocument.openTransaction("Create LatticeArrayFromShape")
|
||||
FreeCADGui.addModule("latticeArrayFromShape")
|
||||
FreeCADGui.addModule("latticeExecuter")
|
||||
FreeCADGui.doCommand("f = latticeArrayFromShape.makeLatticeArrayFromShape(name='"+name+"')")
|
||||
FreeCADGui.addModule("lattice2ArrayFromShape")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = lattice2ArrayFromShape.makeLatticeArrayFromShape(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f.Base = App.ActiveDocument."+sel[0].ObjectName)
|
||||
if nonArray:
|
||||
FreeCADGui.doCommand("f.WholeObject = True")
|
||||
|
@ -204,7 +204,7 @@ def CreateLatticeArrayFromShape(name, nonArray = False):
|
|||
|
||||
FreeCADGui.doCommand("for child in f.ViewObject.Proxy.claimChildren():\n"+
|
||||
" child.ViewObject.hide()")
|
||||
FreeCADGui.doCommand("latticeExecuter.executeFeature(f)")
|
||||
FreeCADGui.doCommand("lattice2Executer.executeFeature(f)")
|
||||
FreeCADGui.doCommand("f = None")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
|
@ -212,10 +212,10 @@ def CreateLatticeArrayFromShape(name, nonArray = False):
|
|||
class _CommandLatticeArrayFromShape:
|
||||
"Command to create LatticeArrayFromShape feature"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : getIconPath("Lattice_ArrayFromShape.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice_ArrayFromShape","Make lattice from compound"),
|
||||
return {'Pixmap' : getIconPath("Lattice2_ArrayFromShape.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice2_ArrayFromShape","Make lattice from compound"),
|
||||
'Accel': "",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice_ArrayFromShape","Lattice ArrayFromShape: make placements array from shapes in a compound.")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice2_ArrayFromShape","Lattice ArrayFromShape: make placements array from shapes in a compound.")}
|
||||
|
||||
def Activated(self):
|
||||
if len(FreeCADGui.Selection.getSelection()) == 1 :
|
||||
|
@ -223,8 +223,8 @@ class _CommandLatticeArrayFromShape:
|
|||
else:
|
||||
mb = QtGui.QMessageBox()
|
||||
mb.setIcon(mb.Icon.Warning)
|
||||
mb.setText(translate("Lattice_ArrayFromShape", "Please select one object, first.", None))
|
||||
mb.setWindowTitle(translate("Lattice_ArrayFromShape","Bad selection", None))
|
||||
mb.setText(translate("Lattice2_ArrayFromShape", "Please select one object, first.", None))
|
||||
mb.setWindowTitle(translate("Lattice2_ArrayFromShape","Bad selection", None))
|
||||
mb.exec_()
|
||||
|
||||
def IsActive(self):
|
||||
|
@ -233,15 +233,15 @@ class _CommandLatticeArrayFromShape:
|
|||
else:
|
||||
return False
|
||||
|
||||
FreeCADGui.addCommand('Lattice_ArrayFromShape', _CommandLatticeArrayFromShape())
|
||||
FreeCADGui.addCommand('Lattice2_ArrayFromShape', _CommandLatticeArrayFromShape())
|
||||
|
||||
class _CommandLatticePlacementFromShape:
|
||||
"Command to create LatticeArrayFromShape feature linking to placement of one shape"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : getIconPath("Lattice_PlacementFromShape.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice_ArrayFromShape","Single Placement: linked to shape"),
|
||||
return {'Pixmap' : getIconPath("Lattice2_PlacementFromShape.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice2_ArrayFromShape","Single Placement: linked to shape"),
|
||||
'Accel': "",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice_ArrayFromShape","Lattice PlacementFromShape: make Placement linked to placement of selected object.")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice2_ArrayFromShape","Lattice PlacementFromShape: make Placement linked to placement of selected object.")}
|
||||
|
||||
def Activated(self):
|
||||
if len(FreeCADGui.Selection.getSelection()) == 1 :
|
||||
|
@ -249,8 +249,8 @@ class _CommandLatticePlacementFromShape:
|
|||
else:
|
||||
mb = QtGui.QMessageBox()
|
||||
mb.setIcon(mb.Icon.Warning)
|
||||
mb.setText(translate("Lattice_ArrayFromShape", "Please select one object, first.", None))
|
||||
mb.setWindowTitle(translate("Lattice_ArrayFromShape","Bad selection", None))
|
||||
mb.setText(translate("Lattice2_ArrayFromShape", "Please select one object, first.", None))
|
||||
mb.setWindowTitle(translate("Lattice2_ArrayFromShape","Bad selection", None))
|
||||
mb.exec_()
|
||||
|
||||
def IsActive(self):
|
||||
|
@ -259,9 +259,9 @@ class _CommandLatticePlacementFromShape:
|
|||
else:
|
||||
return False
|
||||
|
||||
FreeCADGui.addCommand('Lattice_PlacementFromShape', _CommandLatticePlacementFromShape())
|
||||
FreeCADGui.addCommand('Lattice2_PlacementFromShape', _CommandLatticePlacementFromShape())
|
||||
|
||||
exportedCommands = ['Lattice_ArrayFromShape'] #Lattice_PlacementFromShape will be included in latticePlacement set of commands. I know, it's ugly....
|
||||
exportedCommands = ['Lattice2_ArrayFromShape'] #Lattice2_PlacementFromShape will be included in lattice2Placement set of commands. I know, it's ugly....
|
||||
|
||||
# -------------------------- /Gui command --------------------------------------------------
|
||||
|
||||
|
|
|
@ -179,9 +179,9 @@ class _ViewProviderBoundBox:
|
|||
|
||||
def CreateBoundBox(name):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create BoundBox")
|
||||
FreeCADGui.addModule("latticeBoundBox")
|
||||
FreeCADGui.addModule("lattice2BoundBox")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = latticeBoundBox.makeBoundBox(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f = lattice2BoundBox.makeBoundBox(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f.Base = FreeCADGui.Selection.getSelection()[0]")
|
||||
FreeCADGui.doCommand("lattice2Executer.executeFeature(f)")
|
||||
FreeCADGui.doCommand("f = None")
|
||||
|
|
|
@ -180,9 +180,9 @@ class ViewProviderCompose(lattice2BaseFeature.ViewProviderLatticeFeature):
|
|||
def CreateCompose(name):
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Compose")
|
||||
FreeCADGui.addModule("latticeCompose")
|
||||
FreeCADGui.addModule("lattice2Compose")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = latticeCompose.makeCompose(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f = lattice2Compose.makeCompose(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f.Base = App.ActiveDocument."+sel[0].ObjectName)
|
||||
FreeCADGui.doCommand("f.Tool = App.ActiveDocument."+sel[1].ObjectName)
|
||||
FreeCADGui.doCommand("for child in f.ViewObject.Proxy.claimChildren():\n"+
|
||||
|
|
|
@ -27,7 +27,7 @@ class CompoundExplorer:
|
|||
"""
|
||||
CompoundExplorer: Iterator class to traverse compound hierarchy.
|
||||
Usage:
|
||||
for (child, msg, it) in latticeCompoundExplorer.CompoundExplorer(App.ActiveDocument.Compound.Shape):
|
||||
for (child, msg, it) in lattice2CompoundExplorer.CompoundExplorer(App.ActiveDocument.Compound.Shape):
|
||||
#child is a shape.
|
||||
#msg is int equal to one of three constants:
|
||||
# CompoundExplorer.MSG_LEAF - child is a leaf (non-compound)
|
||||
|
|
|
@ -149,9 +149,9 @@ class _ViewProviderLatticeDowngrade:
|
|||
|
||||
def CreateLatticeDowngrade(name, mode = "Wires"):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create latticeDowngrade")
|
||||
FreeCADGui.addModule("latticeDowngrade")
|
||||
FreeCADGui.addModule("lattice2Downgrade")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = latticeDowngrade.makeLatticeDowngrade(name = '"+name+"')")
|
||||
FreeCADGui.doCommand("f = lattice2Downgrade.makeLatticeDowngrade(name = '"+name+"')")
|
||||
FreeCADGui.doCommand("f.Base = FreeCADGui.Selection.getSelection()[0]")
|
||||
FreeCADGui.doCommand("f.Mode = '"+mode+"'")
|
||||
FreeCADGui.doCommand("f.Label = f.Mode + ' of ' + f.Base.Label")
|
||||
|
|
|
@ -30,19 +30,19 @@ import math
|
|||
import FreeCAD as App
|
||||
import Part
|
||||
|
||||
from latticeCommon import *
|
||||
import latticeBaseFeature
|
||||
import latticeCompoundExplorer as LCE
|
||||
import latticeGeomUtils as Utils
|
||||
import latticeExecuter
|
||||
from lattice2Common import *
|
||||
import lattice2BaseFeature
|
||||
import lattice2CompoundExplorer as LCE
|
||||
import lattice2GeomUtils as Utils
|
||||
import lattice2Executer
|
||||
|
||||
# -------------------------- document object --------------------------------------------------
|
||||
|
||||
def makeLatticeInvert(name):
|
||||
'''makeLatticeInvert(name): makes a LatticeInvert object.'''
|
||||
return latticeBaseFeature.makeLatticeFeature(name, LatticeInvert, ViewProviderInvert)
|
||||
return lattice2BaseFeature.makeLatticeFeature(name, LatticeInvert, ViewProviderInvert)
|
||||
|
||||
class LatticeInvert(latticeBaseFeature.LatticeFeature):
|
||||
class LatticeInvert(lattice2BaseFeature.LatticeFeature):
|
||||
"The Lattice Invert object"
|
||||
|
||||
def derivedInit(self,obj):
|
||||
|
@ -61,8 +61,8 @@ class LatticeInvert(latticeBaseFeature.LatticeFeature):
|
|||
def derivedExecute(self,obj):
|
||||
# cache stuff
|
||||
base = obj.Base.Shape
|
||||
if not latticeBaseFeature.isObjectLattice(obj.Base):
|
||||
latticeExecuter.warning(obj, "Base is not a lattice, but lattice is expected. Results may be unexpected.\n")
|
||||
if not lattice2BaseFeature.isObjectLattice(obj.Base):
|
||||
lattice2Executer.warning(obj, "Base is not a lattice, but lattice is expected. Results may be unexpected.\n")
|
||||
baseChildren = LCE.AllLeaves(base)
|
||||
|
||||
#cache mode comparisons, for speed
|
||||
|
@ -101,10 +101,10 @@ class LatticeInvert(latticeBaseFeature.LatticeFeature):
|
|||
return outputPlms
|
||||
|
||||
|
||||
class ViewProviderInvert(latticeBaseFeature.ViewProviderLatticeFeature):
|
||||
class ViewProviderInvert(lattice2BaseFeature.ViewProviderLatticeFeature):
|
||||
|
||||
def getIcon(self):
|
||||
return getIconPath('Lattice_Invert.svg')
|
||||
return getIconPath('Lattice2_Invert.svg')
|
||||
|
||||
def claimChildren(self):
|
||||
return [self.Object.Base]
|
||||
|
@ -117,13 +117,13 @@ class ViewProviderInvert(latticeBaseFeature.ViewProviderLatticeFeature):
|
|||
def CreateLatticeInvert(name):
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
FreeCAD.ActiveDocument.openTransaction("Create LatticeInvert")
|
||||
FreeCADGui.addModule("latticeInvert")
|
||||
FreeCADGui.addModule("latticeExecuter")
|
||||
FreeCADGui.doCommand("f = latticeInvert.makeLatticeInvert(name='"+name+"')")
|
||||
FreeCADGui.addModule("lattice2Invert")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = lattice2Invert.makeLatticeInvert(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f.Base = App.ActiveDocument."+sel[0].ObjectName)
|
||||
FreeCADGui.doCommand("for child in f.ViewObject.Proxy.claimChildren():\n"+
|
||||
" child.ViewObject.hide()")
|
||||
FreeCADGui.doCommand("latticeExecuter.executeFeature(f)")
|
||||
FreeCADGui.doCommand("lattice2Executer.executeFeature(f)")
|
||||
FreeCADGui.doCommand("f = None")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
|
@ -131,10 +131,10 @@ def CreateLatticeInvert(name):
|
|||
class _CommandLatticeInvert:
|
||||
"Command to create LatticeInvert feature"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : getIconPath("Lattice_Invert.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice_Invert","Invert lattice"),
|
||||
return {'Pixmap' : getIconPath("Lattice2_Invert.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice2_Invert","Invert lattice"),
|
||||
'Accel': "",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice_Invert","Lattice Invert: invert all placements in a lattice object.")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice2_Invert","Lattice Invert: invert all placements in a lattice object.")}
|
||||
|
||||
def Activated(self):
|
||||
if len(FreeCADGui.Selection.getSelection()) == 1 :
|
||||
|
@ -142,8 +142,8 @@ class _CommandLatticeInvert:
|
|||
else:
|
||||
mb = QtGui.QMessageBox()
|
||||
mb.setIcon(mb.Icon.Warning)
|
||||
mb.setText(translate("Lattice_Invert", "Please select one object, first. The object must be a lattice object (array of placements).", None))
|
||||
mb.setWindowTitle(translate("Lattice_Invert","Bad selection", None))
|
||||
mb.setText(translate("Lattice2_Invert", "Please select one object, first. The object must be a lattice object (array of placements).", None))
|
||||
mb.setWindowTitle(translate("Lattice2_Invert","Bad selection", None))
|
||||
mb.exec_()
|
||||
|
||||
def IsActive(self):
|
||||
|
@ -152,9 +152,9 @@ class _CommandLatticeInvert:
|
|||
else:
|
||||
return False
|
||||
|
||||
FreeCADGui.addCommand('Lattice_Invert', _CommandLatticeInvert())
|
||||
FreeCADGui.addCommand('Lattice2_Invert', _CommandLatticeInvert())
|
||||
|
||||
exportedCommands = ['Lattice_Invert']
|
||||
exportedCommands = ['Lattice2_Invert']
|
||||
|
||||
# -------------------------- /Gui command --------------------------------------------------
|
||||
|
||||
|
|
|
@ -102,9 +102,9 @@ class ViewProviderJoinArrays(lattice2BaseFeature.ViewProviderLatticeFeature):
|
|||
def CreateJoinArrays(name):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
FreeCAD.ActiveDocument.openTransaction("Create JoinArrays")
|
||||
FreeCADGui.addModule("latticeJoinArrays")
|
||||
FreeCADGui.addModule("lattice2JoinArrays")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = latticeJoinArrays.makeJoinArrays(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f = lattice2JoinArrays.makeJoinArrays(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f.Links = []")
|
||||
for s in sel:
|
||||
FreeCADGui.doCommand("f.Links = f.Links + [App.ActiveDocument."+s.Name+"]")
|
||||
|
|
|
@ -228,9 +228,9 @@ class ViewProviderLinearArray(lattice2BaseFeature.ViewProviderLatticeFeature):
|
|||
def CreateLinearArray(name):
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
FreeCAD.ActiveDocument.openTransaction("Create LinearArray")
|
||||
FreeCADGui.addModule("latticeLinearArray")
|
||||
FreeCADGui.addModule("lattice2LinearArray")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = latticeLinearArray.makeLinearArray(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f = lattice2LinearArray.makeLinearArray(name='"+name+"')")
|
||||
if len(sel) == 1:
|
||||
FreeCADGui.doCommand("f.Link = App.ActiveDocument."+sel[0].ObjectName)
|
||||
if sel[0].HasSubObjects:
|
||||
|
|
|
@ -77,7 +77,7 @@ class LatticePlacement(lattice2BaseFeature.LatticeFeature):
|
|||
elif obj.PlacementChoice == 'YZ plane':
|
||||
rot.Q = (0.5, 0.5, 0.5, 0.5) #will get normalized by FC automatically
|
||||
else:
|
||||
raise ValueError("latticePlacement: unsupported placement: "+obj.PlacementChoice)
|
||||
raise ValueError("lattice2Placement: unsupported placement: "+obj.PlacementChoice)
|
||||
obj.Placement = App.Placement(rot.multVec(App.Vector(0,0,obj.Offset)), rot)
|
||||
if obj.FlipZ:
|
||||
obj.Placement = obj.Placement.multiply(App.Placement(App.Vector(),App.Rotation(App.Vector(1,0,0),180)))
|
||||
|
@ -102,9 +102,9 @@ class ViewProviderLatticePlacement(lattice2BaseFeature.ViewProviderLatticeFeatur
|
|||
def CreateLatticePlacement(name,mode = 'Custom'):
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
FreeCAD.ActiveDocument.openTransaction("Create Lattice Placement")
|
||||
FreeCADGui.addModule("latticePlacement")
|
||||
FreeCADGui.addModule("lattice2Placement")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = latticePlacement.makeLatticePlacement(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f = lattice2Placement.makeLatticePlacement(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f.PlacementChoice = '"+mode+"'")
|
||||
FreeCADGui.doCommand("lattice2Executer.executeFeature(f)")
|
||||
FreeCADGui.doCommand("f = None")
|
||||
|
|
|
@ -221,9 +221,9 @@ class ViewProviderPolarArray(lattice2BaseFeature.ViewProviderLatticeFeature):
|
|||
def CreatePolarArray(name):
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
FreeCAD.ActiveDocument.openTransaction("Create PolarArray")
|
||||
FreeCADGui.addModule("latticePolarArray")
|
||||
FreeCADGui.addModule("lattice2PolarArray")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = latticePolarArray.makePolarArray(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f = lattice2PolarArray.makePolarArray(name='"+name+"')")
|
||||
if len(sel) == 1:
|
||||
FreeCADGui.doCommand("f.AxisLink = App.ActiveDocument."+sel[0].ObjectName)
|
||||
if sel[0].HasSubObjects:
|
||||
|
|
|
@ -24,11 +24,11 @@
|
|||
import FreeCAD as App
|
||||
import Part
|
||||
|
||||
from latticeCommon import *
|
||||
import latticeBaseFeature
|
||||
import latticeCompoundExplorer as LCE
|
||||
import latticeExecuter
|
||||
import latticeGeomUtils as Utils
|
||||
from lattice2Common import *
|
||||
import lattice2BaseFeature
|
||||
import lattice2CompoundExplorer as LCE
|
||||
import lattice2Executer
|
||||
import lattice2GeomUtils as Utils
|
||||
|
||||
__title__="Lattice ProjectArray module for FreeCAD"
|
||||
__author__ = "DeepSOIC"
|
||||
|
@ -39,9 +39,9 @@ __url__ = ""
|
|||
|
||||
def makeProjectArray(name):
|
||||
'''makeProjectArray(name): makes a Lattice ProjectArray object.'''
|
||||
return latticeBaseFeature.makeLatticeFeature(name, LatticeProjectArray, ViewProviderProjectArray)
|
||||
return lattice2BaseFeature.makeLatticeFeature(name, LatticeProjectArray, ViewProviderProjectArray)
|
||||
|
||||
class LatticeProjectArray(latticeBaseFeature.LatticeFeature):
|
||||
class LatticeProjectArray(lattice2BaseFeature.LatticeFeature):
|
||||
"The Lattice ProjectArray object"
|
||||
|
||||
def derivedInit(self,obj):
|
||||
|
@ -68,12 +68,12 @@ class LatticeProjectArray(latticeBaseFeature.LatticeFeature):
|
|||
|
||||
def derivedExecute(self,obj):
|
||||
#validity check
|
||||
if not latticeBaseFeature.isObjectLattice(obj.Base):
|
||||
latticeExecuter.warning(obj,"A lattice object is expected as Base, but a generic shape was provided. It will be treated as a lattice object; results may be unexpected.")
|
||||
if not lattice2BaseFeature.isObjectLattice(obj.Base):
|
||||
lattice2Executer.warning(obj,"A lattice object is expected as Base, but a generic shape was provided. It will be treated as a lattice object; results may be unexpected.")
|
||||
|
||||
toolShape = obj.Tool.Shape
|
||||
if latticeBaseFeature.isObjectLattice(obj.Tool):
|
||||
latticeExecuter.warning(obj,"A lattice object was provided as Tool. It will be converted into points; orientations will be ignored.")
|
||||
if lattice2BaseFeature.isObjectLattice(obj.Tool):
|
||||
lattice2Executer.warning(obj,"A lattice object was provided as Tool. It will be converted into points; orientations will be ignored.")
|
||||
leaves = LCE.AllLeaves(toolShape)
|
||||
points = [Part.Vertex(leaf.Placement.Base) for leaf in leaves]
|
||||
toolShape = Part.makeCompound(points)
|
||||
|
@ -173,11 +173,11 @@ class LatticeProjectArray(latticeBaseFeature.LatticeFeature):
|
|||
return output
|
||||
|
||||
|
||||
class ViewProviderProjectArray(latticeBaseFeature.ViewProviderLatticeFeature):
|
||||
class ViewProviderProjectArray(lattice2BaseFeature.ViewProviderLatticeFeature):
|
||||
"A View Provider for the Lattice ProjectArray object"
|
||||
|
||||
def getIcon(self):
|
||||
return getIconPath("Lattice_ProjectArray.svg")
|
||||
return getIconPath("Lattice2_ProjectArray.svg")
|
||||
|
||||
def claimChildren(self):
|
||||
return [self.Object.Base]
|
||||
|
@ -189,21 +189,21 @@ def CreateLatticeProjectArray(name):
|
|||
iLtc = 0 #index of lattice object in selection
|
||||
iStc = 1 #index of stencil object in selection
|
||||
for i in range(0,len(sel)):
|
||||
if latticeBaseFeature.isObjectLattice(sel[i]):
|
||||
if lattice2BaseFeature.isObjectLattice(sel[i]):
|
||||
iLtc = i
|
||||
iStc = i-1 #this may give negative index, but python accepts negative indexes
|
||||
break
|
||||
FreeCAD.ActiveDocument.openTransaction("Create ProjectArray")
|
||||
FreeCADGui.addModule("latticeProjectArray")
|
||||
FreeCADGui.addModule("latticeExecuter")
|
||||
FreeCADGui.addModule("lattice2ProjectArray")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("sel = Gui.Selection.getSelectionEx()")
|
||||
FreeCADGui.doCommand("f = latticeProjectArray.makeProjectArray(name = '"+name+"')")
|
||||
FreeCADGui.doCommand("f = lattice2ProjectArray.makeProjectArray(name = '"+name+"')")
|
||||
FreeCADGui.doCommand("f.Base = App.ActiveDocument."+sel[iLtc].ObjectName)
|
||||
FreeCADGui.doCommand("f.Tool = App.ActiveDocument."+sel[iStc].ObjectName)
|
||||
|
||||
FreeCADGui.doCommand("for child in f.ViewObject.Proxy.claimChildren():\n"+
|
||||
" child.ViewObject.hide()")
|
||||
FreeCADGui.doCommand("latticeExecuter.executeFeature(f)")
|
||||
FreeCADGui.doCommand("lattice2Executer.executeFeature(f)")
|
||||
FreeCADGui.doCommand("f = None")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
|
@ -216,10 +216,10 @@ class _CommandProjectArray:
|
|||
"Command to create Lattice ProjectArray feature"
|
||||
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : getIconPath("Lattice_ProjectArray.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice_ProjectArray","Project Array"),
|
||||
return {'Pixmap' : getIconPath("Lattice2_ProjectArray.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice2_ProjectArray","Project Array"),
|
||||
'Accel': "",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice_ProjectArray","Project Array: alter placements based on their proximity to a shape.")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice2_ProjectArray","Project Array: alter placements based on their proximity to a shape.")}
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
|
@ -228,8 +228,8 @@ class _CommandProjectArray:
|
|||
else:
|
||||
mb = QtGui.QMessageBox()
|
||||
mb.setIcon(mb.Icon.Warning)
|
||||
mb.setText(translate("Lattice_ProjectArray", "Select one lattice object to be projected, and one shape to project onto, first!", None))
|
||||
mb.setWindowTitle(translate("Lattice_ProjectArray","Bad selection", None))
|
||||
mb.setText(translate("Lattice2_ProjectArray", "Select one lattice object to be projected, and one shape to project onto, first!", None))
|
||||
mb.setWindowTitle(translate("Lattice2_ProjectArray","Bad selection", None))
|
||||
mb.exec_()
|
||||
|
||||
def IsActive(self):
|
||||
|
@ -238,8 +238,8 @@ class _CommandProjectArray:
|
|||
else:
|
||||
return False
|
||||
|
||||
FreeCADGui.addCommand('Lattice_ProjectArray', _CommandProjectArray())
|
||||
FreeCADGui.addCommand('Lattice2_ProjectArray', _CommandProjectArray())
|
||||
|
||||
exportedCommands = ['Lattice_ProjectArray']
|
||||
exportedCommands = ['Lattice2_ProjectArray']
|
||||
|
||||
# -------------------------- /Gui command --------------------------------------------------
|
||||
|
|
|
@ -30,11 +30,11 @@ import math
|
|||
import FreeCAD as App
|
||||
import Part
|
||||
|
||||
from latticeCommon import *
|
||||
import latticeBaseFeature
|
||||
import latticeCompoundExplorer as LCE
|
||||
import latticeInterpolatorUtil as LIU
|
||||
import latticeExecuter
|
||||
from lattice2Common import *
|
||||
import lattice2BaseFeature
|
||||
import lattice2CompoundExplorer as LCE
|
||||
import lattice2InterpolatorUtil as LIU
|
||||
import lattice2Executer
|
||||
|
||||
# -------------------------- document object --------------------------------------------------
|
||||
|
||||
|
@ -46,9 +46,9 @@ def dotProduct(list1,list2):
|
|||
|
||||
def makeLatticeResample(name):
|
||||
'''makeLatticeResample(name): makes a LatticeResample object.'''
|
||||
return latticeBaseFeature.makeLatticeFeature(name, LatticeResample, ViewProviderLatticeResample)
|
||||
return lattice2BaseFeature.makeLatticeFeature(name, LatticeResample, ViewProviderLatticeResample)
|
||||
|
||||
class LatticeResample(latticeBaseFeature.LatticeFeature):
|
||||
class LatticeResample(lattice2BaseFeature.LatticeFeature):
|
||||
"The Lattice Resample object"
|
||||
|
||||
def derivedInit(self,obj):
|
||||
|
@ -70,8 +70,8 @@ class LatticeResample(latticeBaseFeature.LatticeFeature):
|
|||
def derivedExecute(self,obj):
|
||||
# cache stuff
|
||||
base = obj.Base.Shape
|
||||
if not latticeBaseFeature.isObjectLattice(obj.Base):
|
||||
latticeExecuter.warning(obj, "Base is not a lattice, but lattice is expected. Results may be unexpected.\n")
|
||||
if not lattice2BaseFeature.isObjectLattice(obj.Base):
|
||||
lattice2Executer.warning(obj, "Base is not a lattice, but lattice is expected. Results may be unexpected.\n")
|
||||
input = [leaf.Placement for leaf in LCE.AllLeaves(base)]
|
||||
|
||||
if len(input) < 2:
|
||||
|
@ -136,10 +136,10 @@ class LatticeResample(latticeBaseFeature.LatticeFeature):
|
|||
return outputPlms
|
||||
|
||||
|
||||
class ViewProviderLatticeResample(latticeBaseFeature.ViewProviderLatticeFeature):
|
||||
class ViewProviderLatticeResample(lattice2BaseFeature.ViewProviderLatticeFeature):
|
||||
|
||||
def getIcon(self):
|
||||
return getIconPath('Lattice_Resample.svg')
|
||||
return getIconPath('Lattice2_Resample.svg')
|
||||
|
||||
def claimChildren(self):
|
||||
return [self.Object.Base]
|
||||
|
@ -152,13 +152,13 @@ class ViewProviderLatticeResample(latticeBaseFeature.ViewProviderLatticeFeature)
|
|||
def CreateLatticeResample(name):
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
FreeCAD.ActiveDocument.openTransaction("Create LatticeResample")
|
||||
FreeCADGui.addModule("latticeResample")
|
||||
FreeCADGui.addModule("latticeExecuter")
|
||||
FreeCADGui.doCommand("f = latticeResample.makeLatticeResample(name='"+name+"')")
|
||||
FreeCADGui.addModule("lattice2Resample")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = lattice2Resample.makeLatticeResample(name='"+name+"')")
|
||||
FreeCADGui.doCommand("f.Base = App.ActiveDocument."+sel[0].ObjectName)
|
||||
FreeCADGui.doCommand("for child in f.ViewObject.Proxy.claimChildren():\n"+
|
||||
" child.ViewObject.hide()")
|
||||
FreeCADGui.doCommand("latticeExecuter.executeFeature(f)")
|
||||
FreeCADGui.doCommand("lattice2Executer.executeFeature(f)")
|
||||
FreeCADGui.doCommand("f = None")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
|
@ -166,10 +166,10 @@ def CreateLatticeResample(name):
|
|||
class _CommandLatticeResample:
|
||||
"Command to create LatticeResample feature"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : getIconPath("Lattice_Resample.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice_Resample","Resample Array"),
|
||||
return {'Pixmap' : getIconPath("Lattice2_Resample.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice2_Resample","Resample Array"),
|
||||
'Accel': "",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice_Resample","Lattice Resample: interpolate placement-path using 3-rd degree b-spline interpolation.")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice2_Resample","Lattice Resample: interpolate placement-path using 3-rd degree b-spline interpolation.")}
|
||||
|
||||
def Activated(self):
|
||||
if len(FreeCADGui.Selection.getSelection()) == 1 :
|
||||
|
@ -177,8 +177,8 @@ class _CommandLatticeResample:
|
|||
else:
|
||||
mb = QtGui.QMessageBox()
|
||||
mb.setIcon(mb.Icon.Warning)
|
||||
mb.setText(translate("Lattice_Resample", "Please select one object, first. The object must be a lattice object (array of placements).", None))
|
||||
mb.setWindowTitle(translate("Lattice_Resample","Bad selection", None))
|
||||
mb.setText(translate("Lattice2_Resample", "Please select one object, first. The object must be a lattice object (array of placements).", None))
|
||||
mb.setWindowTitle(translate("Lattice2_Resample","Bad selection", None))
|
||||
mb.exec_()
|
||||
|
||||
def IsActive(self):
|
||||
|
@ -187,9 +187,9 @@ class _CommandLatticeResample:
|
|||
else:
|
||||
return False
|
||||
|
||||
FreeCADGui.addCommand('Lattice_Resample', _CommandLatticeResample())
|
||||
FreeCADGui.addCommand('Lattice2_Resample', _CommandLatticeResample())
|
||||
|
||||
exportedCommands = ['Lattice_Resample']
|
||||
exportedCommands = ['Lattice2_Resample']
|
||||
|
||||
# -------------------------- /Gui command --------------------------------------------------
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
#***************************************************************************
|
||||
|
||||
|
||||
from latticeCommon import *
|
||||
import latticeBaseFeature
|
||||
import latticeExecuter
|
||||
import latticeCompoundExplorer as LCE
|
||||
from latticeBoundBox import getPrecisionBoundBox #needed for alignment
|
||||
from lattice2Common import *
|
||||
import lattice2BaseFeature
|
||||
import lattice2Executer
|
||||
import lattice2CompoundExplorer as LCE
|
||||
from lattice2BoundBox import getPrecisionBoundBox #needed for alignment
|
||||
|
||||
import FreeCAD as App
|
||||
import Part
|
||||
|
@ -51,8 +51,8 @@ def findFont(font_file_name):
|
|||
|
||||
dirlist = [] #list of directories to probe
|
||||
|
||||
import latticeDummy
|
||||
lattice_path = os.path.dirname(latticeDummy.__file__)
|
||||
import lattice2Dummy
|
||||
lattice_path = os.path.dirname(lattice2Dummy.__file__)
|
||||
dirlist.append(lattice_path + "/fonts")
|
||||
|
||||
if len(App.ActiveDocument.FileName) > 0:
|
||||
|
@ -151,8 +151,8 @@ class LatticeShapeString:
|
|||
if lattice is None:
|
||||
plms = [App.Placement() for i in range(0,nOfStrings)]
|
||||
else:
|
||||
if not latticeBaseFeature.isObjectLattice(lattice):
|
||||
latticeExecuter.warning(obj,"ShapeString's link to array must point to a lattice. It points to a generic shape. Results may be unexpected.")
|
||||
if not lattice2BaseFeature.isObjectLattice(lattice):
|
||||
lattice2Executer.warning(obj,"ShapeString's link to array must point to a lattice. It points to a generic shape. Results may be unexpected.")
|
||||
leaves = LCE.AllLeaves(lattice.Shape)
|
||||
plms = [leaf.Placement for leaf in leaves]
|
||||
|
||||
|
@ -253,12 +253,12 @@ class ViewProviderLatticeShapeString:
|
|||
def CreateLatticeShapeString(name):
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
FreeCAD.ActiveDocument.openTransaction("Create LatticeShapeString")
|
||||
FreeCADGui.addModule("latticeShapeString")
|
||||
FreeCADGui.addModule("latticeExecuter")
|
||||
FreeCADGui.doCommand("f = latticeShapeString.makeLatticeShapeString(name='"+name+"')")
|
||||
FreeCADGui.addModule("lattice2ShapeString")
|
||||
FreeCADGui.addModule("lattice2Executer")
|
||||
FreeCADGui.doCommand("f = lattice2ShapeString.makeLatticeShapeString(name='"+name+"')")
|
||||
if len(sel) == 1:
|
||||
FreeCADGui.doCommand("f.ArrayLink = FreeCADGui.Selection.getSelection()[0]")
|
||||
FreeCADGui.doCommand("latticeExecuter.executeFeature(f)")
|
||||
FreeCADGui.doCommand("lattice2Executer.executeFeature(f)")
|
||||
FreeCADGui.doCommand("f = None")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
|
@ -271,9 +271,9 @@ class _CommandLatticeShapeString:
|
|||
"Command to create LatticeShapeString feature"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : getIconPath("Draft_ShapeString.svg"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice_ShapeString","ShapeString for arraying"),
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Lattice2_ShapeString","ShapeString for arraying"),
|
||||
'Accel': "",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice_ShapeString","Make strings at given placements")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Lattice2_ShapeString","Make strings at given placements")}
|
||||
|
||||
def Activated(self):
|
||||
if len(FreeCADGui.Selection.getSelection()) == 0 or len(FreeCADGui.Selection.getSelection()) == 1:
|
||||
|
@ -281,8 +281,8 @@ class _CommandLatticeShapeString:
|
|||
else:
|
||||
mb = QtGui.QMessageBox()
|
||||
mb.setIcon(mb.Icon.Warning)
|
||||
mb.setText(translate("Lattice_ShapeString", "Either select nothing, or just one lattice object! You seem to have more than one object selected.", None))
|
||||
mb.setWindowTitle(translate("Lattice_ShapeString","Bad selection", None))
|
||||
mb.setText(translate("Lattice2_ShapeString", "Either select nothing, or just one lattice object! You seem to have more than one object selected.", None))
|
||||
mb.setWindowTitle(translate("Lattice2_ShapeString","Bad selection", None))
|
||||
mb.exec_()
|
||||
|
||||
def IsActive(self):
|
||||
|
@ -291,8 +291,8 @@ class _CommandLatticeShapeString:
|
|||
else:
|
||||
return False
|
||||
|
||||
FreeCADGui.addCommand('Lattice_ShapeString', _CommandLatticeShapeString())
|
||||
FreeCADGui.addCommand('Lattice2_ShapeString', _CommandLatticeShapeString())
|
||||
|
||||
exportedCommands = ['Lattice_ShapeString']
|
||||
exportedCommands = ['Lattice2_ShapeString']
|
||||
|
||||
# -------------------------- /Gui command --------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue
Block a user