Skip to main content
Added link to original answer containing the code form getFormatExportData
Source Link
MarcoB
  • 67.7k
  • 18
  • 96
  • 198

Don't have the time to fully answer this yet, but here's a debug toolsa debug tool I developed previously. First off we can figure out how OBJ is exported

getFormatExportData["OBJ"]

{"FormatName" -> "OBJ", "DefaultElement" -> "Graphics3D", 
 "DocumentedElements" -> None, "Function" -> System`Convert`OBJDump`ExportOBJ, 
 "FunctionChannels" -> {"Streams"}, "HiddenElements" -> None, 
 "Options" -> {"InvertNormals", "VerticalAxis", "Comments"}, 
 "Sources" -> \
{"/Applications/Mathematica.app/Contents/SystemFiles/Kernel/SystemResources/\
MacOSX-x86-64/Convert/Common3D.mx", 
   "/Applications/Mathematica.app/Contents/SystemFiles/Kernel/SystemResources/\
MacOSX-x86-64/Convert/OBJ.mx"}, "BinaryFormat" -> True, 
 "File" -> "/Applications/Mathematica.app/Contents/SystemFiles/Formats/OBJ/\
Export.m"}

Then we get the defs for that func (you may need to load the .mx first)

System`Convert`OBJDump`ExportOBJ // GeneralUtilities`PrintDefinitionsLocal

ExportOBJ[strm_, expr_, opts___] := Block[
    {res, nopts, method, a, expr1, obj},
    nopts = Flatten @ {opts};
    method = ("ImportExportMethod" /. nopts) /. {"ImportExportMethod" -> $ImportExportMethod};
nopts = DeleteCases[nopts, "ImportExportMethod" -> _];
a = Flatten[expr /. {RuleDelayed -> List}];
nopts = Union @ Flatten @ Join[nopts, Most @ a];
nopts = Select[nopts, Function[Equal[Head @ #, Rule]]];
obj = Last @ a;
expr1 = "Graphics3D" -> obj;
res = dispatchExportOBJ[method, strm, expr1, nopts];
res /; UnsameQ[res, $Failed]
];

Which means it's handled by dispatchExportOBJ and so looking at those defs we get back to either System`Convert`OBJDump`LegacyExportOBJ or System`Convert`OBJDump`ImprovedLgacyExportOBJ, the latter of which seems to delegate to GeometryTools`WGTAssimpExport and the former of which is just a bunch of WriteString calls which could be modified to have higher precision.

Can't get you to a full solution at this point in time though.

Don't have the time to fully answer this yet, but here's a debug tools. First off we can figure out how OBJ is exported

getFormatExportData["OBJ"]

{"FormatName" -> "OBJ", "DefaultElement" -> "Graphics3D", 
 "DocumentedElements" -> None, "Function" -> System`Convert`OBJDump`ExportOBJ, 
 "FunctionChannels" -> {"Streams"}, "HiddenElements" -> None, 
 "Options" -> {"InvertNormals", "VerticalAxis", "Comments"}, 
 "Sources" -> \
{"/Applications/Mathematica.app/Contents/SystemFiles/Kernel/SystemResources/\
MacOSX-x86-64/Convert/Common3D.mx", 
   "/Applications/Mathematica.app/Contents/SystemFiles/Kernel/SystemResources/\
MacOSX-x86-64/Convert/OBJ.mx"}, "BinaryFormat" -> True, 
 "File" -> "/Applications/Mathematica.app/Contents/SystemFiles/Formats/OBJ/\
Export.m"}

Then we get the defs for that func (you may need to load the .mx first)

System`Convert`OBJDump`ExportOBJ // GeneralUtilities`PrintDefinitionsLocal

ExportOBJ[strm_, expr_, opts___] := Block[
    {res, nopts, method, a, expr1, obj},
    nopts = Flatten @ {opts};
    method = ("ImportExportMethod" /. nopts) /. {"ImportExportMethod" -> $ImportExportMethod};
nopts = DeleteCases[nopts, "ImportExportMethod" -> _];
a = Flatten[expr /. {RuleDelayed -> List}];
nopts = Union @ Flatten @ Join[nopts, Most @ a];
nopts = Select[nopts, Function[Equal[Head @ #, Rule]]];
obj = Last @ a;
expr1 = "Graphics3D" -> obj;
res = dispatchExportOBJ[method, strm, expr1, nopts];
res /; UnsameQ[res, $Failed]
];

Which means it's handled by dispatchExportOBJ and so looking at those defs we get back to either System`Convert`OBJDump`LegacyExportOBJ or System`Convert`OBJDump`ImprovedLgacyExportOBJ, the latter of which seems to delegate to GeometryTools`WGTAssimpExport and the former of which is just a bunch of WriteString calls which could be modified to have higher precision.

Can't get you to a full solution at this point in time though.

Don't have the time to fully answer this yet, but here's a debug tool I developed previously. First off we can figure out how OBJ is exported

getFormatExportData["OBJ"]

{"FormatName" -> "OBJ", "DefaultElement" -> "Graphics3D", 
 "DocumentedElements" -> None, "Function" -> System`Convert`OBJDump`ExportOBJ, 
 "FunctionChannels" -> {"Streams"}, "HiddenElements" -> None, 
 "Options" -> {"InvertNormals", "VerticalAxis", "Comments"}, 
 "Sources" -> \
{"/Applications/Mathematica.app/Contents/SystemFiles/Kernel/SystemResources/\
MacOSX-x86-64/Convert/Common3D.mx", 
   "/Applications/Mathematica.app/Contents/SystemFiles/Kernel/SystemResources/\
MacOSX-x86-64/Convert/OBJ.mx"}, "BinaryFormat" -> True, 
 "File" -> "/Applications/Mathematica.app/Contents/SystemFiles/Formats/OBJ/\
Export.m"}

Then we get the defs for that func (you may need to load the .mx first)

System`Convert`OBJDump`ExportOBJ // GeneralUtilities`PrintDefinitionsLocal

ExportOBJ[strm_, expr_, opts___] := Block[
    {res, nopts, method, a, expr1, obj},
    nopts = Flatten @ {opts};
    method = ("ImportExportMethod" /. nopts) /. {"ImportExportMethod" -> $ImportExportMethod};
nopts = DeleteCases[nopts, "ImportExportMethod" -> _];
a = Flatten[expr /. {RuleDelayed -> List}];
nopts = Union @ Flatten @ Join[nopts, Most @ a];
nopts = Select[nopts, Function[Equal[Head @ #, Rule]]];
obj = Last @ a;
expr1 = "Graphics3D" -> obj;
res = dispatchExportOBJ[method, strm, expr1, nopts];
res /; UnsameQ[res, $Failed]
];

Which means it's handled by dispatchExportOBJ and so looking at those defs we get back to either System`Convert`OBJDump`LegacyExportOBJ or System`Convert`OBJDump`ImprovedLgacyExportOBJ, the latter of which seems to delegate to GeometryTools`WGTAssimpExport and the former of which is just a bunch of WriteString calls which could be modified to have higher precision.

Can't get you to a full solution at this point in time though.

Source Link
b3m2a1
  • 47.1k
  • 3
  • 95
  • 245

Don't have the time to fully answer this yet, but here's a debug tools. First off we can figure out how OBJ is exported

getFormatExportData["OBJ"]

{"FormatName" -> "OBJ", "DefaultElement" -> "Graphics3D", 
 "DocumentedElements" -> None, "Function" -> System`Convert`OBJDump`ExportOBJ, 
 "FunctionChannels" -> {"Streams"}, "HiddenElements" -> None, 
 "Options" -> {"InvertNormals", "VerticalAxis", "Comments"}, 
 "Sources" -> \
{"/Applications/Mathematica.app/Contents/SystemFiles/Kernel/SystemResources/\
MacOSX-x86-64/Convert/Common3D.mx", 
   "/Applications/Mathematica.app/Contents/SystemFiles/Kernel/SystemResources/\
MacOSX-x86-64/Convert/OBJ.mx"}, "BinaryFormat" -> True, 
 "File" -> "/Applications/Mathematica.app/Contents/SystemFiles/Formats/OBJ/\
Export.m"}

Then we get the defs for that func (you may need to load the .mx first)

System`Convert`OBJDump`ExportOBJ // GeneralUtilities`PrintDefinitionsLocal

ExportOBJ[strm_, expr_, opts___] := Block[
    {res, nopts, method, a, expr1, obj},
    nopts = Flatten @ {opts};
    method = ("ImportExportMethod" /. nopts) /. {"ImportExportMethod" -> $ImportExportMethod};
nopts = DeleteCases[nopts, "ImportExportMethod" -> _];
a = Flatten[expr /. {RuleDelayed -> List}];
nopts = Union @ Flatten @ Join[nopts, Most @ a];
nopts = Select[nopts, Function[Equal[Head @ #, Rule]]];
obj = Last @ a;
expr1 = "Graphics3D" -> obj;
res = dispatchExportOBJ[method, strm, expr1, nopts];
res /; UnsameQ[res, $Failed]
];

Which means it's handled by dispatchExportOBJ and so looking at those defs we get back to either System`Convert`OBJDump`LegacyExportOBJ or System`Convert`OBJDump`ImprovedLgacyExportOBJ, the latter of which seems to delegate to GeometryTools`WGTAssimpExport and the former of which is just a bunch of WriteString calls which could be modified to have higher precision.

Can't get you to a full solution at this point in time though.