Merge branch 'main' into modernize-type-check
This commit is contained in:
@@ -301,9 +301,10 @@ class CommandBuildingPart:
|
||||
ss += "]"
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create BuildingPart"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.doCommand("obj = Arch.makeBuildingPart("+ss+")")
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("obj.Placement = FreeCAD.DraftWorkingPlane.getPlacement()")
|
||||
FreeCADGui.addModule("WorkingPlane")
|
||||
FreeCADGui.doCommand("obj = Arch.makeBuildingPart("+ss+")")
|
||||
FreeCADGui.doCommand("obj.Placement = WorkingPlane.get_working_plane().get_placement()")
|
||||
FreeCADGui.doCommand("Draft.autogroup(obj)")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
@@ -963,30 +964,22 @@ class ViewProviderBuildingPart:
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
|
||||
def setWorkingPlane(self,restore=False):
|
||||
vobj = self.Object.ViewObject
|
||||
|
||||
if hasattr(self,"Object") and hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
import FreeCADGui
|
||||
autoclip = False
|
||||
if hasattr(self.Object.ViewObject,"AutoCutView"):
|
||||
autoclip = self.Object.ViewObject.AutoCutView
|
||||
if restore:
|
||||
FreeCAD.DraftWorkingPlane.restore()
|
||||
if autoclip:
|
||||
self.Object.ViewObject.CutView = False
|
||||
else:
|
||||
FreeCAD.DraftWorkingPlane.save()
|
||||
FreeCADGui.runCommand("Draft_SelectPlane")
|
||||
if autoclip:
|
||||
self.Object.ViewObject.CutView = True
|
||||
if hasattr(FreeCADGui,"Snapper"):
|
||||
FreeCADGui.Snapper.setGrid()
|
||||
if hasattr(FreeCADGui,"draftToolBar"):
|
||||
if restore and hasattr(self,"wptext"):
|
||||
FreeCADGui.draftToolBar.wplabel.setText(self.wptext)
|
||||
else:
|
||||
self.wptext = FreeCADGui.draftToolBar.wplabel.text()
|
||||
FreeCADGui.draftToolBar.wplabel.setText(self.Object.Label)
|
||||
FreeCAD.DraftWorkingPlane.lastBuildingPart = self.Object.Name
|
||||
import WorkingPlane
|
||||
wp = WorkingPlane.get_working_plane(update=False)
|
||||
autoclip = False
|
||||
if hasattr(vobj,"AutoCutView"):
|
||||
autoclip = vobj.AutoCutView
|
||||
if restore:
|
||||
if wp.label.rstrip("*") == self.Object.Label:
|
||||
wp._previous()
|
||||
if autoclip:
|
||||
vobj.CutView = False
|
||||
else:
|
||||
wp.align_to_selection()
|
||||
if autoclip:
|
||||
vobj.CutView = True
|
||||
|
||||
def writeCamera(self):
|
||||
|
||||
|
||||
@@ -124,8 +124,8 @@ class CommandArchCurtainWall:
|
||||
else:
|
||||
# interactive line drawing
|
||||
self.points = []
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
FreeCAD.DraftWorkingPlane.setup()
|
||||
import WorkingPlane
|
||||
WorkingPlane.get_working_plane()
|
||||
if hasattr(FreeCADGui,"Snapper"):
|
||||
FreeCADGui.Snapper.getPoint(callback=self.getPoint)
|
||||
|
||||
|
||||
@@ -46,8 +46,9 @@ __url__ = "http://www.freecad.org"
|
||||
def getPlanWithLine(line):
|
||||
"""Function to make a plane along Normal plan"""
|
||||
import Part
|
||||
plan = FreeCAD.DraftWorkingPlane
|
||||
w = plan.getNormal()
|
||||
import WorkingPlane
|
||||
plan = WorkingPlane.get_working_plane()
|
||||
w = plan.axis
|
||||
part = Part.Shape(line)
|
||||
out = part.extrude(w)
|
||||
return out
|
||||
|
||||
@@ -583,8 +583,8 @@ class Nester:
|
||||
|
||||
# flatten the polygon on the XY plane
|
||||
|
||||
wp = WorkingPlane.plane()
|
||||
wp.alignToPointAndAxis(face.CenterOfMass,face.normalAt(0,0))
|
||||
wp = WorkingPlane.PlaneBase()
|
||||
wp.align_to_point_and_axis(face.CenterOfMass,face.normalAt(0,0))
|
||||
pverts = []
|
||||
for v in verts:
|
||||
vx = DraftVecUtils.project(v,wp.u)
|
||||
|
||||
@@ -165,9 +165,9 @@ class CommandPanel:
|
||||
return
|
||||
|
||||
# interactive mode
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
FreeCAD.DraftWorkingPlane.setup()
|
||||
|
||||
import WorkingPlane
|
||||
WorkingPlane.get_working_plane()
|
||||
|
||||
self.points = []
|
||||
self.tracker = DraftTrackers.boxTracker()
|
||||
self.tracker.width(self.Width)
|
||||
@@ -434,8 +434,6 @@ class _Panel(ArchComponent.Component):
|
||||
if self.clone(obj):
|
||||
return
|
||||
|
||||
import Part #, DraftGeomUtils
|
||||
|
||||
layers = []
|
||||
length = 0
|
||||
width = 0
|
||||
|
||||
@@ -74,7 +74,8 @@ def makeSectionPlane(objectslist=None,name=None):
|
||||
for o in Draft.get_group_contents(objectslist):
|
||||
if hasattr(o,"Shape") and hasattr(o.Shape,"BoundBox"):
|
||||
bb.add(o.Shape.BoundBox)
|
||||
obj.Placement = FreeCAD.DraftWorkingPlane.getPlacement()
|
||||
import WorkingPlane
|
||||
obj.Placement = WorkingPlane.get_working_plane().get_placement()
|
||||
obj.Placement.Base = bb.Center
|
||||
if FreeCAD.GuiUp:
|
||||
margin = bb.XLength*0.1
|
||||
@@ -391,13 +392,13 @@ def getSVG(source,
|
||||
svgcache = ''
|
||||
# render using the Arch Vector Renderer
|
||||
import ArchVRM, WorkingPlane
|
||||
wp = WorkingPlane.plane()
|
||||
wp = WorkingPlane.PlaneBase()
|
||||
pl = FreeCAD.Placement(source.Placement)
|
||||
if source.ViewObject and hasattr(source.ViewObject,"CutMargin"):
|
||||
mv = pl.multVec(FreeCAD.Vector(0,0,1))
|
||||
mv.multiply(source.ViewObject.CutMargin)
|
||||
pl.move(mv)
|
||||
wp.setFromPlacement(pl)
|
||||
wp.align_to_placement(pl)
|
||||
#wp.inverse()
|
||||
render = ArchVRM.Renderer()
|
||||
render.setWorkingPlane(wp)
|
||||
@@ -748,9 +749,9 @@ def getCoinSVG(cutplane,objs,cameradata=None,linewidth=0.2,singleface=False,face
|
||||
factor = None
|
||||
trans = None
|
||||
import WorkingPlane
|
||||
wp = WorkingPlane.plane()
|
||||
wp.alignToPointAndAxis_SVG(Vector(0,0,0),cutplane.normalAt(0,0),0)
|
||||
p = wp.getLocalCoords(markervec)
|
||||
wp = WorkingPlane.PlaneBase()
|
||||
wp.align_to_point_and_axis_svg(Vector(0,0,0),cutplane.normalAt(0,0),0)
|
||||
p = wp.get_local_coords(markervec)
|
||||
orlength = FreeCAD.Vector(p.x,p.y,0).Length
|
||||
marker = re.findall("<line x1=.*?stroke=\"\#ffffff\".*?\/>",svg)
|
||||
if marker:
|
||||
@@ -763,7 +764,7 @@ def getCoinSVG(cutplane,objs,cameradata=None,linewidth=0.2,singleface=False,face
|
||||
p2 = FreeCAD.Vector(x2,y2,0)
|
||||
factor = orlength/p2.sub(p1).Length
|
||||
if factor:
|
||||
orig = wp.getLocalCoords(FreeCAD.Vector(boundbox.XMin,boundbox.YMin,boundbox.ZMin))
|
||||
orig = wp.get_local_coords(FreeCAD.Vector(boundbox.XMin,boundbox.YMin,boundbox.ZMin))
|
||||
orig = FreeCAD.Vector(orig.x,-orig.y,0)
|
||||
scaledp1 = FreeCAD.Vector(p1.x*factor,p1.y*factor,0)
|
||||
trans = orig.sub(scaledp1)
|
||||
|
||||
@@ -170,9 +170,8 @@ def placeAlongEdge(p1,p2,horizontal=False):
|
||||
|
||||
pl = FreeCAD.Placement()
|
||||
pl.Base = p1
|
||||
up = FreeCAD.Vector(0,0,1)
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
up = FreeCAD.DraftWorkingPlane.axis
|
||||
import WorkingPlane
|
||||
up = WorkingPlane.get_working_plane(update=False).axis
|
||||
zaxis = p2.sub(p1)
|
||||
yaxis = up.cross(zaxis)
|
||||
if yaxis.Length > 0:
|
||||
@@ -290,6 +289,7 @@ class _CommandStructure:
|
||||
self.bpoint = None
|
||||
self.bmode = False
|
||||
self.precastvalues = None
|
||||
self.wp = None
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
if sel:
|
||||
st = Draft.getObjectsOfType(sel,"Structure")
|
||||
@@ -309,15 +309,15 @@ class _CommandStructure:
|
||||
return
|
||||
|
||||
# interactive mode
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
FreeCAD.DraftWorkingPlane.setup()
|
||||
import WorkingPlane
|
||||
self.wp = WorkingPlane.get_working_plane()
|
||||
|
||||
self.points = []
|
||||
self.tracker = DraftTrackers.boxTracker()
|
||||
self.tracker.width(self.Width)
|
||||
self.tracker.height(self.Height)
|
||||
self.tracker.length(self.Length)
|
||||
self.tracker.setRotation(FreeCAD.DraftWorkingPlane.getRotation().Rotation)
|
||||
self.tracker.setRotation(self.wp.get_placement().Rotation)
|
||||
self.tracker.on()
|
||||
self.precast = ArchPrecast._PrecastTaskPanel()
|
||||
self.dents = ArchPrecast._DentsTaskPanel()
|
||||
@@ -344,6 +344,7 @@ class _CommandStructure:
|
||||
horiz = True # determines the type of rotation to apply to the final object
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Structure"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
FreeCADGui.addModule("WorkingPlane")
|
||||
if self.Profile is not None:
|
||||
try: # try to update latest precast values - fails if dialog has been destroyed already
|
||||
self.precastvalues = self.precast.getValues()
|
||||
@@ -361,8 +362,7 @@ class _CommandStructure:
|
||||
delta = FreeCAD.Vector(0,0-self.Width/2,0)
|
||||
else:
|
||||
delta = FreeCAD.Vector(-self.Length/2,-self.Width/2,0)
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
delta = FreeCAD.DraftWorkingPlane.getRotation().multVec(delta)
|
||||
delta = self.wp.get_global_coords(delta,as_vector=True)
|
||||
point = point.add(delta)
|
||||
if self.bpoint:
|
||||
self.bpoint = self.bpoint.add(delta)
|
||||
@@ -396,7 +396,8 @@ class _CommandStructure:
|
||||
FreeCADGui.doCommand('s.Placement = Arch.placeAlongEdge('+DraftVecUtils.toString(self.bpoint)+","+DraftVecUtils.toString(point)+","+str(horiz)+")")
|
||||
else:
|
||||
FreeCADGui.doCommand('s.Placement.Base = '+DraftVecUtils.toString(point))
|
||||
FreeCADGui.doCommand('s.Placement.Rotation = s.Placement.Rotation.multiply(FreeCAD.DraftWorkingPlane.getRotation().Rotation)')
|
||||
FreeCADGui.doCommand('wp = WorkingPlane.get_working_plane()')
|
||||
FreeCADGui.doCommand('s.Placement.Rotation = s.Placement.Rotation.multiply(wp.get_placement().Rotation)')
|
||||
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.doCommand("Draft.autogroup(s)")
|
||||
@@ -543,16 +544,14 @@ class _CommandStructure:
|
||||
delta = Vector(0,0,self.Height/2)
|
||||
else:
|
||||
delta = Vector(self.Length/2,0,0)
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
delta = FreeCAD.DraftWorkingPlane.getRotation().multVec(delta)
|
||||
delta = self.wp.get_global_coords(delta,as_vector=True)
|
||||
if self.modec.isChecked():
|
||||
self.tracker.pos(point.add(delta))
|
||||
self.tracker.on()
|
||||
else:
|
||||
if self.bpoint:
|
||||
delta = Vector(0,0,-self.Height/2)
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
delta = FreeCAD.DraftWorkingPlane.getRotation().multVec(delta)
|
||||
delta = self.wp.get_global_coords(delta,as_vector=True)
|
||||
self.tracker.update([self.bpoint.add(delta),point.add(delta)])
|
||||
self.tracker.on()
|
||||
l = (point.sub(self.bpoint)).Length
|
||||
|
||||
@@ -105,8 +105,8 @@ class CommandArchTruss:
|
||||
else:
|
||||
# interactive line drawing
|
||||
self.points = []
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
FreeCAD.DraftWorkingPlane.setup()
|
||||
import WorkingPlane
|
||||
WorkingPlane.get_working_plane()
|
||||
if hasattr(FreeCADGui,"Snapper"):
|
||||
FreeCADGui.Snapper.getPoint(callback=self.getPoint)
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ class Renderer:
|
||||
self.wp = wp
|
||||
else:
|
||||
import WorkingPlane
|
||||
self.wp = WorkingPlane.plane()
|
||||
self.wp = WorkingPlane.PlaneBase()
|
||||
|
||||
if DEBUG: print("Renderer initialized on " + str(self.wp))
|
||||
|
||||
@@ -92,7 +92,7 @@ class Renderer:
|
||||
def setWorkingPlane(self,wp):
|
||||
"sets a Draft WorkingPlane or Placement for this renderer"
|
||||
if isinstance(wp,FreeCAD.Placement):
|
||||
self.wp.setFromPlacement(wp)
|
||||
self.wp.align_to_placement(wp)
|
||||
else:
|
||||
self.wp = wp
|
||||
if DEBUG: print("Renderer set on " + str(self.wp))
|
||||
@@ -198,7 +198,7 @@ class Renderer:
|
||||
for e in edges:
|
||||
v = e.Vertexes[0].Point
|
||||
#print(v)
|
||||
v = self.wp.getLocalCoords(v)
|
||||
v = self.wp.get_local_coords(v)
|
||||
verts.append(v)
|
||||
verts.append(verts[0])
|
||||
if len(verts) > 2:
|
||||
@@ -211,7 +211,7 @@ class Renderer:
|
||||
return None
|
||||
else:
|
||||
# restoring flipped normals
|
||||
vnorm = self.wp.getLocalCoords(norm)
|
||||
vnorm = self.wp.get_local_coords(norm)
|
||||
if vnorm.getAngle(sh.normalAt(0,0)) > 1:
|
||||
sh.reverse()
|
||||
#print("VRM: projectFace end: ",len(sh.Vertexes)," verts")
|
||||
@@ -220,8 +220,8 @@ class Renderer:
|
||||
def projectEdge(self,edge):
|
||||
"projects a single edge on the WP"
|
||||
if len(edge.Vertexes) > 1:
|
||||
v1 = self.wp.getLocalCoords(edge.Vertexes[0].Point)
|
||||
v2 = self.wp.getLocalCoords(edge.Vertexes[-1].Point)
|
||||
v1 = self.wp.get_local_coords(edge.Vertexes[0].Point)
|
||||
v2 = self.wp.get_local_coords(edge.Vertexes[-1].Point)
|
||||
return Part.LineSegment(v1,v2).toShape()
|
||||
return edge
|
||||
|
||||
@@ -293,7 +293,7 @@ class Renderer:
|
||||
|
||||
# http://paulbourke.net/geometry/insidepoly/
|
||||
count = 0
|
||||
p = self.wp.getLocalCoords(vert.Point)
|
||||
p = self.wp.get_local_coords(vert.Point)
|
||||
for e in face[0].Edges:
|
||||
p1 = e.Vertexes[0].Point
|
||||
p2 = e.Vertexes[-1].Point
|
||||
|
||||
@@ -316,6 +316,7 @@ class _CommandWall:
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
done = False
|
||||
self.existing = []
|
||||
self.wp = None
|
||||
|
||||
if sel:
|
||||
# automatic mode
|
||||
@@ -345,9 +346,9 @@ class _CommandWall:
|
||||
# interactive mode
|
||||
|
||||
self.points = []
|
||||
import WorkingPlane
|
||||
self.wp = WorkingPlane.get_working_plane()
|
||||
self.tracker = DraftTrackers.boxTracker()
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
FreeCAD.DraftWorkingPlane.setup()
|
||||
FreeCADGui.Snapper.getPoint(callback=self.getPoint,
|
||||
extradlg=self.taskbox(),
|
||||
title=translate("Arch","First point of wall")+":")
|
||||
@@ -386,8 +387,8 @@ class _CommandWall:
|
||||
|
||||
elif len(self.points) == 2:
|
||||
import Part
|
||||
l = Part.LineSegment(FreeCAD.DraftWorkingPlane.getLocalCoords(self.points[0]),
|
||||
FreeCAD.DraftWorkingPlane.getLocalCoords(self.points[1]))
|
||||
l = Part.LineSegment(self.wp.get_local_coords(self.points[0]),
|
||||
self.wp.get_local_coords(self.points[1]))
|
||||
self.tracker.finalize()
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Wall"))
|
||||
FreeCADGui.addModule("Arch")
|
||||
@@ -431,6 +432,8 @@ class _CommandWall:
|
||||
"""
|
||||
|
||||
FreeCADGui.addModule("Draft")
|
||||
FreeCADGui.addModule("WorkingPlane")
|
||||
FreeCADGui.doCommand("wp = WorkingPlane.get_working_plane()")
|
||||
if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetBool("WallSketches",True):
|
||||
# Use ArchSketch if SketchArch add-on is present
|
||||
try:
|
||||
@@ -439,13 +442,13 @@ class _CommandWall:
|
||||
FreeCADGui.doCommand('base=ArchSketchObject.makeArchSketch()')
|
||||
except:
|
||||
FreeCADGui.doCommand('base=FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject","WallTrace")')
|
||||
FreeCADGui.doCommand('base.Placement = FreeCAD.DraftWorkingPlane.getPlacement()')
|
||||
FreeCADGui.doCommand('base.Placement = wp.get_placement()')
|
||||
FreeCADGui.doCommand('base.addGeometry(trace)')
|
||||
else:
|
||||
FreeCADGui.doCommand('base=Draft.makeLine(trace)')
|
||||
FreeCADGui.doCommand('FreeCAD.ActiveDocument.recompute()')
|
||||
FreeCADGui.doCommand('wall = Arch.makeWall(base,width='+str(self.Width)+',height='+str(self.Height)+',align="'+str(self.Align)+'")')
|
||||
FreeCADGui.doCommand('wall.Normal = FreeCAD.DraftWorkingPlane.getNormal()')
|
||||
FreeCADGui.doCommand('wall.Normal = wp.axis')
|
||||
if self.MultiMat:
|
||||
FreeCADGui.doCommand("wall.Material = FreeCAD.ActiveDocument."+self.MultiMat.Name)
|
||||
FreeCADGui.doCommand("Draft.autogroup(wall)")
|
||||
@@ -467,7 +470,7 @@ class _CommandWall:
|
||||
|
||||
if FreeCADGui.Control.activeDialog():
|
||||
b = self.points[0]
|
||||
n = FreeCAD.DraftWorkingPlane.axis
|
||||
n = self.wp.axis
|
||||
bv = point.sub(b)
|
||||
dv = bv.cross(n)
|
||||
dv = DraftVecUtils.scaleTo(dv,self.Width/2)
|
||||
|
||||
@@ -186,6 +186,7 @@ class _CommandWindow:
|
||||
self.Include = True
|
||||
self.baseFace = None
|
||||
self.wparams = ["Width","Height","H1","H2","H3","W1","W2","O1","O2"]
|
||||
self.wp = None
|
||||
|
||||
# autobuild mode
|
||||
if FreeCADGui.Selection.getSelectionEx():
|
||||
@@ -235,8 +236,8 @@ class _CommandWindow:
|
||||
return
|
||||
|
||||
# interactive mode
|
||||
if hasattr(FreeCAD,"DraftWorkingPlane"):
|
||||
FreeCAD.DraftWorkingPlane.setup()
|
||||
import WorkingPlane
|
||||
self.wp = WorkingPlane.get_working_plane()
|
||||
|
||||
self.tracker = DraftTrackers.boxTracker()
|
||||
self.tracker.length(self.Width)
|
||||
@@ -274,8 +275,8 @@ class _CommandWindow:
|
||||
point = point.add(FreeCAD.Vector(0,0,self.Sill))
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Window"))
|
||||
|
||||
FreeCADGui.doCommand("import math, FreeCAD, Arch, DraftGeomUtils")
|
||||
FreeCADGui.doCommand("wp = FreeCAD.DraftWorkingPlane")
|
||||
FreeCADGui.doCommand("import math, FreeCAD, Arch, DraftGeomUtils, WorkingPlane")
|
||||
FreeCADGui.doCommand("wp = WorkingPlane.get_working_plane()")
|
||||
|
||||
if self.baseFace is not None:
|
||||
FreeCADGui.doCommand("face = FreeCAD.ActiveDocument." + self.baseFace[0].Name + ".Shape.Faces[" + str(self.baseFace[1]) + "]")
|
||||
@@ -342,9 +343,8 @@ class _CommandWindow:
|
||||
delta = FreeCAD.Vector(self.Width/2,self.Thickness/2,self.Height/2)
|
||||
delta = delta.add(FreeCAD.Vector(0,0,self.Sill))
|
||||
|
||||
wp = FreeCAD.DraftWorkingPlane
|
||||
if self.baseFace is None:
|
||||
rot = FreeCAD.Rotation(wp.u,wp.v,-wp.axis,"XZY")
|
||||
rot = FreeCAD.Rotation(self.wp.u,self.wp.v,-self.wp.axis,"XZY")
|
||||
self.tracker.setRotation(rot)
|
||||
if info:
|
||||
if "Face" in info['Component']:
|
||||
@@ -353,7 +353,7 @@ class _CommandWindow:
|
||||
self.baseFace = [o,int(info['Component'][4:])-1]
|
||||
#print("switching to ",o.Label," face ",self.baseFace[1])
|
||||
f = o.Shape.Faces[self.baseFace[1]]
|
||||
p = DraftGeomUtils.placement_from_face(f,vec_z=wp.axis,rotated=True)
|
||||
p = DraftGeomUtils.placement_from_face(f,vec_z=self.wp.axis,rotated=True)
|
||||
rot = p.Rotation
|
||||
self.tracker.setRotation(rot)
|
||||
r = self.tracker.trans.rotation.getValue().getValue()
|
||||
|
||||
@@ -714,9 +714,7 @@ def getRotation(entity):
|
||||
w = FreeCAD.Vector(entity.Axis3.DirectionRatios)
|
||||
except AttributeError:
|
||||
return FreeCAD.Rotation()
|
||||
import WorkingPlane
|
||||
p = WorkingPlane.plane(u=u, v=v, w=w)
|
||||
return p.getRotation().Rotation
|
||||
return FreeCAD.Rotation(u, v, w, "ZYX")
|
||||
|
||||
|
||||
def getPlacement(entity,scaling=1000):
|
||||
|
||||
@@ -73,6 +73,7 @@ class Draft_SelectPlane:
|
||||
App.activeDraftCommand.finish()
|
||||
|
||||
App.activeDraftCommand = self
|
||||
self.call = None
|
||||
|
||||
# Set variables
|
||||
self.wp = WorkingPlane.get_working_plane()
|
||||
@@ -134,6 +135,7 @@ class Draft_SelectPlane:
|
||||
if Gui.Selection.hasSelection():
|
||||
if self.wp.align_to_selection(self.offset):
|
||||
Gui.Selection.clearSelection()
|
||||
self.finish()
|
||||
return
|
||||
|
||||
# Execute the actual task panel delayed to catch possible active Draft command
|
||||
|
||||
@@ -77,6 +77,7 @@ class Facebinder(DraftObject):
|
||||
if "Face" in sub:
|
||||
try:
|
||||
face = Part.getShape(sel[0], sub, needSubElement=True, retType=0)
|
||||
area += face.Area
|
||||
if offs_val:
|
||||
if face.Surface.isPlanar():
|
||||
norm = face.normalAt(0, 0)
|
||||
@@ -86,14 +87,14 @@ class Facebinder(DraftObject):
|
||||
else:
|
||||
offs = face.makeOffsetShape(offs_val, 1e-7)
|
||||
faces.extend(offs.Faces)
|
||||
area += face.Area
|
||||
else:
|
||||
faces.append(face)
|
||||
except Part.OCCError:
|
||||
print("Draft: error building facebinder")
|
||||
return
|
||||
if not faces:
|
||||
return
|
||||
try:
|
||||
sh = None
|
||||
if extr_val:
|
||||
extrs = []
|
||||
for face in faces:
|
||||
@@ -103,23 +104,26 @@ class Facebinder(DraftObject):
|
||||
else:
|
||||
extr = face.makeOffsetShape(extr_val, 1e-7, fill=True)
|
||||
extrs.extend(extr.Solids)
|
||||
sh = extrs.pop()
|
||||
sh = sh.multiFuse(extrs)
|
||||
shp = Part.Shape() # create empty shape to ensure default Placement
|
||||
shp = shp.fuse(extrs.pop()) # add 1st shape, multiFuse does not work otherwise
|
||||
if extrs:
|
||||
shp = shp.multiFuse(extrs) # multiFuse is more reliable than serial fuse
|
||||
else:
|
||||
shp = Part.Shape()
|
||||
shp = shp.fuse(faces.pop())
|
||||
if faces:
|
||||
shp = shp.multiFuse(faces)
|
||||
if len(faces) > 1:
|
||||
if not sh:
|
||||
sh = faces.pop()
|
||||
sh = sh.multiFuse(faces)
|
||||
if hasattr(obj, "Sew") and obj.Sew:
|
||||
sh.sewShape()
|
||||
shp.sewShape()
|
||||
if not hasattr(obj, "RemoveSplitter"):
|
||||
sh = sh.removeSplitter()
|
||||
shp = shp.removeSplitter()
|
||||
elif obj.RemoveSplitter:
|
||||
sh = sh.removeSplitter()
|
||||
shp = shp.removeSplitter()
|
||||
except Part.OCCError:
|
||||
print("Draft: error building facebinder")
|
||||
return
|
||||
obj.Shape = sh
|
||||
obj.Placement = pl
|
||||
obj.Shape = shp
|
||||
obj.Area = area
|
||||
self.props_changed_clear()
|
||||
|
||||
|
||||
@@ -66,24 +66,28 @@ TaskFemConstraintTemperature::TaskFemConstraintTemperature(
|
||||
std::vector<std::string> SubElements = pcConstraint->References.getSubValues();
|
||||
|
||||
// Fill data into dialog elements
|
||||
ui->if_temperature->setMinimum(0);
|
||||
ui->if_temperature->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_temperature->setMinimum(0);
|
||||
ui->qsb_temperature->setMaximum(FLOAT_MAX);
|
||||
ui->qsb_cflux->setMinimum(-FLOAT_MAX);
|
||||
ui->qsb_cflux->setMaximum(FLOAT_MAX);
|
||||
|
||||
std::string constraint_type = pcConstraint->ConstraintType.getValueAsString();
|
||||
if (constraint_type == "Temperature") {
|
||||
ui->rb_temperature->setChecked(true);
|
||||
ui->if_temperature->setValue(pcConstraint->Temperature.getQuantityValue());
|
||||
App::PropertyEnumeration* constrType = &pcConstraint->ConstraintType;
|
||||
QStringList qTypeList;
|
||||
for (auto item : constrType->getEnumVector()) {
|
||||
qTypeList << QString::fromUtf8(item.c_str());
|
||||
}
|
||||
|
||||
ui->if_temperature->bind(pcConstraint->Temperature);
|
||||
ui->if_temperature->setUnit(pcConstraint->Temperature.getUnit());
|
||||
}
|
||||
else if (constraint_type == "CFlux") {
|
||||
ui->rb_cflux->setChecked(true);
|
||||
std::string str = "Concentrated heat flux";
|
||||
ui->if_temperature->setValue(pcConstraint->CFlux.getQuantityValue());
|
||||
ui->if_temperature->bind(pcConstraint->CFlux);
|
||||
ui->if_temperature->setUnit(pcConstraint->CFlux.getUnit());
|
||||
}
|
||||
ui->cb_constr_type->addItems(qTypeList);
|
||||
ui->cb_constr_type->setCurrentIndex(constrType->getValue());
|
||||
onConstrTypeChanged(constrType->getValue());
|
||||
|
||||
ui->qsb_temperature->setValue(pcConstraint->Temperature.getQuantityValue());
|
||||
ui->qsb_temperature->bind(pcConstraint->Temperature);
|
||||
ui->qsb_temperature->setUnit(pcConstraint->Temperature.getUnit());
|
||||
|
||||
ui->qsb_cflux->setValue(pcConstraint->CFlux.getQuantityValue());
|
||||
ui->qsb_cflux->bind(pcConstraint->CFlux);
|
||||
ui->qsb_cflux->setUnit(pcConstraint->CFlux.getUnit());
|
||||
|
||||
ui->lw_references->clear();
|
||||
for (std::size_t i = 0; i < Objects.size(); i++) {
|
||||
@@ -108,12 +112,22 @@ TaskFemConstraintTemperature::TaskFemConstraintTemperature(
|
||||
&QListWidget::itemClicked,
|
||||
this,
|
||||
&TaskFemConstraintTemperature::setSelection);
|
||||
connect(ui->rb_temperature, &QRadioButton::clicked, this, &TaskFemConstraintTemperature::Temp);
|
||||
connect(ui->rb_cflux, &QRadioButton::clicked, this, &TaskFemConstraintTemperature::Flux);
|
||||
connect(ui->cb_constr_type,
|
||||
qOverload<int>(&QComboBox::activated),
|
||||
this,
|
||||
&TaskFemConstraintTemperature::onConstrTypeChanged);
|
||||
connect(ui->qsb_temperature,
|
||||
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
|
||||
this,
|
||||
&TaskFemConstraintTemperature::onTempChanged);
|
||||
connect(ui->qsb_cflux,
|
||||
qOverload<double>(&Gui::QuantitySpinBox::valueChanged),
|
||||
this,
|
||||
&TaskFemConstraintTemperature::onCFluxChanged);
|
||||
|
||||
// Selection buttons
|
||||
buttonGroup->addButton(ui->btnAdd, (int)SelectionChangeModes::refAdd);
|
||||
buttonGroup->addButton(ui->btnRemove, (int)SelectionChangeModes::refRemove);
|
||||
buttonGroup->addButton(ui->btnAdd, static_cast<int>(SelectionChangeModes::refAdd));
|
||||
buttonGroup->addButton(ui->btnRemove, static_cast<int>(SelectionChangeModes::refRemove));
|
||||
|
||||
updateUI();
|
||||
}
|
||||
@@ -129,20 +143,41 @@ void TaskFemConstraintTemperature::updateUI()
|
||||
}
|
||||
}
|
||||
|
||||
void TaskFemConstraintTemperature::Temp()
|
||||
void TaskFemConstraintTemperature::onTempChanged(double)
|
||||
{
|
||||
Fem::ConstraintTemperature* pcConstraint =
|
||||
static_cast<Fem::ConstraintTemperature*>(ConstraintView->getObject());
|
||||
ui->if_temperature->setUnit(pcConstraint->Temperature.getUnit());
|
||||
ui->if_temperature->setValue(pcConstraint->Temperature.getQuantityValue());
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.Temperature = \"%s\"",
|
||||
name.c_str(),
|
||||
get_temperature().c_str());
|
||||
}
|
||||
|
||||
void TaskFemConstraintTemperature::Flux()
|
||||
void TaskFemConstraintTemperature::onCFluxChanged(double)
|
||||
{
|
||||
Fem::ConstraintTemperature* pcConstraint =
|
||||
static_cast<Fem::ConstraintTemperature*>(ConstraintView->getObject());
|
||||
ui->if_temperature->setUnit(pcConstraint->CFlux.getUnit());
|
||||
ui->if_temperature->setValue(pcConstraint->CFlux.getQuantityValue());
|
||||
std::string name = ConstraintView->getObject()->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.CFlux = \"%s\"",
|
||||
name.c_str(),
|
||||
get_cflux().c_str());
|
||||
}
|
||||
|
||||
void TaskFemConstraintTemperature::onConstrTypeChanged(int item)
|
||||
{
|
||||
auto obj = static_cast<Fem::ConstraintTemperature*>(ConstraintView->getObject());
|
||||
obj->ConstraintType.setValue(item);
|
||||
const char* type = obj->ConstraintType.getValueAsString();
|
||||
if (strcmp(type, "Temperature") == 0) {
|
||||
ui->qsb_temperature->setVisible(true);
|
||||
ui->qsb_cflux->setVisible(false);
|
||||
ui->lbl_temperature->setVisible(true);
|
||||
ui->lbl_cflux->setVisible(false);
|
||||
}
|
||||
else if (strcmp(type, "CFlux") == 0) {
|
||||
ui->qsb_cflux->setVisible(true);
|
||||
ui->qsb_temperature->setVisible(false);
|
||||
ui->lbl_cflux->setVisible(true);
|
||||
ui->lbl_temperature->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void TaskFemConstraintTemperature::addToSelection()
|
||||
@@ -270,25 +305,17 @@ const std::string TaskFemConstraintTemperature::getReferences() const
|
||||
|
||||
std::string TaskFemConstraintTemperature::get_temperature() const
|
||||
{
|
||||
return ui->if_temperature->value().getSafeUserString().toStdString();
|
||||
return ui->qsb_temperature->value().getSafeUserString().toStdString();
|
||||
}
|
||||
|
||||
std::string TaskFemConstraintTemperature::get_cflux() const
|
||||
{
|
||||
return ui->if_temperature->value().getSafeUserString().toStdString();
|
||||
return ui->qsb_cflux->value().getSafeUserString().toStdString();
|
||||
}
|
||||
|
||||
std::string TaskFemConstraintTemperature::get_constraint_type() const
|
||||
{
|
||||
std::string type;
|
||||
|
||||
if (ui->rb_temperature->isChecked()) {
|
||||
type = "\"Temperature\"";
|
||||
}
|
||||
else if (ui->rb_cflux->isChecked()) {
|
||||
type = "\"CFlux\"";
|
||||
}
|
||||
return type;
|
||||
return ui->cb_constr_type->currentText().toStdString();
|
||||
}
|
||||
|
||||
bool TaskFemConstraintTemperature::event(QEvent* e)
|
||||
@@ -357,7 +384,7 @@ bool TaskDlgFemConstraintTemperature::accept()
|
||||
|
||||
try {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.ConstraintType = %s",
|
||||
"App.ActiveDocument.%s.ConstraintType = \"%s\"",
|
||||
name.c_str(),
|
||||
parameterTemperature->get_constraint_type().c_str());
|
||||
if (type == "Temperature") {
|
||||
|
||||
@@ -55,8 +55,9 @@ public:
|
||||
|
||||
private Q_SLOTS:
|
||||
void onReferenceDeleted();
|
||||
void Temp();
|
||||
void Flux();
|
||||
void onConstrTypeChanged(int item);
|
||||
void onCFluxChanged(double);
|
||||
void onTempChanged(double);
|
||||
void addToSelection() override;
|
||||
void removeFromSelection() override;
|
||||
|
||||
|
||||
@@ -49,42 +49,45 @@
|
||||
<widget class="QListWidget" name="lw_references"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_temperature">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_constr_type">
|
||||
<property name="text">
|
||||
<string>Temperature</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
<string>Constraint type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="rb_cflux">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cb_constr_type"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_temperature">
|
||||
<property name="text">
|
||||
<string>Temperature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsb_temperature">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">K</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lbl_cflux">
|
||||
<property name="text">
|
||||
<string>Concentrated heat flux</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layoutTemperature">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbl_type">
|
||||
<property name="text">
|
||||
<string>Temperature</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Gui::QuantitySpinBox" name="if_temperature">
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::QuantitySpinBox" name="qsb_cflux">
|
||||
<property name="unit" stdset="0">
|
||||
<string notr="true">K</string>
|
||||
<string notr="true">mW</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.000000000000000</double>
|
||||
|
||||
@@ -6,16 +6,22 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>264</width>
|
||||
<height>142</height>
|
||||
<width>344</width>
|
||||
<height>160</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Sprocket parameter</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Number of teeth:</string>
|
||||
</property>
|
||||
@@ -23,6 +29,12 @@
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="spinBox_NumberOfTeeth">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
@@ -43,6 +55,12 @@
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboBox_SprocketReference">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>ANSI 25</string>
|
||||
@@ -205,7 +223,7 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="Gui::InputField" name="Quantity_Pitch">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -245,14 +263,14 @@
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Roller Diameter:</string>
|
||||
<string>Chain Roller Diameter:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="Gui::InputField" name="Quantity_RollerDiameter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@@ -289,14 +307,14 @@
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Thickness:</string>
|
||||
<string>Tooth Width</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="Gui::InputField" name="Quantity_Thickness">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
||||
@@ -346,21 +346,25 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
# Note that emitting preambles between moves breaks some dressups and prevents path optimization on some controllers
|
||||
pathParams["preamble"] = False
|
||||
|
||||
if self.endVector is None:
|
||||
verts = hWire.Wires[0].Vertexes
|
||||
idx = 0
|
||||
if obj.Direction == "CCW":
|
||||
idx = len(verts) - 1
|
||||
x = verts[idx].X
|
||||
y = verts[idx].Y
|
||||
# Zero start value adjustments for Path.fromShapes() bug
|
||||
if Path.Geom.isRoughly(x, 0.0):
|
||||
x = 0.00001
|
||||
if Path.Geom.isRoughly(y, 0.0):
|
||||
y = 0.00001
|
||||
pathParams["start"] = FreeCAD.Vector(x, y, verts[0].Z)
|
||||
else:
|
||||
pathParams["start"] = self.endVector
|
||||
# Always manually setting pathParams["start"] to the first or
|
||||
# last vertex of the wire (depending on obj.Direction) ensures
|
||||
# the edge is always milled in the correct direction. Using
|
||||
# self.endVector would allow Path.fromShapes to reverse the
|
||||
# direction if that would shorten the travel move and thus cause
|
||||
# the edges being milled in seemingly random directions.
|
||||
|
||||
verts = hWire.Wires[0].Vertexes
|
||||
idx = 0
|
||||
if obj.Direction == "CCW":
|
||||
idx = len(verts) - 1
|
||||
x = verts[idx].X
|
||||
y = verts[idx].Y
|
||||
# Zero start value adjustments for Path.fromShapes() bug
|
||||
if Path.Geom.isRoughly(x, 0.0):
|
||||
x = 0.00001
|
||||
if Path.Geom.isRoughly(y, 0.0):
|
||||
y = 0.00001
|
||||
pathParams["start"] = FreeCAD.Vector(x, y, verts[0].Z)
|
||||
|
||||
obj.PathParams = str(
|
||||
{key: value for key, value in pathParams.items() if key != "shapes"}
|
||||
|
||||
@@ -394,7 +394,7 @@ void SketcherToolDefaultWidget::setParameterLabel(int parameterindex, const QStr
|
||||
void SketcherToolDefaultWidget::setParameter(int parameterindex, double val)
|
||||
{
|
||||
if (parameterindex < nParameters) {
|
||||
getParameterSpinBox(parameterindex)->setValue(Base::Quantity(val, Base::Unit::Length));
|
||||
getParameterSpinBox(parameterindex)->setValue(val);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -424,6 +424,45 @@ void SketcherToolDefaultWidget::configureParameterUnit(int parameterindex, const
|
||||
QT_TRANSLATE_NOOP("Exceptions", "ToolWidget parameter index out of range"));
|
||||
}
|
||||
|
||||
void SketcherToolDefaultWidget::configureParameterDecimals(int parameterindex, int val)
|
||||
{
|
||||
Base::StateLocker lock(blockParameterSlots, true);
|
||||
if (parameterindex < nParameters) {
|
||||
getParameterSpinBox(parameterindex)->setDecimals(val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
THROWM(Base::IndexError,
|
||||
QT_TRANSLATE_NOOP("Exceptions", "ToolWidget parameter index out of range"));
|
||||
}
|
||||
|
||||
void SketcherToolDefaultWidget::configureParameterMin(int parameterindex, double val)
|
||||
{
|
||||
Base::StateLocker lock(blockParameterSlots, true);
|
||||
if (parameterindex < nParameters) {
|
||||
getParameterSpinBox(parameterindex)->setMinimum(val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
THROWM(Base::IndexError,
|
||||
QT_TRANSLATE_NOOP("Exceptions", "ToolWidget parameter index out of range"));
|
||||
}
|
||||
|
||||
void SketcherToolDefaultWidget::configureParameterMax(int parameterindex, double val)
|
||||
{
|
||||
Base::StateLocker lock(blockParameterSlots, true);
|
||||
if (parameterindex < nParameters) {
|
||||
getParameterSpinBox(parameterindex)->setMaximum(val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
THROWM(Base::IndexError,
|
||||
QT_TRANSLATE_NOOP("Exceptions", "ToolWidget parameter index out of range"));
|
||||
}
|
||||
|
||||
void SketcherToolDefaultWidget::setParameterEnabled(int parameterindex, bool active)
|
||||
{
|
||||
if (parameterindex < nParameters) {
|
||||
@@ -714,6 +753,20 @@ void SketcherToolDefaultWidget::restoreCheckBoxPref(int checkboxindex)
|
||||
}
|
||||
}
|
||||
|
||||
void SketcherToolDefaultWidget::setCheckboxIcon(int checkboxindex, QIcon icon)
|
||||
{
|
||||
if (checkboxindex < nCheckbox) {
|
||||
getCheckBox(checkboxindex)->setIcon(icon);
|
||||
}
|
||||
}
|
||||
|
||||
void SketcherToolDefaultWidget::setComboboxItemIcon(int comboboxindex, int index, QIcon icon)
|
||||
{
|
||||
if (comboboxindex < nCombobox) {
|
||||
getComboBox(comboboxindex)->setItemIcon(index, icon);
|
||||
}
|
||||
}
|
||||
|
||||
void SketcherToolDefaultWidget::setComboboxPrefEntry(int comboboxindex,
|
||||
const std::string& prefEntry)
|
||||
{
|
||||
|
||||
@@ -146,6 +146,9 @@ public:
|
||||
void setParameter(int parameterindex, double val);
|
||||
void configureParameterInitialValue(int parameterindex, double value);
|
||||
void configureParameterUnit(int parameterindex, const Base::Unit& unit);
|
||||
void configureParameterDecimals(int parameterindex, int val);
|
||||
void configureParameterMax(int parameterindex, double val);
|
||||
void configureParameterMin(int parameterindex, double val);
|
||||
double getParameter(int parameterindex);
|
||||
bool isParameterSet(int parameterindex);
|
||||
void
|
||||
@@ -172,6 +175,7 @@ public:
|
||||
void setCheckboxToolTip(int checkboxindex, const QString& string);
|
||||
bool getCheckboxChecked(int checkboxindex);
|
||||
void setCheckboxPrefEntry(int checkboxindex, const std::string& prefEntry);
|
||||
void setCheckboxIcon(int checkboxindex, QIcon icon);
|
||||
void restoreCheckBoxPref(int checkboxindex);
|
||||
|
||||
void initNComboboxes(int ncombobox);
|
||||
@@ -180,6 +184,7 @@ public:
|
||||
void setComboboxLabel(int comboboxindex, const QString& string);
|
||||
int getComboboxIndex(int comboboxindex);
|
||||
void setComboboxElements(int comboboxindex, const QStringList& names);
|
||||
void setComboboxItemIcon(int comboboxindex, int index, QIcon icon);
|
||||
void setComboboxPrefEntry(int comboboxindex, const std::string& prefEntry);
|
||||
void restoreComboboxPref(int comboboxindex);
|
||||
|
||||
|
||||
@@ -1066,11 +1066,12 @@ void execLine2Points(Gui::Command* cmd)
|
||||
//check if editing existing edge
|
||||
if (!edgeNames.empty() && (edgeNames.size() == 1)) {
|
||||
TechDraw::CosmeticEdge* ce = baseFeat->getCosmeticEdgeBySelection(edgeNames.front());
|
||||
if (!ce) {
|
||||
if (!ce || ce->m_geometry->getGeomType() != TechDraw::GeomType::GENERIC) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr("Selection is not a Cosmetic Line."));
|
||||
return;
|
||||
}
|
||||
|
||||
Gui::Control().showDialog(new TaskDlgCosmeticLine(baseFeat,
|
||||
edgeNames.front()));
|
||||
return;
|
||||
@@ -1208,11 +1209,14 @@ void execCosmeticCircle(Gui::Command* cmd)
|
||||
//check if editing existing edge
|
||||
if (!edgeNames.empty() && (edgeNames.size() == 1)) {
|
||||
TechDraw::CosmeticEdge* ce = baseFeat->getCosmeticEdgeBySelection(edgeNames.front());
|
||||
if (!ce) {
|
||||
if (!ce
|
||||
|| !(ce->m_geometry->getGeomType() == TechDraw::GeomType::CIRCLE
|
||||
|| ce->m_geometry->getGeomType() == TechDraw::GeomType::ARCOFCIRCLE)) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong Selection"),
|
||||
QObject::tr("Selection is not a Cosmetic edge."));
|
||||
QObject::tr("Selection is not a Cosmetic Circle or a Cosmetic Arc of Circle."));
|
||||
return;
|
||||
}
|
||||
|
||||
Gui::Control().showDialog(new TaskDlgCosmeticCircle(baseFeat,
|
||||
edgeNames.front()));
|
||||
return;
|
||||
|
||||
@@ -289,6 +289,8 @@ void QGIViewPart::drawAllEdges()
|
||||
item->setNormalColor(PreferencesGui::getAccessibleQColor(PreferencesGui::normalQColor()));
|
||||
item->setStyle(Qt::SolidLine);
|
||||
if ((*itGeom)->getCosmetic()) {
|
||||
item->setCosmetic(true);
|
||||
|
||||
// cosmetic edge - format appropriately
|
||||
int source = (*itGeom)->source();
|
||||
if (source == COSMETICEDGE) {
|
||||
|
||||
Reference in New Issue
Block a user