Skip to content

Commit

Permalink
Upgading to Schema 10
Browse files Browse the repository at this point in the history
  • Loading branch information
drewsipher committed Feb 6, 2025
1 parent 2c2ab70 commit a3cbf0b
Show file tree
Hide file tree
Showing 25 changed files with 849 additions and 27 deletions.
9 changes: 9 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"justMyCode": true
},
{
"name": "Python: Build Proto Script",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/scripts/build_proto.py",
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"justMyCode": true
}
]
}
8 changes: 7 additions & 1 deletion scripts/transpileProto.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"google.protobuf.Any": "_any_pb2"
}

methods_rename = {
"import" : "import_file"
}

python_types = [
"int",
"float",
Expand Down Expand Up @@ -512,7 +516,9 @@ def generate_service_code( current_node:TreeNode, tree:Tree) -> str:
if c.isupper() and i != 0:
method_name += "_"
method_name += c.lower()

# Replace method_name if it matches any key in defenitions_rename
method_name = methods_rename.get(method_name, method_name)

# loop over all the properties from the request node to get the input node

method_properties = []
Expand Down
22 changes: 22 additions & 0 deletions three/MF/V3/Descriptors/HeatMap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class HeatMap:

"""
Heat map descriptor.
"""
def __init__(self, count: int, min: float, max: float, median: float, mean: float, stddev: float, outlierDistance: float):
# The of points included in the point-to-mesh statistics.
self.count = count
# The minimum point-to-mesh distance.
self.min = min
# The maximum point-to-mesh distance.
self.max = max
# The median point-to-mesh distance.
self.median = median
# The mean point-to-mesh distance.
self.mean = mean
# The standard deviation of the point-to-mesh distances.
self.stddev = stddev
# The point-to-mesh outlier distance. Distances greater than this value are excluded from the statistics.
self.outlierDistance = outlierDistance


50 changes: 50 additions & 0 deletions three/MF/V3/Descriptors/Import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from MF.V3.Descriptors.Project import Project as MF_V3_Descriptors_Project_Project
from enum import Enum
from typing import List


class Import:

"""
Import scan descriptor.
"""
class Error(Enum):

"""
Import error codes.
"""
Unspecified = "Unspecified" # The error is unspecified.
FileNotSupported = "FileNotSupported" # The file format is not supported.
CannotReadFile = "CannotReadFile" # The file format is supported but cannot be read.
MeshIsEmpty = "MeshIsEmpty" # The imported mesh has no faces.
NotEnoughStorage = "NotEnoughStorage" # There is not enough filesystem memory to store the mesh.

class Imported:

"""
A file that was successfully imported to the project.
"""
def __init__(self, file: str):
# The file name.
self.file = file

class Ignored:

"""
A file that failed to be imported to the project.
"""
def __init__(self, file: str, error: 'Import.Error'):
# The file name.
self.file = file
# The import error code.
self.error = error

def __init__(self, groups: MF_V3_Descriptors_Project_Project.Group, imported: List['Imported'] = None, ignored: List['Ignored'] = None):
# The updated project group tree.
self.groups = groups
# The list of successfully imported files.
self.imported = imported
# The list of ignored files.
self.ignored = ignored


1 change: 1 addition & 0 deletions three/MF/V3/Descriptors/ScanData.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Type(Enum):
Normal = "Normal" # Vertex normal.
Color = "Color" # Vertex color.
UV = "UV" # Vertex texture coordinate.
Quality = "Quality" # Vertex quality.
Triangle = "Triangle" # Triangle index.
Texture = "Texture" # Texture.

Expand Down
31 changes: 30 additions & 1 deletion three/MF/V3/Descriptors/Settings/Advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,38 @@ def __init__(self, value: int, default: int, min: int, max: int):
self.min = min
self.max = max

def __init__(self, rampAngle: 'RampAngle'):
class PointClippingRadius:
def __init__(self, value: float, default: float, min: float, max: float):
self.value = value
self.default = default
self.min = min
self.max = max

class PointClippingMinHeight:
def __init__(self, value: float, default: float, min: float, max: float):
self.value = value
self.default = default
self.min = min
self.max = max

class PointClippingMaxHeight:
def __init__(self, value: float, default: float, min: float, max: float):
self.value = value
self.default = default
self.min = min
self.max = max

def __init__(self, use: 'Advanced.Use', rampAngle: 'RampAngle', pointClippingRadius: 'PointClippingRadius', pointClippingMinHeight: 'PointClippingMinHeight', pointClippingMaxHeight: 'PointClippingMaxHeight'):
# Use the advanced turntable settings.
self.use = use
# The angle in degrees to slow down the turntable at the end of a rotation.
self.rampAngle = rampAngle
# The radius of the point clipping cylinder.
self.pointClippingRadius = pointClippingRadius
# The minimum height of the point clipping cylinder.
self.pointClippingMinHeight = pointClippingMinHeight
# The maximum height of the point clipping cylinder.
self.pointClippingMaxHeight = pointClippingMaxHeight

def __init__(self, capture: 'Capture', sampling: 'Sampling', edgeDetection: 'EdgeDetection', phaseFilter: 'PhaseFilter', adaptiveSampling: 'AdaptiveSampling', normalEstimation: 'NormalEstimation', outlierRemoval: 'OutlierRemoval', remesh: 'Remesh', camera: 'Camera', turntable: 'Turntable'):
# Capture settings descriptor.
Expand Down
2 changes: 2 additions & 0 deletions three/MF/V3/Descriptors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from MF.V3.Descriptors.BoundingBox import *
from MF.V3.Descriptors.CaptureImage import *
from MF.V3.Descriptors.Export import *
from MF.V3.Descriptors.HeatMap import *
from MF.V3.Descriptors.Image import *
from MF.V3.Descriptors.Import import *
from MF.V3.Descriptors.Merge import *
from MF.V3.Descriptors.Project import *
from MF.V3.Descriptors.ProjectActions import *
Expand Down
10 changes: 9 additions & 1 deletion three/MF/V3/Settings/Advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,17 @@ class Turntable:
"""
Turntable settings.
"""
def __init__(self, rampAngle: int = None):
def __init__(self, rampAngle: int = None, pointClippingRadius: float = None, pointClippingMinHeight: float = None, pointClippingMaxHeight: float = None, use: bool = None):
# The angle in degrees to slow down the turntable at the end of a rotation.
self.rampAngle = rampAngle
# The radius of the point clipping cylinder.
self.pointClippingRadius = pointClippingRadius
# The minimum height of the point clipping cylinder.
self.pointClippingMinHeight = pointClippingMinHeight
# The maximum height of the point clipping cylinder.
self.pointClippingMaxHeight = pointClippingMaxHeight
# Use the turntable settings.
self.use = use

def __init__(self, capture: 'Capture' = None, sampling: 'Sampling' = None, edgeDetection: 'EdgeDetection' = None, phaseFilter: 'PhaseFilter' = None, adaptiveSampling: 'AdaptiveSampling' = None, normalEstimation: 'NormalEstimation' = None, outlierRemoval: 'OutlierRemoval' = None, remesh: 'Remesh' = None, camera: 'Camera' = None, turntable: 'Turntable' = None):
# Capture settings.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
from typing import List


class CopyGroup:
class CopyGroups:

"""
Copy scan group settings.
Copy scan groups settings.
"""
def __init__(self, sourceIndexes: List[int] = None, targetIndex: int = None, childPosition: int = None, nameSuffix: str = None):
def __init__(self, sourceIndexes: List[int] = None, targetIndex: int = None, childPosition: int = None, nameSuffix: str = None, enumerate: bool = None):
# The indexes of the groups to copy.
self.sourceIndexes = sourceIndexes
"""
The index of the group into which the source group are copied.
If unspecified the copied groups are added to the root of the group tree.
The index of the group into which the source groups are copied.
If unspecified the copied groups are inserted after their respective source groups within the same parent group.
"""
self.targetIndex = targetIndex
"""
The position among the target group's children where the copied groups are inserted.
If unspecified the copied groups are appended to the end of the target group's children.
Ignored if the targetIndex is unspecified or specified but does not exist.
"""
self.childPosition = childPosition
"""
Optional name suffix to append to the copied group names.
If unspecified the names are unchanged.
If unspecified the copied group names are unchanged.
"""
self.nameSuffix = nameSuffix
"""
Append a copy index the copied group names. e.g. ("name-2", "name-3"). Default is true.
If a name suffix is specified then the first copy of each source group is not enumerated,
but subsequent copies are.
"""
self.enumerate = enumerate


17 changes: 16 additions & 1 deletion three/MF/V3/Settings/Export.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,21 @@ class Format(Enum):
stl = "stl" # Stereolithography format.
xyz = "xyz" # Chemical format.

def __init__(self, selection: MF_V3_Settings_ScanSelection_ScanSelection = None, texture: bool = None, merge: bool = None, format: 'Format' = None, scale: float = None):
class Color:
"""Settings for mapping the vertex quality to a vertex color.
The specific meaning of 'quality' depends on the broader context.
In the case heat maps, the quality is the point-to-mesh distance of the vertex."""
def __init__(self, scale: float = None, offset: float = None, min: float = None, max: float = None):
# The scale in `normalizedQuality = quality * scale + offset` that normalizes the quality value to the range [0, 1] which maps to the color range [blue, red] . `offset` must also be specified.
self.scale = scale
# The offset in `normalizedQuality = quality * scale + offset` that normalizes the quality value to the range [0, 1] which maps to the color range [blue, red] . `scale` must also be specified.
self.offset = offset
# The quality value that is mapped to the minimum color (blue). `max` must also be specified.
self.min = min
# The quality value that is mapped to the maximum color (red). `min` must also be specified.
self.max = max

def __init__(self, selection: MF_V3_Settings_ScanSelection_ScanSelection = None, texture: bool = None, merge: bool = None, format: 'Format' = None, scale: float = None, color: 'Color' = None):
# The scan selection.
self.selection = selection
# Export textures.
Expand All @@ -31,5 +45,6 @@ def __init__(self, selection: MF_V3_Settings_ScanSelection_ScanSelection = None,
self.format = format
# Scale factor of the exported geometry.
self.scale = scale
self.color = color


17 changes: 17 additions & 0 deletions three/MF/V3/Settings/HeatMap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import List


class HeatMap:

"""
Scan heat map settings.
"""
def __init__(self, sources: List[int] = None, targets: List[int] = None, outlierDistance: float = None):
# Set of source group indexes.
self.sources = sources
# Set of target group indexes.
self.targets = targets
# Threshold for which distances are excluded from the statistics in the descriptor.
self.outlierDistance = outlierDistance


32 changes: 32 additions & 0 deletions three/MF/V3/Settings/Import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from enum import Enum


class Import:

"""
Import mesh settings.
"""
class Unit(Enum):

"""
Unit of imported mesh positions.
"""
Millimeter = "Millimeter" # Mesh positions in millimeters.
Centimeter = "Centimeter" # Mesh positions in centimeters.
Meter = "Meter" # Mesh positions in meters.
Inch = "Inch" # Mesh positions in inches.
Foot = "Foot" # Mesh positions in feet.

def __init__(self, name: str = None, scale: float = None, unit: 'Unit' = None, center: bool = None, groupIndex: int = None):
# Optional name of the impored mesh. Ignored if the imported file is a zip archive, in which case the archive filenames are used.
self.name = name
# Optional scale factor for mesh positions. Default is 1.0.
self.scale = scale
# Unit of imported mesh positions. Default is millimeters. Ignored if the scale is specified.
self.unit = unit
# If true the mesh is centered at the world origin. Default is true.
self.center = center
# Project group index in which to add the imported meshes. Default is 0 (root group).
self.groupIndex = groupIndex


6 changes: 5 additions & 1 deletion three/MF/V3/Settings/Scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def __init__(self, projectorSampleRate: float = None, imageSampleRate: float = N
# Outlier removal settings.
self.outlierRemoval = outlierRemoval

def __init__(self, camera: MF_V3_Settings_Camera_Camera = None, projector: MF_V3_Settings_Projector_Projector = None, turntable: MF_V3_Settings_Turntable_Turntable = None, capture: MF_V3_Settings_Capture_Capture = None, processing: 'Processing' = None):
def __init__(self, camera: MF_V3_Settings_Camera_Camera = None, projector: MF_V3_Settings_Projector_Projector = None, turntable: MF_V3_Settings_Turntable_Turntable = None, capture: MF_V3_Settings_Capture_Capture = None, processing: 'Processing' = None, alignWithScanner: bool = None, centerAtOrigin: bool = None):
# Camera settings.
self.camera = camera
# Projector settings.
Expand All @@ -174,5 +174,9 @@ def __init__(self, camera: MF_V3_Settings_Camera_Camera = None, projector: MF_V3
self.capture = capture
# Processing settings.
self.processing = processing
# Align the scan with the scanner.
self.alignWithScanner = alignWithScanner
# Center the scan at the origin.
self.centerAtOrigin = centerAtOrigin


1 change: 1 addition & 0 deletions three/MF/V3/Settings/ScanData.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Buffer(Enum):
Normal = "Normal" # Vertex normal.
Color = "Color" # Vertex color.
UV = "UV" # Vertex UVs
Quality = "Quality" # Vertex quality.
Triangle = "Triangle" # Triangle index.
Texture = "Texture" # Texture.
All = "All" # All buffer types.
Expand Down
10 changes: 9 additions & 1 deletion three/MF/V3/Settings/Turntable.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ class Turntable:
"""
Turntable settings.
"""
def __init__(self, scans: int, sweep: int, use: bool = None):
def __init__(self, scans: int, sweep: int, use: bool = None, pointClippingRadius: float = None, pointClippingMinHeight: float = None, pointClippingMaxHeight: float = None, offsetAngle: float = None):
# The number of turntable scans.
self.scans = scans
# Turntable angle sweep in degrees.
self.sweep = sweep
# Use the turntable.
self.use = use
# The radius of the point clipping cylinder.
self.pointClippingRadius = pointClippingRadius
# The minimum height of the point clipping cylinder.
self.pointClippingMinHeight = pointClippingMinHeight
# The maximum height of the point clipping cylinder.
self.pointClippingMaxHeight = pointClippingMaxHeight
# The offset Angle of the turntable for starting position
self.offsetAngle = offsetAngle


4 changes: 3 additions & 1 deletion three/MF/V3/Settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
from MF.V3.Settings.Camera import *
from MF.V3.Settings.Capture import *
from MF.V3.Settings.CaptureImage import *
from MF.V3.Settings.CopyGroup import *
from MF.V3.Settings.CopyGroups import *
from MF.V3.Settings.CopyProject import *
from MF.V3.Settings.Export import *
from MF.V3.Settings.Group import *
from MF.V3.Settings.HeatMap import *
from MF.V3.Settings.I18n import *
from MF.V3.Settings.Import import *
from MF.V3.Settings.Merge import *
from MF.V3.Settings.NewGroup import *
from MF.V3.Settings.Project import *
Expand Down
Loading

0 comments on commit a3cbf0b

Please sign in to comment.