+ making some internal classes private in Draft and Arch
git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5206 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
parent
e741f3a2d4
commit
2d1997b79c
|
@ -32,15 +32,15 @@ def makeBuilding(objectslist,join=False,name="Building"):
|
|||
'''makeBuilding(objectslist,[joinmode]): creates a building including the
|
||||
objects from the given list. If joinmode is True, components will be joined.'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
Building(obj)
|
||||
ViewProviderBuilding(obj.ViewObject)
|
||||
_Building(obj)
|
||||
_ViewProviderBuilding(obj.ViewObject)
|
||||
obj.Components = objectslist
|
||||
for comp in obj.Components:
|
||||
comp.ViewObject.hide()
|
||||
obj.JoinMode = join
|
||||
return obj
|
||||
|
||||
class CommandBuilding:
|
||||
class _CommandBuilding:
|
||||
"the Arch Building command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Building',
|
||||
|
@ -53,16 +53,16 @@ class CommandBuilding:
|
|||
makeBuilding(FreeCADGui.Selection.getSelection())
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
class Building(Cell.Cell):
|
||||
class _Building(Cell._Cell):
|
||||
"The Building object"
|
||||
def __init__(self,obj):
|
||||
Cell.Cell.__init__(self,obj)
|
||||
Cell._Cell.__init__(self,obj)
|
||||
self.Type = "Building"
|
||||
|
||||
class ViewProviderBuilding(Cell.ViewProviderCell):
|
||||
class _ViewProviderBuilding(Cell._ViewProviderCell):
|
||||
"A View Provider for the Building object"
|
||||
def __init__(self,vobj):
|
||||
Cell.ViewProviderCell.__init__(self,vobj)
|
||||
Cell._ViewProviderCell.__init__(self,vobj)
|
||||
|
||||
def getIcon(self):
|
||||
return """
|
||||
|
@ -96,4 +96,4 @@ class ViewProviderBuilding(Cell.ViewProviderCell):
|
|||
" .. "};
|
||||
"""
|
||||
|
||||
FreeCADGui.addCommand('Arch_Building',CommandBuilding())
|
||||
FreeCADGui.addCommand('Arch_Building',_CommandBuilding())
|
||||
|
|
|
@ -34,15 +34,15 @@ def makeCell(objectslist,join=True,name="Cell"):
|
|||
objects from the given list. If joinmode is False, contents will
|
||||
not be joined.'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
Cell(obj)
|
||||
ViewProviderCell(obj.ViewObject)
|
||||
_Cell(obj)
|
||||
_ViewProviderCell(obj.ViewObject)
|
||||
obj.Components = objectslist
|
||||
for comp in obj.Components:
|
||||
comp.ViewObject.hide()
|
||||
obj.JoinMode = join
|
||||
return obj
|
||||
|
||||
class CommandCell:
|
||||
class _CommandCell:
|
||||
"the Arch Cell command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Cell',
|
||||
|
@ -55,7 +55,7 @@ class CommandCell:
|
|||
makeCell(FreeCADGui.Selection.getSelection())
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
class Cell:
|
||||
class _Cell:
|
||||
"The Cell object"
|
||||
def __init__(self,obj):
|
||||
obj.addProperty("App::PropertyLinkList","Components","Base",
|
||||
|
@ -90,7 +90,7 @@ class Cell:
|
|||
obj.Shape = baseShape
|
||||
obj.Placement = pl
|
||||
|
||||
class ViewProviderCell:
|
||||
class _ViewProviderCell:
|
||||
"A View Provider for the Cell object"
|
||||
def __init__(self,vobj):
|
||||
vobj.Proxy = self
|
||||
|
@ -154,4 +154,4 @@ class ViewProviderCell:
|
|||
def __setstate__(self,state):
|
||||
return None
|
||||
|
||||
FreeCADGui.addCommand('Arch_Cell',CommandCell())
|
||||
FreeCADGui.addCommand('Arch_Cell',_CommandCell())
|
||||
|
|
|
@ -214,7 +214,7 @@ def removeShape(objs,mark=True):
|
|||
|
||||
# command definitions ###############################################
|
||||
|
||||
class CommandAdd:
|
||||
class _CommandAdd:
|
||||
"the Arch Add command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Add',
|
||||
|
@ -235,7 +235,7 @@ class CommandAdd:
|
|||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
|
||||
class CommandRemove:
|
||||
class _CommandRemove:
|
||||
"the Arch Add command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Remove',
|
||||
|
@ -259,7 +259,7 @@ class CommandRemove:
|
|||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
|
||||
class CommandSplitMesh:
|
||||
class _CommandSplitMesh:
|
||||
"the Arch SplitMesh command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_SplitMesh',
|
||||
|
@ -286,7 +286,7 @@ class CommandSplitMesh:
|
|||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
|
||||
class CommandMeshToShape:
|
||||
class _CommandMeshToShape:
|
||||
"the Arch MeshToShape command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_MeshToShape',
|
||||
|
@ -319,7 +319,7 @@ class CommandMeshToShape:
|
|||
g.addObject(newobj)
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
class CommandSelectNonSolidMeshes:
|
||||
class _CommandSelectNonSolidMeshes:
|
||||
"the Arch SelectNonSolidMeshes command definition"
|
||||
def GetResources(self):
|
||||
return {'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_SelectNonSolidMeshes","Select non-manifold meshes"),
|
||||
|
@ -343,7 +343,7 @@ class CommandSelectNonSolidMeshes:
|
|||
for o in sel:
|
||||
FreeCADGui.Selection.addSelection(o)
|
||||
|
||||
class CommandRemoveShape:
|
||||
class _CommandRemoveShape:
|
||||
"the Arch RemoveShape command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_RemoveShape',
|
||||
|
@ -360,9 +360,9 @@ class CommandRemoveShape:
|
|||
sel = FreeCADGui.Selection.getSelection()
|
||||
removeShape(sel)
|
||||
|
||||
FreeCADGui.addCommand('Arch_Add',CommandAdd())
|
||||
FreeCADGui.addCommand('Arch_Remove',CommandRemove())
|
||||
FreeCADGui.addCommand('Arch_SplitMesh',CommandSplitMesh())
|
||||
FreeCADGui.addCommand('Arch_MeshToShape',CommandMeshToShape())
|
||||
FreeCADGui.addCommand('Arch_SelectNonSolidMeshes',CommandSelectNonSolidMeshes())
|
||||
FreeCADGui.addCommand('Arch_RemoveShape',CommandRemoveShape())
|
||||
FreeCADGui.addCommand('Arch_Add',_CommandAdd())
|
||||
FreeCADGui.addCommand('Arch_Remove',_CommandRemove())
|
||||
FreeCADGui.addCommand('Arch_SplitMesh',_CommandSplitMesh())
|
||||
FreeCADGui.addCommand('Arch_MeshToShape',_CommandMeshToShape())
|
||||
FreeCADGui.addCommand('Arch_SelectNonSolidMeshes',_CommandSelectNonSolidMeshes())
|
||||
FreeCADGui.addCommand('Arch_RemoveShape',_CommandRemoveShape())
|
||||
|
|
|
@ -33,15 +33,15 @@ def makeFloor(objectslist,join=True,name="Floor"):
|
|||
objects from the given list. If joinmode is False, components will
|
||||
not be joined.'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
Floor(obj)
|
||||
ViewProviderFloor(obj.ViewObject)
|
||||
_Floor(obj)
|
||||
_ViewProviderFloor(obj.ViewObject)
|
||||
obj.Components = objectslist
|
||||
for comp in obj.Components:
|
||||
comp.ViewObject.hide()
|
||||
obj.JoinMode = join
|
||||
return obj
|
||||
|
||||
class CommandFloor:
|
||||
class _CommandFloor:
|
||||
"the Arch Cell command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Floor',
|
||||
|
@ -54,18 +54,18 @@ class CommandFloor:
|
|||
makeFloor(FreeCADGui.Selection.getSelection())
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
class Floor(Cell.Cell):
|
||||
class _Floor(Cell._Cell):
|
||||
"The Cell object"
|
||||
def __init__(self,obj):
|
||||
Cell.Cell.__init__(self,obj)
|
||||
Cell._Cell.__init__(self,obj)
|
||||
obj.addProperty("App::PropertyLength","Height","Base",
|
||||
"The height of this floor")
|
||||
self.Type = "Floor"
|
||||
|
||||
class ViewProviderFloor(Cell.ViewProviderCell):
|
||||
class _ViewProviderFloor(Cell._ViewProviderCell):
|
||||
"A View Provider for the Cell object"
|
||||
def __init__(self,vobj):
|
||||
Cell.ViewProviderCell.__init__(self,vobj)
|
||||
Cell._ViewProviderCell.__init__(self,vobj)
|
||||
|
||||
def getIcon(self):
|
||||
return """
|
||||
|
@ -99,4 +99,4 @@ class ViewProviderFloor(Cell.ViewProviderCell):
|
|||
" "};
|
||||
"""
|
||||
|
||||
FreeCADGui.addCommand('Arch_Floor',CommandFloor())
|
||||
FreeCADGui.addCommand('Arch_Floor',_CommandFloor())
|
||||
|
|
|
@ -5,7 +5,7 @@ from pivy import coin
|
|||
from draftlibs import fcvec,fcgeo
|
||||
|
||||
|
||||
class CommandSectionPlane:
|
||||
class _CommandSectionPlane:
|
||||
"the Arch SectionPlane command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_SectionPlane',
|
||||
|
@ -16,8 +16,8 @@ class CommandSectionPlane:
|
|||
sel = FreeCADGui.Selection.getSelection()
|
||||
FreeCAD.ActiveDocument.openTransaction("Section Plane")
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython","Section")
|
||||
SectionPlane(obj)
|
||||
ViewProviderSectionPlane(obj.ViewObject)
|
||||
_SectionPlane(obj)
|
||||
_ViewProviderSectionPlane(obj.ViewObject)
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
g = []
|
||||
for o in sel:
|
||||
|
@ -32,11 +32,11 @@ class CommandSectionPlane:
|
|||
page.Template = template
|
||||
view = FreeCAD.ActiveDocument.addObject("Drawing::FeatureViewPython","View")
|
||||
page.addObject(view)
|
||||
ArchDrawingView(view)
|
||||
_ArchDrawingView(view)
|
||||
view.Source = obj
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
class SectionPlane:
|
||||
class _SectionPlane:
|
||||
"A section plane object"
|
||||
def __init__(self,obj):
|
||||
obj.Proxy = self
|
||||
|
@ -59,7 +59,7 @@ class SectionPlane:
|
|||
def getNormal(self):
|
||||
return self.Object.Shape.Faces[0].normalAt(0,0)
|
||||
|
||||
class ViewProviderSectionPlane(Component.ViewProviderComponent):
|
||||
class _ViewProviderSectionPlane(Component.ViewProviderComponent):
|
||||
"A View Provider for Section Planes"
|
||||
def __init__(self,vobj):
|
||||
vobj.addProperty("App::PropertyLength","DisplaySize","Base",
|
||||
|
@ -152,7 +152,7 @@ class ViewProviderSectionPlane(Component.ViewProviderComponent):
|
|||
vobj.Object.Proxy.execute(vobj.Object)
|
||||
return
|
||||
|
||||
class ArchDrawingView:
|
||||
class _ArchDrawingView:
|
||||
def __init__(self, obj):
|
||||
obj.addProperty("App::PropertyLink","Source","Base","The linked object")
|
||||
obj.Proxy = self
|
||||
|
@ -373,4 +373,4 @@ class ArchDrawingView:
|
|||
return svg
|
||||
|
||||
|
||||
FreeCADGui.addCommand('Arch_SectionPlane',CommandSectionPlane())
|
||||
FreeCADGui.addCommand('Arch_SectionPlane',_CommandSectionPlane())
|
||||
|
|
|
@ -32,13 +32,13 @@ def makeSite(objectslist,name="Site"):
|
|||
'''makeBuilding(objectslist): creates a site including the
|
||||
objects from the given list.'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
Site(obj)
|
||||
ViewProviderSite(obj.ViewObject)
|
||||
_Site(obj)
|
||||
_ViewProviderSite(obj.ViewObject)
|
||||
obj.Components = objectslist
|
||||
obj.JoinMode = False
|
||||
return obj
|
||||
|
||||
class CommandSite:
|
||||
class _CommandSite:
|
||||
"the Arch Site command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Site',
|
||||
|
@ -51,10 +51,10 @@ class CommandSite:
|
|||
makeSite(FreeCADGui.Selection.getSelection())
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
class Site(Cell.Cell):
|
||||
class _Site(Cell._Cell):
|
||||
"The Site object"
|
||||
def __init__(self,obj):
|
||||
Cell.Cell.__init__(self,obj)
|
||||
Cell._Cell.__init__(self,obj)
|
||||
self.Type = "Site"
|
||||
|
||||
def execute(self,obj):
|
||||
|
@ -63,10 +63,10 @@ class Site(Cell.Cell):
|
|||
def onChanged(self,obj,prop):
|
||||
pass
|
||||
|
||||
class ViewProviderSite(Cell.ViewProviderCell):
|
||||
class _ViewProviderSite(Cell._ViewProviderCell):
|
||||
"A View Provider for the Site object"
|
||||
def __init__(self,vobj):
|
||||
Cell.ViewProviderCell.__init__(self,vobj)
|
||||
Cell._ViewProviderCell.__init__(self,vobj)
|
||||
|
||||
def getIcon(self):
|
||||
return """
|
||||
|
@ -100,4 +100,4 @@ class ViewProviderSite(Cell.ViewProviderCell):
|
|||
" "};
|
||||
"""
|
||||
|
||||
FreeCADGui.addCommand('Arch_Site',CommandSite())
|
||||
FreeCADGui.addCommand('Arch_Site',_CommandSite())
|
||||
|
|
|
@ -36,8 +36,8 @@ def makeStructure(baseobj=None,length=None,width=None,height=None,name="Structur
|
|||
extrusion height. If no base object is given, you can also specify
|
||||
length and width for a cubic object.'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
Structure(obj)
|
||||
ViewProviderStructure(obj.ViewObject)
|
||||
_Structure(obj)
|
||||
_ViewProviderStructure(obj.ViewObject)
|
||||
if baseobj: obj.Base = baseobj
|
||||
if length: obj.Length = length
|
||||
if width: obj.Width = width
|
||||
|
@ -56,7 +56,7 @@ def makeStructure(baseobj=None,length=None,width=None,height=None,name="Structur
|
|||
obj.ViewObject.ShapeColor = (r,g,b,1.0)
|
||||
return obj
|
||||
|
||||
class CommandStructure:
|
||||
class _CommandStructure:
|
||||
"the Arch Structure command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Structure',
|
||||
|
@ -74,7 +74,7 @@ class CommandStructure:
|
|||
else:
|
||||
makeStructure()
|
||||
|
||||
class Structure(Component.Component):
|
||||
class _Structure(Component.Component):
|
||||
"The Structure object"
|
||||
def __init__(self,obj):
|
||||
Component.Component.__init__(self,obj)
|
||||
|
@ -144,7 +144,7 @@ class Structure(Component.Component):
|
|||
obj.Shape = base
|
||||
if not fcgeo.isNull(pl): obj.Placement = pl
|
||||
|
||||
class ViewProviderStructure(Component.ViewProviderComponent):
|
||||
class _ViewProviderStructure(Component.ViewProviderComponent):
|
||||
"A View Provider for the Structure object"
|
||||
|
||||
def __init__(self,vobj):
|
||||
|
@ -182,4 +182,4 @@ class ViewProviderStructure(Component.ViewProviderComponent):
|
|||
" .++ "};
|
||||
"""
|
||||
|
||||
FreeCADGui.addCommand('Arch_Structure',CommandStructure())
|
||||
FreeCADGui.addCommand('Arch_Structure',_CommandStructure())
|
||||
|
|
|
@ -34,8 +34,8 @@ def makeWall(baseobj=None,width=None,height=None,align="Center",name="Wall"):
|
|||
'''makeWall(obj,[width],[height],[align],[name]): creates a wall based on the
|
||||
given object'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
Wall(obj)
|
||||
ViewProviderWall(obj.ViewObject)
|
||||
_Wall(obj)
|
||||
_ViewProviderWall(obj.ViewObject)
|
||||
if baseobj: obj.Base = baseobj
|
||||
if width: obj.Width = width
|
||||
if height: obj.Height = height
|
||||
|
@ -49,7 +49,7 @@ def makeWall(baseobj=None,width=None,height=None,align="Center",name="Wall"):
|
|||
obj.ViewObject.ShapeColor = (r,g,b,1.0)
|
||||
return obj
|
||||
|
||||
class CommandWall:
|
||||
class _CommandWall:
|
||||
"the Arch Wall command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Wall',
|
||||
|
@ -67,7 +67,7 @@ class CommandWall:
|
|||
else:
|
||||
wall = makeWall()
|
||||
|
||||
class Wall(Component.Component):
|
||||
class _Wall(Component.Component):
|
||||
"The Wall object"
|
||||
def __init__(self,obj):
|
||||
Component.Component.__init__(self,obj)
|
||||
|
@ -180,7 +180,7 @@ class Wall(Component.Component):
|
|||
if not fcgeo.isNull(pl):
|
||||
obj.Placement = pl
|
||||
|
||||
class ViewProviderWall(Component.ViewProviderComponent):
|
||||
class _ViewProviderWall(Component.ViewProviderComponent):
|
||||
"A View Provider for the Wall object"
|
||||
|
||||
def __init__(self,vobj):
|
||||
|
@ -218,4 +218,4 @@ class ViewProviderWall(Component.ViewProviderComponent):
|
|||
" "};
|
||||
"""
|
||||
|
||||
FreeCADGui.addCommand('Arch_Wall',CommandWall())
|
||||
FreeCADGui.addCommand('Arch_Wall',_CommandWall())
|
||||
|
|
|
@ -34,8 +34,8 @@ def makeWindow(baseobj=None,name="Window"):
|
|||
'''makeWindow(obj,[name]): creates a window based on the
|
||||
given object'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::FeaturePython",name)
|
||||
Window(obj)
|
||||
ViewProviderWindow(obj.ViewObject)
|
||||
_Window(obj)
|
||||
_ViewProviderWindow(obj.ViewObject)
|
||||
if baseobj: obj.Base = baseobj
|
||||
if obj.Base: obj.Base.ViewObject.hide()
|
||||
#p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
|
@ -46,7 +46,7 @@ def makeWindow(baseobj=None,name="Window"):
|
|||
#obj.ViewObject.ShapeColor = (r,g,b,1.0)
|
||||
return obj
|
||||
|
||||
class CommandWindow:
|
||||
class _CommandWindow:
|
||||
"the Arch Window command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Arch_Window',
|
||||
|
@ -65,7 +65,7 @@ class CommandWindow:
|
|||
makeWindow(rect)
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
class Window(Component.Component):
|
||||
class _Window(Component.Component):
|
||||
"The Window object"
|
||||
def __init__(self,obj):
|
||||
Component.Component.__init__(self,obj)
|
||||
|
@ -107,7 +107,7 @@ class Window(Component.Component):
|
|||
obj.Placement = pl
|
||||
self.Subvolume.Placement = pl
|
||||
|
||||
class ViewProviderWindow(Component.ViewProviderComponent):
|
||||
class _ViewProviderWindow(Component.ViewProviderComponent):
|
||||
"A View Provider for the Window object"
|
||||
|
||||
def __init__(self,vobj):
|
||||
|
@ -141,4 +141,4 @@ class ViewProviderWindow(Component.ViewProviderComponent):
|
|||
" . "};
|
||||
"""
|
||||
|
||||
FreeCADGui.addCommand('Arch_Window',CommandWindow())
|
||||
FreeCADGui.addCommand('Arch_Window',_CommandWindow())
|
||||
|
|
|
@ -287,8 +287,8 @@ def makeCircle(radius, placement=None, face=True, startangle=None, endangle=None
|
|||
(in degrees), they are used and the object appears as an arc.'''
|
||||
if placement: typecheck([(placement,FreeCAD.Placement)], "makeCircle")
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Circle")
|
||||
Circle(obj)
|
||||
ViewProviderDraft(obj.ViewObject)
|
||||
_Circle(obj)
|
||||
_ViewProviderDraft(obj.ViewObject)
|
||||
obj.Radius = radius
|
||||
if not face: obj.ViewObject.DisplayMode = "Wireframe"
|
||||
if (startangle != None) and (endangle != None):
|
||||
|
@ -309,8 +309,8 @@ def makeRectangle(length, height, placement=None, face=True, support=None):
|
|||
rectangle is shown as a wireframe, otherwise as a face.'''
|
||||
if placement: typecheck([(placement,FreeCAD.Placement)], "makeRectangle")
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Rectangle")
|
||||
Rectangle(obj)
|
||||
ViewProviderRectangle(obj.ViewObject)
|
||||
_Rectangle(obj)
|
||||
_ViewProviderRectangle(obj.ViewObject)
|
||||
obj.Length = length
|
||||
obj.Height = height
|
||||
obj.Support = support
|
||||
|
@ -335,8 +335,8 @@ def makeDimension(p1,p2,p3=None,p4=None):
|
|||
and mode is either "radius" or "diameter".
|
||||
'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("App::FeaturePython","Dimension")
|
||||
Dimension(obj)
|
||||
ViewProviderDimension(obj.ViewObject)
|
||||
_Dimension(obj)
|
||||
_ViewProviderDimension(obj.ViewObject)
|
||||
if isinstance(p1,Vector) and isinstance(p2,Vector):
|
||||
obj.Start = p1
|
||||
obj.End = p2
|
||||
|
@ -368,8 +368,8 @@ def makeAngularDimension(center,angles,p3):
|
|||
from the given center, with the given list of angles, passing through p3.
|
||||
'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("App::FeaturePython","Dimension")
|
||||
AngularDimension(obj)
|
||||
ViewProviderAngularDimension(obj.ViewObject)
|
||||
_AngularDimension(obj)
|
||||
_ViewProviderAngularDimension(obj.ViewObject)
|
||||
obj.Center = center
|
||||
for a in range(len(angles)):
|
||||
if angles[a] > 2*math.pi:
|
||||
|
@ -399,8 +399,8 @@ def makeWire(pointslist,closed=False,placement=None,face=True,support=None):
|
|||
if len(pointslist) == 2: fname = "Line"
|
||||
else: fname = "Wire"
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython",fname)
|
||||
Wire(obj)
|
||||
ViewProviderWire(obj.ViewObject)
|
||||
_Wire(obj)
|
||||
_ViewProviderWire(obj.ViewObject)
|
||||
obj.Points = pointslist
|
||||
obj.Closed = closed
|
||||
obj.Support = support
|
||||
|
@ -420,8 +420,8 @@ def makePolygon(nfaces,radius=1,inscribed=True,placement=None,face=True,support=
|
|||
'''
|
||||
if nfaces < 3: return None
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Polygon")
|
||||
Polygon(obj)
|
||||
ViewProviderDraft(obj.ViewObject)
|
||||
_Polygon(obj)
|
||||
_ViewProviderDraft(obj.ViewObject)
|
||||
obj.FacesNumber = nfaces
|
||||
obj.Radius = radius
|
||||
if inscribed:
|
||||
|
@ -456,8 +456,8 @@ def makeBSpline(pointslist,closed=False,placement=None,face=True,support=None):
|
|||
if len(pointslist) == 2: fname = "Line"
|
||||
else: fname = "BSpline"
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython",fname)
|
||||
BSpline(obj)
|
||||
ViewProviderBSpline(obj.ViewObject)
|
||||
_BSpline(obj)
|
||||
_ViewProviderBSpline(obj.ViewObject)
|
||||
obj.Points = pointslist
|
||||
obj.Closed = closed
|
||||
obj.Support = support
|
||||
|
@ -495,31 +495,31 @@ def makeCopy(obj):
|
|||
'''makeCopy(object): returns an exact copy of an object'''
|
||||
newobj = FreeCAD.ActiveDocument.addObject(obj.Type,getRealName(obj.Name))
|
||||
if getType(obj) == "Rectangle":
|
||||
Rectangle(newobj)
|
||||
ViewProviderRectangle(newobj.ViewObject)
|
||||
_Rectangle(newobj)
|
||||
_ViewProviderRectangle(newobj.ViewObject)
|
||||
elif getType(obj) == "Wire":
|
||||
Wire(newobj)
|
||||
ViewProviderWire(newobj.ViewObject)
|
||||
_Wire(newobj)
|
||||
_ViewProviderWire(newobj.ViewObject)
|
||||
elif getType(obj) == "Circle":
|
||||
Circle(newobj)
|
||||
ViewProviderCircle(newobj.ViewObject)
|
||||
_Circle(newobj)
|
||||
_ViewProviderCircle(newobj.ViewObject)
|
||||
elif getType(obj) == "Polygon":
|
||||
Polygon(newobj)
|
||||
ViewProviderPolygon(newobj.ViewObject)
|
||||
_Polygon(newobj)
|
||||
_ViewProviderPolygon(newobj.ViewObject)
|
||||
elif getType(obj) == "BSpline":
|
||||
BSpline(newobj)
|
||||
ViewProviderBSpline(newobj.ViewObject)
|
||||
_BSpline(newobj)
|
||||
_ViewProviderBSpline(newobj.ViewObject)
|
||||
elif getType(obj) == "Block":
|
||||
Block(newobj)
|
||||
ViewProviderBlock(newobj.ViewObject)
|
||||
_Block(newobj)
|
||||
_ViewProviderBlock(newobj.ViewObject)
|
||||
elif getType(obj) == "Structure":
|
||||
import Structure
|
||||
Structure.Structure(newobj)
|
||||
Structure.ViewProviderStructure(newobj.ViewObject)
|
||||
Structure._Structure(newobj)
|
||||
Structure._ViewProviderStructure(newobj.ViewObject)
|
||||
elif getType(obj) == "Wall":
|
||||
import Wall
|
||||
Wall.Wall(newobj)
|
||||
Wall.ViewProviderWall(newobj.ViewObject)
|
||||
Wall._Wall(newobj)
|
||||
Wall._ViewProviderWall(newobj.ViewObject)
|
||||
elif obj.isDerivedFrom("Part::Feature"):
|
||||
newobj.Shape = obj.Shape
|
||||
else:
|
||||
|
@ -534,8 +534,8 @@ def makeCopy(obj):
|
|||
def makeBlock(objectslist):
|
||||
'''makeBlock(objectslist): Creates a Draft Block from the given objects'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Block")
|
||||
Block(obj)
|
||||
ViewProviderBlock(obj.ViewObject)
|
||||
_Block(obj)
|
||||
_ViewProviderBlock(obj.ViewObject)
|
||||
obj.Components = objectslist
|
||||
for o in objectslist:
|
||||
o.ViewObject.Visibility = False
|
||||
|
@ -561,8 +561,8 @@ def fuse(object1,object2):
|
|||
a standard Part fuse.'''
|
||||
if fcgeo.isCoplanar(object1.Shape.fuse(object2.Shape).Faces):
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Fusion")
|
||||
Wire(obj)
|
||||
ViewProviderWire(obj.ViewObject)
|
||||
_Wire(obj)
|
||||
_ViewProviderWire(obj.ViewObject)
|
||||
else:
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Fuse","Fusion")
|
||||
obj.Base = object1
|
||||
|
@ -612,8 +612,8 @@ def move(objectslist,vector,copy=False):
|
|||
elif getType(obj) == "Dimension":
|
||||
if copy:
|
||||
newobj = FreeCAD.ActiveDocument.addObject("App::FeaturePython",getRealName(obj.Name))
|
||||
Dimension(newobj)
|
||||
DimensionViewProvider(newobj.ViewObject)
|
||||
_Dimension(newobj)
|
||||
_DimensionViewProvider(newobj.ViewObject)
|
||||
else:
|
||||
newobj = obj
|
||||
newobj.Start = obj.Start.add(vector)
|
||||
|
@ -1117,7 +1117,7 @@ def makeDrawingView(obj,page,lwmod=None,tmod=None):
|
|||
(in percent). The Hint scale, X and Y of the page are used.
|
||||
'''
|
||||
viewobj = FreeCAD.ActiveDocument.addObject("Drawing::FeatureViewPython","View"+obj.Name)
|
||||
DrawingView(viewobj)
|
||||
_DrawingView(viewobj)
|
||||
page.addObject(viewobj)
|
||||
viewobj.Scale = page.ViewObject.HintScale
|
||||
viewobj.X = page.ViewObject.HintOffsetX
|
||||
|
@ -1133,8 +1133,8 @@ def makeShape2DView(baseobj,projectionVector=None):
|
|||
2D projection of the given object. A specific projection vector can also be given.
|
||||
'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("Part::Part2DObjectPython","Shape2DView")
|
||||
Shape2DView(obj)
|
||||
ViewProviderDraft(obj.ViewObject)
|
||||
_Shape2DView(obj)
|
||||
_ViewProviderDraft(obj.ViewObject)
|
||||
obj.Base = baseobj
|
||||
if projectionVector:
|
||||
obj.Projection = projectionVector
|
||||
|
@ -1145,7 +1145,7 @@ def makeShape2DView(baseobj,projectionVector=None):
|
|||
# Python Features definitions
|
||||
#---------------------------------------------------------------------------
|
||||
|
||||
class ViewProviderDraft:
|
||||
class _ViewProviderDraft:
|
||||
"A generic View Provider for Draft objects"
|
||||
|
||||
def __init__(self, obj):
|
||||
|
@ -1186,7 +1186,7 @@ class ViewProviderDraft:
|
|||
def getIcon(self):
|
||||
return(":/icons/Draft_Draft.svg")
|
||||
|
||||
class Dimension:
|
||||
class _Dimension:
|
||||
"The Dimension object"
|
||||
def __init__(self, obj):
|
||||
obj.addProperty("App::PropertyVector","Start","Base",
|
||||
|
@ -1212,7 +1212,7 @@ class Dimension:
|
|||
if obj.ViewObject:
|
||||
obj.ViewObject.update()
|
||||
|
||||
class ViewProviderDimension:
|
||||
class _ViewProviderDimension:
|
||||
"A View Provider for the Dimension object"
|
||||
def __init__(self, obj):
|
||||
obj.addProperty("App::PropertyLength","FontSize","Base","Font size")
|
||||
|
@ -1476,7 +1476,7 @@ class ViewProviderDimension:
|
|||
def __setstate__(self,state):
|
||||
return None
|
||||
|
||||
class AngularDimension:
|
||||
class _AngularDimension:
|
||||
"The AngularDimension object"
|
||||
def __init__(self, obj):
|
||||
obj.addProperty("App::PropertyAngle","FirstAngle","Base",
|
||||
|
@ -1501,7 +1501,7 @@ class AngularDimension:
|
|||
if fp.ViewObject:
|
||||
fp.ViewObject.update()
|
||||
|
||||
class ViewProviderAngularDimension:
|
||||
class _ViewProviderAngularDimension:
|
||||
"A View Provider for the Angular Dimension object"
|
||||
def __init__(self, obj):
|
||||
obj.addProperty("App::PropertyLength","FontSize","Base","Font size")
|
||||
|
@ -1684,7 +1684,7 @@ class ViewProviderAngularDimension:
|
|||
" "};
|
||||
"""
|
||||
|
||||
class Rectangle:
|
||||
class _Rectangle:
|
||||
"The Rectangle object"
|
||||
|
||||
def __init__(self, obj):
|
||||
|
@ -1713,10 +1713,10 @@ class Rectangle:
|
|||
fp.Shape = shape
|
||||
fp.Placement = plm
|
||||
|
||||
class ViewProviderRectangle(ViewProviderDraft):
|
||||
class _ViewProviderRectangle(_ViewProviderDraft):
|
||||
"A View Provider for the Rectangle object"
|
||||
def __init__(self, obj):
|
||||
ViewProviderDraft.__init__(self,obj)
|
||||
_ViewProviderDraft.__init__(self,obj)
|
||||
obj.addProperty("App::PropertyFile","TextureImage",
|
||||
"Base","Uses an image as a texture map")
|
||||
|
||||
|
@ -1736,7 +1736,7 @@ class ViewProviderRectangle(ViewProviderDraft):
|
|||
self.texture = None
|
||||
return
|
||||
|
||||
class Circle:
|
||||
class _Circle:
|
||||
"The Circle object"
|
||||
|
||||
def __init__(self, obj):
|
||||
|
@ -1766,7 +1766,7 @@ class Circle:
|
|||
fp.Shape = shape
|
||||
fp.Placement = plm
|
||||
|
||||
class Wire:
|
||||
class _Wire:
|
||||
"The Wire object"
|
||||
|
||||
def __init__(self, obj):
|
||||
|
@ -1829,10 +1829,10 @@ class Wire:
|
|||
fp.Shape = shape
|
||||
fp.Placement = plm
|
||||
|
||||
class ViewProviderWire(ViewProviderDraft):
|
||||
class _ViewProviderWire(_ViewProviderDraft):
|
||||
"A View Provider for the Wire object"
|
||||
def __init__(self, obj):
|
||||
ViewProviderDraft.__init__(self,obj)
|
||||
_ViewProviderDraft.__init__(self,obj)
|
||||
obj.addProperty("App::PropertyBool","EndArrow","Base",
|
||||
"Displays a dim symbol at the end of the wire")
|
||||
|
||||
|
@ -1867,7 +1867,7 @@ class ViewProviderWire(ViewProviderDraft):
|
|||
def claimChildren(self):
|
||||
return [self.Object.Base,self.Object.Tool]
|
||||
|
||||
class Polygon:
|
||||
class _Polygon:
|
||||
"The Polygon object"
|
||||
|
||||
def __init__(self, obj):
|
||||
|
@ -1904,7 +1904,7 @@ class Polygon:
|
|||
fp.Shape = shape
|
||||
fp.Placement = plm
|
||||
|
||||
class DrawingView:
|
||||
class _DrawingView:
|
||||
def __init__(self, obj):
|
||||
obj.addProperty("App::PropertyVector","Direction","Shape view","Projection direction")
|
||||
obj.addProperty("App::PropertyFloat","LinewidthModifier","Drawing view","Modifies the linewidth of the lines inside this object")
|
||||
|
@ -1945,7 +1945,7 @@ class DrawingView:
|
|||
result += '</g>'
|
||||
return result
|
||||
|
||||
class BSpline:
|
||||
class _BSpline:
|
||||
"The BSpline object"
|
||||
|
||||
def __init__(self, obj):
|
||||
|
@ -1983,10 +1983,10 @@ class BSpline:
|
|||
fp.Shape = spline.toShape()
|
||||
fp.Placement = plm
|
||||
|
||||
class ViewProviderBSpline(ViewProviderDraft):
|
||||
class _ViewProviderBSpline(_ViewProviderDraft):
|
||||
"A View Provider for the BSPline object"
|
||||
def __init__(self, obj):
|
||||
ViewProviderDraft.__init__(self,obj)
|
||||
_ViewProviderDraft.__init__(self,obj)
|
||||
obj.addProperty("App::PropertyBool","EndArrow",
|
||||
"Base","Displays a dim symbol at the end of the wire")
|
||||
col = coin.SoBaseColor()
|
||||
|
@ -2015,7 +2015,7 @@ class ViewProviderBSpline(ViewProviderDraft):
|
|||
rn.removeChild(self.pt)
|
||||
return
|
||||
|
||||
class Block:
|
||||
class _Block:
|
||||
"The Block object"
|
||||
|
||||
def __init__(self, obj):
|
||||
|
@ -2041,13 +2041,15 @@ class Block:
|
|||
fp.Shape = shape
|
||||
fp.Placement = plm
|
||||
|
||||
class ViewProviderBlock(ViewProviderDraft):
|
||||
class _ViewProviderBlock(_ViewProviderDraft):
|
||||
"A View Provider for the Block object"
|
||||
def __init__(self,obj):
|
||||
_ViewProviderDraft.__init__(self,obj)
|
||||
|
||||
def claimChildren(self):
|
||||
return self.Object.Components
|
||||
|
||||
class Shape2DView:
|
||||
class _Shape2DView:
|
||||
"The Shape2DView object"
|
||||
|
||||
def __init__(self,obj):
|
||||
|
|
Loading…
Reference in New Issue
Block a user