Save FreeCAD WebAssembly development state
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:
@@ -34,6 +34,7 @@ __url__ = "https://www.freecad.org"
|
||||
|
||||
import math
|
||||
import os
|
||||
import copy
|
||||
import re
|
||||
import time
|
||||
import uuid
|
||||
@@ -1670,16 +1671,16 @@ class IfcSchema:
|
||||
filename = FreeCAD.getUserMacroDir(True) + os.sep + filename
|
||||
if not os.path.exists(filename):
|
||||
raise ImportError("no IFCSchema file found!")
|
||||
|
||||
self.file = open(self.filename)
|
||||
self.data = self.file.read()
|
||||
self.types = self.readTypes()
|
||||
self.entities = self.readEntities()
|
||||
if DEBUG:
|
||||
print(
|
||||
"Parsed from schema %s: %s entities and %s types"
|
||||
% (self.filename, len(self.entities), len(self.types))
|
||||
)
|
||||
self.filename = filename
|
||||
self.file = pyopen(self.filename)
|
||||
self.data = self.file.read()
|
||||
self.types = self.readTypes()
|
||||
self.entities = self.readEntities()
|
||||
if DEBUG:
|
||||
print(
|
||||
"Parsed from schema %s: %s entities and %s types"
|
||||
% (self.filename, len(self.entities), len(self.types))
|
||||
)
|
||||
|
||||
def readTypes(self):
|
||||
"""
|
||||
@@ -1718,11 +1719,18 @@ class IfcSchema:
|
||||
subtypeofmatch = re.search(r".*SUBTYPE OF \((.*?)\);", raw_entity_str)
|
||||
entity["supertype"] = subtypeofmatch.groups()[0].upper() if subtypeofmatch else None
|
||||
|
||||
# find the shortest string matched from the end of the entity type header to the
|
||||
# first occurrence of a NO_ATTR string (when it occurs on a new line)
|
||||
# Stop attributes at the first EXPRESS section marker. The old
|
||||
# implementation only recognized CRLF; Python universal-newline
|
||||
# mode converts the staged schema to LF on WebAssembly, causing
|
||||
# INVERSE/WHERE clauses to be parsed as ordinary attributes.
|
||||
inner_str = re.search(";(.*?)$", raw_entity_str, re.DOTALL).groups()[0]
|
||||
|
||||
attrs_str = min([inner_str.partition("\r\n " + a)[0] for a in self.NO_ATTR])
|
||||
sections = [
|
||||
section
|
||||
for marker in self.NO_ATTR
|
||||
for section in [re.search(r"\n\s*" + re.escape(marker) + r"\b", inner_str, re.IGNORECASE)]
|
||||
if section
|
||||
]
|
||||
attrs_str = inner_str[: min(section.start() for section in sections)] if sections else inner_str
|
||||
attrs = []
|
||||
for am in re.finditer("(.*?) : (.*?);", attrs_str, re.DOTALL):
|
||||
name, attr_type = [s.replace("\r\n\t", "") for s in am.groups()]
|
||||
@@ -1770,7 +1778,7 @@ class IfcFile:
|
||||
def __init__(self, filename, schema):
|
||||
self.filename = filename
|
||||
self.schema = IfcSchema(schema)
|
||||
self.file = open(self.filename)
|
||||
self.file = pyopen(self.filename)
|
||||
self.entById, self.entsByName, self.header = self.read()
|
||||
self.file.close()
|
||||
if DEBUG:
|
||||
|
||||
@@ -553,6 +553,8 @@ def _get_param_dictionary():
|
||||
|
||||
# Arch parameters that are not in the preferences:
|
||||
param_dict["Mod/Arch"] = {
|
||||
"IfcVersion": ("int", 0),
|
||||
"WallColor": ("unsigned", 4294967295),
|
||||
"applyConstructionStyle": ("bool", True),
|
||||
"ClaimHosted": ("bool", True),
|
||||
"CustomIfcSchema": ("string", ""), # importIFClegacy.py
|
||||
@@ -572,6 +574,11 @@ def _get_param_dictionary():
|
||||
"ifcMergeProfiles": ("bool", False),
|
||||
"IfcScalingFactor": ("float", 1.0), # importIFClegacy.py
|
||||
"ifcSeparatePlacements": ("bool", False), # importIFClegacy.py
|
||||
# ArchComponent properties also use these GUI preference defaults.
|
||||
# Keep them available when Qt resource forms are intentionally absent
|
||||
# from a GUI-free WebAssembly runtime.
|
||||
"MoveBase": ("bool", False),
|
||||
"MoveWithHost": ("bool", True),
|
||||
"MultiMaterialColumnWidth0": ("int", 120),
|
||||
"MultiMaterialColumnWidth1": ("int", 120),
|
||||
"PanelLength": ("float", 1000.0),
|
||||
@@ -604,6 +611,7 @@ def _get_param_dictionary():
|
||||
"StructureWidth": ("float", 100.0),
|
||||
"swallowAdditions": ("bool", True),
|
||||
"swallowSubtractions": ("bool", True),
|
||||
"UseMaterialColor": ("bool", True),
|
||||
"WallAlignment": ("int", 0),
|
||||
"WallHeight": ("float", 3000.0),
|
||||
"WallWidth": ("float", 200.0),
|
||||
|
||||
@@ -35,6 +35,9 @@ the graphical user interface (GUI).
|
||||
# \ingroup draftutils
|
||||
# \brief Provides general utility functions used throughout the workbench.
|
||||
|
||||
# Color conversion helpers, including rgba_to_argb, are kept in this module
|
||||
# for native Python-family source discovery and replay.
|
||||
|
||||
## \addtogroup draftutils
|
||||
# @{
|
||||
import os
|
||||
|
||||
@@ -320,6 +320,7 @@ bool FemMesh::accepts(PyObject* pyob) const
|
||||
return (pyob && PyObject_TypeCheck(pyob, &(Fem::FemMeshPy::Type)));
|
||||
}
|
||||
template<>
|
||||
__attribute__((weak))
|
||||
bool TopoShape::accepts(PyObject* pyob) const
|
||||
{
|
||||
return (pyob && PyObject_TypeCheck(pyob, &(Part::TopoShapePy::Type)));
|
||||
|
||||
@@ -88,7 +88,8 @@
|
||||
#include "FeaturePartPolygon.h"
|
||||
#include "FeaturePartSection.h"
|
||||
#include "FeaturePartSpline.h"
|
||||
#include "FeatureProjectOnSurface.h"
|
||||
#include "FeatureProjectOnSurface.h"
|
||||
#include "PartFeatureReference.h"
|
||||
#include "FeatureRevolution.h"
|
||||
#include "Geometry.h"
|
||||
#include "Geometry2d.h"
|
||||
@@ -441,8 +442,9 @@ PyMOD_INIT_FUNC(Part)
|
||||
Part::PreviewExtension ::init();
|
||||
Part::PrismExtension ::init();
|
||||
|
||||
Part::Feature ::init();
|
||||
Part::FeatureExt ::init();
|
||||
Part::Feature ::init();
|
||||
Part::FeatureExt ::init();
|
||||
Part::FeatureReference ::init();
|
||||
Part::BodyBase ::init();
|
||||
Part::FeaturePython ::init();
|
||||
Part::FeatureGeometrySet ::init();
|
||||
|
||||
@@ -25,21 +25,28 @@ set(Start_LIBS
|
||||
FreeCADApp
|
||||
)
|
||||
|
||||
set(Start_SRCS
|
||||
AppStart.cpp
|
||||
DisplayedFilesModel.cpp
|
||||
DisplayedFilesModel.h
|
||||
ExamplesModel.cpp
|
||||
ExamplesModel.h
|
||||
CustomFolderModel.cpp
|
||||
CustomFolderModel.h
|
||||
FileUtilities.cpp
|
||||
FileUtilities.h
|
||||
PreCompiled.h
|
||||
RecentFilesModel.cpp
|
||||
RecentFilesModel.h
|
||||
ThumbnailSource.cpp
|
||||
ThumbnailSource.h)
|
||||
if(FREECAD_WEB)
|
||||
# The Web runtime exposes Start's native Python module only. The recent
|
||||
# file/example models require desktop Qt timezone/thread features disabled
|
||||
# by the GUI-free Web dependency profile.
|
||||
set(Start_SRCS AppStart.cpp)
|
||||
else()
|
||||
set(Start_SRCS
|
||||
AppStart.cpp
|
||||
DisplayedFilesModel.cpp
|
||||
DisplayedFilesModel.h
|
||||
ExamplesModel.cpp
|
||||
ExamplesModel.h
|
||||
CustomFolderModel.cpp
|
||||
CustomFolderModel.h
|
||||
FileUtilities.cpp
|
||||
FileUtilities.h
|
||||
PreCompiled.h
|
||||
RecentFilesModel.cpp
|
||||
RecentFilesModel.h
|
||||
ThumbnailSource.cpp
|
||||
ThumbnailSource.h)
|
||||
endif()
|
||||
|
||||
add_library(Start SHARED ${Start_SRCS})
|
||||
|
||||
|
||||
@@ -259,6 +259,12 @@ add_library(TechDraw SHARED
|
||||
${Python_SRCS}
|
||||
)
|
||||
|
||||
if(FREECAD_WEB AND FREECAD_WEB_ENABLE_TECHDRAW_NATIVE)
|
||||
# TechDraw's QFuture/QFutureWatcher paths require atomics and the same
|
||||
# pthread ABI used by the Web Qt Concurrent build.
|
||||
target_compile_options(TechDraw PRIVATE "-pthread" "-sUSE_PTHREADS=1" "-sPTHREAD_POOL_SIZE=4")
|
||||
endif()
|
||||
|
||||
if(FREECAD_USE_PCH)
|
||||
target_precompile_headers(TechDraw PRIVATE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
# include <sstream>
|
||||
# include <QCollator>
|
||||
# include <sstream>
|
||||
# include <clocale>
|
||||
# include <QCollator>
|
||||
# include <QDateTime>
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include <Base/Console.h>
|
||||
#include <Base/Interpreter.h>
|
||||
@@ -169,3 +172,25 @@ PyMOD_INIT_FUNC(Web)
|
||||
Base::Console().log("Loading Web module... done\n");
|
||||
PyMOD_Return(mod);
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
namespace {
|
||||
std::string webPortError;
|
||||
}
|
||||
extern "C" {
|
||||
EMSCRIPTEN_KEEPALIVE int fc_web_web_validate_port(int port)
|
||||
{
|
||||
webPortError.clear();
|
||||
if (port > std::numeric_limits<unsigned short>::max()) {
|
||||
webPortError = "port number is greater than maximum";
|
||||
return 0;
|
||||
}
|
||||
if (port < 0) {
|
||||
webPortError = "port number is lower than 0";
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
EMSCRIPTEN_KEEPALIVE const char* fc_web_web_validate_port_error() { return webPortError.c_str(); }
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user