Merge pull request #3 from mahaarbo/freecad0.17
Support for FreeCAD >0.16
This commit is contained in:
commit
bb0b9217dd
3 changed files with 34 additions and 20 deletions
10
ARFrames.py
10
ARFrames.py
|
@ -161,7 +161,7 @@ class ViewProviderFrame(object):
|
||||||
pl = fp.getPropertyByName("Placement")
|
pl = fp.getPropertyByName("Placement")
|
||||||
self.transform.translation = (pl.Base.x,
|
self.transform.translation = (pl.Base.x,
|
||||||
pl.Base.y,
|
pl.Base.y,
|
||||||
pl.Base.Z)
|
pl.Base.z)
|
||||||
self.transform.rotation = pl.Rotation.Q
|
self.transform.rotation = pl.Rotation.Q
|
||||||
|
|
||||||
def getDisplayModes(self, vobj):
|
def getDisplayModes(self, vobj):
|
||||||
|
@ -356,7 +356,6 @@ class FeatureFramePanel:
|
||||||
QtCore.QObject.connect(self.form.ChoicesBox,
|
QtCore.QObject.connect(self.form.ChoicesBox,
|
||||||
QtCore.SIGNAL("currentIndexChanged(QString)"),
|
QtCore.SIGNAL("currentIndexChanged(QString)"),
|
||||||
self.choiceChanged)
|
self.choiceChanged)
|
||||||
# Setting up relevant illustrations
|
|
||||||
self.scenes = {}
|
self.scenes = {}
|
||||||
for choice in self.choices:
|
for choice in self.choices:
|
||||||
sc = QtGui.QGraphicsScene()
|
sc = QtGui.QGraphicsScene()
|
||||||
|
@ -376,9 +375,12 @@ class FeatureFramePanel:
|
||||||
"PointOnSurface": PointOnSurfacePanel,
|
"PointOnSurface": PointOnSurfacePanel,
|
||||||
"Center": CenterPanel,
|
"Center": CenterPanel,
|
||||||
"PointOnCenterline": PointOnCenterlinePanel}
|
"PointOnCenterline": PointOnCenterlinePanel}
|
||||||
new_panel = paneldict[sel_choice](self.selected, self.so_desc)
|
pan = paneldict[sel_choice](self.selected, self.so_desc)
|
||||||
FreeCADGui.Control.closeDialog()
|
FreeCADGui.Control.closeDialog()
|
||||||
FreeCADGui.Control.showDialog(new_panel)
|
# The dialog is actually closed after the accept function has
|
||||||
|
# completed. So we need to use a delayed task to open the new dialog:
|
||||||
|
QtCore.QTimer.singleShot(0,
|
||||||
|
lambda: FreeCADGui.Control.showDialog(pan))
|
||||||
|
|
||||||
def reject(self):
|
def reject(self):
|
||||||
FreeCADGui.Control.closeDialog()
|
FreeCADGui.Control.closeDialog()
|
||||||
|
|
27
ARTools.py
27
ARTools.py
|
@ -393,7 +393,9 @@ def exportPartInfoAndFeaturesDialogue():
|
||||||
appendFeatureFrames(unique_selected[0], ofile)
|
appendFeatureFrames(unique_selected[0], ofile)
|
||||||
if len(unique_selected) > 1:
|
if len(unique_selected) > 1:
|
||||||
FreeCAD.Console.PrintWarning("Multi-part export not yet supported.\n")
|
FreeCAD.Console.PrintWarning("Multi-part export not yet supported.\n")
|
||||||
FreeCAD.Console.PrintMessage("Feature frames of " + str(unique_selected[0].Label) + " exported to " + str(ofile) + "\n")
|
FreeCAD.Console.PrintMessage("Feature frames of "
|
||||||
|
+ str(unique_selected[0].Label)
|
||||||
|
+ " exported to " + str(ofile) + "\n")
|
||||||
|
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
|
@ -419,7 +421,7 @@ def getPrimitiveInfo(prim_type, subobj, scale=1e-3):
|
||||||
d["radius"] = scale*subobj.Curve.Radius
|
d["radius"] = scale*subobj.Curve.Radius
|
||||||
d["center"] = vector2list(subobj.Curve.Center, scale)
|
d["center"] = vector2list(subobj.Curve.Center, scale)
|
||||||
d["axis"] = vector2list(subobj.Curve.Axis, scale=1)
|
d["axis"] = vector2list(subobj.Curve.Axis, scale=1)
|
||||||
d["paramerrange"] = subobj.ParameterRange
|
d["parameterrange"] = subobj.ParameterRange
|
||||||
elif prim_type == "ArcOfEllipse":
|
elif prim_type == "ArcOfEllipse":
|
||||||
d["center"] = vector2list(subobj.Curve.Center, scale)
|
d["center"] = vector2list(subobj.Curve.Center, scale)
|
||||||
d["axis"] = vector2list(subobj.Curve.Axis, scale=1)
|
d["axis"] = vector2list(subobj.Curve.Axis, scale=1)
|
||||||
|
@ -446,7 +448,7 @@ def getPrimitiveInfo(prim_type, subobj, scale=1e-3):
|
||||||
d["radius"] = scale*subobj.Curve.Radius
|
d["radius"] = scale*subobj.Curve.Radius
|
||||||
d["center"] = vector2list(subobj.Curve.Center, scale)
|
d["center"] = vector2list(subobj.Curve.Center, scale)
|
||||||
d["axis"] = vector2list(subobj.Curve.Axis, scale=1)
|
d["axis"] = vector2list(subobj.Curve.Axis, scale=1)
|
||||||
d["paramerrange"] = subobj.ParameterRange
|
d["parameterrange"] = subobj.ParameterRange
|
||||||
elif prim_type == "Ellipse":
|
elif prim_type == "Ellipse":
|
||||||
d["center"] = vector2list(subobj.Curve.Center, scale)
|
d["center"] = vector2list(subobj.Curve.Center, scale)
|
||||||
d["axis"] = vector2list(subobj.Curve.Axis, scale=1)
|
d["axis"] = vector2list(subobj.Curve.Axis, scale=1)
|
||||||
|
@ -466,10 +468,21 @@ def getPrimitiveInfo(prim_type, subobj, scale=1e-3):
|
||||||
d["center"] = vector2list(subobj.Curve.Center, scale)
|
d["center"] = vector2list(subobj.Curve.Center, scale)
|
||||||
d["focal"] = scale*subobj.Curve.Focal
|
d["focal"] = scale*subobj.Curve.Focal
|
||||||
elif prim_type == "Line":
|
elif prim_type == "Line":
|
||||||
if not subobj.Curve.Infinite:
|
if int(FreeCAD.Version()[1]) > 16:
|
||||||
d["startpoint"] = vector2list(subobj.Curve.StartPoint)
|
sp = subobj.valueAt(subobj.FirstParameter)
|
||||||
d["endpoint"] = vector2list(subobj.Curve.EndPoint)
|
ep = subobj.valueAt(subobj.LastParameter)
|
||||||
d["infinite"] = subobj.Curve.Infinite
|
d["startpoint"] = vector2list(sp)
|
||||||
|
d["endpoint"] = vector2list
|
||||||
|
else:
|
||||||
|
if not hasattr(subobj.Curve, "Infinite"):
|
||||||
|
d["startpoint"] = vector2list(subobj.Curve.StartPoint)
|
||||||
|
d["endpoint"] = vector2list(subobj.Curve.EndPoint)
|
||||||
|
if hasattr(subobj.Curve, "Infinite"):
|
||||||
|
if subobj.Curve.Infinite:
|
||||||
|
d["infinite"] = subobj.Curve.Infinite
|
||||||
|
else:
|
||||||
|
d["startpoint"] = vector2list(subobj.Curve.StartPoint)
|
||||||
|
d["endpoint"] = vector2list(subobj.Curve.EndPoint)
|
||||||
elif prim_type == "BSplineSurface":
|
elif prim_type == "BSplineSurface":
|
||||||
FreeCAD.Console.PrintWarning("getPrimitiveInfo of BSpline incomplete.")
|
FreeCAD.Console.PrintWarning("getPrimitiveInfo of BSpline incomplete.")
|
||||||
elif prim_type == "BezierSurface":
|
elif prim_type == "BezierSurface":
|
||||||
|
|
13
README.md
13
README.md
|
@ -3,18 +3,17 @@
|
||||||
Annotation for robotics bench. A FreeCAD workbench for annotating frames of interest, exporting these w.r.t. the part frame, and exporting part information.
|
Annotation for robotics bench. A FreeCAD workbench for annotating frames of interest, exporting these w.r.t. the part frame, and exporting part information.
|
||||||
|
|
||||||
# Installation instructions
|
# Installation instructions
|
||||||
This workbench uses freecad 0.16 so far.
|
This workbench supports versions of FreeCAD>0.16.
|
||||||
|
|
||||||
0. If you're on ubuntu 14.04, you have to run: `sudo add-apt-reposityory ppa:freecad-maintainers/freecad-stable` then `sudo apt-get update`,
|
1. [Install FreeCAD](https://www.freecadweb.org/wiki/Installing)
|
||||||
1. Install FreeCAD
|
2. If you're not on Ubuntu follow the [workbench installation instructions](https://www.freecadweb.org/wiki/How_to_install_additional_workbenches) or you can do the following on Ubuntu.
|
||||||
`sudo apt-get install Freecad`
|
3. Custom workbenches are located in `.FreeCAD/Mod/` under your home directory
|
||||||
2. Custom workbenches are located in `.FreeCAD/Mod/` under your home directory
|
|
||||||
`cd ~/.FreeCAD/Mod/`
|
`cd ~/.FreeCAD/Mod/`
|
||||||
3. Either
|
3. Either
|
||||||
- Clone the repository there
|
- Clone the repository there
|
||||||
- symlink the cloned repo in there
|
- symlink the cloned repo in there (`ln -s ./ARBench ~/.FreeCAD/ARBench`)
|
||||||
4. Start the workbench by
|
4. Start the workbench by
|
||||||
1. Run FreeCAD
|
1. Running FreeCAD
|
||||||
2. Open a STEP file
|
2. Open a STEP file
|
||||||
3. Open the `ARBench` workbench
|
3. Open the `ARBench` workbench
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue