Extend FreeCAD WebAssembly runtime support
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Some checks failed
FreeCAD master CI / Prepare (push) Has been cancelled
FreeCAD master CI / Pixi (push) Has been cancelled
FreeCAD master CI / Ubuntu (push) Has been cancelled
FreeCAD master CI / Windows (push) Has been cancelled
FreeCAD master CI / Lint (push) Has been cancelled
FreeCAD master CI / WrapUp (push) Has been cancelled
CodeQL Advanced / Analyze (actions) (push) Has been cancelled
CodeQL Advanced / Analyze (python) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
This commit is contained in:
@@ -701,6 +701,14 @@ def _get_param_dictionary():
|
||||
if fd.open(QtCore.QIODevice.ReadOnly | QtCore.QFile.Text):
|
||||
text = QtCore.QTextStream(fd).readAll()
|
||||
fd.close()
|
||||
elif not App.GuiUp:
|
||||
# Headless runtimes embed the source UI files without Qt resources.
|
||||
from pathlib import Path
|
||||
|
||||
source = Path(__file__).resolve().parent.parent / "Resources" / "ui" / fnm.rsplit("/", 1)[-1]
|
||||
if not source.is_file():
|
||||
continue
|
||||
text = source.read_text(encoding="utf-8")
|
||||
else:
|
||||
continue
|
||||
|
||||
|
||||
@@ -267,7 +267,9 @@ def svg_precision():
|
||||
int
|
||||
params.get_param("svgPrecision")
|
||||
"""
|
||||
return params.get_param("svgPrecision")
|
||||
value = params.get_param("svgPrecision")
|
||||
# A headless parameter database may not contain the SVG preference yet.
|
||||
return 3 if value is None else value
|
||||
|
||||
|
||||
def tolerance():
|
||||
|
||||
@@ -88,7 +88,12 @@ target_include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
target_link_libraries(Import ${Import_LIBS})
|
||||
target_link_libraries(Import ${Import_LIBS})
|
||||
|
||||
if(EMSCRIPTEN)
|
||||
# Keep native parser failures inside the Python error/transaction boundary.
|
||||
target_compile_options(Import PRIVATE "-fexceptions")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
target_compile_options(Import PRIVATE /wd4251 /wd4275)
|
||||
|
||||
@@ -22,13 +22,23 @@
|
||||
# * *
|
||||
# ******************************************************************************/
|
||||
|
||||
import FreeCAD, FreeCADGui
|
||||
import FreeCAD
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
else:
|
||||
FreeCADGui = None
|
||||
from .SegmentFunction import SegmentFunction, IntervalFunction, StressFunction, TranslationFunction
|
||||
from .ShaftFeature import ShaftFeature
|
||||
from .ShaftDiagram import Diagram
|
||||
import math
|
||||
|
||||
|
||||
def Diagram(*args, **kwargs):
|
||||
# Geometry creation does not require the desktop plotting backend.
|
||||
from .ShaftDiagram import Diagram as ShaftDiagram
|
||||
|
||||
return ShaftDiagram(*args, **kwargs)
|
||||
|
||||
|
||||
class ShaftSegment:
|
||||
def __init__(self, l, d, di):
|
||||
self.length = l
|
||||
@@ -113,12 +123,12 @@ class Shaft:
|
||||
if self.segments[i].constraintType != "Fixed":
|
||||
continue
|
||||
if i == len(self.segments) - 1:
|
||||
self.segments[index].constraint.References = [
|
||||
(self.feature.feature, "Face%u" % (2 * (index + 1) + 1))
|
||||
self.segments[i].constraint.References = [
|
||||
(self.feature.feature, "Face%u" % (2 * (i + 1) + 1))
|
||||
]
|
||||
else:
|
||||
# Remove reference since it is now in the middle of the shaft (which is not allowed)
|
||||
self.segments[index].constraint.References = [(None, "")]
|
||||
self.segments[i].constraint.References = [(None, "")]
|
||||
|
||||
def updateSegment(self, index, length=None, diameter=None, innerdiameter=None):
|
||||
oldLength = self.segments[index].length
|
||||
|
||||
@@ -22,7 +22,11 @@
|
||||
# * *
|
||||
# ******************************************************************************/
|
||||
|
||||
import FreeCAD, FreeCADGui
|
||||
import FreeCAD
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
else:
|
||||
FreeCADGui = None
|
||||
import Part, Sketcher
|
||||
|
||||
|
||||
@@ -148,11 +152,13 @@ class ShaftFeature:
|
||||
self.feature.ReferenceAxis = (self.sketch, ["H_Axis"])
|
||||
self.feature.Angle = 360.0
|
||||
self.Doc.recompute()
|
||||
self.Gui.hide("SketchShaft")
|
||||
if self.Gui is not None:
|
||||
self.Gui.getDocument(self.Doc.Name).getObject(self.sketch.Name).hide()
|
||||
else:
|
||||
self.Doc.recompute()
|
||||
# FIXME: Will give a warning in the console if the active window is not the feature
|
||||
self.Gui.SendMsgToActiveView("ViewFit")
|
||||
if self.Gui is not None:
|
||||
self.Gui.SendMsgToActiveView("ViewFit")
|
||||
|
||||
def updateSegment(self, segment, oldLength, length, diameter, innerdiameter):
|
||||
constrRadius = 4 + segment * 6
|
||||
|
||||
Reference in New Issue
Block a user