Simple shape vrml export
This commit is contained in:
@ -5,6 +5,8 @@ import io as StringIO
|
|||||||
from typing import IO, Optional, Union, cast
|
from typing import IO, Optional, Union, cast
|
||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
|
from OCP.VrmlAPI import VrmlAPI
|
||||||
|
|
||||||
from ...cq import Workplane
|
from ...cq import Workplane
|
||||||
from ...utils import deprecate
|
from ...utils import deprecate
|
||||||
from ..shapes import Shape
|
from ..shapes import Shape
|
||||||
@ -23,9 +25,10 @@ class ExportTypes:
|
|||||||
SVG = "SVG"
|
SVG = "SVG"
|
||||||
TJS = "TJS"
|
TJS = "TJS"
|
||||||
DXF = "DXF"
|
DXF = "DXF"
|
||||||
|
VRML = "VRML"
|
||||||
|
|
||||||
|
|
||||||
ExportLiterals = Literal["STL", "STEP", "AMF", "SVG", "TJS", "DXF"]
|
ExportLiterals = Literal["STL", "STEP", "AMF", "SVG", "TJS", "DXF", "VRML"]
|
||||||
|
|
||||||
|
|
||||||
def export(
|
def export(
|
||||||
@ -98,6 +101,10 @@ def export(
|
|||||||
elif exportType == ExportTypes.STL:
|
elif exportType == ExportTypes.STL:
|
||||||
shape.exportStl(fname, tolerance, angularTolerance)
|
shape.exportStl(fname, tolerance, angularTolerance)
|
||||||
|
|
||||||
|
elif exportType == ExportTypes.VRML:
|
||||||
|
shape.mesh(tolerance, angularTolerance)
|
||||||
|
VrmlAPI.Write_s(shape.wrapped, fname)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise ValueError("Unknown export type")
|
raise ValueError("Unknown export type")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user